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.cpp48
1 files changed, 42 insertions, 6 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 3531478..aeb3742 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -7,2 +7,3 @@
+#include "profileeditordialog.h"
#include "configdialog.h"
@@ -10,2 +11,3 @@
#include "metafactory.h"
+#include "profile.h"
#include "profilemanager.h"
@@ -111,3 +113,5 @@ ProfileManager* MainWindow::manager() {
}
-
+TabWidget* MainWindow::tabWidget() {
+ return m_consoleWindow;
+}
void MainWindow::populateProfiles() {
@@ -139,2 +143,8 @@ void MainWindow::slotNew() {
qWarning("New Connection");
+ ProfileEditorDialog dlg(factory() );
+ int ret = dlg.exec();
+
+ if ( ret == QDialog::Accepted ) {
+ create( dlg.profile() );
+ }
}
@@ -154,4 +164,4 @@ void MainWindow::slotTerminate() {
currentSession()->layer()->close();
- delete m_curSession;
- m_curSession = 0l;
+
+ slotClose();
/* FIXME move to the next session */
@@ -172,9 +182,35 @@ void MainWindow::slotConfigure() {
}
-
+/*
+ * we will remove
+ * this window from the tabwidget
+ * remove it from the list
+ * delete it
+ * and set the currentSession()
+ */
void MainWindow::slotClose() {
-}
+ if (!currentSession() )
+ return;
-void MainWindow::slotProfile( int ) {
+ tabWidget()->remove( currentSession() );
+ tabWidget()->setCurrent( m_sessions.first() );
+ m_sessions.remove( m_curSession );
+ delete m_curSession;
+ m_curSession = m_sessions.first();
+}
+/*
+ * We will get the name
+ * Then the profile
+ * and then we will make a profile
+ */
+void MainWindow::slotProfile( int id) {
+ Profile prof = manager()->profile( m_sessionsPop->text( id) );
+ create( prof );
+}
+void MainWindow::create( const Profile& prof ) {
+ Session *ses = manager()->fromProfile( prof, tabWidget() );
+ m_sessions.append( ses );
+ tabWidget()->add( ses );
+ m_curSession = ses;
}