summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp18
-rw-r--r--noncore/apps/opie-console/mainwindow.h1
2 files changed, 14 insertions, 5 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 0a58b6c..bfd1c2e 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -46,69 +46,69 @@ void MainWindow::initUI() {
46 /* add a toolbar for icons */ 46 /* add a toolbar for icons */
47 m_icons = new QToolBar(this); 47 m_icons = new QToolBar(this);
48 48
49 /* 49 /*
50 * new Action for new sessions 50 * new Action for new sessions
51 */ 51 */
52 QAction* a = new QAction(tr("New Connection"), 52 QAction* a = new QAction(tr("New Connection"),
53 Resource::loadPixmap( "new" ), 53 Resource::loadPixmap( "new" ),
54 QString::null, 0, this, 0); 54 QString::null, 0, this, 0);
55 a->addTo( m_console ); 55 a->addTo( m_console );
56 a->addTo( m_icons ); 56 a->addTo( m_icons );
57 connect(a, SIGNAL(activated() ), 57 connect(a, SIGNAL(activated() ),
58 this, SLOT(slotNew() ) ); 58 this, SLOT(slotNew() ) );
59 59
60 /* 60 /*
61 * connect action 61 * connect action
62 */ 62 */
63 m_connect = new QAction(); 63 m_connect = new QAction();
64 m_connect->setText( tr("Connect") ); 64 m_connect->setText( tr("Connect") );
65 m_connect->addTo( m_console ); 65 m_connect->addTo( m_console );
66 connect(m_connect, SIGNAL(activated() ), 66 connect(m_connect, SIGNAL(activated() ),
67 this, SLOT(slotConnect() ) ); 67 this, SLOT(slotConnect() ) );
68 68
69 /* 69 /*
70 * disconnect action 70 * disconnect action
71 */ 71 */
72 m_disconnect = new QAction(); 72 m_disconnect = new QAction();
73 m_disconnect->setText( tr("Disconnect") ); 73 m_disconnect->setText( tr("Disconnect") );
74 m_disconnect->addTo( m_console ); 74 m_disconnect->addTo( m_console );
75 connect(m_disconnect, SIGNAL(activated() ), 75 connect(m_disconnect, SIGNAL(activated() ),
76 this, SLOT(slotDisconnect() ) ); 76 this, SLOT(slotDisconnect() ) );
77 77
78 m_transfer = new QAction(); 78 m_transfer = new QAction();
79 m_transfer->setText( tr("Transfer file...") ); 79 m_transfer->setText( tr("Transfer file...") );
80 m_transfer->addTo( m_console ); 80 m_transfer->addTo( m_console );
81 connect(m_transfer, SIGNAL(activated() ), 81 connect(m_transfer, SIGNAL(activated() ),
82 this, SLOT(slotTransfer() ) ); 82 this, SLOT(slotTransfer() ) );
83 83
84 /* 84 /*
85 * terminate action 85 * terminate action
86 */ 86 */
87 m_terminate = new QAction(); 87 m_terminate = new QAction();
88 m_terminate->setText( tr("Terminate") ); 88 m_terminate->setText( tr("Terminate") );
89 m_terminate->addTo( m_console ); 89 m_terminate->addTo( m_console );
90 connect(m_terminate, SIGNAL(activated() ), 90 connect(m_terminate, SIGNAL(activated() ),
91 this, SLOT(slotTerminate() ) ); 91 this, SLOT(slotTerminate() ) );
92 92
93 a = new QAction(); 93 a = new QAction();
94 a->setText( tr("Close Window") ); 94 a->setText( tr("Close Window") );
95 a->addTo( m_console ); 95 a->addTo( m_console );
96 connect(a, SIGNAL(activated() ), 96 connect(a, SIGNAL(activated() ),
97 this, SLOT(slotClose() ) ); 97 this, SLOT(slotClose() ) );
98 98
99 /* 99 /*
100 * the settings action 100 * the settings action
101 */ 101 */
102 m_setProfiles = new QAction(tr("Configure Profiles"), 102 m_setProfiles = new QAction(tr("Configure Profiles"),
103 Resource::loadPixmap( "SettingsIcon" ), 103 Resource::loadPixmap( "SettingsIcon" ),
104 QString::null, 0, this, 0); 104 QString::null, 0, this, 0);
105 m_setProfiles->addTo( m_settings ); 105 m_setProfiles->addTo( m_settings );
106 m_setProfiles->addTo( m_icons ); 106 m_setProfiles->addTo( m_icons );
107 connect( m_setProfiles, SIGNAL(activated() ), 107 connect( m_setProfiles, SIGNAL(activated() ),
108 this, SLOT(slotConfigure() ) ); 108 this, SLOT(slotConfigure() ) );
109 109
110 /* 110 /*
111 * script actions 111 * script actions
112 */ 112 */
113 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); 113 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0);
114 m_recordScript->addTo(m_scripts); 114 m_recordScript->addTo(m_scripts);
@@ -135,64 +135,66 @@ void MainWindow::initUI() {
135 this, SLOT(slotOpenKeb(bool))); 135 this, SLOT(slotOpenKeb(bool)));
136 m_openKeys->addTo(m_icons); 136 m_openKeys->addTo(m_icons);
137 137
138 138
139 /* insert the submenu */ 139 /* insert the submenu */
140 m_console->insertItem(tr("New from Profile"), m_sessionsPop, 140 m_console->insertItem(tr("New from Profile"), m_sessionsPop,
141 -1, 0); 141 -1, 0);
142 142
143 /* insert the connection menu */ 143 /* insert the connection menu */
144 m_bar->insertItem( tr("Connection"), m_console ); 144 m_bar->insertItem( tr("Connection"), m_console );
145 145
146 /* the scripts menu */ 146 /* the scripts menu */
147 m_bar->insertItem( tr("Scripts"), m_scripts ); 147 m_bar->insertItem( tr("Scripts"), m_scripts );
148 148
149 /* the settings menu */ 149 /* the settings menu */
150 m_bar->insertItem( tr("Settings"), m_settings ); 150 m_bar->insertItem( tr("Settings"), m_settings );
151 151
152 /* and the keyboard */ 152 /* and the keyboard */
153 m_keyBar = new QToolBar(this); 153 m_keyBar = new QToolBar(this);
154 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); 154 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE );
155 m_keyBar->setHorizontalStretchable( TRUE ); 155 m_keyBar->setHorizontalStretchable( TRUE );
156 m_keyBar->hide(); 156 m_keyBar->hide();
157 157
158 m_kb = new FunctionKeyboard(m_keyBar); 158 m_kb = new FunctionKeyboard(m_keyBar);
159 159
160 /* 160 /*
161 * connect to the menu activation 161 * connect to the menu activation
162 */ 162 */
163 connect( m_sessionsPop, SIGNAL(activated( int ) ), 163 connect( m_sessionsPop, SIGNAL(activated( int ) ),
164 this, SLOT(slotProfile( int ) ) ); 164 this, SLOT(slotProfile( int ) ) );
165 165
166 m_consoleWindow = new TabWidget( this, "blah"); 166 m_consoleWindow = new TabWidget( this, "blah");
167 connect(m_consoleWindow, SIGNAL(activated(Session*) ),
168 this, SLOT(slotSessionChanged(Session*) ) );
167 setCentralWidget( m_consoleWindow ); 169 setCentralWidget( m_consoleWindow );
168 170
169} 171}
170 172
171ProfileManager* MainWindow::manager() { 173ProfileManager* MainWindow::manager() {
172 return m_manager; 174 return m_manager;
173} 175}
174TabWidget* MainWindow::tabWidget() { 176TabWidget* MainWindow::tabWidget() {
175 return m_consoleWindow; 177 return m_consoleWindow;
176} 178}
177void MainWindow::populateProfiles() { 179void MainWindow::populateProfiles() {
178 m_sessionsPop->clear(); 180 m_sessionsPop->clear();
179 Profile::ValueList list = manager()->all(); 181 Profile::ValueList list = manager()->all();
180 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { 182 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) {
181 m_sessionsPop->insertItem( (*it).name() ); 183 m_sessionsPop->insertItem( (*it).name() );
182 } 184 }
183 185
184} 186}
185MainWindow::~MainWindow() { 187MainWindow::~MainWindow() {
186 delete m_factory; 188 delete m_factory;
187 manager()->save(); 189 manager()->save();
188} 190}
189 191
190MetaFactory* MainWindow::factory() { 192MetaFactory* MainWindow::factory() {
191 return m_factory; 193 return m_factory;
192} 194}
193 195
194Session* MainWindow::currentSession() { 196Session* MainWindow::currentSession() {
195 return m_curSession; 197 return m_curSession;
196} 198}
197 199
198QList<Session> MainWindow::sessions() { 200QList<Session> MainWindow::sessions() {
@@ -299,32 +301,38 @@ void MainWindow::slotClose() {
299 * Then the profile 301 * Then the profile
300 * and then we will make a profile 302 * and then we will make a profile
301 */ 303 */
302void MainWindow::slotProfile( int id) { 304void MainWindow::slotProfile( int id) {
303 Profile prof = manager()->profile( m_sessionsPop->text( id) ); 305 Profile prof = manager()->profile( m_sessionsPop->text( id) );
304 create( prof ); 306 create( prof );
305} 307}
306void MainWindow::create( const Profile& prof ) { 308void MainWindow::create( const Profile& prof ) {
307 Session *ses = manager()->fromProfile( prof, tabWidget() ); 309 Session *ses = manager()->fromProfile( prof, tabWidget() );
308 310
309 m_sessions.append( ses ); 311 m_sessions.append( ses );
310 tabWidget()->add( ses ); 312 tabWidget()->add( ses );
311 m_curSession = ses; 313 m_curSession = ses;
312 314
313} 315}
314 316
315void MainWindow::slotTransfer() 317void MainWindow::slotTransfer()
316{ 318{
317 if ( currentSession() ) { 319 if ( currentSession() ) {
318 TransferDialog dlg(this); 320 TransferDialog dlg(this);
319 //dlg.showMaximized(); 321 //dlg.showMaximized();
320 dlg.exec(); 322 dlg.exec();
321 } 323 }
322} 324}
323 325
324 326
325void MainWindow::slotOpenKeb(bool state) { 327void MainWindow::slotOpenKeb(bool state) {
326 328
327 if (state) m_keyBar->show(); 329 if (state) m_keyBar->show();
328 else m_keyBar->hide(); 330 else m_keyBar->hide();
329 331
330} 332}
333void MainWindow::slotSessionChanged( Session* ses ) {
334 if ( ses ) {
335 qWarning("changing %s", ses->name().latin1() );
336 m_curSession = ses;
337 }
338}
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h
index 94144a4..d16d6af 100644
--- a/noncore/apps/opie-console/mainwindow.h
+++ b/noncore/apps/opie-console/mainwindow.h
@@ -33,64 +33,65 @@ public:
33 MetaFactory* factory(); 33 MetaFactory* factory();
34 34
35 /** 35 /**
36 * A session contains a QWidget*, 36 * A session contains a QWidget*,
37 * an IOLayer* and some infos for us 37 * an IOLayer* and some infos for us
38 */ 38 */
39 Session* currentSession(); 39 Session* currentSession();
40 40
41 /** 41 /**
42 * the session list 42 * the session list
43 */ 43 */
44 QList<Session> sessions(); 44 QList<Session> sessions();
45 45
46 /** 46 /**
47 * 47 *
48 */ 48 */
49 ProfileManager* manager(); 49 ProfileManager* manager();
50 TabWidget* tabWidget(); 50 TabWidget* tabWidget();
51 51
52private slots: 52private slots:
53 void slotNew(); 53 void slotNew();
54 void slotConnect(); 54 void slotConnect();
55 void slotDisconnect(); 55 void slotDisconnect();
56 void slotTerminate(); 56 void slotTerminate();
57 void slotConfigure(); 57 void slotConfigure();
58 void slotClose(); 58 void slotClose();
59 void slotProfile(int); 59 void slotProfile(int);
60 void slotTransfer(); 60 void slotTransfer();
61 void slotOpenKeb(bool); 61 void slotOpenKeb(bool);
62 void slotRecordScript(); 62 void slotRecordScript();
63 void slotSaveScript(); 63 void slotSaveScript();
64 void slotRunScript(); 64 void slotRunScript();
65 void slotSessionChanged( Session* );
65private: 66private:
66 void initUI(); 67 void initUI();
67 void populateProfiles(); 68 void populateProfiles();
68 void create( const Profile& ); 69 void create( const Profile& );
69 /** 70 /**
70 * the current session 71 * the current session
71 */ 72 */
72 Session* m_curSession; 73 Session* m_curSession;
73 74
74 /** 75 /**
75 * the session list 76 * the session list
76 */ 77 */
77 QList<Session> m_sessions; 78 QList<Session> m_sessions;
78 79
79 /** 80 /**
80 * the metafactory 81 * the metafactory
81 */ 82 */
82 MetaFactory* m_factory; 83 MetaFactory* m_factory;
83 ProfileManager* m_manager; 84 ProfileManager* m_manager;
84 85
85 TabWidget* m_consoleWindow; 86 TabWidget* m_consoleWindow;
86 QToolBar* m_tool; 87 QToolBar* m_tool;
87 QToolBar* m_icons; 88 QToolBar* m_icons;
88 QToolBar* m_keyBar; 89 QToolBar* m_keyBar;
89 QMenuBar* m_bar; 90 QMenuBar* m_bar;
90 QPopupMenu* m_console; 91 QPopupMenu* m_console;
91 QPopupMenu* m_settings; 92 QPopupMenu* m_settings;
92 QPopupMenu* m_sessionsPop; 93 QPopupMenu* m_sessionsPop;
93 QPopupMenu* m_scripts; 94 QPopupMenu* m_scripts;
94 QAction* m_connect; 95 QAction* m_connect;
95 QAction* m_disconnect; 96 QAction* m_disconnect;
96 QAction* m_terminate; 97 QAction* m_terminate;