[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9

Maximiliano Curia maxy at moszumanska.debian.org
Mon May 9 09:05:34 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=3eb23b0

The following commit has been merged in the master branch:
commit 3eb23b039a5a686963cb3ec7d39574668d2f7abe
Author: Rohan Garg <rohangarg at kubuntu.org>
Date:   Tue Sep 25 00:25:34 2012 +0530

    Add a new Widget class that allows the user to configure their
    notifications
---
 KTp/Widgets/CMakeLists.txt                         |  3 +
 KTp/Widgets/notificationconfigdialog.cpp           | 95 ++++++++++++++++++++++
 .../notificationconfigdialog.h}                    | 36 ++++----
 3 files changed, 118 insertions(+), 16 deletions(-)

diff --git a/KTp/Widgets/CMakeLists.txt b/KTp/Widgets/CMakeLists.txt
index 8435709..708c8b0 100644
--- a/KTp/Widgets/CMakeLists.txt
+++ b/KTp/Widgets/CMakeLists.txt
@@ -7,6 +7,7 @@ set (ktp_widgets_private_SRCS
     contact-grid-dialog.cpp
     add-contact-dialog.cpp
     join-chat-room-dialog.cpp
+    notificationconfigdialog.cpp
 )
 
 set (ktp_widgets_private_HDRS
@@ -14,6 +15,7 @@ set (ktp_widgets_private_HDRS
      contact-grid-dialog.h
      add-contact-dialog.h
      join-chat-room-dialog.h
+     notificationconfigdialog.h
 )
 
 kde4_add_ui_files (ktp_widgets_private_SRCS
@@ -35,6 +37,7 @@ target_link_libraries (ktpwidgetsprivate
                        ${KDE4_KDECORE_LIBS}
                        ${TELEPATHY_QT4_LIBRARIES}
                        ${KDE4_KDEUI_LIBS}
+                       ${KDE4_KNOTIFYCONFIG_LIBRARY}
                        ktpcommoninternalsprivate
                        ktpmodelsprivate
 )
diff --git a/KTp/Widgets/notificationconfigdialog.cpp b/KTp/Widgets/notificationconfigdialog.cpp
new file mode 100644
index 0000000..46dc823
--- /dev/null
+++ b/KTp/Widgets/notificationconfigdialog.cpp
@@ -0,0 +1,95 @@
+/*
+ * This file is part of KDE Telepathy Common Internals
+ *
+ * Copyright (C) 2012 Rohan Garg <rohangarg at kubuntu.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "notificationconfigdialog.h"
+
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QLabel>
+
+#include <TelepathyQt/Contact>
+
+#include <KNotifyConfigWidget>
+#include <KComboBox>
+#include <KAboutData>
+
+KTp::NotificationConfigDialog::NotificationConfigDialog(const Tp::ContactPtr &contact, QWidget *parent)
+    : KDialog(parent)
+    , m_notifyWidget(new KNotifyConfigWidget(this))
+{
+    Q_ASSERT(contact);
+    m_contact = contact;
+    setCaption(i18n("Configure notifications for %1", m_contact.data()->alias()));
+    setAttribute(Qt::WA_DeleteOnClose);
+    setButtons(KDialog::Apply | KDialog::Cancel);
+
+    QWidget *centralWidget = new QWidget(this);
+    QVBoxLayout *vboxLayout = new QVBoxLayout(centralWidget);
+    QHBoxLayout *hboxLayout = new QHBoxLayout(centralWidget);
+    QLabel *label = new QLabel(i18n("Configure notifications for"), centralWidget);
+    KComboBox *comboBox = new KComboBox(centralWidget);
+
+    comboBox->setEditable(false);
+    comboBox->addItem(m_contact.data()->alias());
+    comboBox->addItem(i18n("All users"));
+    hboxLayout->addWidget(label);
+    hboxLayout->addWidget(comboBox);
+    vboxLayout->addLayout(hboxLayout);
+    vboxLayout->addWidget(m_notifyWidget);
+    centralWidget->setLayout(vboxLayout);
+    setMainWidget(centralWidget);
+
+    m_notifyWidget->setApplication(QLatin1String("ktelepathy"),
+                                   QLatin1String("contact"),
+                                   m_contact.data()->id());
+
+    connect(this, SIGNAL(applyClicked()),
+            SLOT(saveConfig()));
+    connect(comboBox, SIGNAL(currentIndexChanged(int)),
+            SLOT(updateNotifyWidget(int)));
+}
+
+KTp::NotificationConfigDialog::~NotificationConfigDialog()
+{
+}
+
+void KTp::NotificationConfigDialog::saveConfig()
+{
+    m_notifyWidget->save();
+}
+
+void KTp::NotificationConfigDialog::updateNotifyWidget(int selection)
+{
+    if (selection == 0) {
+        m_notifyWidget->setApplication(QLatin1String("ktelepathy"),
+                                       QLatin1String("contact"),
+                                       m_contact.data()->id());
+        setCaption(i18n("Configure notifications for %1", m_contact.data()->alias()));
+    } else if (selection == 1) {
+        m_notifyWidget->setApplication(QLatin1String("ktelepathy"));
+        setCaption(i18n("Configure notifications for all users"));
+    }
+}
+
+void KTp::NotificationConfigDialog::show()
+{
+    m_notifyWidget->show();
+    setVisible(true);
+}
diff --git a/KTp/pending-wallet.h b/KTp/Widgets/notificationconfigdialog.h
similarity index 55%
copy from KTp/pending-wallet.h
copy to KTp/Widgets/notificationconfigdialog.h
index 9ef86d7..bd3dd5e 100644
--- a/KTp/pending-wallet.h
+++ b/KTp/Widgets/notificationconfigdialog.h
@@ -1,5 +1,7 @@
 /*
- * Copyright (C) 2012 David Edmundson <kde at davidedmundson.co.uk>
+ * This file is part of KDE Telepathy Common Internals
+ *
+ * Copyright (C) 2012 Rohan Garg <rohangarg at kubuntu.org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -16,30 +18,32 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#ifndef NOTIFICATIONCONFIGDIALOG_H
+#define NOTIFICATIONCONFIGDIALOG_H
 
-#ifndef PENDINGWALLETOPERATION_H
-#define PENDINGWALLETOPERATION_H
+#include <KTp/ktp-export.h>
 
-#include <TelepathyQt/PendingOperation>
+#include <KDialog>
+#include <TelepathyQt/Types>
 
-#include "wallet-interface.h"
-#include <KTp/ktp-export.h>
+class KNotifyConfigWidget;
 
-namespace KTp
-{
-class PendingWalletPrivate;
+namespace KTp {
 
-class KTP_EXPORT PendingWallet : public Tp::PendingOperation
+class KTP_EXPORT NotificationConfigDialog : public KDialog
 {
     Q_OBJECT
 public:
-    friend class WalletInterface;
-    KTp::WalletInterface *walletInterface() const;
+    explicit NotificationConfigDialog(const Tp::ContactPtr &contact, QWidget *parent=0);
+    ~NotificationConfigDialog();
+    void show();
 private:
-    PendingWallet(KTp::WalletInterface *wallet);
-    virtual ~PendingWallet();
-    KTp::PendingWalletPrivate *d;
+    KNotifyConfigWidget *m_notifyWidget;
+    Tp::ContactPtr m_contact;
+private Q_SLOTS:
+    void saveConfig();
+    void updateNotifyWidget(int);
 };
 
 }
-#endif // PENDINGWALLETOPERATION_H
+#endif // NOTIFICATIONCONFIGDIALOG_H

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list