author | ulf69 <ulf69> | 2004-09-15 17:53:22 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-09-15 17:53:22 (UTC) |
commit | d3925ba5bd25224bc4a60d3d6a107c464994a1ea (patch) (unidiff) | |
tree | 60f69da1d2b79ee3081e7ef5c09a46470ca6eda0 /pwmanager/pwmanager/pwmview.h | |
parent | ce83a3479d23b9e8a59c745ccd0a0b14f64ef4e8 (diff) | |
download | kdepimpi-d3925ba5bd25224bc4a60d3d6a107c464994a1ea.zip kdepimpi-d3925ba5bd25224bc4a60d3d6a107c464994a1ea.tar.gz kdepimpi-d3925ba5bd25224bc4a60d3d6a107c464994a1ea.tar.bz2 |
initial revision
Diffstat (limited to 'pwmanager/pwmanager/pwmview.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | pwmanager/pwmanager/pwmview.h | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/pwmanager/pwmanager/pwmview.h b/pwmanager/pwmanager/pwmview.h new file mode 100644 index 0000000..b4cec65 --- a/dev/null +++ b/pwmanager/pwmanager/pwmview.h | |||
@@ -0,0 +1,140 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * copyright (C) 2003, 2004 by Michael Buesch * | ||
4 | * email: mbuesch@freenet.de * | ||
5 | * * | ||
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 * | ||
8 | * as published by the Free Software Foundation. * | ||
9 | * * | ||
10 | ***************************************************************************/ | ||
11 | |||
12 | /*************************************************************************** | ||
13 | * copyright (C) 2004 by Ulf Schenk | ||
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 | ||
16 | * | ||
17 | * $Id$ | ||
18 | **************************************************************************/ | ||
19 | |||
20 | #ifndef PWMVIEW_H | ||
21 | #define PWMVIEW_H | ||
22 | |||
23 | #include "listviewpwm.h" | ||
24 | #include "pwmdoc.h" | ||
25 | #include "pwmviewstyle.h" | ||
26 | |||
27 | #include <kconfig.h> | ||
28 | #include <klocale.h> | ||
29 | |||
30 | #include <qevent.h> | ||
31 | #include <qfont.h> | ||
32 | #include <qobject.h> | ||
33 | |||
34 | #include <vector> | ||
35 | #include <string> | ||
36 | |||
37 | using std::string; | ||
38 | using std::vector; | ||
39 | |||
40 | class PwM; | ||
41 | class ConfFile; | ||
42 | class PwMStatusBar; | ||
43 | |||
44 | |||
45 | /** View class for PwM */ | ||
46 | class PwMView : public PwMViewStyle | ||
47 | { | ||
48 | Q_OBJECT | ||
49 | friend class PwMViewStyle; | ||
50 | public: | ||
51 | /** construtor */ | ||
52 | PwMView(PwM *_mainClass, QWidget* parent, PwMDoc *_doc, | ||
53 | const char *name = 0); | ||
54 | /** destructor */ | ||
55 | ~PwMView(); | ||
56 | |||
57 | /** returns pointer to the document */ | ||
58 | PwMDoc* document() | ||
59 | { return doc; } | ||
60 | /** returns the index of the currently selected entry. | ||
61 | * (index as represented in PwMDoc !) | ||
62 | */ | ||
63 | bool getCurEntryIndex(unsigned int *index); | ||
64 | /** returns the position of the given item in the document | ||
65 | * Note: This func only serches in the current category. | ||
66 | */ | ||
67 | bool getDocEntryIndex(unsigned int *index, | ||
68 | const QListViewItem *item); | ||
69 | |||
70 | public slots: | ||
71 | /** update the view (call if dirty) */ | ||
72 | void updateView() | ||
73 | { | ||
74 | updateCategories(); | ||
75 | shiftToView(); | ||
76 | } | ||
77 | /** (re)sort all items and (re)shift them to listView. */ | ||
78 | void shiftToView(); | ||
79 | /** handle clicking on an item */ | ||
80 | void handleToggle(QListViewItem *item); | ||
81 | /** handle right-clicking on an item */ | ||
82 | void handleRightClick(QListViewItem *item, const QPoint &point, int); | ||
83 | /** selects the item at "index" */ | ||
84 | void selAt(int index); | ||
85 | /** rename category button pressed */ | ||
86 | void renCatButton_slot(); | ||
87 | /** delete category button pressed */ | ||
88 | void delCatButton_slot(); | ||
89 | |||
90 | protected: | ||
91 | /** right-click context-menu */ | ||
92 | QPopupMenu *ctxMenu; | ||
93 | |||
94 | protected: | ||
95 | /** update the categories from document */ | ||
96 | void updateCategories(); | ||
97 | /** widget resize event */ | ||
98 | void resizeEvent(QResizeEvent *); | ||
99 | /** initialize context-menu */ | ||
100 | void initCtxMenu(); | ||
101 | /** tempoarly disable auto-sorting and user-sorting */ | ||
102 | void tmpDisableSort() | ||
103 | { lv->setSorting(-1); } | ||
104 | /** re-enable tempoarly disabled sorting */ | ||
105 | void tmpReEnableSort() | ||
106 | { | ||
107 | lv->setSorting(lv->columns() + 1, | ||
108 | true/*lv->sortOrder() == Qt::Ascending*/); | ||
109 | } | ||
110 | /** The user pressed and released a key. */ | ||
111 | void keyReleaseEvent(QKeyEvent *e); | ||
112 | |||
113 | protected slots: | ||
114 | /** changes the comment text-edit, because a new item has been selected */ | ||
115 | void refreshCommentTextEdit(QListViewItem *curItem); | ||
116 | /** copy pw to clipboard */ | ||
117 | void copyPwToClip(); | ||
118 | /** copy name to clipboard */ | ||
119 | void copyNameToClip(); | ||
120 | /** copy desc to clipboard */ | ||
121 | void copyDescToClip(); | ||
122 | /** copy url to clipboard */ | ||
123 | void copyUrlToClip(); | ||
124 | /** copy launcher to clipboard */ | ||
125 | void copyLauncherToClip(); | ||
126 | /** copy comment to clipboard */ | ||
127 | void copyCommentToClip(); | ||
128 | /** reorganize the "listViewPos" positions in the document | ||
129 | * (for the current category only!) | ||
130 | */ | ||
131 | void reorgLp(); | ||
132 | |||
133 | private: | ||
134 | /** document */ | ||
135 | PwMDoc *doc; | ||
136 | /** pointer to the main class "PwM" */ | ||
137 | PwM *mainClass; | ||
138 | }; | ||
139 | |||
140 | #endif | ||