summaryrefslogtreecommitdiff
path: root/noncore
authorzecke <zecke>2002-10-13 19:01:50 (UTC)
committer zecke <zecke>2002-10-13 19:01:50 (UTC)
commit130ae6144e031b4de2244990c53df8654bd840ae (patch) (unidiff)
treedf4a5660fffd733064758cf346894269ca000cdc /noncore
parent495abbf351f29328b52cb055566ef8bec6f466f0 (diff)
downloadopie-130ae6144e031b4de2244990c53df8654bd840ae.zip
opie-130ae6144e031b4de2244990c53df8654bd840ae.tar.gz
opie-130ae6144e031b4de2244990c53df8654bd840ae.tar.bz2
keep track of the current session
Diffstat (limited to 'noncore') (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
@@ -54,53 +54,53 @@ void MainWindow::initUI() {
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 );
@@ -143,48 +143,50 @@ void MainWindow::initUI() {
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() {
@@ -307,24 +309,30 @@ void 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
@@ -41,48 +41,49 @@ public:
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;