-rw-r--r-- | noncore/apps/opie-console/configdialog.cpp | 68 | ||||
-rw-r--r-- | noncore/apps/opie-console/configdialog.h | 23 |
2 files changed, 91 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/configdialog.cpp b/noncore/apps/opie-console/configdialog.cpp new file mode 100644 index 0000000..ba3cd31 --- a/dev/null +++ b/noncore/apps/opie-console/configdialog.cpp | |||
@@ -0,0 +1,68 @@ | |||
1 | |||
2 | #include "profile.h" | ||
3 | #include "qlistview.h" | ||
4 | #include "configdialog.h" | ||
5 | |||
6 | class ConfigListItem : public QListViewItem { | ||
7 | public: | ||
8 | ConfigListItem( QListView* item, const Profile& ); | ||
9 | ~ConfigListItem(); | ||
10 | Profile profile()const; | ||
11 | |||
12 | private: | ||
13 | Profile m_prof; | ||
14 | }; | ||
15 | ConfigListItem::ConfigListItem( QListView* item, const Profile& prof ) | ||
16 | : QListViewItem( item ), m_prof( prof ) | ||
17 | { | ||
18 | setText(0, prof.name() ); | ||
19 | } | ||
20 | ConfigListItem::~ConfigListItem() { | ||
21 | |||
22 | } | ||
23 | Profile ConfigListItem::profile()const { | ||
24 | return m_prof; | ||
25 | } | ||
26 | |||
27 | /* Dialog */ | ||
28 | |||
29 | ConfigDialog::ConfigDialog( const Profile::ValueList& lis, QWidget* parent ) | ||
30 | : ConfigureBase( parent, 0, TRUE ) | ||
31 | { | ||
32 | //init(); | ||
33 | { | ||
34 | Profile::ValueList::ConstIterator it; | ||
35 | for (it = lis.begin(); it != lis.end(); ++it ) { | ||
36 | new ConfigListItem( lstView, (*it) ); | ||
37 | } | ||
38 | } | ||
39 | } | ||
40 | ConfigDialog::~ConfigDialog() { | ||
41 | |||
42 | } | ||
43 | Profile::ValueList ConfigDialog::list()const { | ||
44 | /* iterate over the list */ | ||
45 | Profile::ValueList lst; | ||
46 | QListViewItemIterator it(lstView); | ||
47 | for ( ; it.current(); ++it ) { | ||
48 | ConfigListItem* item = (ConfigListItem*)it.current(); | ||
49 | lst.append( item->profile() ); | ||
50 | } | ||
51 | return lst; | ||
52 | } | ||
53 | /* our slots */ | ||
54 | void ConfigDialog::slotRemove() { | ||
55 | ConfigListItem* item = (ConfigListItem*)lstView->currentItem(); | ||
56 | if (!item ) | ||
57 | return; | ||
58 | |||
59 | lstView->takeItem( item ); | ||
60 | delete item; | ||
61 | } | ||
62 | void ConfigDialog::slotEdit() { | ||
63 | |||
64 | } | ||
65 | void ConfigDialog::slotAdd() { | ||
66 | |||
67 | } | ||
68 | |||
diff --git a/noncore/apps/opie-console/configdialog.h b/noncore/apps/opie-console/configdialog.h new file mode 100644 index 0000000..a0c40d0 --- a/dev/null +++ b/noncore/apps/opie-console/configdialog.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef OPIE_CONFIG_DIALOG_H | ||
2 | #define OPIE_CONFIG_DIALOG_H | ||
3 | |||
4 | #include <qdialog.h> | ||
5 | |||
6 | #include "configurebase.h" | ||
7 | #include "profile.h" | ||
8 | |||
9 | class ConfigDialog : public ConfigureBase { | ||
10 | Q_OBJECT | ||
11 | public: | ||
12 | ConfigDialog( const Profile::ValueList&, QWidget* parent = 0l); | ||
13 | ~ConfigDialog(); | ||
14 | |||
15 | Profile::ValueList list()const; | ||
16 | protected slots: | ||
17 | void slotRemove(); | ||
18 | void slotEdit(); | ||
19 | void slotAdd(); | ||
20 | |||
21 | }; | ||
22 | |||
23 | #endif | ||