-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 16db0ea..06bee33 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -16,12 +16,13 @@ | |||
16 | /* Ported Konsole to Qt/Embedded */ | 16 | /* Ported Konsole to Qt/Embedded */ |
17 | /* */ | 17 | /* */ |
18 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | 18 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ |
19 | /* */ | 19 | /* */ |
20 | /* -------------------------------------------------------------------------- */ | 20 | /* -------------------------------------------------------------------------- */ |
21 | // enhancements added by L.J. Potter <ljp@llornkcor.com> | 21 | // enhancements added by L.J. Potter <ljp@llornkcor.com> |
22 | #define QWS_QT_OPIE | ||
22 | 23 | ||
23 | #include <qpe/resource.h> | 24 | #include <qpe/resource.h> |
24 | 25 | ||
25 | #include <qdir.h> | 26 | #include <qdir.h> |
26 | #include <qevent.h> | 27 | #include <qevent.h> |
27 | #include <qdragobject.h> | 28 | #include <qdragobject.h> |
@@ -51,13 +52,15 @@ | |||
51 | #include <assert.h> | 52 | #include <assert.h> |
52 | 53 | ||
53 | #include "konsole.h" | 54 | #include "konsole.h" |
54 | #include "keytrans.h" | 55 | #include "keytrans.h" |
55 | #include "commandeditdialog.h" | 56 | #include "commandeditdialog.h" |
56 | 57 | ||
58 | #ifdef QWS_QT_OPIE | ||
57 | #include <opie/colorpopupmenu.h> | 59 | #include <opie/colorpopupmenu.h> |
60 | #endif | ||
58 | 61 | ||
59 | class EKNumTabBar : public QTabBar { | 62 | class EKNumTabBar : public QTabBar { |
60 | public: | 63 | public: |
61 | void numberTabs() | 64 | void numberTabs() |
62 | { | 65 | { |
63 | // Yes, it really is this messy. QTabWidget needs functions | 66 | // Yes, it really is this messy. QTabWidget needs functions |
@@ -289,13 +292,17 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
289 | colorMenu->insertItem(tr( "Blue on Magenta")); | 292 | colorMenu->insertItem(tr( "Blue on Magenta")); |
290 | colorMenu->insertItem(tr( "Magenta on Blue")); | 293 | colorMenu->insertItem(tr( "Magenta on Blue")); |
291 | colorMenu->insertItem(tr( "Cyan on White")); | 294 | colorMenu->insertItem(tr( "Cyan on White")); |
292 | colorMenu->insertItem(tr( "White on Cyan")); | 295 | colorMenu->insertItem(tr( "White on Cyan")); |
293 | colorMenu->insertItem(tr( "Blue on Black")); | 296 | colorMenu->insertItem(tr( "Blue on Black")); |
294 | colorMenu->insertItem(tr( "Amber on Black")); | 297 | colorMenu->insertItem(tr( "Amber on Black")); |
298 | |||
299 | #ifdef QWS_QT_OPIE | ||
295 | colorMenu->insertItem(tr( "Custom")); | 300 | colorMenu->insertItem(tr( "Custom")); |
301 | #endif | ||
302 | |||
296 | configMenu->insertItem(tr( "Colors") ,colorMenu); | 303 | configMenu->insertItem(tr( "Colors") ,colorMenu); |
297 | 304 | ||
298 | connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); | 305 | connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); |
299 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); | 306 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); |
300 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); | 307 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); |
301 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); | 308 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); |
@@ -739,13 +746,15 @@ void Konsole::colorMenuSelected(int iD) | |||
739 | if(iD==-18) {// Black, Gold | 746 | if(iD==-18) {// Black, Gold |
740 | background.setRgb(0x00,0x00,0x00); | 747 | background.setRgb(0x00,0x00,0x00); |
741 | foreground.setRgb(255,215,0); | 748 | foreground.setRgb(255,215,0); |
742 | cfg.writeEntry("Schema","18"); | 749 | cfg.writeEntry("Schema","18"); |
743 | colorMenu->setItemChecked(-18,TRUE); | 750 | colorMenu->setItemChecked(-18,TRUE); |
744 | } | 751 | } |
745 | if(iD==-19) {// Custom | 752 | #ifdef QWS_QT_OPIE |
753 | if(iD==-19) { | ||
754 | // Custom | ||
746 | qDebug("do custom"); | 755 | qDebug("do custom"); |
747 | if(fromMenu) { | 756 | if(fromMenu) { |
748 | ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color"); | 757 | ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color"); |
749 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, | 758 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, |
750 | SLOT(changeForegroundColor(const QColor&))); | 759 | SLOT(changeForegroundColor(const QColor&))); |
751 | penColorPopupMenu->exec(); | 760 | penColorPopupMenu->exec(); |
@@ -755,13 +764,13 @@ void Konsole::colorMenuSelected(int iD) | |||
755 | foreground.setNamedColor(cfg.readEntry("foreground","")); | 764 | foreground.setNamedColor(cfg.readEntry("foreground","")); |
756 | background.setNamedColor(cfg.readEntry("background","")); | 765 | background.setNamedColor(cfg.readEntry("background","")); |
757 | } | 766 | } |
758 | fromMenu=FALSE; | 767 | fromMenu=FALSE; |
759 | colorMenu->setItemChecked(-19,TRUE); | 768 | colorMenu->setItemChecked(-19,TRUE); |
760 | } | 769 | } |
761 | 770 | #endif | |
762 | for (i = 0; i < TABLE_COLORS; i++) { | 771 | for (i = 0; i < TABLE_COLORS; i++) { |
763 | if(i==0 || i == 10) { | 772 | if(i==0 || i == 10) { |
764 | m_table[i].color = foreground; | 773 | m_table[i].color = foreground; |
765 | } | 774 | } |
766 | else if(i==1 || i == 11) { | 775 | else if(i==1 || i == 11) { |
767 | m_table[i].color = background; m_table[i].transparent=0; | 776 | m_table[i].color = background; m_table[i].transparent=0; |
@@ -775,14 +784,14 @@ void Konsole::colorMenuSelected(int iD) | |||
775 | update(); | 784 | update(); |
776 | 785 | ||
777 | } | 786 | } |
778 | 787 | ||
779 | void Konsole::configMenuSelected(int iD) | 788 | void Konsole::configMenuSelected(int iD) |
780 | { | 789 | { |
781 | QString temp; | 790 | // QString temp; |
782 | qDebug( temp.sprintf("configmenu %d",iD)); | 791 | // qDebug( temp.sprintf("configmenu %d",iD)); |
783 | TEWidget* te = getTe(); | 792 | TEWidget* te = getTe(); |
784 | Config cfg("Konsole"); | 793 | Config cfg("Konsole"); |
785 | cfg.setGroup("Menubar"); | 794 | cfg.setGroup("Menubar"); |
786 | if( iD == -4) { | 795 | if( iD == -4) { |
787 | cfg.setGroup("Tabs"); | 796 | cfg.setGroup("Tabs"); |
788 | QString tmp=cfg.readEntry("Position","Bottom"); | 797 | QString tmp=cfg.readEntry("Position","Bottom"); |
@@ -794,13 +803,20 @@ void Konsole::configMenuSelected(int iD) | |||
794 | } else { | 803 | } else { |
795 | tab->setTabPosition(QTabWidget::Top); | 804 | tab->setTabPosition(QTabWidget::Top); |
796 | configMenu->changeItem( iD,"Tabs on Bottom"); | 805 | configMenu->changeItem( iD,"Tabs on Bottom"); |
797 | cfg.writeEntry("Position","Top"); | 806 | cfg.writeEntry("Position","Top"); |
798 | } | 807 | } |
799 | } | 808 | } |
800 | if( iD == -29) { | 809 | int i; |
810 | #ifdef QWS_QT_OPIE | ||
811 | i=-29; | ||
812 | #else | ||
813 | i=-28; | ||
814 | #endif | ||
815 | |||
816 | if( iD == i) { | ||
801 | cfg.setGroup("ScrollBar"); | 817 | cfg.setGroup("ScrollBar"); |
802 | bool b=cfg.readBoolEntry("HorzScroll",0); | 818 | bool b=cfg.readBoolEntry("HorzScroll",0); |
803 | b=!b; | 819 | b=!b; |
804 | cfg.writeEntry("HorzScroll", b ); | 820 | cfg.writeEntry("HorzScroll", b ); |
805 | cfg.write(); | 821 | cfg.write(); |
806 | doWrap(); | 822 | doWrap(); |
@@ -968,17 +984,19 @@ void Konsole::changeForegroundColor(const QColor &color) { | |||
968 | // QString colors; | 984 | // QString colors; |
969 | // colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); | 985 | // colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); |
970 | cfg.writeEntry("foreground",color.name()); | 986 | cfg.writeEntry("foreground",color.name()); |
971 | cfg.write(); | 987 | cfg.write(); |
972 | 988 | ||
973 | qDebug("do other dialog"); | 989 | qDebug("do other dialog"); |
990 | #ifdef QWS_QT_OPIE | ||
991 | |||
974 | ColorPopupMenu* penColorPopupMenu2 = new ColorPopupMenu(Qt::black, this,"background color"); | 992 | ColorPopupMenu* penColorPopupMenu2 = new ColorPopupMenu(Qt::black, this,"background color"); |
975 | connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, | 993 | connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, |
976 | SLOT(changeBackgroundColor(const QColor&))); | 994 | SLOT(changeBackgroundColor(const QColor&))); |
977 | penColorPopupMenu2->exec(); | 995 | penColorPopupMenu2->exec(); |
978 | 996 | #endif | |
979 | } | 997 | } |
980 | 998 | ||
981 | void Konsole::changeBackgroundColor(const QColor &color) { | 999 | void Konsole::changeBackgroundColor(const QColor &color) { |
982 | 1000 | ||
983 | qDebug("Change background"); | 1001 | qDebug("Change background"); |
984 | Config cfg("Konsole"); | 1002 | Config cfg("Konsole"); |
@@ -990,18 +1008,25 @@ void Konsole::changeBackgroundColor(const QColor &color) { | |||
990 | // colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); | 1008 | // colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); |
991 | cfg.writeEntry("background",color.name()); | 1009 | cfg.writeEntry("background",color.name()); |
992 | cfg.write(); | 1010 | cfg.write(); |
993 | } | 1011 | } |
994 | 1012 | ||
995 | void Konsole::doWrap() { | 1013 | void Konsole::doWrap() { |
996 | Config cfg("Konsole"); | 1014 | int i; |
1015 | #ifdef QWS_QT_OPIE | ||
1016 | i=-29; | ||
1017 | #else | ||
1018 | i=-28; | ||
1019 | #endif | ||
1020 | |||
1021 | Config cfg("Konsole"); | ||
997 | cfg.setGroup("ScrollBar"); | 1022 | cfg.setGroup("ScrollBar"); |
998 | TEWidget* te = getTe(); | 1023 | TEWidget* te = getTe(); |
999 | if( !cfg.readBoolEntry("HorzScroll",0)) { | 1024 | if( !cfg.readBoolEntry("HorzScroll",0)) { |
1000 | te->setWrapAt(0); | 1025 | te->setWrapAt(0); |
1001 | configMenu->setItemChecked(-29,FALSE); | 1026 | configMenu->setItemChecked( i,FALSE); |
1002 | } else { | 1027 | } else { |
1003 | te->setWrapAt(90); | 1028 | te->setWrapAt(90); |
1004 | // te->setWrapAt(120); | 1029 | // te->setWrapAt(120); |
1005 | configMenu->setItemChecked(-29,TRUE); | 1030 | configMenu->setItemChecked( i,TRUE); |
1006 | } | 1031 | } |
1007 | } | 1032 | } |