-rw-r--r-- | pwmanager/pwmanager/pwm.cpp | 52 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwm.h | 39 |
2 files changed, 79 insertions, 12 deletions
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp index cd56399..ac2e66e 100644 --- a/pwmanager/pwmanager/pwm.cpp +++ b/pwmanager/pwmanager/pwm.cpp | |||
@@ -189,29 +189,37 @@ PwM::~PwM() | |||
189 | void PwM::initMenubar() | 189 | void PwM::initMenubar() |
190 | { | 190 | { |
191 | KIconLoader* picons; | 191 | KIconLoader* picons; |
192 | #ifndef PWM_EMBEDDED | 192 | #ifndef PWM_EMBEDDED |
193 | KIconLoader icons; | 193 | KIconLoader icons; |
194 | picons = &icons; | 194 | picons = &icons; |
195 | #else | 195 | #else |
196 | picons = KGlobal::iconLoader(); | 196 | picons = KGlobal::iconLoader(); |
197 | |||
198 | |||
199 | syncPopup = new KPopupMenu(this); | ||
200 | |||
201 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup); | ||
202 | syncManager->setBlockSave(false); | ||
203 | |||
204 | connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | ||
205 | syncManager->fillSyncMenu(); | ||
206 | |||
197 | #endif | 207 | #endif |
198 | filePopup = new KPopupMenu(this); | 208 | filePopup = new KPopupMenu(this); |
199 | importPopup = new KPopupMenu(filePopup); | 209 | importPopup = new KPopupMenu(filePopup); |
200 | exportPopup = new KPopupMenu(filePopup); | 210 | exportPopup = new KPopupMenu(filePopup); |
201 | managePopup = new KPopupMenu(this); | 211 | managePopup = new KPopupMenu(this); |
202 | #ifdef CONFIG_KEYCARD | 212 | #ifdef CONFIG_KEYCARD |
203 | chipcardPopup = new KPopupMenu(this); | 213 | chipcardPopup = new KPopupMenu(this); |
204 | #endif // CONFIG_KEYCARD | 214 | #endif // CONFIG_KEYCARD |
205 | viewPopup = new KPopupMenu(this); | 215 | viewPopup = new KPopupMenu(this); |
206 | optionsPopup = new KPopupMenu(this); | 216 | optionsPopup = new KPopupMenu(this); |
207 | #ifdef PWM_EMBEDDED | 217 | |
208 | syncPopup = new KPopupMenu(this); | ||
209 | #endif | ||
210 | // "file" popup menu | 218 | // "file" popup menu |
211 | filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), | 219 | filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), |
212 | i18n("&New"), this, | 220 | i18n("&New"), this, |
213 | SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW); | 221 | SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW); |
214 | filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)), | 222 | filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)), |
215 | i18n("&Open"), this, | 223 | i18n("&Open"), this, |
216 | SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN); | 224 | SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN); |
217 | filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)), | 225 | filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)), |
@@ -324,24 +332,17 @@ void PwM::initMenubar() | |||
324 | i18n("&Configure..."), this, | 332 | i18n("&Configure..."), this, |
325 | SLOT(config_slot()), | 333 | SLOT(config_slot()), |
326 | BUTTON_POPUP_OPTIONS_CONFIG); | 334 | BUTTON_POPUP_OPTIONS_CONFIG); |
327 | menuBar()->insertItem(i18n("&Options"), optionsPopup); | 335 | menuBar()->insertItem(i18n("&Options"), optionsPopup); |
328 | // "help" popup menu | 336 | // "help" popup menu |
329 | #ifndef PWM_EMBEDDED | 337 | #ifndef PWM_EMBEDDED |
330 | helpPopup = helpMenu(QString::null, false); | 338 | helpPopup = helpMenu(QString::null, false); |
331 | #else | 339 | #else |
332 | Popup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), | 340 | menuBar()->insertItem(i18n("&Sync"), syncPopup); |
333 | i18n("&Configure..."), this, | ||
334 | SLOT(config_slot()), | ||
335 | BUTTON_POPUP_OPTIONS_CONFIG); | ||
336 | connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); | ||
337 | fillSyncMenu(); | ||
338 | |||
339 | menuBar()->insertItem(i18n("&Syncronize"), syncPopup); | ||
340 | 341 | ||
341 | 342 | ||
342 | 343 | ||
343 | 344 | ||
344 | 345 | ||
345 | helpPopup = new KPopupMenu(this); | 346 | helpPopup = new KPopupMenu(this); |
346 | 347 | ||
347 | 348 | ||
@@ -1312,14 +1313,43 @@ void PwM::createAboutData_slot() | |||
1312 | "Olivier Sessink - gpasman@nl.linux.org\n" | 1313 | "Olivier Sessink - gpasman@nl.linux.org\n" |
1313 | "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n" | 1314 | "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n" |
1314 | "Troy Engel - tengel@sonic.net\n" | 1315 | "Troy Engel - tengel@sonic.net\n" |
1315 | "Wickey - wickey@gmx.at\n" | 1316 | "Wickey - wickey@gmx.at\n" |
1316 | "Ian MacGregor - original documentation author.\n" | 1317 | "Ian MacGregor - original documentation author.\n" |
1317 | ); | 1318 | ); |
1318 | } | 1319 | } |
1319 | 1320 | ||
1321 | |||
1322 | //this are the overwritten callbackmethods from the syncinterface | ||
1323 | bool PwM::sync(KSyncManager* manager, QString filename, int mode) | ||
1324 | { | ||
1325 | return true; | ||
1326 | } | ||
1327 | |||
1328 | bool PwM::syncExternal(KSyncManager* manager, QString resource) | ||
1329 | { | ||
1330 | return true; | ||
1331 | } | ||
1332 | |||
1333 | //called by the syncmanager to indicate that the work has to marked as dirty. | ||
1334 | void PwM::sync_setModified() | ||
1335 | { | ||
1336 | } | ||
1337 | |||
1338 | //called by the syncmanager to ask if the dirty flag is set. | ||
1339 | bool PwM::sync_isModified() | ||
1340 | { | ||
1341 | } | ||
1342 | |||
1343 | //called by the syncmanager to indicate that the work has to be saved. | ||
1344 | void PwM::sync_save() | ||
1345 | { | ||
1346 | } | ||
1347 | |||
1348 | |||
1349 | |||
1320 | #endif | 1350 | #endif |
1321 | 1351 | ||
1322 | 1352 | ||
1323 | #ifndef PWM_EMBEDDED | 1353 | #ifndef PWM_EMBEDDED |
1324 | #include "pwm.moc" | 1354 | #include "pwm.moc" |
1325 | #endif | 1355 | #endif |
diff --git a/pwmanager/pwmanager/pwm.h b/pwmanager/pwmanager/pwm.h index 36a8b5b..2fe7352 100644 --- a/pwmanager/pwmanager/pwm.h +++ b/pwmanager/pwmanager/pwm.h | |||
@@ -25,35 +25,42 @@ | |||
25 | #include <klistview.h> | 25 | #include <klistview.h> |
26 | #include <kmainwindow.h> | 26 | #include <kmainwindow.h> |
27 | 27 | ||
28 | #ifndef PWM_EMBEDDED | 28 | #ifndef PWM_EMBEDDED |
29 | #include <kwin.h> | 29 | #include <kwin.h> |
30 | #include <kapp.h> | 30 | #include <kapp.h> |
31 | #include <kdeversion.h> | 31 | #include <kdeversion.h> |
32 | #else | 32 | #else |
33 | #include <ksyncmanager.h> | ||
33 | #endif | 34 | #endif |
34 | 35 | ||
35 | #include <kaction.h> | 36 | #include <kaction.h> |
36 | 37 | ||
37 | |||
38 | #include <qglobal.h> | 38 | #include <qglobal.h> |
39 | 39 | ||
40 | #include "pwmview.h" | 40 | #include "pwmview.h" |
41 | #include "pwmexception.h" | 41 | #include "pwmexception.h" |
42 | 42 | ||
43 | 43 | ||
44 | /** timeout for displaying a message on the status-bar (in seconds) */ | 44 | /** timeout for displaying a message on the status-bar (in seconds) */ |
45 | #define STATUSBAR_MSG_TIMEOUT5 | 45 | #define STATUSBAR_MSG_TIMEOUT5 |
46 | 46 | ||
47 | 47 | ||
48 | class PwMInit; | 48 | class PwMInit; |
49 | class KSyncManager; | ||
49 | 50 | ||
50 | /** PwM is the base class of the project */ | 51 | /** PwM is the base class of the project */ |
52 | #ifndef PWM_EMBEDDED | ||
53 | //MOC_SKIP_BEGIN | ||
51 | class PwM : public KMainWindow | 54 | class PwM : public KMainWindow |
55 | //MOC_SKIP_END | ||
56 | #else | ||
57 | class PwM : public KMainWindow, public KSyncInterface | ||
58 | #endif | ||
52 | { | 59 | { |
53 | Q_OBJECT | 60 | Q_OBJECT |
54 | public: | 61 | public: |
55 | friend class PwMView; | 62 | friend class PwMView; |
56 | /** construtor */ | 63 | /** construtor */ |
57 | PwM(PwMInit *_init, PwMDoc *doc, | 64 | PwM(PwMInit *_init, PwMDoc *doc, |
58 | bool virginity = true, | 65 | bool virginity = true, |
59 | QWidget* parent = 0, const char *name = 0); | 66 | QWidget* parent = 0, const char *name = 0); |
@@ -251,11 +258,41 @@ protected: | |||
251 | /** "export" popup-menu */ | 258 | /** "export" popup-menu */ |
252 | KPopupMenu *exportPopup; | 259 | KPopupMenu *exportPopup; |
253 | /** "import" popup-menu */ | 260 | /** "import" popup-menu */ |
254 | KPopupMenu *importPopup; | 261 | KPopupMenu *importPopup; |
255 | /** force quit this window? */ | 262 | /** force quit this window? */ |
256 | bool forceQuit; | 263 | bool forceQuit; |
257 | /** force minimize this window to the tray */ | 264 | /** force minimize this window to the tray */ |
258 | bool forceMinimizeToTray; | 265 | bool forceMinimizeToTray; |
266 | |||
267 | |||
268 | |||
269 | |||
270 | private: | ||
271 | #ifdef PWM_EMBEDDED | ||
272 | //this are the overwritten callbackmethods from the syncinterface | ||
273 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | ||
274 | virtual bool syncExternal(KSyncManager* manager, QString resource); | ||
275 | |||
276 | //called by the syncmanager to indicate that the work has to marked as dirty. | ||
277 | virtual void sync_setModified(); | ||
278 | //called by the syncmanager to ask if the dirty flag is set. | ||
279 | virtual bool sync_isModified(); | ||
280 | //called by the syncmanager to indicate that the work has to be saved. | ||
281 | virtual void sync_save(); | ||
282 | |||
283 | // LR ******************************* | ||
284 | // sync stuff! | ||
285 | QPopupMenu *syncPopup; | ||
286 | KSyncManager* syncManager; | ||
287 | #endif | ||
288 | |||
289 | |||
290 | |||
291 | |||
292 | |||
293 | |||
294 | |||
295 | |||
259 | }; | 296 | }; |
260 | 297 | ||
261 | #endif | 298 | #endif |