summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp33
1 files changed, 33 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
@@ -1,28 +1,31 @@
#include <qaction.h>
#include <qmenubar.h>
#include <qlabel.h>
#include <qpopupmenu.h>
#include <qtoolbar.h>
#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 );
m_tool = new QToolBar( this );
m_tool->setHorizontalStretchable( TRUE );
m_bar = new QMenuBar( m_tool );
m_console = new QPopupMenu( this );
m_sessionsPop= new QPopupMenu( this );
m_settings = new QPopupMenu( this );
@@ -56,43 +59,67 @@ void MainWindow::initUI() {
connect(m_disconnect, SIGNAL(activated() ),
this, SLOT(slotDisconnect() ) );
/*
* terminate action
*/
m_terminate = new QAction();
m_terminate->setText( tr("Terminate") );
m_terminate->addTo( m_console );
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
*/
m_setProfiles = new QAction();
m_setProfiles->setText( tr("Configure Profiles") );
m_setProfiles->addTo( m_settings );
connect( m_setProfiles, SIGNAL(activated() ),
this, SLOT(slotConfigure() ) );
/* insert the submenu */
m_console->insertItem(tr("New from Profile"), m_sessionsPop,
-1, 0);
/* insert the connection menu */
m_bar->insertItem( tr("Connection"), m_console );
/* 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;
}
MetaFactory* MainWindow::factory() {
return m_factory;
}
Session* MainWindow::currentSession() {
return m_curSession;
}
@@ -112,12 +139,18 @@ void MainWindow::slotDisconnect() {
currentSession()->layer()->close();
}
void MainWindow::slotTerminate() {
if ( currentSession() )
currentSession()->layer()->close();
delete m_curSession;
m_curSession = 0l;
/* FIXME move to the next session */
}
void MainWindow::slotConfigure() {
qWarning("configure");
}
+void MainWindow::slotClose() {
+
+}
+void MainWindow::slotProfile(int) {
+
+}