From 5ab6d90452fcfe15d6aaafc599c5467d3c05552a Mon Sep 17 00:00:00 2001 From: Fritz Elfert Date: Tue, 31 Jul 2001 18:29:32 +0000 Subject: Added check for unsupported operation. --- kde2/klipsi/main.cpp | 13 +++++++++---- kde2/klipsi/toplevel.cpp | 37 ++++++++++++++++++++++++++++++------- kde2/klipsi/toplevel.h | 1 + 3 files changed, 40 insertions(+), 11 deletions(-) (limited to 'kde2') 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 #include #include +#include #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 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( + "Your Psion does not support the remote clipboard " + "protocol.
The reason for that is usually a missing " + "server library on your Psion.
Make shure, that " + "C:\\System\\Libs\\clipsvr.rsy exists.
" + "Klipsi will now terminate.
"), + 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 *); -- cgit v1.2.3