Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 0bd6a13..fbeaa74 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,39 +1,40 @@ | |||
1 | 1 | ||
2 | #include <qaction.h> | 2 | #include <qaction.h> |
3 | #include <qmenubar.h> | 3 | #include <qmenubar.h> |
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | #include <qpopupmenu.h> | 5 | #include <qpopupmenu.h> |
6 | #include <qtoolbar.h> | 6 | #include <qtoolbar.h> |
7 | 7 | ||
8 | #include "profileeditordialog.h" | 8 | #include "profileeditordialog.h" |
9 | #include "configdialog.h" | 9 | #include "configdialog.h" |
10 | #include "default.h" | 10 | #include "default.h" |
11 | #include "metafactory.h" | 11 | #include "metafactory.h" |
12 | #include "profile.h" | 12 | #include "profile.h" |
13 | #include "profilemanager.h" | 13 | #include "profilemanager.h" |
14 | #include "mainwindow.h" | 14 | #include "mainwindow.h" |
15 | #include "tabwidget.h" | 15 | #include "tabwidget.h" |
16 | #include "transferdialog.h" | ||
16 | 17 | ||
17 | MainWindow::MainWindow() { | 18 | MainWindow::MainWindow() { |
18 | m_factory = new MetaFactory(); | 19 | m_factory = new MetaFactory(); |
19 | Default def(m_factory); | 20 | Default def(m_factory); |
20 | m_sessions.setAutoDelete( TRUE ); | 21 | m_sessions.setAutoDelete( TRUE ); |
21 | m_curSession = 0; | 22 | m_curSession = 0; |
22 | m_manager = new ProfileManager( m_factory ); | 23 | m_manager = new ProfileManager( m_factory ); |
23 | m_manager->load(); | 24 | m_manager->load(); |
24 | 25 | ||
25 | initUI(); | 26 | initUI(); |
26 | populateProfiles(); | 27 | populateProfiles(); |
27 | } | 28 | } |
28 | void MainWindow::initUI() { | 29 | void MainWindow::initUI() { |
29 | setToolBarsMovable( FALSE ); | 30 | setToolBarsMovable( FALSE ); |
30 | 31 | ||
31 | m_tool = new QToolBar( this ); | 32 | m_tool = new QToolBar( this ); |
32 | m_tool->setHorizontalStretchable( TRUE ); | 33 | m_tool->setHorizontalStretchable( TRUE ); |
33 | 34 | ||
34 | m_bar = new QMenuBar( m_tool ); | 35 | m_bar = new QMenuBar( m_tool ); |
35 | m_console = new QPopupMenu( this ); | 36 | m_console = new QPopupMenu( this ); |
36 | m_sessionsPop= new QPopupMenu( this ); | 37 | m_sessionsPop= new QPopupMenu( this ); |
37 | m_settings = new QPopupMenu( this ); | 38 | m_settings = new QPopupMenu( this ); |
38 | 39 | ||
39 | /* | 40 | /* |
@@ -42,48 +43,54 @@ void MainWindow::initUI() { | |||
42 | QAction* a = new QAction(); | 43 | QAction* a = new QAction(); |
43 | a->setText( tr("New Connection") ); | 44 | a->setText( tr("New Connection") ); |
44 | a->addTo( m_console ); | 45 | a->addTo( m_console ); |
45 | connect(a, SIGNAL(activated() ), | 46 | connect(a, SIGNAL(activated() ), |
46 | this, SLOT(slotNew() ) ); | 47 | this, SLOT(slotNew() ) ); |
47 | 48 | ||
48 | /* | 49 | /* |
49 | * connect action | 50 | * connect action |
50 | */ | 51 | */ |
51 | m_connect = new QAction(); | 52 | m_connect = new QAction(); |
52 | m_connect->setText( tr("Connect") ); | 53 | m_connect->setText( tr("Connect") ); |
53 | m_connect->addTo( m_console ); | 54 | m_connect->addTo( m_console ); |
54 | connect(m_connect, SIGNAL(activated() ), | 55 | connect(m_connect, SIGNAL(activated() ), |
55 | this, SLOT(slotConnect() ) ); | 56 | this, SLOT(slotConnect() ) ); |
56 | 57 | ||
57 | /* | 58 | /* |
58 | * disconnect action | 59 | * disconnect action |
59 | */ | 60 | */ |
60 | m_disconnect = new QAction(); | 61 | m_disconnect = new QAction(); |
61 | m_disconnect->setText( tr("Disconnect") ); | 62 | m_disconnect->setText( tr("Disconnect") ); |
62 | m_disconnect->addTo( m_console ); | 63 | m_disconnect->addTo( m_console ); |
63 | connect(m_disconnect, SIGNAL(activated() ), | 64 | connect(m_disconnect, SIGNAL(activated() ), |
64 | this, SLOT(slotDisconnect() ) ); | 65 | this, SLOT(slotDisconnect() ) ); |
65 | 66 | ||
67 | m_transfer = new QAction(); | ||
68 | m_transfer->setText( tr("Transfer file...") ); | ||
69 | m_transfer->addTo( m_console ); | ||
70 | connect(m_transfer, SIGNAL(activated() ), | ||
71 | this, SLOT(slotTransfer() ) ); | ||
72 | |||
66 | /* | 73 | /* |
67 | * terminate action | 74 | * terminate action |
68 | */ | 75 | */ |
69 | m_terminate = new QAction(); | 76 | m_terminate = new QAction(); |
70 | m_terminate->setText( tr("Terminate") ); | 77 | m_terminate->setText( tr("Terminate") ); |
71 | m_terminate->addTo( m_console ); | 78 | m_terminate->addTo( m_console ); |
72 | connect(m_terminate, SIGNAL(activated() ), | 79 | connect(m_terminate, SIGNAL(activated() ), |
73 | this, SLOT(slotTerminate() ) ); | 80 | this, SLOT(slotTerminate() ) ); |
74 | 81 | ||
75 | a = new QAction(); | 82 | a = new QAction(); |
76 | a->setText( tr("Close Window") ); | 83 | a->setText( tr("Close Window") ); |
77 | a->addTo( m_console ); | 84 | a->addTo( m_console ); |
78 | connect(a, SIGNAL(activated() ), | 85 | connect(a, SIGNAL(activated() ), |
79 | this, SLOT(slotClose() ) ); | 86 | this, SLOT(slotClose() ) ); |
80 | 87 | ||
81 | /* | 88 | /* |
82 | * the settings action | 89 | * the settings action |
83 | */ | 90 | */ |
84 | m_setProfiles = new QAction(); | 91 | m_setProfiles = new QAction(); |
85 | m_setProfiles->setText( tr("Configure Profiles") ); | 92 | m_setProfiles->setText( tr("Configure Profiles") ); |
86 | m_setProfiles->addTo( m_settings ); | 93 | m_setProfiles->addTo( m_settings ); |
87 | connect( m_setProfiles, SIGNAL(activated() ), | 94 | connect( m_setProfiles, SIGNAL(activated() ), |
88 | this, SLOT(slotConfigure() ) ); | 95 | this, SLOT(slotConfigure() ) ); |
89 | 96 | ||
@@ -193,25 +200,34 @@ void MainWindow::slotClose() { | |||
193 | return; | 200 | return; |
194 | 201 | ||
195 | tabWidget()->remove( currentSession() ); | 202 | tabWidget()->remove( currentSession() ); |
196 | /*it's autodelete */ | 203 | /*it's autodelete */ |
197 | m_sessions.remove( m_curSession ); | 204 | m_sessions.remove( m_curSession ); |
198 | m_curSession = m_sessions.first(); | 205 | m_curSession = m_sessions.first(); |
199 | tabWidget()->setCurrent( m_curSession ); | 206 | tabWidget()->setCurrent( m_curSession ); |
200 | } | 207 | } |
201 | 208 | ||
202 | /* | 209 | /* |
203 | * We will get the name | 210 | * We will get the name |
204 | * Then the profile | 211 | * Then the profile |
205 | * and then we will make a profile | 212 | * and then we will make a profile |
206 | */ | 213 | */ |
207 | void MainWindow::slotProfile( int id) { | 214 | void MainWindow::slotProfile( int id) { |
208 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 215 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
209 | create( prof ); | 216 | create( prof ); |
210 | } | 217 | } |
211 | void MainWindow::create( const Profile& prof ) { | 218 | void MainWindow::create( const Profile& prof ) { |
212 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 219 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
213 | 220 | ||
214 | m_sessions.append( ses ); | 221 | m_sessions.append( ses ); |
215 | tabWidget()->add( ses ); | 222 | tabWidget()->add( ses ); |
216 | m_curSession = ses; | 223 | m_curSession = ses; |
224 | |||
217 | } | 225 | } |
226 | |||
227 | void MainWindow::slotTransfer() | ||
228 | { | ||
229 | TransferDialog dlg(this); | ||
230 | dlg.showMaximized(); | ||
231 | dlg.exec(); | ||
232 | } | ||
233 | |||