[SCM] ktp-contact-list packaging branch, master, updated. debian/15.12.1-2-1070-g6c56f91

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:07:09 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=95239b5

The following commit has been merged in the master branch:
commit 95239b588667c58dc9b7cac32a91bc1f92665584
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Wed Jul 20 00:31:19 2011 +0100

    Only show "do you want to disconnect dialog" when manually closing the window, not on computer shutdown.
    
    Review by: Martin Klapetek
---
 CMakeLists.txt                                     |  1 +
 .../contact-info.h => contact-list-application.cpp | 36 +++++--------
 ...-contact-dialog.h => contact-list-application.h | 33 +++++-------
 main-widget.cpp                                    | 62 ++++++++++++----------
 main.cpp                                           |  4 +-
 5 files changed, 64 insertions(+), 72 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index de2827f..b01272f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,6 +21,7 @@ include_directories (${KDE4_INCLUDES}
 
 set (contactlist_SRCS
      abstract-contact-delegate.cpp
+     contact-list-application.cpp
      contact-view-hover-button.cpp
      contact-overlays.cpp
      contact-delegate-overlay.cpp
diff --git a/dialogs/contact-info.h b/contact-list-application.cpp
similarity index 64%
copy from dialogs/contact-info.h
copy to contact-list-application.cpp
index 95add7d..8b2a8e0 100644
--- a/dialogs/contact-info.h
+++ b/contact-list-application.cpp
@@ -1,5 +1,5 @@
 /*
- * Dialog for showing contact info
+ * Contact List Application
  *
  * Copyright (C) 2011 David Edmundson <kde at davidedmundson.co.uk>
  *
@@ -18,29 +18,21 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include "contact-list-application.h"
 
-#ifndef CONTACTINFO_H
-#define CONTACTINFO_H
-
-#include <KDialog>
-#include <TelepathyQt4/Contact>
-
-
-namespace Ui {
-    class ContactInfo;
+ContactListApplication::ContactListApplication() :
+    KUniqueApplication(),
+    m_isShuttingDown(false)
+{
 }
 
-class ContactInfo : public KDialog
+void ContactListApplication::commitData(QSessionManager &sm)
 {
-    Q_OBJECT
-
-public:
-    explicit ContactInfo(const Tp::ContactPtr &contact, QWidget *parent = 0);
-    ~ContactInfo();
-
-private:
-    Ui::ContactInfo *ui;
-    KIcon iconForPresenceState(Tp::Contact::PresenceState state) const;
-};
+    m_isShuttingDown = true;
+    KUniqueApplication::commitData(sm);
+}
 
-#endif // CONTACTINFO_H
+bool ContactListApplication::isShuttingDown() const
+{
+    return m_isShuttingDown;
+}
diff --git a/dialogs/add-contact-dialog.h b/contact-list-application.h
similarity index 63%
copy from dialogs/add-contact-dialog.h
copy to contact-list-application.h
index d8c9e61..a514cd6 100644
--- a/dialogs/add-contact-dialog.h
+++ b/contact-list-application.h
@@ -1,5 +1,5 @@
 /*
- * Add contact dialog
+ * Contact List Application
  *
  * Copyright (C) 2011 David Edmundson <kde at davidedmundson.co.uk>
  *
@@ -18,31 +18,24 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef ADDCONTACTDIALOG_H
-#define ADDCONTACTDIALOG_H
+#ifndef CONTACTLISTAPPLICATION_H
+#define CONTACTLISTAPPLICATION_H
 
-#include <KDialog>
+#include <KUniqueApplication>
 
-#include <TelepathyQt4/Types>
-
-namespace Ui {
-    class AddContactDialog;
-}
-
-class AccountsModel;
-
-class AddContactDialog : public KDialog
+class ContactListApplication : public KUniqueApplication
 {
     Q_OBJECT
-
 public:
-    explicit AddContactDialog(AccountsModel* accountModel, QWidget *parent = 0);
-    virtual ~AddContactDialog();
-    Tp::AccountPtr account() const;
-    const QString screenName() const;
+    explicit ContactListApplication();
+    virtual void commitData(QSessionManager &sm);
+
+    /** Returns true if the application is starting to shut down, if set no warning dialogs should be shown to the user*/
+    bool isShuttingDown() const;
 
 private:
-    Ui::AddContactDialog *ui;
+    bool m_isShuttingDown;
+
 };
 
-#endif // ADDCONTACTDIALOG_H
+#endif // CONTACTLISTAPPLICATION_H
diff --git a/main-widget.cpp b/main-widget.cpp
index 8f6534b..93f936e 100644
--- a/main-widget.cpp
+++ b/main-widget.cpp
@@ -60,6 +60,7 @@
 #include "contact-delegate.h"
 #include "contact-delegate-compact.h"
 #include "fetch-avatar-job.h"
+#include "contact-list-application.h"
 
 #include "dialogs/add-contact-dialog.h"
 #include "dialogs/join-chat-room-dialog.h"
@@ -1451,38 +1452,41 @@ void MainWidget::closeEvent(QCloseEvent* e)
     KConfigGroup generalConfigGroup(config, "General");
     KConfigGroup notifyConigGroup(config, "Notification Messages");
 
-    //the standard KMessageBox control saves "true" if you select the checkbox, therefore the reversed var name
-    bool dontCheckForPlasmoid = notifyConigGroup.readEntry("dont_check_for_plasmoid", false);
-
-    if (isAnyAccountOnline() && !dontCheckForPlasmoid) {
-        if (!isPresencePlasmoidPresent()) {
-            switch (KMessageBox::warningYesNoCancel(this,
-                    i18n("You do not have any other presence controls active (a Presence widget for example).
"
-                         "Do you want to stay online or would you rather go offline?"),
-                    i18n("No Other Presence Controls Found"),
-                    KGuiItem(i18n("Stay Online"), KIcon("user-online")),
-                    KGuiItem(i18n("Go Offline"), KIcon("user-offline")),
-                    KStandardGuiItem::cancel(),
-                    QString("dont_check_for_plasmoid"))) {
-
-                case KMessageBox::No:
-                    generalConfigGroup.writeEntry("go_offline_when_closing", true);
-                    goOffline();
-                    break;
-                case KMessageBox::Cancel:
-                    e->ignore();
-                    return;
+    ContactListApplication *app = qobject_cast<ContactListApplication*>(kapp);
+    if (!app->isShuttingDown()) {    
+        //the standard KMessageBox control saves "true" if you select the checkbox, therefore the reversed var name
+        bool dontCheckForPlasmoid = notifyConigGroup.readEntry("dont_check_for_plasmoid", false);
+
+        if (isAnyAccountOnline() && !dontCheckForPlasmoid) {
+            if (!isPresencePlasmoidPresent()) {
+                switch (KMessageBox::warningYesNoCancel(this,
+                        i18n("You do not have any other presence controls active (a Presence widget for example).
"
+                            "Do you want to stay online or would you rather go offline?"),
+                        i18n("No Other Presence Controls Found"),
+                        KGuiItem(i18n("Stay Online"), KIcon("user-online")),
+                        KGuiItem(i18n("Go Offline"), KIcon("user-offline")),
+                        KStandardGuiItem::cancel(),
+                        QString("dont_check_for_plasmoid"))) {
+
+                    case KMessageBox::No:
+                        generalConfigGroup.writeEntry("go_offline_when_closing", true);
+                        goOffline();
+                        break;
+                    case KMessageBox::Cancel:
+                        e->ignore();
+                        return;
+                }
+            }
+        } else if (isAnyAccountOnline() && dontCheckForPlasmoid) {
+            bool shouldGoOffline = generalConfigGroup.readEntry("go_offline_when_closing", false);
+            if (shouldGoOffline) {
+                goOffline();
             }
         }
-    } else if (isAnyAccountOnline() && dontCheckForPlasmoid) {
-        bool shouldGoOffline = generalConfigGroup.readEntry("go_offline_when_closing", false);
-        if (shouldGoOffline) {
-            goOffline();
-        }
+        
+        generalConfigGroup.config()->sync();
     }
-
-    generalConfigGroup.config()->sync();
-
+    
     KMainWindow::closeEvent(e);
 }
 
diff --git a/main.cpp b/main.cpp
index 1b92c79..049d655 100644
--- a/main.cpp
+++ b/main.cpp
@@ -29,6 +29,8 @@
 #include <TelepathyQt4/Types>
 #include <TelepathyQt4/Debug>
 
+#include "contact-list-application.h"
+
 int main(int argc, char *argv[])
 {
     KAboutData aboutData("telepathy-kde-contactlist", 0, ki18n("Telepathy KDE Contact List"), "0.1",
@@ -46,7 +48,7 @@ int main(int argc, char *argv[])
     options.add("debug", ki18n("Show Telepathy debugging information"));
     KCmdLineArgs::addCmdLineOptions(options);
 
-    KUniqueApplication app;
+    ContactListApplication app;
 
     Tp::registerTypes();
     Tp::enableDebug(KCmdLineArgs::parsedArgs()->isSet("debug"));

-- 
ktp-contact-list packaging



More information about the pkg-kde-commits mailing list