From 7980189a2cb34e2864c339ef68bfbe7fb4910750 Mon Sep 17 00:00:00 2001 From: zecke Date: Sat, 28 Sep 2002 20:45:11 +0000 Subject: Add profiles and the profilemanager to the mainwindow if one would have a ConfigureDialog one could see it.... --- diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 1ae4a20..3c1c8ea 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -6,14 +6,17 @@ #include #include "metafactory.h" +#include "profilemanager.h" #include "mainwindow.h" MainWindow::MainWindow() { m_factory = new MetaFactory(); m_sessions.setAutoDelete( TRUE ); m_curSession = 0; + m_manager = new ProfileManager(m_factory); initUI(); + populateProfiles(); } void MainWindow::initUI() { setToolBarsMovable( FALSE ); @@ -65,6 +68,12 @@ void MainWindow::initUI() { connect(m_disconnect, SIGNAL(activated() ), this, SLOT(slotTerminate() ) ); + a = new QAction(); + a->setText( tr("Close Window") ); + a->addTo( m_console ); + connect(a, SIGNAL(activated() ), + this, SLOT(slotClose() ) ); + /* * the settings action */ @@ -84,6 +93,24 @@ void MainWindow::initUI() { /* the settings menu */ m_bar->insertItem( tr("Settings"), m_settings ); + /* + * connect to the menu activation + */ + connect( m_sessionsPop, SIGNAL(activated(int) ), + this, SLOT(slotProfile(int) ) ); + +} +ProfileManager* MainWindow::manager() { + return m_manager; +} +void MainWindow::populateProfiles() { + manager()->load(); + Profile::ValueList list = manager()->all(); + for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); + ++it ) { + m_sessionsPop->insertItem( (*it).name() ); + } + } MainWindow::~MainWindow() { delete m_factory; @@ -121,3 +148,9 @@ void MainWindow::slotTerminate() { void MainWindow::slotConfigure() { qWarning("configure"); } +void MainWindow::slotClose() { + +} +void MainWindow::slotProfile(int) { + +} diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h index b6a8419..be4b469 100644 --- a/noncore/apps/opie-console/mainwindow.h +++ b/noncore/apps/opie-console/mainwindow.h @@ -16,6 +16,7 @@ class QMenuBar; class QAction; class MetaFactory; +class ProfileManager; class MainWindow : public QMainWindow { Q_OBJECT public: @@ -39,15 +40,23 @@ public: */ QList sessions(); + /** + * + */ + ProfileManager* manager(); + private slots: void slotNew(); void slotConnect(); void slotDisconnect(); void slotTerminate(); void slotConfigure(); + void slotClose(); + void slotProfile(int); private: void initUI(); + void populateProfiles(); /** * the current session */ @@ -62,6 +71,7 @@ private: * the metafactory */ MetaFactory* m_factory; + ProfileManager* m_manager; QToolBar* m_tool; QMenuBar* m_bar; diff --git a/noncore/apps/opie-console/profileconfig.cpp b/noncore/apps/opie-console/profileconfig.cpp index bd089c8..732fae7 100644 --- a/noncore/apps/opie-console/profileconfig.cpp +++ b/noncore/apps/opie-console/profileconfig.cpp @@ -12,6 +12,7 @@ QStringList ProfileConfig::groups()const { QStringList list; QMap::ConstIterator it; it= Config::groups.begin(); + qWarning("config %d", Config::groups.count() ); for (; it != Config::groups.end(); ++it ) list << it.key(); diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp index c8a4db5..24256a5 100644 --- a/noncore/apps/opie-console/profilemanager.cpp +++ b/noncore/apps/opie-console/profilemanager.cpp @@ -15,6 +15,7 @@ ProfileManager::~ProfileManager() { } void ProfileManager::load() { m_list.clear(); + qWarning("load"); ProfileConfig conf("opie-console-profiles"); QStringList groups = conf.groups(); QStringList::Iterator it; @@ -23,6 +24,7 @@ void ProfileManager::load() { * for each profile */ for ( it = groups.begin(); it != groups.end(); ++it ) { + qWarning("group " + (*it) ); conf.setGroup( (*it) ); Profile prof; prof.setName( conf.readEntry("name") ); -- cgit v0.9.0.2