[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdenetwork/kppp
From:       Kevin Krammer <kevin.krammer () gmx ! at>
Date:       2007-11-25 22:38:30
Message-ID: 1196030310.801919.1409.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 741584 by krake:

Another take at deprecation warnings.

This also fixes the system tray menu visually, since the KDE4 one has its own
minimize/restore action and thus currently showed two "Restore" entries.

The change also hides the quit action which is now also standard in system menus.
It would probably be better to disconnect from the maybeQuit slots and connect it
to the main window's quit handling code instead, which warns that PPP will also be
killed and shuts down the network properly.



 M  +10 -39    docking.cpp  
 M  +0 -5      docking.h  


--- trunk/KDE/kdenetwork/kppp/docking.cpp #741583:741584
@@ -24,6 +24,7 @@
  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
+#include <kactioncollection.h>
 #include <kwindowsystem.h>
 #include <klocale.h>
 #include <kiconloader.h>
@@ -57,11 +58,15 @@
 
   // popup menu for right mouse button
   popup_m = contextMenu();
-  toggleID = popup_m->insertItem(i18n("Restore"),
-				 this, SLOT(toggle_window_state()));
-  popup_m->insertItem(i18n("Details"), p_kppp, SLOT(showStats()));
-  popup_m->insertSeparator();
-  popup_m->insertItem(i18n("Disconnect"), p_kppp, SLOT(disconnect()));
+  popup_m->addAction(i18n("Details"), p_kppp, SLOT(showStats()));
+  popup_m->addSeparator();
+  popup_m->addAction(i18n("Disconnect"), p_kppp, SLOT(disconnect()));
+  // TODO see if we can rather connect the quit action to the
+  // main window's quit handling, bypassing KSystemTrayIcon::maybeQuit
+  QAction *quit =
+    actionCollection()->action(KStandardAction::name(KStandardAction::Quit));
+  if (quit != 0)
+    quit->setVisible(false);
   // connect to stats for little modem animation
   connect(stats, SIGNAL(statsChanged(int)), SLOT(paintIcon(int)));
 
@@ -110,38 +115,4 @@
   stats->stop();
 }
 
-
-void DockWidget::mousePressEvent(QMouseEvent *e) {
-  // open/close connect-window on right mouse button
-  if ( e->button() == Qt::LeftButton ) {
-    toggle_window_state();
-  }
-
-  // open popup menu on left mouse button
-  if ( e->button() == Qt::RightButton ) {
-    QString text;
-    if(p_kppp->con_win->isVisible())
-      text = i18n("Minimize");
-    else
-      text = i18n("Restore");
-
-    popup_m->changeItem(toggleID, text);
-    popup_m->popup(e->globalPos());
-    popup_m->exec();
-  }
-}
-
-
-void DockWidget::toggle_window_state() {
-  // restore/hide connect-window
-  if(p_kppp != 0L)  {
-    if (p_kppp->con_win->isVisible())
-      p_kppp->con_win->hide();
-    else {
-      p_kppp->con_win->show();
-      KWindowSystem::activateWindow(p_kppp->con_win->winId());
-    }
-  }
-}
-
 #include "docking.moc"
--- trunk/KDE/kdenetwork/kppp/docking.h #741583:741584
@@ -46,10 +46,6 @@
 protected:
   void showEvent(QShowEvent *) { }
 
-private slots:
-  void toggle_window_state();
-  void mousePressEvent(QMouseEvent *e);
-
 public slots:
   void paintIcon(int);
   void take_stats();
@@ -59,7 +55,6 @@
   static DockWidget *dock_widget;
 
 private:
-  int toggleID;
   PPPStats *stats;
 
   QMenu *popup_m;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic