summaryrefslogtreecommitdiffabout
path: root/pwmanager
Unidiff
Diffstat (limited to 'pwmanager') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwmview.cpp16
-rw-r--r--pwmanager/pwmanager/pwmview.h10
2 files changed, 20 insertions, 6 deletions
diff --git a/pwmanager/pwmanager/pwmview.cpp b/pwmanager/pwmanager/pwmview.cpp
index 58c2fca..d192119 100644
--- a/pwmanager/pwmanager/pwmview.cpp
+++ b/pwmanager/pwmanager/pwmview.cpp
@@ -15,54 +15,58 @@
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#include "pwmview.h" 20#include "pwmview.h"
21#include "pwmexception.h" 21#include "pwmexception.h"
22#include "globalstuff.h" 22#include "globalstuff.h"
23#include "pwm.h" 23#include "pwm.h"
24#include "rencatwnd.h" 24#include "rencatwnd.h"
25#ifndef PWM_EMBEDDED 25#ifndef PWM_EMBEDDED
26#include "configuration.h" 26#include "configuration.h"
27#else 27#else
28#include "pwmprefs.h" 28#include "pwmprefs.h"
29#endif 29#endif
30#include "commentbox.h" 30#include "commentbox.h"
31 31
32#include <kmessagebox.h> 32#include <kmessagebox.h>
33#include <klocale.h> 33#include <klocale.h>
34 34
35#include <qlineedit.h> 35#include <qlineedit.h>
36#include <qpoint.h> 36#include <qpoint.h>
37#include <qapplication.h> 37#include <qapplication.h>
38 38
39//US ENH: wouldn't it be a good idea if we could use this consts everywhere else.
40//US ENH: for examle in listviewpwm.cpp
41//US ENH: Because of that I transfer them into the headerfile.
42/*
39 #define COLUMN_DESC 0 43 #define COLUMN_DESC 0
40 #define COLUMN_NAME 1 44 #define COLUMN_NAME 1
41 #define COLUMN_PW 2 45 #define COLUMN_PW 2
42 #define COLUMN_URL 3 46 #define COLUMN_URL 3
43 #define COLUMN_LAUNCHER 4 47 #define COLUMN_LAUNCHER 4
44 48*/
45 49
46PwMView::PwMView(PwM *_mainClass, 50PwMView::PwMView(PwM *_mainClass,
47 QWidget *parent, PwMDoc *_doc, 51 QWidget *parent, PwMDoc *_doc,
48 const char *name) 52 const char *name)
49 : PwMViewStyle(parent, name) 53 : PwMViewStyle(parent, name)
50{ 54{
51 PWM_ASSERT(_mainClass); 55 PWM_ASSERT(_mainClass);
52 PWM_ASSERT(parent); 56 PWM_ASSERT(parent);
53 PWM_ASSERT(_doc); 57 PWM_ASSERT(_doc);
54 setView(this); 58 setView(this);
55 doc = _doc; 59 doc = _doc;
56 doc->setListViewPointer(this); 60 doc->setListViewPointer(this);
57 mainClass = _mainClass; 61 mainClass = _mainClass;
58 resize(_mainClass->size()); 62 resize(_mainClass->size());
59 initStyle(conf()->confWndMainViewStyle()); 63 initStyle(conf()->confWndMainViewStyle());
60 initCtxMenu(); 64 initCtxMenu();
61 doc->setCurrentView(this); 65 doc->setCurrentView(this);
62 connect(doc, SIGNAL(dataChanged(PwMDoc *)), this, SLOT(updateView())); 66 connect(doc, SIGNAL(dataChanged(PwMDoc *)), this, SLOT(updateView()));
63} 67}
64 68
65PwMView::~PwMView() 69PwMView::~PwMView()
66{ 70{
67} 71}
68 72
@@ -344,53 +348,53 @@ void PwMView::selAt(int index)
344 348
345void PwMView::renCatButton_slot() 349void PwMView::renCatButton_slot()
346{ 350{
347 if (doc->isDeepLocked()) 351 if (doc->isDeepLocked())
348 return; 352 return;
349 RenCatWnd wnd(this); 353 RenCatWnd wnd(this);
350 if (wnd.exec() == 1) { 354 if (wnd.exec() == 1) {
351 QString newName(wnd.getNewName()); 355 QString newName(wnd.getNewName());
352 if (newName == "") 356 if (newName == "")
353 return; 357 return;
354 document()->renameCategory(getCurrentCategory(), 358 document()->renameCategory(getCurrentCategory(),
355 newName); 359 newName);
356 } 360 }
357} 361}
358 362
359void PwMView::delCatButton_slot() 363void PwMView::delCatButton_slot()
360{ 364{
361 if (doc->isDeepLocked()) 365 if (doc->isDeepLocked())
362 return; 366 return;
363 if (numCategories() <= 1) { 367 if (numCategories() <= 1) {
364 mainClass->showStatMsg(i18n("Can't remove the last category.")); 368 mainClass->showStatMsg(i18n("Can't remove the last category."));
365 return; 369 return;
366 } 370 }
367 if (KMessageBox::questionYesNo(this, 371 if (KMessageBox::questionYesNo(this,
368 i18n("Do you really want to " 372 i18n("Do you really want to\n"
369 "delete the selected " 373 "delete the selected\n"
370 "category? All password-" 374 "category? All password-\n"
371 "entries will be lost in " 375 "entries will be lost in\n"
372 "this category!"), 376 "this category!\n"),
373 i18n("Delete category?")) 377 i18n("Delete category?"))
374 == KMessageBox::No) { 378 == KMessageBox::No) {
375 return; 379 return;
376 } 380 }
377 document()->delCategory(getCurrentCategory()); 381 document()->delCategory(getCurrentCategory());
378} 382}
379 383
380void PwMView::copyPwToClip() 384void PwMView::copyPwToClip()
381{ 385{
382 if (doc->isDeepLocked()) 386 if (doc->isDeepLocked())
383 return; 387 return;
384 unsigned int curIndex = 0; 388 unsigned int curIndex = 0;
385 if (!getCurEntryIndex(&curIndex)) 389 if (!getCurEntryIndex(&curIndex))
386 return; 390 return;
387 PwMDataItem d; 391 PwMDataItem d;
388 document()->getDataChangedLock(); 392 document()->getDataChangedLock();
389 document()->getEntry(getCurrentCategory(), curIndex, &d, true); 393 document()->getEntry(getCurrentCategory(), curIndex, &d, true);
390 document()->putDataChangedLock(); 394 document()->putDataChangedLock();
391 PwM::copyToClipboard(d.pw.c_str()); 395 PwM::copyToClipboard(d.pw.c_str());
392} 396}
393 397
394void PwMView::copyNameToClip() 398void PwMView::copyNameToClip()
395{ 399{
396 if (doc->isDeepLocked()) 400 if (doc->isDeepLocked())
diff --git a/pwmanager/pwmanager/pwmview.h b/pwmanager/pwmanager/pwmview.h
index b4cec65..5a326d3 100644
--- a/pwmanager/pwmanager/pwmview.h
+++ b/pwmanager/pwmanager/pwmview.h
@@ -1,46 +1,56 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * copyright (C) 2003, 2004 by Michael Buesch * 3 * copyright (C) 2003, 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de * 4 * email: mbuesch@freenet.de *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License version 2 * 7 * it under the terms of the GNU General Public License version 2 *
8 * as published by the Free Software Foundation. * 8 * as published by the Free Software Foundation. *
9 * * 9 * *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager 14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#ifndef PWMVIEW_H 20#ifndef PWMVIEW_H
21#define PWMVIEW_H 21#define PWMVIEW_H
22 22
23//US ENH: wouldn't it be a good idea if we could use this consts everywhere else.
24//US ENH: for examle in listviewpwm.cpp
25//US ENH: Because of that I transfer them into the headerfile.
26 #define COLUMN_DESC 0
27 #define COLUMN_NAME 1
28 #define COLUMN_PW 2
29 #define COLUMN_URL 3
30 #define COLUMN_LAUNCHER 4
31
32
23#include "listviewpwm.h" 33#include "listviewpwm.h"
24#include "pwmdoc.h" 34#include "pwmdoc.h"
25#include "pwmviewstyle.h" 35#include "pwmviewstyle.h"
26 36
27#include <kconfig.h> 37#include <kconfig.h>
28#include <klocale.h> 38#include <klocale.h>
29 39
30#include <qevent.h> 40#include <qevent.h>
31#include <qfont.h> 41#include <qfont.h>
32#include <qobject.h> 42#include <qobject.h>
33 43
34#include <vector> 44#include <vector>
35#include <string> 45#include <string>
36 46
37using std::string; 47using std::string;
38using std::vector; 48using std::vector;
39 49
40class PwM; 50class PwM;
41class ConfFile; 51class ConfFile;
42class PwMStatusBar; 52class PwMStatusBar;
43 53
44 54
45/** View class for PwM */ 55/** View class for PwM */
46class PwMView : public PwMViewStyle 56class PwMView : public PwMViewStyle