summaryrefslogtreecommitdiff
authorjosef <josef>2002-10-14 18:36:44 (UTC)
committer josef <josef>2002-10-14 18:36:44 (UTC)
commit481d98eabc371d473fef7c640a710c5535637750 (patch) (unidiff)
treed9abf610d40d761109ced904a6b9618e28cd9022
parent66e2630b56989e149a04159d5273ec5cc1661dff (diff)
downloadopie-481d98eabc371d473fef7c640a710c5535637750.zip
opie-481d98eabc371d473fef7c640a710c5535637750.tar.gz
opie-481d98eabc371d473fef7c640a710c5535637750.tar.bz2
- display warning if connection cannot be established
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 02f8451..b143361 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -168,194 +168,198 @@ void MainWindow::initUI() {
168 m_kb = new FunctionKeyboard(m_keyBar); 168 m_kb = new FunctionKeyboard(m_keyBar);
169 169
170 /* 170 /*
171 * connect to the menu activation 171 * connect to the menu activation
172 */ 172 */
173 connect( m_sessionsPop, SIGNAL(activated( int ) ), 173 connect( m_sessionsPop, SIGNAL(activated( int ) ),
174 this, SLOT(slotProfile( int ) ) ); 174 this, SLOT(slotProfile( int ) ) );
175 175
176 m_consoleWindow = new TabWidget( this, "blah"); 176 m_consoleWindow = new TabWidget( this, "blah");
177 connect(m_consoleWindow, SIGNAL(activated(Session*) ), 177 connect(m_consoleWindow, SIGNAL(activated(Session*) ),
178 this, SLOT(slotSessionChanged(Session*) ) ); 178 this, SLOT(slotSessionChanged(Session*) ) );
179 setCentralWidget( m_consoleWindow ); 179 setCentralWidget( m_consoleWindow );
180 180
181} 181}
182 182
183ProfileManager* MainWindow::manager() { 183ProfileManager* MainWindow::manager() {
184 return m_manager; 184 return m_manager;
185} 185}
186TabWidget* MainWindow::tabWidget() { 186TabWidget* MainWindow::tabWidget() {
187 return m_consoleWindow; 187 return m_consoleWindow;
188} 188}
189void MainWindow::populateProfiles() { 189void MainWindow::populateProfiles() {
190 m_sessionsPop->clear(); 190 m_sessionsPop->clear();
191 Profile::ValueList list = manager()->all(); 191 Profile::ValueList list = manager()->all();
192 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { 192 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) {
193 m_sessionsPop->insertItem( (*it).name() ); 193 m_sessionsPop->insertItem( (*it).name() );
194 } 194 }
195 195
196} 196}
197MainWindow::~MainWindow() { 197MainWindow::~MainWindow() {
198 delete m_factory; 198 delete m_factory;
199 manager()->save(); 199 manager()->save();
200} 200}
201 201
202MetaFactory* MainWindow::factory() { 202MetaFactory* MainWindow::factory() {
203 return m_factory; 203 return m_factory;
204} 204}
205 205
206Session* MainWindow::currentSession() { 206Session* MainWindow::currentSession() {
207 return m_curSession; 207 return m_curSession;
208} 208}
209 209
210QList<Session> MainWindow::sessions() { 210QList<Session> MainWindow::sessions() {
211 return m_sessions; 211 return m_sessions;
212} 212}
213 213
214void MainWindow::slotNew() { 214void MainWindow::slotNew() {
215 qWarning("New Connection"); 215 qWarning("New Connection");
216 ProfileEditorDialog dlg(factory() ); 216 ProfileEditorDialog dlg(factory() );
217 dlg.showMaximized(); 217 dlg.showMaximized();
218 int ret = dlg.exec(); 218 int ret = dlg.exec();
219 219
220 if ( ret == QDialog::Accepted ) { 220 if ( ret == QDialog::Accepted ) {
221 create( dlg.profile() ); 221 create( dlg.profile() );
222 } 222 }
223} 223}
224 224
225void MainWindow::slotRecordScript() { 225void MainWindow::slotRecordScript() {
226/* if (currentSession()) { 226/* if (currentSession()) {
227 currentSession()->emulationLayer()->startRecording(); 227 currentSession()->emulationLayer()->startRecording();
228 } 228 }
229 */ 229 */
230} 230}
231 231
232void MainWindow::slotSaveScript() { 232void MainWindow::slotSaveScript() {
233/* if (currentSession() && currentSession()->emulationLayer()->isRecording()) { 233/* if (currentSession() && currentSession()->emulationLayer()->isRecording()) {
234 MimeTypes types; 234 MimeTypes types;
235 QStringList script; 235 QStringList script;
236 script << "text/plain"; 236 script << "text/plain";
237 types.insert("Script", script); 237 types.insert("Script", script);
238 QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); 238 QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types);
239 if (!filename.isEmpty()) { 239 if (!filename.isEmpty()) {
240 currentSession()->emulationLayer()->script()->saveTo(filename); 240 currentSession()->emulationLayer()->script()->saveTo(filename);
241 currentSession()->emulationLayer()->clearScript(); 241 currentSession()->emulationLayer()->clearScript();
242 } 242 }
243 } 243 }
244 */ 244 */
245} 245}
246 246
247void MainWindow::slotRunScript() { 247void MainWindow::slotRunScript() {
248/* 248/*
249 if (currentSession()) { 249 if (currentSession()) {
250 MimeTypes types; 250 MimeTypes types;
251 QStringList script; 251 QStringList script;
252 script << "text/plain"; 252 script << "text/plain";
253 types.insert("Script", script); 253 types.insert("Script", script);
254 QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); 254 QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types);
255 if (!filename.isEmpty()) { 255 if (!filename.isEmpty()) {
256 Script script(DocLnk(filename).file()); 256 Script script(DocLnk(filename).file());
257 currentSession()->emulationLayer()->runScript(&script); 257 currentSession()->emulationLayer()->runScript(&script);
258 } 258 }
259 } 259 }
260 */ 260 */
261} 261}
262 262
263void MainWindow::slotConnect() { 263void MainWindow::slotConnect() {
264 if ( currentSession() ) 264 if ( currentSession() ) {
265 currentSession()->layer()->open(); 265 bool ret = currentSession()->layer()->open();
266 if(!ret) QMessageBox::warning(currentSession()->widgetStack(),
267 QObject::tr("Failed"),
268 QObject::tr("Connecting failed for this session."));
269 }
266} 270}
267 271
268void MainWindow::slotDisconnect() { 272void MainWindow::slotDisconnect() {
269 if ( currentSession() ) 273 if ( currentSession() )
270 currentSession()->layer()->close(); 274 currentSession()->layer()->close();
271} 275}
272 276
273void MainWindow::slotTerminate() { 277void MainWindow::slotTerminate() {
274 if ( currentSession() ) 278 if ( currentSession() )
275 currentSession()->layer()->close(); 279 currentSession()->layer()->close();
276 280
277 slotClose(); 281 slotClose();
278 /* FIXME move to the next session */ 282 /* FIXME move to the next session */
279} 283}
280 284
281void MainWindow::slotConfigure() { 285void MainWindow::slotConfigure() {
282 qWarning("configure"); 286 qWarning("configure");
283 ConfigDialog conf( manager()->all(), factory() ); 287 ConfigDialog conf( manager()->all(), factory() );
284 conf.showMaximized(); 288 conf.showMaximized();
285 289
286 int ret = conf.exec(); 290 int ret = conf.exec();
287 291
288 if ( QDialog::Accepted == ret ) { 292 if ( QDialog::Accepted == ret ) {
289 qWarning("conf %d", conf.list().count() ); 293 qWarning("conf %d", conf.list().count() );
290 manager()->setProfiles( conf.list() ); 294 manager()->setProfiles( conf.list() );
291 manager()->save(); 295 manager()->save();
292 populateProfiles(); 296 populateProfiles();
293 } 297 }
294} 298}
295/* 299/*
296 * we will remove 300 * we will remove
297 * this window from the tabwidget 301 * this window from the tabwidget
298 * remove it from the list 302 * remove it from the list
299 * delete it 303 * delete it
300 * and set the currentSession() 304 * and set the currentSession()
301 */ 305 */
302void MainWindow::slotClose() { 306void MainWindow::slotClose() {
303 qWarning("close"); 307 qWarning("close");
304 if (!currentSession() ) 308 if (!currentSession() )
305 return; 309 return;
306 310
307 tabWidget()->remove( currentSession() ); 311 tabWidget()->remove( currentSession() );
308 /*it's autodelete */ 312 /*it's autodelete */
309 m_sessions.remove( m_curSession ); 313 m_sessions.remove( m_curSession );
310 m_curSession = m_sessions.first(); 314 m_curSession = m_sessions.first();
311 tabWidget()->setCurrent( m_curSession ); 315 tabWidget()->setCurrent( m_curSession );
312} 316}
313 317
314/* 318/*
315 * We will get the name 319 * We will get the name
316 * Then the profile 320 * Then the profile
317 * and then we will make a profile 321 * and then we will make a profile
318 */ 322 */
319void MainWindow::slotProfile( int id) { 323void MainWindow::slotProfile( int id) {
320 Profile prof = manager()->profile( m_sessionsPop->text( id) ); 324 Profile prof = manager()->profile( m_sessionsPop->text( id) );
321 create( prof ); 325 create( prof );
322} 326}
323void MainWindow::create( const Profile& prof ) { 327void MainWindow::create( const Profile& prof ) {
324 Session *ses = manager()->fromProfile( prof, tabWidget() ); 328 Session *ses = manager()->fromProfile( prof, tabWidget() );
325 329
326 if((!ses) || (!ses->layer()) || (!ses->widgetStack())) 330 if((!ses) || (!ses->layer()) || (!ses->widgetStack()))
327 { 331 {
328 QMessageBox::warning(this, 332 QMessageBox::warning(this,
329 QObject::tr("Session failed"), 333 QObject::tr("Session failed"),
330 QObject::tr("Cannot open session: Not all components were found.")); 334 QObject::tr("Cannot open session: Not all components were found."));
331 //if(ses) delete ses; 335 //if(ses) delete ses;
332 return; 336 return;
333 } 337 }
334 338
335 m_sessions.append( ses ); 339 m_sessions.append( ses );
336 tabWidget()->add( ses ); 340 tabWidget()->add( ses );
337 m_curSession = ses; 341 m_curSession = ses;
338 342
339} 343}
340 344
341void MainWindow::slotTransfer() 345void MainWindow::slotTransfer()
342{ 346{
343 // if ( currentSession() ) { 347 // if ( currentSession() ) {
344 TransferDialog dlg(this); 348 TransferDialog dlg(this);
345 dlg.showMaximized(); 349 dlg.showMaximized();
346 dlg.exec(); 350 dlg.exec();
347 // } 351 // }
348} 352}
349 353
350 354
351void MainWindow::slotOpenKeb(bool state) { 355void MainWindow::slotOpenKeb(bool state) {
352 356
353 if (state) m_keyBar->show(); 357 if (state) m_keyBar->show();
354 else m_keyBar->hide(); 358 else m_keyBar->hide();
355 359
356} 360}
357void MainWindow::slotSessionChanged( Session* ses ) { 361void MainWindow::slotSessionChanged( Session* ses ) {
358 if ( ses ) { 362 if ( ses ) {
359 qWarning("changing %s", ses->name().latin1() ); 363 qWarning("changing %s", ses->name().latin1() );
360 m_curSession = ses; 364 m_curSession = ses;
361 } 365 }