summaryrefslogtreecommitdiff
path: root/noncore
authorzecke <zecke>2002-09-28 20:45:11 (UTC)
committer zecke <zecke>2002-09-28 20:45:11 (UTC)
commit7980189a2cb34e2864c339ef68bfbe7fb4910750 (patch) (unidiff)
treea14028faccc70982d105c229f84d77e13741e987 /noncore
parentb6df65ad2ffb50f029b96ebf9d0d78dfa23f3f19 (diff)
downloadopie-7980189a2cb34e2864c339ef68bfbe7fb4910750.zip
opie-7980189a2cb34e2864c339ef68bfbe7fb4910750.tar.gz
opie-7980189a2cb34e2864c339ef68bfbe7fb4910750.tar.bz2
Add profiles and the profilemanager to the mainwindow
if one would have a ConfigureDialog one could see it....
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp33
-rw-r--r--noncore/apps/opie-console/mainwindow.h10
-rw-r--r--noncore/apps/opie-console/profileconfig.cpp1
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp2
4 files changed, 46 insertions, 0 deletions
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 @@
6#include <qtoolbar.h> 6#include <qtoolbar.h>
7 7
8#include "metafactory.h" 8#include "metafactory.h"
9#include "profilemanager.h"
9#include "mainwindow.h" 10#include "mainwindow.h"
10 11
11MainWindow::MainWindow() { 12MainWindow::MainWindow() {
12 m_factory = new MetaFactory(); 13 m_factory = new MetaFactory();
13 m_sessions.setAutoDelete( TRUE ); 14 m_sessions.setAutoDelete( TRUE );
14 m_curSession = 0; 15 m_curSession = 0;
16 m_manager = new ProfileManager(m_factory);
15 17
16 initUI(); 18 initUI();
19 populateProfiles();
17} 20}
18void MainWindow::initUI() { 21void MainWindow::initUI() {
19 setToolBarsMovable( FALSE ); 22 setToolBarsMovable( FALSE );
@@ -65,6 +68,12 @@ void MainWindow::initUI() {
65 connect(m_disconnect, SIGNAL(activated() ), 68 connect(m_disconnect, SIGNAL(activated() ),
66 this, SLOT(slotTerminate() ) ); 69 this, SLOT(slotTerminate() ) );
67 70
71 a = new QAction();
72 a->setText( tr("Close Window") );
73 a->addTo( m_console );
74 connect(a, SIGNAL(activated() ),
75 this, SLOT(slotClose() ) );
76
68 /* 77 /*
69 * the settings action 78 * the settings action
70 */ 79 */
@@ -84,6 +93,24 @@ void MainWindow::initUI() {
84 /* the settings menu */ 93 /* the settings menu */
85 m_bar->insertItem( tr("Settings"), m_settings ); 94 m_bar->insertItem( tr("Settings"), m_settings );
86 95
96 /*
97 * connect to the menu activation
98 */
99 connect( m_sessionsPop, SIGNAL(activated(int) ),
100 this, SLOT(slotProfile(int) ) );
101
102}
103ProfileManager* MainWindow::manager() {
104 return m_manager;
105}
106void MainWindow::populateProfiles() {
107 manager()->load();
108 Profile::ValueList list = manager()->all();
109 for (Profile::ValueList::Iterator it = list.begin(); it != list.end();
110 ++it ) {
111 m_sessionsPop->insertItem( (*it).name() );
112 }
113
87} 114}
88MainWindow::~MainWindow() { 115MainWindow::~MainWindow() {
89 delete m_factory; 116 delete m_factory;
@@ -121,3 +148,9 @@ void MainWindow::slotTerminate() {
121void MainWindow::slotConfigure() { 148void MainWindow::slotConfigure() {
122 qWarning("configure"); 149 qWarning("configure");
123} 150}
151void MainWindow::slotClose() {
152
153}
154void MainWindow::slotProfile(int) {
155
156}
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;
16class QAction; 16class QAction;
17class MetaFactory; 17class MetaFactory;
18 18
19class ProfileManager;
19class MainWindow : public QMainWindow { 20class MainWindow : public QMainWindow {
20 Q_OBJECT 21 Q_OBJECT
21public: 22public:
@@ -39,15 +40,23 @@ public:
39 */ 40 */
40 QList<Session> sessions(); 41 QList<Session> sessions();
41 42
43 /**
44 *
45 */
46 ProfileManager* manager();
47
42private slots: 48private slots:
43 void slotNew(); 49 void slotNew();
44 void slotConnect(); 50 void slotConnect();
45 void slotDisconnect(); 51 void slotDisconnect();
46 void slotTerminate(); 52 void slotTerminate();
47 void slotConfigure(); 53 void slotConfigure();
54 void slotClose();
55 void slotProfile(int);
48 56
49private: 57private:
50 void initUI(); 58 void initUI();
59 void populateProfiles();
51 /** 60 /**
52 * the current session 61 * the current session
53 */ 62 */
@@ -62,6 +71,7 @@ private:
62 * the metafactory 71 * the metafactory
63 */ 72 */
64 MetaFactory* m_factory; 73 MetaFactory* m_factory;
74 ProfileManager* m_manager;
65 75
66 QToolBar* m_tool; 76 QToolBar* m_tool;
67 QMenuBar* m_bar; 77 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 {
12 QStringList list; 12 QStringList list;
13 QMap<QString, ConfigGroup>::ConstIterator it; 13 QMap<QString, ConfigGroup>::ConstIterator it;
14 it= Config::groups.begin(); 14 it= Config::groups.begin();
15 qWarning("config %d", Config::groups.count() );
15 16
16 for (; it != Config::groups.end(); ++it ) 17 for (; it != Config::groups.end(); ++it )
17 list << it.key(); 18 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() {
15} 15}
16void ProfileManager::load() { 16void ProfileManager::load() {
17 m_list.clear(); 17 m_list.clear();
18 qWarning("load");
18 ProfileConfig conf("opie-console-profiles"); 19 ProfileConfig conf("opie-console-profiles");
19 QStringList groups = conf.groups(); 20 QStringList groups = conf.groups();
20 QStringList::Iterator it; 21 QStringList::Iterator it;
@@ -23,6 +24,7 @@ void ProfileManager::load() {
23 * for each profile 24 * for each profile
24 */ 25 */
25 for ( it = groups.begin(); it != groups.end(); ++it ) { 26 for ( it = groups.begin(); it != groups.end(); ++it ) {
27 qWarning("group " + (*it) );
26 conf.setGroup( (*it) ); 28 conf.setGroup( (*it) );
27 Profile prof; 29 Profile prof;
28 prof.setName( conf.readEntry("name") ); 30 prof.setName( conf.readEntry("name") );