Diffstat (limited to 'noncore/apps/opie-console/configdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/configdialog.cpp | 68 |
1 files changed, 68 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 | |||