[prev in list] [next in list] [prev in thread] [next in thread]
List: kopete-devel
Subject: [Kopete-devel] quit from systray
From: Andres Krapf <dae () chez ! com>
Date: 2002-04-10 21:29:10
[Download RAW message or body]
i've looked into it, and here's a patch that makes the quit from systray work.
i've integrated the other patch for hiding on close.
what do you think ?
--
Andres
["kopetehide2.patch" (text/x-diff)]
Index: kopete/library/ui/kopetewindow.cpp
===================================================================
RCS file: /home/kde/kdenonbeta/kopete/kopete/library/ui/kopetewindow.cpp,v
retrieving revision 1.25
diff -u -r1.25 kopetewindow.cpp
--- kopete/library/ui/kopetewindow.cpp 9 Apr 2002 04:55:46 -0000 1.25
+++ kopete/library/ui/kopetewindow.cpp 10 Apr 2002 20:27:42 -0000
@@ -29,6 +29,7 @@
#include <kconfig.h>
#include <kdebug.h>
#include <klocale.h>
+#include <kmessagebox.h>
#include <kstdaction.h>
KopeteWindow::KopeteWindow(QWidget *parent, const char *name ): \
KMainWindow(parent,name) @@ -100,7 +101,7 @@
actionPrefs = KStdAction::preferences(kopeteapp, SLOT(slotPreferences()), \
actionCollection());
// actionQuit = KStdAction::quit(kopeteapp, SLOT(slotExit()), actionCollection());
- KStdAction::quit(kopeteapp, SLOT(quit()), actionCollection());
+ actionQuit = KStdAction::quit(kopeteapp, SLOT(quit()), actionCollection());
toolbarAction = KStdAction::showToolbar(this, SLOT(showToolbar()), \
actionCollection());
@@ -121,7 +122,8 @@
actionAwayMenu->plug( tm );
tm->insertSeparator();
actionPrefs->plug( tm );
-// tm->insertSeparator();
+ tm->insertSeparator();
+ actionQuit->plug(tm);
}
KopeteWindow::~KopeteWindow()
@@ -217,6 +219,18 @@
KopeteContactViewItem *contactvi = dynamic_cast<KopeteContactViewItem *>(item);
if ( contactvi )
contactvi->contact()->execute();
+}
+
+bool KopeteWindow::close(bool del)
+{
+ KConfig *config = KGlobal::config();
+ if (!config->readBoolEntry("hideOnCloseInfo",false)) {
+ KMessageBox::information(this,i18n("<qt>Closing the main window will keep kopete \
running in the system tray. Use Quit from the File menu to quit the \
application?</qt>"),i18n("Docking in system tray")); \
+ config->writeEntry("hideOnCloseInfo",true); + config->sync();
+ }
+ hide();
+ return false;
}
// vim: set noet sw=4 ts=4 sts=4:
Index: kopete/library/ui/kopetewindow.h
===================================================================
RCS file: /home/kde/kdenonbeta/kopete/kopete/library/ui/kopetewindow.h,v
retrieving revision 1.13
diff -u -r1.13 kopetewindow.h
--- kopete/library/ui/kopetewindow.h 7 Apr 2002 09:17:17 -0000 1.13
+++ kopete/library/ui/kopetewindow.h 10 Apr 2002 20:27:42 -0000
@@ -64,6 +64,8 @@
KopeteSystemTray *tray;
+ virtual bool close ( bool del );
+
private:
void initView ( void );
void initActions ( void );
Index: kopete/library/ui/systemtray.cpp
===================================================================
RCS file: /home/kde/kdenonbeta/kopete/kopete/library/ui/systemtray.cpp,v
retrieving revision 1.8
diff -u -r1.8 systemtray.cpp
--- kopete/library/ui/systemtray.cpp 6 Apr 2002 19:00:26 -0000 1.8
+++ kopete/library/ui/systemtray.cpp 10 Apr 2002 20:27:42 -0000
@@ -158,3 +158,12 @@
mIsBlinkIcon = true;
}
}
+
+void KopeteSystemTray::showEvent ( QShowEvent *e ) {
+/*
+ * The parent's implementation forces 2 menuitems on the right click menu:
+ * Restore/Minimize
+ * Quit, which doesn't work for us since it's connected to slot \
KopeteWindow::close() + * So we just leave an empty menu with a titlebar
+ */
+}
Index: kopete/library/ui/systemtray.h
===================================================================
RCS file: /home/kde/kdenonbeta/kopete/kopete/library/ui/systemtray.h,v
retrieving revision 1.6
diff -u -r1.6 systemtray.h
--- kopete/library/ui/systemtray.h 3 Apr 2002 02:21:08 -0000 1.6
+++ kopete/library/ui/systemtray.h 10 Apr 2002 20:27:42 -0000
@@ -41,7 +41,8 @@
void startBlink();
void stopBlink();
- bool isBlinking() const { return mIsBlinking; };
+ bool isBlinking() const { return mIsBlinking; };
+
private:
QTimer *mBlinkTimer;
QPixmap mKopeteIcon;
@@ -50,10 +51,12 @@
bool mIsBlinkIcon;
bool mIsBlinking;
- void startBlinkPrivate();
+ void startBlinkPrivate();
+
protected:
virtual void mousePressEvent( QMouseEvent *e );
- virtual void mouseDoubleClickEvent( QMouseEvent *me );
+ virtual void mouseDoubleClickEvent( QMouseEvent *me );
+ virtual void showEvent ( QShowEvent *e );
private slots:
void slotBlink();
_______________________________________________
Kopete-devel mailing list
Kopete-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/kopete-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic