summaryrefslogtreecommitdiff
path: root/core/apps/embeddedkonsole/konsole.cpp
Unidiff
Diffstat (limited to 'core/apps/embeddedkonsole/konsole.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp68
1 files changed, 51 insertions, 17 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index 3c87ad4..16db0ea 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -349,28 +349,31 @@ void Konsole::init(const char* _pgm, QStrList & _args)
349// for (int i = 0; commonCmds[i] != NULL; i++) { 349// for (int i = 0; commonCmds[i] != NULL; i++) {
350// commonCombo->insertItem( commonCmds[i], i ); 350// commonCombo->insertItem( commonCmds[i], i );
351// tmp = cfg.readEntry( QString::number(i),""); 351// tmp = cfg.readEntry( QString::number(i),"");
352// if(tmp != "") 352// if(tmp != "")
353// commonCombo->changeItem( tmp,i ); 353// commonCombo->changeItem( tmp,i );
354// } 354// }
355 355
356 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); 356 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) ));
357 357
358 scrollMenu->insertItem(tr( "None" )); 358 scrollMenu->insertItem(tr( "None" ));
359 scrollMenu->insertItem(tr( "Left" )); 359 scrollMenu->insertItem(tr( "Left" ));
360 scrollMenu->insertItem(tr( "Right" )); 360 scrollMenu->insertItem(tr( "Right" ));
361 scrollMenu->insertSeparator(4); 361// scrollMenu->insertSeparator(4);
362 scrollMenu->insertItem(tr( "Horizontal" )); 362// scrollMenu->insertItem(tr( "Horizontal" ));
363 363
364 configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); 364 configMenu->insertItem(tr( "ScrollBar" ),scrollMenu);
365
366 configMenu->insertItem(tr( "Wrap" ));
367
365//scrollMenuSelected(-29); 368//scrollMenuSelected(-29);
366// cfg.setGroup("ScrollBar"); 369// cfg.setGroup("ScrollBar");
367// if(cfg.readBoolEntry("HorzScroll",0)) { 370// if(cfg.readBoolEntry("HorzScroll",0)) {
368// if(cfg.readNumEntry("Position",2) == 0) 371// if(cfg.readNumEntry("Position",2) == 0)
369// te->setScrollbarLocation(1); 372// te->setScrollbarLocation(1);
370// else 373// else
371// te->setScrollbarLocation(0); 374// te->setScrollbarLocation(0);
372// te->setScrollbarLocation( cfg.readNumEntry("Position",2)); 375// te->setScrollbarLocation( cfg.readNumEntry("Position",2));
373// te->setWrapAt(120); 376// te->setWrapAt(120);
374// } 377// }
375 // create applications ///////////////////////////////////////////////////// 378 // create applications /////////////////////////////////////////////////////
376 setCentralWidget(tab); 379 setCentralWidget(tab);
@@ -390,24 +393,25 @@ parseCommandLine();
390 resize(321, 321); // Dummy. 393 resize(321, 321); // Dummy.
391 QSize currentSize = size(); 394 QSize currentSize = size();
392 if (currentSize != size()) 395 if (currentSize != size())
393 defaultSize = size(); 396 defaultSize = size();
394} 397}
395 398
396void Konsole::show() 399void Konsole::show()
397{ 400{
398 if ( !nsessions ) { 401 if ( !nsessions ) {
399 newSession(); 402 newSession();
400 } 403 }
401 QMainWindow::show(); 404 QMainWindow::show();
405
402} 406}
403 407
404void Konsole::initSession(const char*, QStrList &) 408void Konsole::initSession(const char*, QStrList &)
405{ 409{
406 QMainWindow::show(); 410 QMainWindow::show();
407} 411}
408 412
409Konsole::~Konsole() 413Konsole::~Konsole()
410{ 414{
411 while (nsessions > 0) { 415 while (nsessions > 0) {
412 doneSession(getTe()->currentSession, 0); 416 doneSession(getTe()->currentSession, 0);
413 } 417 }
@@ -599,24 +603,25 @@ void Konsole::newSession() {
599 TEWidget* te = new TEWidget(tab); 603 TEWidget* te = new TEWidget(tab);
600// te->setBackgroundMode(PaletteBase); //we want transparent!! 604// te->setBackgroundMode(PaletteBase); //we want transparent!!
601 te->setVTFont(fonts.at(cfont)->getFont()); 605 te->setVTFont(fonts.at(cfont)->getFont());
602 tab->addTab(te); 606 tab->addTab(te);
603 TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); 607 TESession* se = new TESession(this, te, se_pgm, se_args, "xterm");
604 te->currentSession = se; 608 te->currentSession = se;
605 connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) ); 609 connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) );
606 se->run(); 610 se->run();
607 se->setConnect(TRUE); 611 se->setConnect(TRUE);
608 se->setHistory(b_scroll); 612 se->setHistory(b_scroll);
609 tab->setCurrentPage(nsessions); 613 tab->setCurrentPage(nsessions);
610 nsessions++; 614 nsessions++;
615 doWrap();
611 setColor(); 616 setColor();
612 } 617 }
613} 618}
614 619
615TEWidget* Konsole::getTe() { 620TEWidget* Konsole::getTe() {
616 if (nsessions) { 621 if (nsessions) {
617 return (TEWidget *) tab->currentPage(); 622 return (TEWidget *) tab->currentPage();
618 } else { 623 } else {
619 return 0; 624 return 0;
620 } 625 }
621} 626}
622 627
@@ -764,43 +769,57 @@ void Konsole::colorMenuSelected(int iD)
764 else 769 else
765 m_table[i].color = defaultCt[i].color; 770 m_table[i].color = defaultCt[i].color;
766 } 771 }
767 } 772 }
768 lastSelectedMenu = iD; 773 lastSelectedMenu = iD;
769 te->setColorTable(m_table); 774 te->setColorTable(m_table);
770 update(); 775 update();
771 776
772} 777}
773 778
774void Konsole::configMenuSelected(int iD) 779void Konsole::configMenuSelected(int iD)
775{ 780{
776// QString temp; 781 QString temp;
777// qDebug( temp.sprintf("configmenu %d",iD)); 782 qDebug( temp.sprintf("configmenu %d",iD));
778 TEWidget* te = getTe(); 783 TEWidget* te = getTe();
779 Config cfg("Konsole"); 784 Config cfg("Konsole");
780 cfg.setGroup("Menubar"); 785 cfg.setGroup("Menubar");
781 if( iD == -4) { 786 if( iD == -4) {
782 cfg.setGroup("Tabs"); 787 cfg.setGroup("Tabs");
783 QString tmp=cfg.readEntry("Position","Bottom"); 788 QString tmp=cfg.readEntry("Position","Bottom");
784 789
785 if(tmp=="Top") { 790 if(tmp=="Top") {
786 tab->setTabPosition(QTabWidget::Bottom); 791 tab->setTabPosition(QTabWidget::Bottom);
787 configMenu->changeItem( iD,"Tabs on Top"); 792 configMenu->changeItem( iD,"Tabs on Top");
788 cfg.writeEntry("Position","Bottom"); 793 cfg.writeEntry("Position","Bottom");
789 } else { 794 } else {
790 tab->setTabPosition(QTabWidget::Top); 795 tab->setTabPosition(QTabWidget::Top);
791 configMenu->changeItem( iD,"Tabs on Bottom"); 796 configMenu->changeItem( iD,"Tabs on Bottom");
792 cfg.writeEntry("Position","Top"); 797 cfg.writeEntry("Position","Top");
793 } 798 }
794 } 799 }
800 if( iD == -29) {
801 cfg.setGroup("ScrollBar");
802 bool b=cfg.readBoolEntry("HorzScroll",0);
803 b=!b;
804 cfg.writeEntry("HorzScroll", b );
805 cfg.write();
806 doWrap();
807 if(cfg.readNumEntry("Position",2) == 0) {
808 te->setScrollbarLocation(1);
809 } else {
810 te->setScrollbarLocation(0);
811 }
812 te->setScrollbarLocation( cfg.readNumEntry("Position",2));
813 }
795} 814}
796 815
797void Konsole::changeCommand(const QString &text, int c) 816void Konsole::changeCommand(const QString &text, int c)
798{ 817{
799 Config cfg("Konsole"); 818 Config cfg("Konsole");
800 cfg.setGroup("Commands"); 819 cfg.setGroup("Commands");
801 if(commonCmds[c] != text) { 820 if(commonCmds[c] != text) {
802 cfg.writeEntry(QString::number(c),text); 821 cfg.writeEntry(QString::number(c),text);
803 commonCombo->clearEdit(); 822 commonCombo->clearEdit();
804 commonCombo->setCurrentItem(c); 823 commonCombo->setCurrentItem(c);
805 } 824 }
806} 825}
@@ -823,38 +842,39 @@ void Konsole::scrollMenuSelected(int index)
823 case -25: 842 case -25:
824 te->setScrollbarLocation(0); 843 te->setScrollbarLocation(0);
825 cfg.writeEntry("Position",0); 844 cfg.writeEntry("Position",0);
826 break; 845 break;
827 case -26: 846 case -26:
828 te->setScrollbarLocation(1); 847 te->setScrollbarLocation(1);
829 cfg.writeEntry("Position",1); 848 cfg.writeEntry("Position",1);
830 break; 849 break;
831 case -27: 850 case -27:
832 te->setScrollbarLocation(2); 851 te->setScrollbarLocation(2);
833 cfg.writeEntry("Position",2); 852 cfg.writeEntry("Position",2);
834 break; 853 break;
835 case -29: { 854// case -29: {
836 bool b=cfg.readBoolEntry("HorzScroll",0); 855// bool b=cfg.readBoolEntry("HorzScroll",0);
837 cfg.writeEntry("HorzScroll", !b ); 856// cfg.writeEntry("HorzScroll", !b );
838 cfg.write(); 857// cfg.write();
839 if(cfg.readNumEntry("Position",2) == 0) 858// if(cfg.readNumEntry("Position",2) == 0) {
840 te->setScrollbarLocation(1); 859// te->setScrollbarLocation(1);
841 else 860// te->setWrapAt(0);
842 te->setScrollbarLocation(0); 861// } else {
843 te->setScrollbarLocation( cfg.readNumEntry("Position",2)); 862// te->setScrollbarLocation(0);
844 te->setWrapAt(120); 863// te->setWrapAt(120);
845 } 864// }
846 break; 865// te->setScrollbarLocation( cfg.readNumEntry("Position",2));
866// }
867// break;
847 }; 868 };
848
849} 869}
850 870
851void Konsole::editCommandListMenuSelected(int iD) 871void Konsole::editCommandListMenuSelected(int iD)
852{ 872{
853// QString temp; 873// QString temp;
854// qDebug( temp.sprintf("edit command list %d",iD)); 874// qDebug( temp.sprintf("edit command list %d",iD));
855 TEWidget* te = getTe(); 875 TEWidget* te = getTe();
856 Config cfg("Konsole"); 876 Config cfg("Konsole");
857 cfg.setGroup("Menubar"); 877 cfg.setGroup("Menubar");
858 if( iD == -3) { 878 if( iD == -3) {
859 if(!secondToolBar->isHidden()) { 879 if(!secondToolBar->isHidden()) {
860 secondToolBar->hide(); 880 secondToolBar->hide();
@@ -962,12 +982,26 @@ void Konsole::changeBackgroundColor(const QColor &color) {
962 982
963 qDebug("Change background"); 983 qDebug("Change background");
964 Config cfg("Konsole"); 984 Config cfg("Konsole");
965 cfg.setGroup("Colors"); 985 cfg.setGroup("Colors");
966 int r, g, b; 986 int r, g, b;
967 color.rgb(&r,&g,&b); 987 color.rgb(&r,&g,&b);
968 background.setRgb(r,g,b); 988 background.setRgb(r,g,b);
969// QString colors; 989// QString colors;
970// colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); 990// colors.sprintf("%d,%d,%d"color.red,color.green,color.blue);
971 cfg.writeEntry("background",color.name()); 991 cfg.writeEntry("background",color.name());
972 cfg.write(); 992 cfg.write();
973} 993}
994
995void Konsole::doWrap() {
996 Config cfg("Konsole");
997 cfg.setGroup("ScrollBar");
998 TEWidget* te = getTe();
999 if( !cfg.readBoolEntry("HorzScroll",0)) {
1000 te->setWrapAt(0);
1001 configMenu->setItemChecked(-29,FALSE);
1002 } else {
1003 te->setWrapAt(90);
1004// te->setWrapAt(120);
1005 configMenu->setItemChecked(-29,TRUE);
1006 }
1007}