author | llornkcor <llornkcor> | 2002-12-08 13:39:34 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-12-08 13:39:34 (UTC) |
commit | 76fda4ee71e83d46f31a77b6d433cefdf24b3e73 (patch) (unidiff) | |
tree | 7f42eaa5b101bd1433ba39d926c41e9ff1fd1a97 | |
parent | a88b210e6895614027c821bb5cedabc9b06117d3 (diff) | |
download | opie-76fda4ee71e83d46f31a77b6d433cefdf24b3e73.zip opie-76fda4ee71e83d46f31a77b6d433cefdf24b3e73.tar.gz opie-76fda4ee71e83d46f31a77b6d433cefdf24b3e73.tar.bz2 |
moved font menu to options due to wrapping of the toolbar when using languages other than english that tend to have many characters in words :)
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 275a9a8..eda3135 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -207,200 +207,201 @@ void Konsole::initCommandList() | |||
207 | 207 | ||
208 | void Konsole::init(const char* _pgm, QStrList & _args) | 208 | void Konsole::init(const char* _pgm, QStrList & _args) |
209 | { | 209 | { |
210 | b_scroll = TRUE; // histon; | 210 | b_scroll = TRUE; // histon; |
211 | n_keytab = 0; | 211 | n_keytab = 0; |
212 | n_render = 0; | 212 | n_render = 0; |
213 | startUp=0; | 213 | startUp=0; |
214 | fromMenu = FALSE; | 214 | fromMenu = FALSE; |
215 | 215 | ||
216 | setCaption( tr("Terminal") ); | 216 | setCaption( tr("Terminal") ); |
217 | setIcon( Resource::loadPixmap( "konsole" ) ); | 217 | setIcon( Resource::loadPixmap( "konsole" ) ); |
218 | 218 | ||
219 | Config cfg("Konsole"); | 219 | Config cfg("Konsole"); |
220 | cfg.setGroup("Konsole"); | 220 | cfg.setGroup("Konsole"); |
221 | QString tmp; | 221 | QString tmp; |
222 | // initialize the list of allowed fonts /////////////////////////////////// | 222 | // initialize the list of allowed fonts /////////////////////////////////// |
223 | cfont = cfg.readNumEntry("FontID", 1); | 223 | cfont = cfg.readNumEntry("FontID", 1); |
224 | QFont f = QFont("Micro", 4, QFont::Normal); | 224 | QFont f = QFont("Micro", 4, QFont::Normal); |
225 | f.setFixedPitch(TRUE); | 225 | f.setFixedPitch(TRUE); |
226 | fonts.append(new VTFont(tr("Micro"), f)); | 226 | fonts.append(new VTFont(tr("Micro"), f)); |
227 | 227 | ||
228 | f = QFont("Fixed", 7, QFont::Normal); | 228 | f = QFont("Fixed", 7, QFont::Normal); |
229 | f.setFixedPitch(TRUE); | 229 | f.setFixedPitch(TRUE); |
230 | fonts.append(new VTFont(tr("Small Fixed"), f)); | 230 | fonts.append(new VTFont(tr("Small Fixed"), f)); |
231 | 231 | ||
232 | f = QFont("Fixed", 12, QFont::Normal); | 232 | f = QFont("Fixed", 12, QFont::Normal); |
233 | f.setFixedPitch(TRUE); | 233 | f.setFixedPitch(TRUE); |
234 | fonts.append(new VTFont(tr("Medium Fixed"), f)); | 234 | fonts.append(new VTFont(tr("Medium Fixed"), f)); |
235 | 235 | ||
236 | // create terminal emulation framework //////////////////////////////////// | 236 | // create terminal emulation framework //////////////////////////////////// |
237 | nsessions = 0; | 237 | nsessions = 0; |
238 | 238 | ||
239 | tab = new EKNumTabWidget(this); | 239 | tab = new EKNumTabWidget(this); |
240 | 240 | ||
241 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); | 241 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); |
242 | 242 | ||
243 | // create terminal toolbar //////////////////////////////////////////////// | 243 | // create terminal toolbar //////////////////////////////////////////////// |
244 | setToolBarsMovable( FALSE ); | 244 | setToolBarsMovable( FALSE ); |
245 | QPEToolBar *menuToolBar = new QPEToolBar( this ); | 245 | QPEToolBar *menuToolBar = new QPEToolBar( this ); |
246 | menuToolBar->setHorizontalStretchable( TRUE ); | 246 | menuToolBar->setHorizontalStretchable( TRUE ); |
247 | 247 | ||
248 | QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); | 248 | QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); |
249 | 249 | ||
250 | fontList = new QPopupMenu( this ); | 250 | fontList = new QPopupMenu( this ); |
251 | for(uint i = 0; i < fonts.count(); i++) { | 251 | for(uint i = 0; i < fonts.count(); i++) { |
252 | VTFont *fnt = fonts.at(i); | 252 | VTFont *fnt = fonts.at(i); |
253 | fontList->insertItem(fnt->getName(), i); | 253 | fontList->insertItem(fnt->getName(), i); |
254 | } | 254 | } |
255 | fontChanged(cfont); | 255 | fontChanged(cfont); |
256 | 256 | ||
257 | configMenu = new QPopupMenu( this); | 257 | configMenu = new QPopupMenu( this); |
258 | colorMenu = new QPopupMenu( this); | 258 | colorMenu = new QPopupMenu( this); |
259 | scrollMenu = new QPopupMenu( this); | 259 | scrollMenu = new QPopupMenu( this); |
260 | editCommandListMenu = new QPopupMenu( this); | 260 | editCommandListMenu = new QPopupMenu( this); |
261 | 261 | ||
262 | configMenu->insertItem(tr("Command List"), editCommandListMenu); | 262 | configMenu->insertItem(tr("Command List"), editCommandListMenu); |
263 | 263 | ||
264 | bool listHidden; | 264 | bool listHidden; |
265 | cfg.setGroup("Menubar"); | 265 | cfg.setGroup("Menubar"); |
266 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") { | 266 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") { |
267 | editCommandListMenu->insertItem( tr( "Show command list" )); | 267 | editCommandListMenu->insertItem( tr( "Show command list" )); |
268 | listHidden=TRUE; | 268 | listHidden=TRUE; |
269 | } else { | 269 | } else { |
270 | editCommandListMenu->insertItem( tr( "Hide command list" )); | 270 | editCommandListMenu->insertItem( tr( "Hide command list" )); |
271 | listHidden=FALSE; | 271 | listHidden=FALSE; |
272 | } | 272 | } |
273 | 273 | ||
274 | cfg.setGroup("Tabs"); | 274 | cfg.setGroup("Tabs"); |
275 | tmp=cfg.readEntry("Position","Bottom"); | 275 | tmp=cfg.readEntry("Position","Bottom"); |
276 | if(tmp=="Top") { | 276 | if(tmp=="Top") { |
277 | tab->setTabPosition(QTabWidget::Top); | 277 | tab->setTabPosition(QTabWidget::Top); |
278 | configMenu->insertItem( tr( "Tabs on Bottom" ) ); | 278 | configMenu->insertItem( tr( "Tabs on Bottom" ) ); |
279 | } else { | 279 | } else { |
280 | tab->setTabPosition(QTabWidget::Bottom); | 280 | tab->setTabPosition(QTabWidget::Bottom); |
281 | configMenu->insertItem(tr("Tabs on Top")); | 281 | configMenu->insertItem(tr("Tabs on Top")); |
282 | } | 282 | } |
283 | configMenu->insertSeparator(2); | 283 | configMenu->insertSeparator(2); |
284 | 284 | ||
285 | colorMenu->insertItem(tr( "Green on Black")); | 285 | colorMenu->insertItem(tr( "Green on Black")); |
286 | colorMenu->insertItem(tr( "Black on White")); | 286 | colorMenu->insertItem(tr( "Black on White")); |
287 | colorMenu->insertItem(tr( "White on Black")); | 287 | colorMenu->insertItem(tr( "White on Black")); |
288 | colorMenu->insertItem(tr( "Black on Transparent")); | 288 | colorMenu->insertItem(tr( "Black on Transparent")); |
289 | colorMenu->insertItem(tr( "Black on Red")); | 289 | colorMenu->insertItem(tr( "Black on Red")); |
290 | colorMenu->insertItem(tr( "Red on Black")); | 290 | colorMenu->insertItem(tr( "Red on Black")); |
291 | colorMenu->insertItem(tr( "Green on Yellow")); | 291 | colorMenu->insertItem(tr( "Green on Yellow")); |
292 | colorMenu->insertItem(tr( "Blue on Magenta")); | 292 | colorMenu->insertItem(tr( "Blue on Magenta")); |
293 | colorMenu->insertItem(tr( "Magenta on Blue")); | 293 | colorMenu->insertItem(tr( "Magenta on Blue")); |
294 | colorMenu->insertItem(tr( "Cyan on White")); | 294 | colorMenu->insertItem(tr( "Cyan on White")); |
295 | colorMenu->insertItem(tr( "White on Cyan")); | 295 | colorMenu->insertItem(tr( "White on Cyan")); |
296 | colorMenu->insertItem(tr( "Blue on Black")); | 296 | colorMenu->insertItem(tr( "Blue on Black")); |
297 | colorMenu->insertItem(tr( "Amber on Black")); | 297 | colorMenu->insertItem(tr( "Amber on Black")); |
298 | 298 | ||
299 | #ifdef QT_QWS_OPIE | 299 | #ifdef QT_QWS_OPIE |
300 | colorMenu->insertItem(tr( "Custom")); | 300 | colorMenu->insertItem(tr( "Custom")); |
301 | #endif | 301 | #endif |
302 | 302 | ||
303 | configMenu->insertItem( tr("Font"), fontList ); | ||
303 | configMenu->insertItem(tr( "Colors") ,colorMenu); | 304 | configMenu->insertItem(tr( "Colors") ,colorMenu); |
304 | 305 | ||
305 | connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); | 306 | connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); |
306 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); | 307 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); |
307 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); | 308 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); |
308 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); | 309 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); |
309 | connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); | 310 | connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); |
310 | menuBar->insertItem( tr("Font"), fontList ); | 311 | |
311 | menuBar->insertItem( tr("Options"), configMenu ); | 312 | menuBar->insertItem( tr("Options"), configMenu ); |
312 | 313 | ||
313 | QPEToolBar *toolbar = new QPEToolBar( this ); | 314 | QPEToolBar *toolbar = new QPEToolBar( this ); |
314 | 315 | ||
315 | QAction *a; | 316 | QAction *a; |
316 | 317 | ||
317 | // Button Commands | 318 | // Button Commands |
318 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); | 319 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); |
319 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); | 320 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); |
320 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); | 321 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); |
321 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); | 322 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); |
322 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); | 323 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); |
323 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); | 324 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); |
324 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); | 325 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); |
325 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); | 326 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); |
326 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); | 327 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); |
327 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); | 328 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); |
328 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); | 329 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); |
329 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); | 330 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); |
330 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | 331 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); |
331 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); | 332 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); |
332 | /* | 333 | /* |
333 | a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); | 334 | a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); |
334 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); | 335 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); |
335 | a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); | 336 | a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); |
336 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); | 337 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); |
337 | */ | 338 | */ |
338 | 339 | ||
339 | secondToolBar = new QPEToolBar( this ); | 340 | secondToolBar = new QPEToolBar( this ); |
340 | secondToolBar->setHorizontalStretchable( TRUE ); | 341 | secondToolBar->setHorizontalStretchable( TRUE ); |
341 | 342 | ||
342 | commonCombo = new QComboBox( secondToolBar ); | 343 | commonCombo = new QComboBox( secondToolBar ); |
343 | commonCombo->setMaximumWidth(236); | 344 | commonCombo->setMaximumWidth(236); |
344 | 345 | ||
345 | editCommandListMenu->insertItem( tr( "Quick Edit" ) ); | 346 | editCommandListMenu->insertItem( tr( "Quick Edit" ) ); |
346 | if( listHidden) { | 347 | if( listHidden) { |
347 | secondToolBar->hide(); | 348 | secondToolBar->hide(); |
348 | editCommandListMenu->setItemEnabled(-23 ,FALSE); | 349 | editCommandListMenu->setItemEnabled(-23 ,FALSE); |
349 | } | 350 | } |
350 | editCommandListMenu->insertItem(tr( "Edit" ) ); | 351 | editCommandListMenu->insertItem(tr( "Edit" ) ); |
351 | 352 | ||
352 | cfg.setGroup("Commands"); | 353 | cfg.setGroup("Commands"); |
353 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 354 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
354 | 355 | ||
355 | initCommandList(); | 356 | initCommandList(); |
356 | // for (int i = 0; commonCmds[i] != NULL; i++) { | 357 | // for (int i = 0; commonCmds[i] != NULL; i++) { |
357 | // commonCombo->insertItem( commonCmds[i], i ); | 358 | // commonCombo->insertItem( commonCmds[i], i ); |
358 | // tmp = cfg.readEntry( QString::number(i),""); | 359 | // tmp = cfg.readEntry( QString::number(i),""); |
359 | // if(tmp != "") | 360 | // if(tmp != "") |
360 | // commonCombo->changeItem( tmp,i ); | 361 | // commonCombo->changeItem( tmp,i ); |
361 | // } | 362 | // } |
362 | 363 | ||
363 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); | 364 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); |
364 | 365 | ||
365 | scrollMenu->insertItem(tr( "None" )); | 366 | scrollMenu->insertItem(tr( "None" )); |
366 | scrollMenu->insertItem(tr( "Left" )); | 367 | scrollMenu->insertItem(tr( "Left" )); |
367 | scrollMenu->insertItem(tr( "Right" )); | 368 | scrollMenu->insertItem(tr( "Right" )); |
368 | // scrollMenu->insertSeparator(4); | 369 | // scrollMenu->insertSeparator(4); |
369 | // scrollMenu->insertItem(tr( "Horizontal" )); | 370 | // scrollMenu->insertItem(tr( "Horizontal" )); |
370 | 371 | ||
371 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); | 372 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); |
372 | 373 | ||
373 | int jut = configMenu->insertItem(tr( "Wrap" )); | 374 | int jut = configMenu->insertItem(tr( "Wrap" )); |
374 | cfg.setGroup("ScrollBar"); | 375 | cfg.setGroup("ScrollBar"); |
375 | configMenu->setItemChecked(jut, cfg.readBoolEntry("HorzScroll",0)); | 376 | configMenu->setItemChecked(jut, cfg.readBoolEntry("HorzScroll",0)); |
376 | 377 | ||
377 | jut = configMenu->insertItem(tr( "Use Beep" )); | 378 | jut = configMenu->insertItem(tr( "Use Beep" )); |
378 | cfg.setGroup("Menubar"); | 379 | cfg.setGroup("Menubar"); |
379 | 380 | ||
380 | configMenu->setItemChecked(jut, cfg.readBoolEntry("useBeep",0)); | 381 | configMenu->setItemChecked(jut, cfg.readBoolEntry("useBeep",0)); |
381 | 382 | ||
382 | 383 | ||
383 | //scrollMenuSelected(-29); | 384 | //scrollMenuSelected(-29); |
384 | // cfg.setGroup("ScrollBar"); | 385 | // cfg.setGroup("ScrollBar"); |
385 | // if(cfg.readBoolEntry("HorzScroll",0)) { | 386 | // if(cfg.readBoolEntry("HorzScroll",0)) { |
386 | // if(cfg.readNumEntry("Position",2) == 0) | 387 | // if(cfg.readNumEntry("Position",2) == 0) |
387 | // te->setScrollbarLocation(1); | 388 | // te->setScrollbarLocation(1); |
388 | // else | 389 | // else |
389 | // te->setScrollbarLocation(0); | 390 | // te->setScrollbarLocation(0); |
390 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 391 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
391 | // te->setWrapAt(120); | 392 | // te->setWrapAt(120); |
392 | // } | 393 | // } |
393 | // create applications ///////////////////////////////////////////////////// | 394 | // create applications ///////////////////////////////////////////////////// |
394 | setCentralWidget(tab); | 395 | setCentralWidget(tab); |
395 | 396 | ||
396 | // load keymaps //////////////////////////////////////////////////////////// | 397 | // load keymaps //////////////////////////////////////////////////////////// |
397 | KeyTrans::loadAll(); | 398 | KeyTrans::loadAll(); |
398 | for (int i = 0; i < KeyTrans::count(); i++) | 399 | for (int i = 0; i < KeyTrans::count(); i++) |
399 | { KeyTrans* s = KeyTrans::find(i); | 400 | { KeyTrans* s = KeyTrans::find(i); |
400 | assert( s ); | 401 | assert( s ); |
401 | } | 402 | } |
402 | 403 | ||
403 | se_pgm = _pgm; | 404 | se_pgm = _pgm; |
404 | se_args = _args; | 405 | se_args = _args; |
405 | se_args.prepend("--login"); | 406 | se_args.prepend("--login"); |
406 | parseCommandLine(); | 407 | parseCommandLine(); |
@@ -573,398 +574,401 @@ void Konsole::setFont(int fontno) | |||
573 | { | 574 | { |
574 | QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); | 575 | QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); |
575 | QMessageBox(this, msg); | 576 | QMessageBox(this, msg); |
576 | return; | 577 | return; |
577 | } | 578 | } |
578 | if (se) se->setFontNo(fontno); | 579 | if (se) se->setFontNo(fontno); |
579 | te->setVTFont(f); | 580 | te->setVTFont(f); |
580 | n_font = fontno; | 581 | n_font = fontno; |
581 | } | 582 | } |
582 | */ | 583 | */ |
583 | 584 | ||
584 | // --| color selection |------------------------------------------------------- | 585 | // --| color selection |------------------------------------------------------- |
585 | 586 | ||
586 | void Konsole::changeColumns(int columns) | 587 | void Konsole::changeColumns(int columns) |
587 | { | 588 | { |
588 | qDebug("change columns"); | 589 | qDebug("change columns"); |
589 | TEWidget* te = getTe(); | 590 | TEWidget* te = getTe(); |
590 | if (te != 0) { | 591 | if (te != 0) { |
591 | setColLin(columns,te->Lines()); | 592 | setColLin(columns,te->Lines()); |
592 | te->update(); | 593 | te->update(); |
593 | } | 594 | } |
594 | } | 595 | } |
595 | 596 | ||
596 | //FIXME: If a child dies during session swap, | 597 | //FIXME: If a child dies during session swap, |
597 | // this routine might be called before | 598 | // this routine might be called before |
598 | // session swap is completed. | 599 | // session swap is completed. |
599 | 600 | ||
600 | void Konsole::doneSession(TESession*, int ) | 601 | void Konsole::doneSession(TESession*, int ) |
601 | { | 602 | { |
602 | TEWidget *te = getTe(); | 603 | TEWidget *te = getTe(); |
603 | if (te != 0) { | 604 | if (te != 0) { |
604 | te->currentSession->setConnect(FALSE); | 605 | te->currentSession->setConnect(FALSE); |
605 | tab->removeTab(te); | 606 | tab->removeTab(te); |
606 | delete te->currentSession; | 607 | delete te->currentSession; |
607 | delete te; | 608 | delete te; |
608 | nsessions--; | 609 | nsessions--; |
609 | } | 610 | } |
610 | 611 | ||
611 | if (nsessions == 0) { | 612 | if (nsessions == 0) { |
612 | close(); | 613 | close(); |
613 | } | 614 | } |
614 | } | 615 | } |
615 | 616 | ||
616 | void Konsole::newSession() { | 617 | void Konsole::newSession() { |
617 | if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory? | 618 | if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory? |
618 | TEWidget* te = new TEWidget(tab); | 619 | TEWidget* te = new TEWidget(tab); |
619 | Config c("Konsole"); | 620 | Config c("Konsole"); |
620 | c.setGroup("Menubar"); | 621 | c.setGroup("Menubar"); |
621 | te->useBeep=c.readBoolEntry("useBeep",0); | 622 | te->useBeep=c.readBoolEntry("useBeep",0); |
622 | 623 | ||
623 | // te->setBackgroundMode(PaletteBase); //we want transparent!! | 624 | // te->setBackgroundMode(PaletteBase); //we want transparent!! |
624 | te->setVTFont(fonts.at(cfont)->getFont()); | 625 | te->setVTFont(fonts.at(cfont)->getFont()); |
625 | tab->addTab(te); | 626 | tab->addTab(te); |
626 | TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); | 627 | TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); |
627 | te->currentSession = se; | 628 | te->currentSession = se; |
628 | connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) ); | 629 | connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) ); |
629 | se->run(); | 630 | se->run(); |
630 | se->setConnect(TRUE); | 631 | se->setConnect(TRUE); |
631 | se->setHistory(b_scroll); | 632 | se->setHistory(b_scroll); |
632 | tab->setCurrentPage(nsessions); | 633 | tab->setCurrentPage(nsessions); |
633 | nsessions++; | 634 | nsessions++; |
634 | doWrap(); | 635 | doWrap(); |
635 | setColor(); | 636 | setColor(); |
636 | } | 637 | } |
637 | } | 638 | } |
638 | 639 | ||
639 | TEWidget* Konsole::getTe() { | 640 | TEWidget* Konsole::getTe() { |
640 | if (nsessions) { | 641 | if (nsessions) { |
641 | return (TEWidget *) tab->currentPage(); | 642 | return (TEWidget *) tab->currentPage(); |
642 | } else { | 643 | } else { |
643 | return 0; | 644 | return 0; |
644 | } | 645 | } |
645 | } | 646 | } |
646 | 647 | ||
647 | void Konsole::switchSession(QWidget* w) { | 648 | void Konsole::switchSession(QWidget* w) { |
648 | TEWidget* te = (TEWidget *) w; | 649 | TEWidget* te = (TEWidget *) w; |
649 | 650 | ||
650 | QFont teFnt = te->getVTFont(); | 651 | QFont teFnt = te->getVTFont(); |
651 | for(uint i = 0; i < fonts.count(); i++) { | 652 | for(uint i = 0; i < fonts.count(); i++) { |
652 | VTFont *fnt = fonts.at(i); | 653 | VTFont *fnt = fonts.at(i); |
653 | bool cf = fnt->getFont() == teFnt; | 654 | bool cf = fnt->getFont() == teFnt; |
654 | fontList->setItemChecked(i, cf); | 655 | fontList->setItemChecked(i, cf); |
655 | if (cf) { | 656 | if (cf) { |
656 | cfont = i; | 657 | cfont = i; |
657 | } | 658 | } |
658 | } | 659 | } |
659 | } | 660 | } |
660 | 661 | ||
661 | void Konsole::colorMenuIsSelected(int iD) { | 662 | void Konsole::colorMenuIsSelected(int iD) { |
662 | fromMenu = TRUE; | 663 | fromMenu = TRUE; |
663 | colorMenuSelected(iD); | 664 | colorMenuSelected(iD); |
664 | } | 665 | } |
665 | 666 | ||
666 | /// ------------------------------- some new stuff by L.J. Potter | 667 | /// ------------------------------- some new stuff by L.J. Potter |
667 | void Konsole::colorMenuSelected(int iD) | 668 | void Konsole::colorMenuSelected(int iD) |
668 | { // this is NOT pretty, elegant or anything else besides functional | 669 | { // this is NOT pretty, elegant or anything else besides functional |
669 | // QString temp; | 670 | // QString temp; |
670 | // qDebug( temp.sprintf("colormenu %d", iD)); | 671 | // qDebug( temp.sprintf("colormenu %d", iD)); |
671 | TEWidget* te = getTe(); | 672 | |
673 | TEWidget* te = getTe(); | ||
672 | Config cfg("Konsole"); | 674 | Config cfg("Konsole"); |
673 | cfg.setGroup("Colors"); | 675 | cfg.setGroup("Colors"); |
674 | // QColor foreground; | 676 | // QColor foreground; |
675 | // QColor background; | 677 | // QColor background; |
676 | colorMenu->setItemChecked(lastSelectedMenu,FALSE); | 678 | colorMenu->setItemChecked(lastSelectedMenu,FALSE); |
677 | ColorEntry m_table[TABLE_COLORS]; | 679 | ColorEntry m_table[TABLE_COLORS]; |
678 | const ColorEntry * defaultCt=te->getdefaultColorTable(); | 680 | const ColorEntry * defaultCt=te->getdefaultColorTable(); |
679 | /////////// fore back | 681 | /////////// fore back |
680 | int i; | 682 | int i; |
681 | if(iD==-9) { // default default | 683 | if(iD==-9) { // default default |
682 | for (i = 0; i < TABLE_COLORS; i++) { | 684 | for (i = 0; i < TABLE_COLORS; i++) { |
683 | m_table[i].color = defaultCt[i].color; | 685 | m_table[i].color = defaultCt[i].color; |
684 | if(i==1 || i == 11) | 686 | if(i==1 || i == 11) |
685 | m_table[i].transparent=1; | 687 | m_table[i].transparent=1; |
686 | cfg.writeEntry("Schema","9"); | 688 | cfg.writeEntry("Schema","9"); |
687 | colorMenu->setItemChecked(-9,TRUE); | 689 | colorMenu->setItemChecked(-9,TRUE); |
688 | } | 690 | } |
689 | } else { | 691 | } else { |
690 | if(iD==-6) { // green black | 692 | if(iD==-6) { // green black |
691 | foreground.setRgb(0x18,255,0x18); | 693 | foreground.setRgb(0x18,255,0x18); |
692 | background.setRgb(0x00,0x00,0x00); | 694 | background.setRgb(0x00,0x00,0x00); |
693 | cfg.writeEntry("Schema","6"); | 695 | cfg.writeEntry("Schema","6"); |
694 | colorMenu->setItemChecked(-6,TRUE); | 696 | colorMenu->setItemChecked(-6,TRUE); |
695 | } | 697 | } |
696 | if(iD==-7) { // black white | 698 | if(iD==-7) { // black white |
697 | foreground.setRgb(0x00,0x00,0x00); | 699 | foreground.setRgb(0x00,0x00,0x00); |
698 | background.setRgb(0xFF,0xFF,0xFF); | 700 | background.setRgb(0xFF,0xFF,0xFF); |
699 | cfg.writeEntry("Schema","7"); | 701 | cfg.writeEntry("Schema","7"); |
700 | colorMenu->setItemChecked(-7,TRUE); | 702 | colorMenu->setItemChecked(-7,TRUE); |
701 | } | 703 | } |
702 | if(iD==-8) { // white black | 704 | if(iD==-8) { // white black |
703 | foreground.setRgb(0xFF,0xFF,0xFF); | 705 | foreground.setRgb(0xFF,0xFF,0xFF); |
704 | background.setRgb(0x00,0x00,0x00); | 706 | background.setRgb(0x00,0x00,0x00); |
705 | cfg.writeEntry("Schema","8"); | 707 | cfg.writeEntry("Schema","8"); |
706 | colorMenu->setItemChecked(-8,TRUE); | 708 | colorMenu->setItemChecked(-8,TRUE); |
707 | } | 709 | } |
708 | if(iD==-10) {// Black, Red | 710 | if(iD==-10) {// Black, Red |
709 | foreground.setRgb(0x00,0x00,0x00); | 711 | foreground.setRgb(0x00,0x00,0x00); |
710 | background.setRgb(0xB2,0x18,0x18); | 712 | background.setRgb(0xB2,0x18,0x18); |
711 | cfg.writeEntry("Schema","10"); | 713 | cfg.writeEntry("Schema","10"); |
712 | colorMenu->setItemChecked(-10,TRUE); | 714 | colorMenu->setItemChecked(-10,TRUE); |
713 | } | 715 | } |
714 | if(iD==-11) {// Red, Black | 716 | if(iD==-11) {// Red, Black |
715 | foreground.setRgb(230,31,31); //0xB2,0x18,0x18 | 717 | foreground.setRgb(230,31,31); //0xB2,0x18,0x18 |
716 | background.setRgb(0x00,0x00,0x00); | 718 | background.setRgb(0x00,0x00,0x00); |
717 | cfg.writeEntry("Schema","11"); | 719 | cfg.writeEntry("Schema","11"); |
718 | colorMenu->setItemChecked(-11,TRUE); | 720 | colorMenu->setItemChecked(-11,TRUE); |
719 | } | 721 | } |
720 | if(iD==-12) {// Green, Yellow - is ugly | 722 | if(iD==-12) {// Green, Yellow - is ugly |
721 | // foreground.setRgb(0x18,0xB2,0x18); | 723 | // foreground.setRgb(0x18,0xB2,0x18); |
722 | foreground.setRgb(36,139,10); | 724 | foreground.setRgb(36,139,10); |
723 | // background.setRgb(0xB2,0x68,0x18); | 725 | // background.setRgb(0xB2,0x68,0x18); |
724 | background.setRgb(255,255,0); | 726 | background.setRgb(255,255,0); |
725 | cfg.writeEntry("Schema","12"); | 727 | cfg.writeEntry("Schema","12"); |
726 | colorMenu->setItemChecked(-12,TRUE); | 728 | colorMenu->setItemChecked(-12,TRUE); |
727 | } | 729 | } |
728 | if(iD==-13) {// Blue, Magenta | 730 | if(iD==-13) {// Blue, Magenta |
729 | foreground.setRgb(0x18,0xB2,0xB2); | 731 | foreground.setRgb(0x18,0xB2,0xB2); |
730 | background.setRgb(0x18,0x18,0xB2); | 732 | background.setRgb(0x18,0x18,0xB2); |
731 | cfg.writeEntry("Schema","13"); | 733 | cfg.writeEntry("Schema","13"); |
732 | colorMenu->setItemChecked(-13,TRUE); | 734 | colorMenu->setItemChecked(-13,TRUE); |
733 | } | 735 | } |
734 | if(iD==-14) {// Magenta, Blue | 736 | if(iD==-14) {// Magenta, Blue |
735 | foreground.setRgb(0x18,0x18,0xB2); | 737 | foreground.setRgb(0x18,0x18,0xB2); |
736 | background.setRgb(0x18,0xB2,0xB2); | 738 | background.setRgb(0x18,0xB2,0xB2); |
737 | cfg.writeEntry("Schema","14"); | 739 | cfg.writeEntry("Schema","14"); |
738 | colorMenu->setItemChecked(-14,TRUE); | 740 | colorMenu->setItemChecked(-14,TRUE); |
739 | } | 741 | } |
740 | if(iD==-15) {// Cyan, White | 742 | if(iD==-15) {// Cyan, White |
741 | foreground.setRgb(0x18,0xB2,0xB2); | 743 | foreground.setRgb(0x18,0xB2,0xB2); |
742 | background.setRgb(0xFF,0xFF,0xFF); | 744 | background.setRgb(0xFF,0xFF,0xFF); |
743 | cfg.writeEntry("Schema","15"); | 745 | cfg.writeEntry("Schema","15"); |
744 | colorMenu->setItemChecked(-15,TRUE); | 746 | colorMenu->setItemChecked(-15,TRUE); |
745 | } | 747 | } |
746 | if(iD==-16) {// White, Cyan | 748 | if(iD==-16) {// White, Cyan |
747 | background.setRgb(0x18,0xB2,0xB2); | 749 | background.setRgb(0x18,0xB2,0xB2); |
748 | foreground.setRgb(0xFF,0xFF,0xFF); | 750 | foreground.setRgb(0xFF,0xFF,0xFF); |
749 | cfg.writeEntry("Schema","16"); | 751 | cfg.writeEntry("Schema","16"); |
750 | colorMenu->setItemChecked(-16,TRUE); | 752 | colorMenu->setItemChecked(-16,TRUE); |
751 | } | 753 | } |
752 | if(iD==-17) {// Black, Blue | 754 | if(iD==-17) {// Black, Blue |
753 | background.setRgb(0x00,0x00,0x00); | 755 | background.setRgb(0x00,0x00,0x00); |
754 | foreground.setRgb(0x18,0xB2,0xB2); | 756 | foreground.setRgb(0x18,0xB2,0xB2); |
755 | cfg.writeEntry("Schema","17"); | 757 | cfg.writeEntry("Schema","17"); |
756 | colorMenu->setItemChecked(-17,TRUE); | 758 | colorMenu->setItemChecked(-17,TRUE); |
757 | } | 759 | } |
758 | if(iD==-18) {// Black, Gold | 760 | if(iD==-18) {// Black, Gold |
759 | background.setRgb(0x00,0x00,0x00); | 761 | background.setRgb(0x00,0x00,0x00); |
760 | foreground.setRgb(255,215,0); | 762 | foreground.setRgb(255,215,0); |
761 | cfg.writeEntry("Schema","18"); | 763 | cfg.writeEntry("Schema","18"); |
762 | colorMenu->setItemChecked(-18,TRUE); | 764 | colorMenu->setItemChecked(-18,TRUE); |
763 | } | 765 | } |
764 | #ifdef QT_QWS_OPIE | 766 | #ifdef QT_QWS_OPIE |
765 | if(iD==-19) { | 767 | if(iD==-19) { |
766 | // Custom | 768 | // Custom |
767 | qDebug("do custom"); | 769 | qDebug("do custom"); |
768 | if(fromMenu) { | 770 | if(fromMenu) { |
769 | ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color"); | 771 | ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color"); |
770 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, | 772 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, |
771 | SLOT(changeForegroundColor(const QColor&))); | 773 | SLOT(changeForegroundColor(const QColor&))); |
772 | penColorPopupMenu->exec(); | 774 | penColorPopupMenu->exec(); |
773 | } | 775 | } |
774 | cfg.writeEntry("Schema","19"); | 776 | cfg.writeEntry("Schema","19"); |
775 | if(!fromMenu) { | 777 | if(!fromMenu) { |
776 | foreground.setNamedColor(cfg.readEntry("foreground","")); | 778 | foreground.setNamedColor(cfg.readEntry("foreground","")); |
777 | background.setNamedColor(cfg.readEntry("background","")); | 779 | background.setNamedColor(cfg.readEntry("background","")); |
778 | } | 780 | } |
779 | fromMenu=FALSE; | 781 | fromMenu=FALSE; |
780 | colorMenu->setItemChecked(-19,TRUE); | 782 | colorMenu->setItemChecked(-19,TRUE); |
781 | } | 783 | } |
782 | #endif | 784 | #endif |
783 | for (i = 0; i < TABLE_COLORS; i++) { | 785 | for (i = 0; i < TABLE_COLORS; i++) { |
784 | if(i==0 || i == 10) { | 786 | if(i==0 || i == 10) { |
785 | m_table[i].color = foreground; | 787 | m_table[i].color = foreground; |
786 | } | 788 | } |
787 | else if(i==1 || i == 11) { | 789 | else if(i==1 || i == 11) { |
788 | m_table[i].color = background; m_table[i].transparent=0; | 790 | m_table[i].color = background; m_table[i].transparent=0; |
789 | } | 791 | } |
790 | else | 792 | else |
791 | m_table[i].color = defaultCt[i].color; | 793 | m_table[i].color = defaultCt[i].color; |
792 | } | 794 | } |
793 | } | 795 | } |
794 | lastSelectedMenu = iD; | 796 | lastSelectedMenu = iD; |
795 | te->setColorTable(m_table); | 797 | te->setColorTable(m_table); |
796 | update(); | 798 | update(); |
797 | 799 | ||
798 | } | 800 | } |
799 | 801 | ||
800 | void Konsole::configMenuSelected(int iD) | 802 | void Konsole::configMenuSelected(int iD) |
801 | { | 803 | { |
802 | // QString temp; | 804 | // QString temp; |
803 | // qDebug( temp.sprintf("configmenu %d",iD)); | 805 | // qDebug( temp.sprintf("configmenu %d",iD)); |
804 | TEWidget* te = getTe(); | 806 | |
807 | TEWidget* te = getTe(); | ||
805 | Config cfg("Konsole"); | 808 | Config cfg("Konsole"); |
806 | cfg.setGroup("Menubar"); | 809 | cfg.setGroup("Menubar"); |
807 | int i,j; | 810 | int i,j; |
808 | #ifdef QT_QWS_OPIE | 811 | #ifdef QT_QWS_OPIE |
809 | i=-29;j=-30; | 812 | i=-29;j=-30; |
810 | #else | 813 | #else |
811 | i=-28;j=-29; | 814 | i=-28;j=-29; |
812 | #endif | 815 | #endif |
813 | 816 | ||
814 | if(iD == -4) { | 817 | if(iD == -4) { |
815 | cfg.setGroup("Tabs"); | 818 | cfg.setGroup("Tabs"); |
816 | QString tmp=cfg.readEntry("Position","Bottom"); | 819 | QString tmp=cfg.readEntry("Position","Bottom"); |
817 | 820 | ||
818 | if(tmp=="Top") { | 821 | if(tmp=="Top") { |
819 | tab->setTabPosition(QTabWidget::Bottom); | 822 | tab->setTabPosition(QTabWidget::Bottom); |
820 | configMenu->changeItem( iD, tr("Tabs on Top")); | 823 | configMenu->changeItem( iD, tr("Tabs on Top")); |
821 | cfg.writeEntry("Position","Bottom"); | 824 | cfg.writeEntry("Position","Bottom"); |
822 | } else { | 825 | } else { |
823 | tab->setTabPosition(QTabWidget::Top); | 826 | tab->setTabPosition(QTabWidget::Top); |
824 | configMenu->changeItem( iD, tr("Tabs on Bottom")); | 827 | configMenu->changeItem( iD, tr("Tabs on Bottom")); |
825 | cfg.writeEntry("Position","Top"); | 828 | cfg.writeEntry("Position","Top"); |
826 | } | 829 | } |
827 | } | 830 | } |
828 | if(iD == i) { | 831 | if(iD == i) { |
829 | cfg.setGroup("ScrollBar"); | 832 | cfg.setGroup("ScrollBar"); |
830 | bool b=cfg.readBoolEntry("HorzScroll",0); | 833 | bool b=cfg.readBoolEntry("HorzScroll",0); |
831 | b=!b; | 834 | b=!b; |
832 | cfg.writeEntry("HorzScroll", b ); | 835 | cfg.writeEntry("HorzScroll", b ); |
833 | cfg.write(); | 836 | cfg.write(); |
834 | doWrap(); | 837 | doWrap(); |
835 | if(cfg.readNumEntry("Position",2) == 0) { | 838 | if(cfg.readNumEntry("Position",2) == 0) { |
836 | te->setScrollbarLocation(1); | 839 | te->setScrollbarLocation(1); |
837 | } else { | 840 | } else { |
838 | te->setScrollbarLocation(0); | 841 | te->setScrollbarLocation(0); |
839 | } | 842 | } |
840 | te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 843 | te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
841 | } | 844 | } |
842 | if(iD == j) { | 845 | if(iD == j) { |
843 | cfg.setGroup("Menubar"); | 846 | cfg.setGroup("Menubar"); |
844 | bool b=cfg.readBoolEntry("useBeep",0); | 847 | bool b=cfg.readBoolEntry("useBeep",0); |
845 | b=!b; | 848 | b=!b; |
846 | cfg.writeEntry("useBeep", b ); | 849 | cfg.writeEntry("useBeep", b ); |
847 | cfg.write(); | 850 | cfg.write(); |
848 | configMenu->setItemChecked(j,b); | 851 | configMenu->setItemChecked(j,b); |
849 | te->useBeep=b; | 852 | te->useBeep=b; |
850 | } | 853 | } |
851 | } | 854 | } |
852 | 855 | ||
853 | void Konsole::changeCommand(const QString &text, int c) | 856 | void Konsole::changeCommand(const QString &text, int c) |
854 | { | 857 | { |
855 | Config cfg("Konsole"); | 858 | Config cfg("Konsole"); |
856 | cfg.setGroup("Commands"); | 859 | cfg.setGroup("Commands"); |
857 | if(commonCmds[c] != text) { | 860 | if(commonCmds[c] != text) { |
858 | cfg.writeEntry(QString::number(c),text); | 861 | cfg.writeEntry(QString::number(c),text); |
859 | commonCombo->clearEdit(); | 862 | commonCombo->clearEdit(); |
860 | commonCombo->setCurrentItem(c); | 863 | commonCombo->setCurrentItem(c); |
861 | } | 864 | } |
862 | } | 865 | } |
863 | 866 | ||
864 | void Konsole::setColor() | 867 | void Konsole::setColor() |
865 | { | 868 | { |
866 | Config cfg("Konsole"); | 869 | Config cfg("Konsole"); |
867 | cfg.setGroup("Colors"); | 870 | cfg.setGroup("Colors"); |
868 | int scheme = cfg.readNumEntry("Schema",1); | 871 | int scheme = cfg.readNumEntry("Schema",1); |
869 | if(scheme != 1) colorMenuSelected( -scheme); | 872 | if(scheme != 1) colorMenuSelected( -scheme); |
870 | } | 873 | } |
871 | 874 | ||
872 | void Konsole::scrollMenuSelected(int index) | 875 | void Konsole::scrollMenuSelected(int index) |
873 | { | 876 | { |
874 | qDebug( "scrollbar menu %d",index); | 877 | // qDebug( "scrollbar menu %d",index); |
878 | |||
875 | TEWidget* te = getTe(); | 879 | TEWidget* te = getTe(); |
876 | Config cfg("Konsole"); | 880 | Config cfg("Konsole"); |
877 | cfg.setGroup("ScrollBar"); | 881 | cfg.setGroup("ScrollBar"); |
878 | int i,j,k; | 882 | int i,j,k; |
879 | #ifdef QT_QWS_OPIE | 883 | #ifdef QT_QWS_OPIE |
880 | i=-25;j=-26;k=-27; | 884 | i=-25;j=-26;k=-27; |
881 | #else | 885 | #else |
882 | i=-24;j=-25;k=-26; | 886 | i=-24;j=-25;k=-26; |
883 | #endif | 887 | #endif |
884 | if(index == i) { | 888 | if(index == i) { |
885 | 889 | ||
886 | te->setScrollbarLocation(0); | 890 | te->setScrollbarLocation(0); |
887 | cfg.writeEntry("Position",0); | 891 | cfg.writeEntry("Position",0); |
888 | } else if(index == j) { | 892 | } else if(index == j) { |
889 | 893 | ||
890 | te->setScrollbarLocation(1); | 894 | te->setScrollbarLocation(1); |
891 | cfg.writeEntry("Position",1); | 895 | cfg.writeEntry("Position",1); |
892 | } else if(index == k) { | 896 | } else if(index == k) { |
893 | 897 | ||
894 | te->setScrollbarLocation(2); | 898 | te->setScrollbarLocation(2); |
895 | cfg.writeEntry("Position",2); | 899 | cfg.writeEntry("Position",2); |
896 | } | 900 | } |
897 | 901 | ||
898 | // case -29: { | 902 | // case -29: { |
899 | // bool b=cfg.readBoolEntry("HorzScroll",0); | 903 | // bool b=cfg.readBoolEntry("HorzScroll",0); |
900 | // cfg.writeEntry("HorzScroll", !b ); | 904 | // cfg.writeEntry("HorzScroll", !b ); |
901 | // cfg.write(); | 905 | // cfg.write(); |
902 | // if(cfg.readNumEntry("Position",2) == 0) { | 906 | // if(cfg.readNumEntry("Position",2) == 0) { |
903 | // te->setScrollbarLocation(1); | 907 | // te->setScrollbarLocation(1); |
904 | // te->setWrapAt(0); | 908 | // te->setWrapAt(0); |
905 | // } else { | 909 | // } else { |
906 | // te->setScrollbarLocation(0); | 910 | // te->setScrollbarLocation(0); |
907 | // te->setWrapAt(120); | 911 | // te->setWrapAt(120); |
908 | // } | 912 | // } |
909 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 913 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
910 | // } | 914 | // } |
911 | // break; | 915 | // break; |
912 | } | 916 | } |
913 | 917 | ||
914 | void Konsole::editCommandListMenuSelected(int iD) | 918 | void Konsole::editCommandListMenuSelected(int iD) |
915 | { | 919 | { |
916 | // QString temp; | 920 | // QString temp; |
917 | // qDebug( temp.sprintf("edit command list %d",iD)); | 921 | // qDebug( temp.sprintf("edit command list %d",iD)); |
918 | TEWidget* te = getTe(); | 922 | TEWidget* te = getTe(); |
919 | Config cfg("Konsole"); | 923 | Config cfg("Konsole"); |
920 | cfg.setGroup("Menubar"); | 924 | cfg.setGroup("Menubar"); |
921 | if( iD == -3) { | 925 | if( iD == -3) { |
922 | if(!secondToolBar->isHidden()) { | 926 | if(!secondToolBar->isHidden()) { |
923 | secondToolBar->hide(); | 927 | secondToolBar->hide(); |
924 | configMenu->changeItem( iD,tr( "Show Command List" )); | 928 | configMenu->changeItem( iD,tr( "Show Command List" )); |
925 | cfg.writeEntry("Hidden","TRUE"); | 929 | cfg.writeEntry("Hidden","TRUE"); |
926 | configMenu->setItemEnabled(-23 ,FALSE); | 930 | configMenu->setItemEnabled(-23 ,FALSE); |
927 | } else { | 931 | } else { |
928 | secondToolBar->show(); | 932 | secondToolBar->show(); |
929 | configMenu->changeItem( iD,tr( "Hide Command List" )); | 933 | configMenu->changeItem( iD,tr( "Hide Command List" )); |
930 | cfg.writeEntry("Hidden","FALSE"); | 934 | cfg.writeEntry("Hidden","FALSE"); |
931 | configMenu->setItemEnabled(-23 ,TRUE); | 935 | configMenu->setItemEnabled(-23 ,TRUE); |
932 | 936 | ||
933 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { | 937 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { |
934 | configMenu->setItemChecked(-23,TRUE); | 938 | configMenu->setItemChecked(-23,TRUE); |
935 | commonCombo->setEditable( TRUE ); | 939 | commonCombo->setEditable( TRUE ); |
936 | } else { | 940 | } else { |
937 | configMenu->setItemChecked(-23,FALSE); | 941 | configMenu->setItemChecked(-23,FALSE); |
938 | commonCombo->setEditable( FALSE ); | 942 | commonCombo->setEditable( FALSE ); |
939 | } | 943 | } |
940 | } | 944 | } |
941 | } | 945 | } |
942 | if( iD == -23) { | 946 | if( iD == -23) { |
943 | cfg.setGroup("Commands"); | 947 | cfg.setGroup("Commands"); |
944 | // qDebug("enableCommandEdit"); | 948 | // qDebug("enableCommandEdit"); |
945 | if( !configMenu->isItemChecked(iD) ) { | 949 | if( !configMenu->isItemChecked(iD) ) { |
946 | commonCombo->setEditable( TRUE ); | 950 | commonCombo->setEditable( TRUE ); |
947 | configMenu->setItemChecked(iD,TRUE); | 951 | configMenu->setItemChecked(iD,TRUE); |
948 | commonCombo->setCurrentItem(0); | 952 | commonCombo->setCurrentItem(0); |
949 | cfg.writeEntry("EditEnabled","TRUE"); | 953 | cfg.writeEntry("EditEnabled","TRUE"); |
950 | } else { | 954 | } else { |
951 | commonCombo->setEditable( FALSE ); | 955 | commonCombo->setEditable( FALSE ); |
952 | configMenu->setItemChecked(iD,FALSE); | 956 | configMenu->setItemChecked(iD,FALSE); |
953 | cfg.writeEntry("EditEnabled","FALSE"); | 957 | cfg.writeEntry("EditEnabled","FALSE"); |
954 | commonCombo->setFocusPolicy(QWidget::NoFocus); | 958 | commonCombo->setFocusPolicy(QWidget::NoFocus); |
955 | te->setFocus(); | 959 | te->setFocus(); |
956 | } | 960 | } |
957 | } | 961 | } |
958 | if(iD == -24) { | 962 | if(iD == -24) { |
959 | // "edit commands" | 963 | // "edit commands" |
960 | CommandEditDialog *m = new CommandEditDialog(this); | 964 | CommandEditDialog *m = new CommandEditDialog(this); |
961 | connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList())); | 965 | connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList())); |
962 | m->showMaximized(); | 966 | m->showMaximized(); |
963 | } | 967 | } |
964 | 968 | ||
965 | } | 969 | } |
966 | 970 | ||
967 | // $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' | 971 | // $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' |
968 | void Konsole::setDocument( const QString &cmd) { | 972 | void Konsole::setDocument( const QString &cmd) { |
969 | newSession(); | 973 | newSession(); |
970 | TEWidget* te = getTe(); | 974 | TEWidget* te = getTe(); |