-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 @@ + +#include "profile.h" +#include "qlistview.h" +#include "configdialog.h" + +class ConfigListItem : public QListViewItem { +public: + ConfigListItem( QListView* item, const Profile& ); + ~ConfigListItem(); + Profile profile()const; + +private: + Profile m_prof; +}; +ConfigListItem::ConfigListItem( QListView* item, const Profile& prof ) + : QListViewItem( item ), m_prof( prof ) +{ + setText(0, prof.name() ); +} +ConfigListItem::~ConfigListItem() { + +} +Profile ConfigListItem::profile()const { + return m_prof; +} + +/* Dialog */ + +ConfigDialog::ConfigDialog( const Profile::ValueList& lis, QWidget* parent ) + : ConfigureBase( parent, 0, TRUE ) +{ + //init(); + { + Profile::ValueList::ConstIterator it; + for (it = lis.begin(); it != lis.end(); ++it ) { + new ConfigListItem( lstView, (*it) ); + } + } +} +ConfigDialog::~ConfigDialog() { + +} +Profile::ValueList ConfigDialog::list()const { +/* iterate over the list */ + Profile::ValueList lst; + QListViewItemIterator it(lstView); + for ( ; it.current(); ++it ) { + ConfigListItem* item = (ConfigListItem*)it.current(); + lst.append( item->profile() ); + } + return lst; +} +/* our slots */ +void ConfigDialog::slotRemove() { + ConfigListItem* item = (ConfigListItem*)lstView->currentItem(); + if (!item ) + return; + + lstView->takeItem( item ); + delete item; +} +void ConfigDialog::slotEdit() { + +} +void ConfigDialog::slotAdd() { + +} + 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 @@ +#ifndef OPIE_CONFIG_DIALOG_H +#define OPIE_CONFIG_DIALOG_H + +#include <qdialog.h> + +#include "configurebase.h" +#include "profile.h" + +class ConfigDialog : public ConfigureBase { + Q_OBJECT +public: + ConfigDialog( const Profile::ValueList&, QWidget* parent = 0l); + ~ConfigDialog(); + + Profile::ValueList list()const; +protected slots: + void slotRemove(); + void slotEdit(); + void slotAdd(); + +}; + +#endif |