diff options
Diffstat (limited to 'kde2')
-rw-r--r-- | kde2/klipsi/main.cpp | 13 | ||||
-rw-r--r-- | kde2/klipsi/toplevel.cpp | 37 | ||||
-rw-r--r-- | kde2/klipsi/toplevel.h | 1 |
3 files changed, 40 insertions, 11 deletions
diff --git a/kde2/klipsi/main.cpp b/kde2/klipsi/main.cpp index e0cbd71..1cfa271 100644 --- a/kde2/klipsi/main.cpp +++ b/kde2/klipsi/main.cpp @@ -55,11 +55,16 @@ int main(int argc, char *argv[]) TopLevel *toplevel = new TopLevel(); - KWin::setSystemTrayWindowFor(toplevel->winId(), 0); - toplevel->setGeometry(-100, -100, 42, 42 ); - toplevel->show(); + if (toplevel->isNotSupported()) + app.quit(); + else { + KWin::setSystemTrayWindowFor(toplevel->winId(), 0); + toplevel->setGeometry(-100, -100, 42, 42 ); + toplevel->show(); - return app.exec(); + return app.exec(); + } + return 0; } /* * Local variables: diff --git a/kde2/klipsi/toplevel.cpp b/kde2/klipsi/toplevel.cpp index 92a685d..92dc2ed 100644 --- a/kde2/klipsi/toplevel.cpp +++ b/kde2/klipsi/toplevel.cpp @@ -34,6 +34,7 @@ #include <kiconloader.h> #include <knotifyclient.h> #include <kdebug.h> +#include <kmessagebox.h> #define QUIT_ITEM 50 @@ -89,18 +90,23 @@ TopLevel::TopLevel() setBackgroundMode(X11ParentRelative); int interval = checkConnection() ? 500 : 5000; - timer->start(interval, true); - - + if (timer) + timer->start(interval, true); } TopLevel::~TopLevel() { closeConnection(); - delete timer; + if (timer) + delete timer; delete menu; } +bool TopLevel:: +isNotSupported() { + return (timer == NULL); +} + void TopLevel:: closeConnection() { if (rf) @@ -155,7 +161,10 @@ slotTimer() } if (!checkConnection()) { - timer->start(5000, true); + if (timer) + timer->start(5000, true); + else + kapp->quit(); return; } @@ -709,13 +718,27 @@ checkConnection() { if (rf) { if (!rc) { rc = new rclip(rclipSocket); - if (rc->initClipbd() == rfsv::E_PSI_GEN_NONE) { + Enum<rfsv::errs> ret; + + if ((ret = rc->initClipbd()) == rfsv::E_PSI_GEN_NONE) { KNotifyClient::event("connected"); constate = CONNECTED; repaint(); return true; - } else + } else { closeConnection(); + if (ret == rfsv::E_PSI_GEN_NSUP) { + KMessageBox::error(NULL, i18n( + "<QT>Your Psion does not support the remote clipboard " + "protocol.<BR/>The reason for that is usually a missing " + "server library on your Psion.<BR/>Make shure, that " + "<B>C:\\System\\Libs\\clipsvr.rsy</B> exists.<BR/>" + "<B>Klipsi</B> will now terminate.</QT>"), + i18n("Protocol not supported")); + delete timer; + timer = NULL; + } + } } } return false; diff --git a/kde2/klipsi/toplevel.h b/kde2/klipsi/toplevel.h index 31f5040..1f7ef1a 100644 --- a/kde2/klipsi/toplevel.h +++ b/kde2/klipsi/toplevel.h @@ -48,6 +48,7 @@ class TopLevel : public KMainWindow public: TopLevel(); ~TopLevel(); + bool isNotSupported(); protected: void paintEvent(QPaintEvent *); |