summaryrefslogtreecommitdiff
path: root/core
authorllornkcor <llornkcor>2002-02-03 14:11:38 (UTC)
committer llornkcor <llornkcor>2002-02-03 14:11:38 (UTC)
commitee82c470b34819d24de543b30f150788fb58b2f1 (patch) (unidiff)
treef1161e9dab6f77de6718fcf0e3a36e1ded4388f0 /core
parentf3def578d169c0a937f418b2d956c73592190cda (diff)
downloadopie-ee82c470b34819d24de543b30f150788fb58b2f1.zip
opie-ee82c470b34819d24de543b30f150788fb58b2f1.tar.gz
opie-ee82c470b34819d24de543b30f150788fb58b2f1.tar.bz2
fixed problem with commandlist and very long commands messing up the combo width, so you couldn't edit.
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index f154bb8..653652a 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -274,55 +274,55 @@ void Konsole::init(const char* _pgm, QStrList & _args)
274 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); 274 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar );
275 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); 275 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 );
276 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); 276 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar );
277 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); 277 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 );
278 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); 278 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar );
279 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); 279 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 );
280 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); 280 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar );
281 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); 281 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 );
282 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); 282 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar );
283 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); 283 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 );
284 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); 284 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar );
285 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); 285 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 );
286 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); 286 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar );
287/* 287/*
288 a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); 288 a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 );
289 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); 289 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar );
290 a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); 290 a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 );
291 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); 291 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar );
292*/ 292*/
293 293
294 secondToolBar = new QPEToolBar( this ); 294 secondToolBar = new QPEToolBar( this );
295 secondToolBar->setHorizontalStretchable( TRUE ); 295 secondToolBar->setHorizontalStretchable( TRUE );
296 296
297 commonCombo = new QComboBox( secondToolBar ); 297 commonCombo = new QComboBox( secondToolBar );
298 298 commonCombo->setMaximumWidth(236);
299 configMenu->insertItem( "Edit Command List"); 299 configMenu->insertItem( "Edit Command List");
300 if( listHidden) { 300 if( listHidden) {
301 secondToolBar->hide(); 301 secondToolBar->hide();
302 configMenu->setItemEnabled(-20 ,FALSE); 302 configMenu->setItemEnabled(-20 ,FALSE);
303 } 303 }
304 304
305 cfg.setGroup("Commands"); 305 cfg.setGroup("Commands");
306 commonCombo->setInsertionPolicy(QComboBox::AtCurrent); 306 commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
307 307
308 for (int i = 0; commonCmds[i] != NULL; i++) { 308 for (int i = 0; commonCmds[i] != NULL; i++) {
309 commonCombo->insertItem( commonCmds[i], i ); 309 commonCombo->insertItem( commonCmds[i], i );
310 tmp = cfg.readEntry( QString::number(i),""); 310 tmp = cfg.readEntry( QString::number(i),"");
311 if(tmp != "") 311 if(tmp != "")
312 commonCombo->changeItem( tmp,i ); 312 commonCombo->changeItem( tmp,i );
313 } 313 }
314 314
315 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); 315 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) ));
316 316
317 // create applications ///////////////////////////////////////////////////// 317 // create applications /////////////////////////////////////////////////////
318 setCentralWidget(tab); 318 setCentralWidget(tab);
319 319
320 // load keymaps //////////////////////////////////////////////////////////// 320 // load keymaps ////////////////////////////////////////////////////////////
321 KeyTrans::loadAll(); 321 KeyTrans::loadAll();
322 for (int i = 0; i < KeyTrans::count(); i++) 322 for (int i = 0; i < KeyTrans::count(); i++)
323 { KeyTrans* s = KeyTrans::find(i); 323 { KeyTrans* s = KeyTrans::find(i);
324 assert( s ); 324 assert( s );
325 } 325 }
326 326
327 se_pgm = _pgm; 327 se_pgm = _pgm;
328 se_args = _args; 328 se_args = _args;
@@ -364,49 +364,49 @@ void Konsole::fontChanged(int f)
364 VTFont* font = fonts.at(f); 364 VTFont* font = fonts.at(f);
365 if (font != 0) { 365 if (font != 0) {
366 for(uint i = 0; i < fonts.count(); i++) { 366 for(uint i = 0; i < fonts.count(); i++) {
367 fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); 367 fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE);
368 } 368 }
369 369
370 cfont = f; 370 cfont = f;
371 371
372 TEWidget* te = getTe(); 372 TEWidget* te = getTe();
373 if (te != 0) { 373 if (te != 0) {
374 te->setVTFont(font->getFont()); 374 te->setVTFont(font->getFont());
375 } 375 }
376 } 376 }
377} 377}
378 378
379 379
380void Konsole::enterCommand(int c) 380void Konsole::enterCommand(int c)
381{ 381{
382 TEWidget* te = getTe(); 382 TEWidget* te = getTe();
383 if (te != 0) { 383 if (te != 0) {
384 if(!commonCombo->editable()) { 384 if(!commonCombo->editable()) {
385 QString text = commonCombo->text(c); //commonCmds[c]; 385 QString text = commonCombo->text(c); //commonCmds[c];
386 te->emitText(text); 386 te->emitText(text);
387 } else { 387 } else {
388 changeCommand( commonCombo->text(c), c); 388 changeCommand( commonCombo->text(c), c);
389 } 389 }
390 } 390 }
391} 391}
392 392
393void Konsole::hitEnter() 393void Konsole::hitEnter()
394{ 394{
395 TEWidget* te = getTe(); 395 TEWidget* te = getTe();
396 if (te != 0) { 396 if (te != 0) {
397 te->emitText(QString("\r")); 397 te->emitText(QString("\r"));
398 } 398 }
399} 399}
400 400
401void Konsole::hitSpace() 401void Konsole::hitSpace()
402{ 402{
403 TEWidget* te = getTe(); 403 TEWidget* te = getTe();
404 if (te != 0) { 404 if (te != 0) {
405 te->emitText(QString(" ")); 405 te->emitText(QString(" "));
406 } 406 }
407} 407}
408 408
409void Konsole::hitTab() 409void Konsole::hitTab()
410{ 410{
411 TEWidget* te = getTe(); 411 TEWidget* te = getTe();
412 if (te != 0) { 412 if (te != 0) {
@@ -556,50 +556,49 @@ TEWidget* Konsole::getTe() {
556 return (TEWidget *) tab->currentPage(); 556 return (TEWidget *) tab->currentPage();
557 } else { 557 } else {
558 return 0; 558 return 0;
559 } 559 }
560} 560}
561 561
562void Konsole::switchSession(QWidget* w) { 562void Konsole::switchSession(QWidget* w) {
563 TEWidget* te = (TEWidget *) w; 563 TEWidget* te = (TEWidget *) w;
564 564
565 QFont teFnt = te->getVTFont(); 565 QFont teFnt = te->getVTFont();
566 for(uint i = 0; i < fonts.count(); i++) { 566 for(uint i = 0; i < fonts.count(); i++) {
567 VTFont *fnt = fonts.at(i); 567 VTFont *fnt = fonts.at(i);
568 bool cf = fnt->getFont() == teFnt; 568 bool cf = fnt->getFont() == teFnt;
569 fontList->setItemChecked(i, cf); 569 fontList->setItemChecked(i, cf);
570 if (cf) { 570 if (cf) {
571 cfont = i; 571 cfont = i;
572 } 572 }
573 } 573 }
574} 574}
575 575
576/// ------------------------------- some new stuff by L.J. Potter 576/// ------------------------------- some new stuff by L.J. Potter
577void Konsole::colorMenuSelected(int iD) 577void Konsole::colorMenuSelected(int iD)
578{ // this is NOT pretty, elegant or anything else besides functional 578{ // this is NOT pretty, elegant or anything else besides functional
579// QString temp; 579// QString temp;
580// temp.sprintf("%d", iD); 580// qDebug( temp.sprintf("%d", iD));
581// qDebug(temp);
582 TEWidget* te = getTe(); 581 TEWidget* te = getTe();
583 Config cfg("Konsole"); 582 Config cfg("Konsole");
584 cfg.setGroup("Colors"); 583 cfg.setGroup("Colors");
585 QColor foreground; 584 QColor foreground;
586 QColor background; 585 QColor background;
587 colorMenu->setItemChecked(lastSelectedMenu,FALSE); 586 colorMenu->setItemChecked(lastSelectedMenu,FALSE);
588 ColorEntry m_table[TABLE_COLORS]; 587 ColorEntry m_table[TABLE_COLORS];
589 const ColorEntry * defaultCt=te->getdefaultColorTable(); 588 const ColorEntry * defaultCt=te->getdefaultColorTable();
590 /////////// fore back 589 /////////// fore back
591 int i; 590 int i;
592 if(iD==-8) { // default default 591 if(iD==-8) { // default default
593 for (i = 0; i < TABLE_COLORS; i++) { 592 for (i = 0; i < TABLE_COLORS; i++) {
594 m_table[i].color = defaultCt[i].color; 593 m_table[i].color = defaultCt[i].color;
595 if(i==1 || i == 11) 594 if(i==1 || i == 11)
596 m_table[i].transparent=1; 595 m_table[i].transparent=1;
597 cfg.writeEntry("Schema","8"); 596 cfg.writeEntry("Schema","8");
598 colorMenu->setItemChecked(-8,TRUE); 597 colorMenu->setItemChecked(-8,TRUE);
599 } 598 }
600 } else { 599 } else {
601 if(iD==-5) { // green black 600 if(iD==-5) { // green black
602 foreground.setRgb(0x18,255,0x18); 601 foreground.setRgb(0x18,255,0x18);
603 background.setRgb(0x00,0x00,0x00); 602 background.setRgb(0x00,0x00,0x00);
604 cfg.writeEntry("Schema","5"); 603 cfg.writeEntry("Schema","5");
605 colorMenu->setItemChecked(-5,TRUE); 604 colorMenu->setItemChecked(-5,TRUE);
@@ -664,51 +663,50 @@ void Konsole::colorMenuSelected(int iD)
664 background.setRgb(0x00,0x00,0x00); 663 background.setRgb(0x00,0x00,0x00);
665 foreground.setRgb(0x18,0xB2,0xB2); 664 foreground.setRgb(0x18,0xB2,0xB2);
666 cfg.writeEntry("Schema","16"); 665 cfg.writeEntry("Schema","16");
667 colorMenu->setItemChecked(-16,TRUE); 666 colorMenu->setItemChecked(-16,TRUE);
668 } 667 }
669 668
670 for (i = 0; i < TABLE_COLORS; i++) { 669 for (i = 0; i < TABLE_COLORS; i++) {
671 if(i==0 || i == 10) { 670 if(i==0 || i == 10) {
672 m_table[i].color = foreground; 671 m_table[i].color = foreground;
673 } 672 }
674 else if(i==1 || i == 11) { 673 else if(i==1 || i == 11) {
675 m_table[i].color = background; m_table[i].transparent=0; 674 m_table[i].color = background; m_table[i].transparent=0;
676 } 675 }
677 else 676 else
678 m_table[i].color = defaultCt[i].color; 677 m_table[i].color = defaultCt[i].color;
679 } 678 }
680 } 679 }
681 lastSelectedMenu = iD; 680 lastSelectedMenu = iD;
682 te->setColorTable(m_table); 681 te->setColorTable(m_table);
683 update(); 682 update();
684} 683}
685 684
686void Konsole::configMenuSelected(int iD) 685void Konsole::configMenuSelected(int iD)
687{ 686{
688// QString temp; 687 QString temp;
689// temp.sprintf("%d",iD); 688 qDebug( temp.sprintf("%d",iD));
690// qDebug(temp);
691 TEWidget* te = getTe(); 689 TEWidget* te = getTe();
692 Config cfg("Konsole"); 690 Config cfg("Konsole");
693 cfg.setGroup("Menubar"); 691 cfg.setGroup("Menubar");
694 if( iD == -2) { 692 if( iD == -2) {
695 if(!secondToolBar->isHidden()) { 693 if(!secondToolBar->isHidden()) {
696 secondToolBar->hide(); 694 secondToolBar->hide();
697 configMenu->changeItem( iD,"Show Command List"); 695 configMenu->changeItem( iD,"Show Command List");
698 cfg.writeEntry("Hidden","TRUE"); 696 cfg.writeEntry("Hidden","TRUE");
699 configMenu->setItemEnabled(-20 ,FALSE); 697 configMenu->setItemEnabled(-20 ,FALSE);
700 } else { 698 } else {
701 secondToolBar->show(); 699 secondToolBar->show();
702 configMenu->changeItem( iD,"Hide Command List"); 700 configMenu->changeItem( iD,"Hide Command List");
703 cfg.writeEntry("Hidden","FALSE"); 701 cfg.writeEntry("Hidden","FALSE");
704 configMenu->setItemEnabled(-20 ,TRUE); 702 configMenu->setItemEnabled(-20 ,TRUE);
705 703
706 if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { 704 if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") {
707 configMenu->setItemChecked(-20,TRUE); 705 configMenu->setItemChecked(-20,TRUE);
708 commonCombo->setEditable( TRUE ); 706 commonCombo->setEditable( TRUE );
709 } else { 707 } else {
710 configMenu->setItemChecked(-20,FALSE); 708 configMenu->setItemChecked(-20,FALSE);
711 commonCombo->setEditable( FALSE ); 709 commonCombo->setEditable( FALSE );
712 } 710 }
713 } 711 }
714 } 712 }
@@ -730,36 +728,36 @@ void Konsole::configMenuSelected(int iD)
730 cfg.setGroup("Commands"); 728 cfg.setGroup("Commands");
731// qDebug("enableCommandEdit"); 729// qDebug("enableCommandEdit");
732 if( !configMenu->isItemChecked(iD) ) { 730 if( !configMenu->isItemChecked(iD) ) {
733 commonCombo->setEditable( TRUE ); 731 commonCombo->setEditable( TRUE );
734 configMenu->setItemChecked(iD,TRUE); 732 configMenu->setItemChecked(iD,TRUE);
735 commonCombo->setCurrentItem(0); 733 commonCombo->setCurrentItem(0);
736 cfg.writeEntry("EditEnabled","TRUE"); 734 cfg.writeEntry("EditEnabled","TRUE");
737 } else { 735 } else {
738 commonCombo->setEditable( FALSE ); 736 commonCombo->setEditable( FALSE );
739 configMenu->setItemChecked(iD,FALSE); 737 configMenu->setItemChecked(iD,FALSE);
740 cfg.writeEntry("EditEnabled","FALSE"); 738 cfg.writeEntry("EditEnabled","FALSE");
741 commonCombo->setFocusPolicy(QWidget::NoFocus); 739 commonCombo->setFocusPolicy(QWidget::NoFocus);
742 te->setFocus(); 740 te->setFocus();
743 } 741 }
744 } 742 }
745} 743}
746 744
747void Konsole::changeCommand(const QString &text, int c) 745void Konsole::changeCommand(const QString &text, int c)
748{ 746{
749 Config cfg("Konsole"); 747 Config cfg("Konsole");
750 cfg.setGroup("Commands"); 748 cfg.setGroup("Commands");
751 if(commonCmds[c] != text) { 749 if(commonCmds[c] != text) {
752 cfg.writeEntry(QString::number(c),text); 750 cfg.writeEntry(QString::number(c),text);
753 commonCombo->clearEdit(); 751 commonCombo->clearEdit();
754 commonCombo->setCurrentItem(c); 752 commonCombo->setCurrentItem(c);
755 } 753 }
756} 754}
757 755
758void Konsole::setColor() 756void Konsole::setColor()
759{ 757{
760 Config cfg("Konsole"); 758 Config cfg("Konsole");
761 cfg.setGroup("Colors"); 759 cfg.setGroup("Colors");
762 int scheme = cfg.readNumEntry("Schema",1); 760 int scheme = cfg.readNumEntry("Schema",1);
763 if(scheme != 1) colorMenuSelected( -scheme); 761 if(scheme != 1) colorMenuSelected( -scheme);
764 762
765} 763}