Diffstat (limited to 'pwmanager/pwmanager/subtbleditimpl.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | pwmanager/pwmanager/subtbleditimpl.h | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/pwmanager/pwmanager/subtbleditimpl.h b/pwmanager/pwmanager/subtbleditimpl.h new file mode 100644 index 0000000..0755fbf --- a/dev/null +++ b/pwmanager/pwmanager/subtbleditimpl.h | |||
@@ -0,0 +1,84 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * copyright (C) 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 SUBTBLEDITIMPL_H | ||
21 | #define SUBTBLEDITIMPL_H | ||
22 | |||
23 | #include "subtbledit.h" | ||
24 | |||
25 | #include <qlineedit.h> | ||
26 | #include <qlistbox.h> | ||
27 | |||
28 | #include <vector> | ||
29 | #include <utility> | ||
30 | |||
31 | using std::vector; | ||
32 | using std::pair; | ||
33 | |||
34 | |||
35 | class SubTblEditImpl : public subTblEdit | ||
36 | { | ||
37 | Q_OBJECT | ||
38 | public: | ||
39 | SubTblEditImpl(QWidget* parent = 0, | ||
40 | const char* name = 0, | ||
41 | WFlags fl = 0); | ||
42 | ~SubTblEditImpl(); | ||
43 | |||
44 | /** returns the title */ | ||
45 | QString getTitle() const | ||
46 | { return titleLineEdit->text(); } | ||
47 | /** returns a pointer to the data */ | ||
48 | const vector< pair<QString, QString> > * getEntries() const | ||
49 | { return &entries; } | ||
50 | /** sets the content of the subtable editor */ | ||
51 | void setContent(const QString &title, | ||
52 | const vector< pair<QString, QString> > *_entries); | ||
53 | |||
54 | public slots: | ||
55 | /** on button pressed */ | ||
56 | void okButton_slot(); | ||
57 | /** cancel button pressed */ | ||
58 | void cancelButton_slot(); | ||
59 | /** add button pressed */ | ||
60 | void addButton_slot(); | ||
61 | /** delete button pressed */ | ||
62 | void delButton_slot(); | ||
63 | |||
64 | protected slots: | ||
65 | /** the user selected another entry */ | ||
66 | void selectedEntry_slot(); | ||
67 | |||
68 | protected: | ||
69 | /** returns the index of the currently selected entry */ | ||
70 | int curIndex() | ||
71 | #ifndef PWM_EMBEDDED | ||
72 | { return entryListBox->index(entryListBox->selectedItem()); } | ||
73 | #else | ||
74 | { return entryListBox->currentItem(); } | ||
75 | #endif | ||
76 | |||
77 | protected: | ||
78 | /** internal storage for all entries */ | ||
79 | vector< pair<QString, QString> > entries; | ||
80 | /** stores the previous selection */ | ||
81 | int prevSelection; | ||
82 | }; | ||
83 | |||
84 | #endif | ||