-rw-r--r-- | core/apps/embeddedkonsole/TEWidget.cpp | 7 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/TEWidget.h | 11 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 68 |
3 files changed, 47 insertions, 39 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp index 4c6ea2a..c220e11 100644 --- a/core/apps/embeddedkonsole/TEWidget.cpp +++ b/core/apps/embeddedkonsole/TEWidget.cpp | |||
@@ -323,25 +323,26 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) | |||
323 | blinking = TRUE; | 323 | blinking = TRUE; |
324 | 324 | ||
325 | resizing = FALSE; | 325 | resizing = FALSE; |
326 | actSel = 0; | 326 | actSel = 0; |
327 | image = 0; | 327 | image = 0; |
328 | lines = 1; | 328 | lines = 1; |
329 | columns = 1; | 329 | columns = 1; |
330 | font_w = 1; | 330 | font_w = 1; |
331 | font_h = 1; | 331 | font_h = 1; |
332 | font_a = 1; | 332 | font_a = 1; |
333 | word_selection_mode = FALSE; | 333 | word_selection_mode = FALSE; |
334 | hposition = 0; | 334 | hposition = 0; |
335 | vcolumns = 0; | 335 | vcolumns = 0; |
336 | useBeep = true; | ||
336 | 337 | ||
337 | setMouseMarks(TRUE); | 338 | setMouseMarks(TRUE); |
338 | setVTFont( QFont("fixed") ); | 339 | setVTFont( QFont("fixed") ); |
339 | setColorTable(base_color_table); // init color table | 340 | setColorTable(base_color_table); // init color table |
340 | 341 | ||
341 | qApp->installEventFilter( this ); //FIXME: see below | 342 | qApp->installEventFilter( this ); //FIXME: see below |
342 | // KCursor::setAutoHideCursor( this, true ); | 343 | // KCursor::setAutoHideCursor( this, true ); |
343 | 344 | ||
344 | // Init DnD //////////////////////////////////////////////////////////////// | 345 | // Init DnD //////////////////////////////////////////////////////////////// |
345 | currentSession = NULL; | 346 | currentSession = NULL; |
346 | // setAcceptDrops(true); // attempt | 347 | // setAcceptDrops(true); // attempt |
347 | // m_drop = new QPopupMenu(this); | 348 | // m_drop = new QPopupMenu(this); |
@@ -1098,25 +1099,27 @@ void TEWidget::frameChanged() | |||
1098 | } | 1099 | } |
1099 | 1100 | ||
1100 | /* ------------------------------------------------------------------------- */ | 1101 | /* ------------------------------------------------------------------------- */ |
1101 | /* */ | 1102 | /* */ |
1102 | /* Sound */ | 1103 | /* Sound */ |
1103 | /* */ | 1104 | /* */ |
1104 | /* ------------------------------------------------------------------------- */ | 1105 | /* ------------------------------------------------------------------------- */ |
1105 | 1106 | ||
1106 | void TEWidget::Bell() | 1107 | void TEWidget::Bell() |
1107 | { | 1108 | { |
1108 | //#ifdef QT_QWS_SHARP | 1109 | //#ifdef QT_QWS_SHARP |
1109 | //# ifndef QT_NO_COP | 1110 | //# ifndef QT_NO_COP |
1110 | QCopEnvelope( "QPE/TaskBar", "soundAlarm()" ); | 1111 | if(useBeep) |
1112 | QCopEnvelope( "QPE/TaskBar", "soundAlarm()" ); | ||
1113 | |||
1111 | //# endif | 1114 | //# endif |
1112 | //#else | 1115 | //#else |
1113 | //# ifndef QT_NO_SOUND | 1116 | //# ifndef QT_NO_SOUND |
1114 | // QSound::play(Resource::findSound("alarm")); | 1117 | // QSound::play(Resource::findSound("alarm")); |
1115 | //# endif | 1118 | //# endif |
1116 | //#endif | 1119 | //#endif |
1117 | 1120 | ||
1118 | // QApplication::beep(); | 1121 | // QApplication::beep(); |
1119 | } | 1122 | } |
1120 | 1123 | ||
1121 | /* ------------------------------------------------------------------------- */ | 1124 | /* ------------------------------------------------------------------------- */ |
1122 | /* */ | 1125 | /* */ |
diff --git a/core/apps/embeddedkonsole/TEWidget.h b/core/apps/embeddedkonsole/TEWidget.h index a480d45..5597f27 100644 --- a/core/apps/embeddedkonsole/TEWidget.h +++ b/core/apps/embeddedkonsole/TEWidget.h | |||
@@ -44,52 +44,45 @@ class TEWidget : public QFrame | |||
44 | public: | 44 | public: |
45 | 45 | ||
46 | TEWidget(QWidget *parent=0, const char *name=0); | 46 | TEWidget(QWidget *parent=0, const char *name=0); |
47 | virtual ~TEWidget(); | 47 | virtual ~TEWidget(); |
48 | 48 | ||
49 | public: | 49 | public: |
50 | 50 | ||
51 | QColor getDefaultBackColor(); | 51 | QColor getDefaultBackColor(); |
52 | 52 | ||
53 | const ColorEntry* getColorTable() const; | 53 | const ColorEntry* getColorTable() const; |
54 | const ColorEntry* getdefaultColorTable() const; | 54 | const ColorEntry* getdefaultColorTable() const; |
55 | void setColorTable(const ColorEntry table[]); | 55 | void setColorTable(const ColorEntry table[]); |
56 | |||
57 | void setScrollbarLocation(int loc); | 56 | void setScrollbarLocation(int loc); |
58 | enum { SCRNONE=0, SCRLEFT=1, SCRRIGHT=2 }; | 57 | enum { SCRNONE=0, SCRLEFT=1, SCRRIGHT=2 }; |
59 | |||
60 | void setScroll(int cursor, int lines); | 58 | void setScroll(int cursor, int lines); |
61 | void doScroll(int lines); | 59 | void doScroll(int lines); |
62 | |||
63 | void doHScroll(int lines); | 60 | void doHScroll(int lines); |
64 | |||
65 | |||
66 | void emitSelection(); | 61 | void emitSelection(); |
67 | void setWrapAt(int columns); | 62 | void setWrapAt(int columns); |
68 | |||
69 | public: | ||
70 | 63 | ||
71 | void setImage(const ca* const newimg, int lines, int columns); | 64 | void setImage(const ca* const newimg, int lines, int columns); |
72 | 65 | ||
73 | int Lines() { return lines; } | 66 | int Lines() { return lines; } |
74 | int Columns() { return columns; } | 67 | int Columns() { return columns; } |
75 | 68 | ||
76 | void calcGeometry(); | 69 | void calcGeometry(); |
77 | void propagateSize(); | 70 | void propagateSize(); |
78 | QSize calcSize(int cols, int lins) const; | 71 | QSize calcSize(int cols, int lins) const; |
79 | 72 | ||
80 | QSize sizeHint() const; | 73 | QSize sizeHint() const; |
81 | 74 | ||
82 | public: | ||
83 | bool useHorzScroll; | 75 | bool useHorzScroll; |
76 | bool useBeep; | ||
84 | 77 | ||
85 | void Bell(); | 78 | void Bell(); |
86 | void emitText(QString text); | 79 | void emitText(QString text); |
87 | void pasteClipboard(); | 80 | void pasteClipboard(); |
88 | 81 | ||
89 | signals: | 82 | signals: |
90 | 83 | ||
91 | void keyPressedSignal(QKeyEvent *e); | 84 | void keyPressedSignal(QKeyEvent *e); |
92 | void mouseSignal(int cb, int cx, int cy); | 85 | void mouseSignal(int cb, int cx, int cy); |
93 | void changedImageSizeSignal(int lines, int columns); | 86 | void changedImageSizeSignal(int lines, int columns); |
94 | void changedHistoryCursor(int value); | 87 | void changedHistoryCursor(int value); |
95 | void changedHorzCursor(int value); | 88 | void changedHorzCursor(int value); |
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 5a68c81..ebff05e 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -362,24 +362,28 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
362 | 362 | ||
363 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); | 363 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); |
364 | 364 | ||
365 | scrollMenu->insertItem(tr( "None" )); | 365 | scrollMenu->insertItem(tr( "None" )); |
366 | scrollMenu->insertItem(tr( "Left" )); | 366 | scrollMenu->insertItem(tr( "Left" )); |
367 | scrollMenu->insertItem(tr( "Right" )); | 367 | scrollMenu->insertItem(tr( "Right" )); |
368 | // scrollMenu->insertSeparator(4); | 368 | // scrollMenu->insertSeparator(4); |
369 | // scrollMenu->insertItem(tr( "Horizontal" )); | 369 | // scrollMenu->insertItem(tr( "Horizontal" )); |
370 | 370 | ||
371 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); | 371 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); |
372 | 372 | ||
373 | configMenu->insertItem(tr( "Wrap" )); | 373 | configMenu->insertItem(tr( "Wrap" )); |
374 | int jut = configMenu->insertItem(tr( "Use Beep" )); | ||
375 | cfg.setGroup("Menubar"); | ||
376 | configMenu->setItemChecked(jut, cfg.readBoolEntry("useBeep",0)); | ||
377 | |||
374 | 378 | ||
375 | //scrollMenuSelected(-29); | 379 | //scrollMenuSelected(-29); |
376 | // cfg.setGroup("ScrollBar"); | 380 | // cfg.setGroup("ScrollBar"); |
377 | // if(cfg.readBoolEntry("HorzScroll",0)) { | 381 | // if(cfg.readBoolEntry("HorzScroll",0)) { |
378 | // if(cfg.readNumEntry("Position",2) == 0) | 382 | // if(cfg.readNumEntry("Position",2) == 0) |
379 | // te->setScrollbarLocation(1); | 383 | // te->setScrollbarLocation(1); |
380 | // else | 384 | // else |
381 | // te->setScrollbarLocation(0); | 385 | // te->setScrollbarLocation(0); |
382 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 386 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
383 | // te->setWrapAt(120); | 387 | // te->setWrapAt(120); |
384 | // } | 388 | // } |
385 | // create applications ///////////////////////////////////////////////////// | 389 | // create applications ///////////////////////////////////////////////////// |
@@ -778,64 +782,73 @@ void Konsole::colorMenuSelected(int iD) | |||
778 | else | 782 | else |
779 | m_table[i].color = defaultCt[i].color; | 783 | m_table[i].color = defaultCt[i].color; |
780 | } | 784 | } |
781 | } | 785 | } |
782 | lastSelectedMenu = iD; | 786 | lastSelectedMenu = iD; |
783 | te->setColorTable(m_table); | 787 | te->setColorTable(m_table); |
784 | update(); | 788 | update(); |
785 | 789 | ||
786 | } | 790 | } |
787 | 791 | ||
788 | void Konsole::configMenuSelected(int iD) | 792 | void Konsole::configMenuSelected(int iD) |
789 | { | 793 | { |
790 | // QString temp; | 794 | // QString temp; |
791 | // qDebug( temp.sprintf("configmenu %d",iD)); | 795 | // qDebug( temp.sprintf("configmenu %d",iD)); |
792 | TEWidget* te = getTe(); | 796 | TEWidget* te = getTe(); |
793 | Config cfg("Konsole"); | 797 | Config cfg("Konsole"); |
794 | cfg.setGroup("Menubar"); | 798 | cfg.setGroup("Menubar"); |
795 | if( iD == -4) { | 799 | int i,j; |
796 | cfg.setGroup("Tabs"); | ||
797 | QString tmp=cfg.readEntry("Position","Bottom"); | ||
798 | |||
799 | if(tmp=="Top") { | ||
800 | tab->setTabPosition(QTabWidget::Bottom); | ||
801 | configMenu->changeItem( iD,"Tabs on Top"); | ||
802 | cfg.writeEntry("Position","Bottom"); | ||
803 | } else { | ||
804 | tab->setTabPosition(QTabWidget::Top); | ||
805 | configMenu->changeItem( iD,"Tabs on Bottom"); | ||
806 | cfg.writeEntry("Position","Top"); | ||
807 | } | ||
808 | } | ||
809 | int i; | ||
810 | #ifdef QWS_QT_OPIE | 800 | #ifdef QWS_QT_OPIE |
811 | i=-29; | 801 | i=-29;j=-30; |
812 | #else | 802 | #else |
813 | i=-28; | 803 | i=-28;j=-29; |
814 | #endif | 804 | #endif |
815 | 805 | ||
816 | if( iD == i) { | 806 | if(iD == -4) { |
817 | cfg.setGroup("ScrollBar"); | 807 | cfg.setGroup("Tabs"); |
808 | QString tmp=cfg.readEntry("Position","Bottom"); | ||
809 | |||
810 | if(tmp=="Top") { | ||
811 | tab->setTabPosition(QTabWidget::Bottom); | ||
812 | configMenu->changeItem( iD,"Tabs on Top"); | ||
813 | cfg.writeEntry("Position","Bottom"); | ||
814 | } else { | ||
815 | tab->setTabPosition(QTabWidget::Top); | ||
816 | configMenu->changeItem( iD,"Tabs on Bottom"); | ||
817 | cfg.writeEntry("Position","Top"); | ||
818 | } | ||
819 | } | ||
820 | if(iD == i) { | ||
821 | cfg.setGroup("ScrollBar"); | ||
818 | bool b=cfg.readBoolEntry("HorzScroll",0); | 822 | bool b=cfg.readBoolEntry("HorzScroll",0); |
819 | b=!b; | 823 | b=!b; |
820 | cfg.writeEntry("HorzScroll", b ); | 824 | cfg.writeEntry("HorzScroll", b ); |
821 | cfg.write(); | 825 | cfg.write(); |
822 | doWrap(); | 826 | doWrap(); |
823 | if(cfg.readNumEntry("Position",2) == 0) { | 827 | if(cfg.readNumEntry("Position",2) == 0) { |
824 | te->setScrollbarLocation(1); | 828 | te->setScrollbarLocation(1); |
825 | } else { | 829 | } else { |
826 | te->setScrollbarLocation(0); | 830 | te->setScrollbarLocation(0); |
827 | } | 831 | } |
828 | te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 832 | te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
829 | } | 833 | } |
834 | if(iD == j) { | ||
835 | cfg.setGroup("Menubar"); | ||
836 | bool b=cfg.readBoolEntry("useBeep",0); | ||
837 | b=!b; | ||
838 | cfg.writeEntry("useBeep", b ); | ||
839 | cfg.write(); | ||
840 | configMenu->setItemChecked(j,b); | ||
841 | te->useBeep=b; | ||
842 | } | ||
830 | } | 843 | } |
831 | 844 | ||
832 | void Konsole::changeCommand(const QString &text, int c) | 845 | void Konsole::changeCommand(const QString &text, int c) |
833 | { | 846 | { |
834 | Config cfg("Konsole"); | 847 | Config cfg("Konsole"); |
835 | cfg.setGroup("Commands"); | 848 | cfg.setGroup("Commands"); |
836 | if(commonCmds[c] != text) { | 849 | if(commonCmds[c] != text) { |
837 | cfg.writeEntry(QString::number(c),text); | 850 | cfg.writeEntry(QString::number(c),text); |
838 | commonCombo->clearEdit(); | 851 | commonCombo->clearEdit(); |
839 | commonCombo->setCurrentItem(c); | 852 | commonCombo->setCurrentItem(c); |
840 | } | 853 | } |
841 | } | 854 | } |
@@ -972,61 +985,60 @@ void Konsole::parseCommandLine() { | |||
972 | exit(0);//close(); | 985 | exit(0);//close(); |
973 | } // end -e switch | 986 | } // end -e switch |
974 | } | 987 | } |
975 | startUp++; | 988 | startUp++; |
976 | } | 989 | } |
977 | 990 | ||
978 | void Konsole::changeForegroundColor(const QColor &color) { | 991 | void Konsole::changeForegroundColor(const QColor &color) { |
979 | Config cfg("Konsole"); | 992 | Config cfg("Konsole"); |
980 | cfg.setGroup("Colors"); | 993 | cfg.setGroup("Colors"); |
981 | int r, g, b; | 994 | int r, g, b; |
982 | color.rgb(&r,&g,&b); | 995 | color.rgb(&r,&g,&b); |
983 | foreground.setRgb(r,g,b); | 996 | foreground.setRgb(r,g,b); |
984 | // QString colors; | 997 | |
985 | // colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); | ||
986 | cfg.writeEntry("foreground",color.name()); | 998 | cfg.writeEntry("foreground",color.name()); |
999 | qDebug("foreground "+color.name()); | ||
987 | cfg.write(); | 1000 | cfg.write(); |
988 | 1001 | ||
989 | qDebug("do other dialog"); | 1002 | qDebug("do other dialog"); |
990 | #ifdef QWS_QT_OPIE | 1003 | #ifdef QWS_QT_OPIE |
991 | 1004 | ||
992 | ColorPopupMenu* penColorPopupMenu2 = new ColorPopupMenu(Qt::black, this,"background color"); | 1005 | ColorPopupMenu* penColorPopupMenu2 = new ColorPopupMenu(Qt::black, this,"background color"); |
993 | connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, | 1006 | connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, |
994 | SLOT(changeBackgroundColor(const QColor&))); | 1007 | SLOT(changeBackgroundColor(const QColor&))); |
995 | penColorPopupMenu2->exec(); | 1008 | penColorPopupMenu2->exec(); |
996 | #endif | 1009 | #endif |
997 | } | 1010 | } |
998 | 1011 | ||
999 | void Konsole::changeBackgroundColor(const QColor &color) { | 1012 | void Konsole::changeBackgroundColor(const QColor &color) { |
1000 | 1013 | ||
1001 | qDebug("Change background"); | 1014 | qDebug("Change background"); |
1002 | Config cfg("Konsole"); | 1015 | Config cfg("Konsole"); |
1003 | cfg.setGroup("Colors"); | 1016 | cfg.setGroup("Colors"); |
1004 | int r, g, b; | 1017 | int r, g, b; |
1005 | color.rgb(&r,&g,&b); | 1018 | color.rgb(&r,&g,&b); |
1006 | background.setRgb(r,g,b); | 1019 | background.setRgb(r,g,b); |
1007 | // QString colors; | ||
1008 | // colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); | ||
1009 | cfg.writeEntry("background",color.name()); | 1020 | cfg.writeEntry("background",color.name()); |
1021 | qDebug("background "+color.name()); | ||
1010 | cfg.write(); | 1022 | cfg.write(); |
1011 | } | 1023 | } |
1012 | 1024 | ||
1013 | void Konsole::doWrap() { | 1025 | void Konsole::doWrap() { |
1014 | int i; | 1026 | int i; |
1015 | #ifdef QWS_QT_OPIE | 1027 | #ifdef QWS_QT_OPIE |
1016 | i=-29; | 1028 | i=-29; |
1017 | #else | 1029 | #else |
1018 | i=-28; | 1030 | i=-28; |
1019 | #endif | 1031 | #endif |
1020 | 1032 | ||
1021 | Config cfg("Konsole"); | 1033 | Config cfg("Konsole"); |
1022 | cfg.setGroup("ScrollBar"); | 1034 | cfg.setGroup("ScrollBar"); |
1023 | TEWidget* te = getTe(); | 1035 | TEWidget* te = getTe(); |
1024 | if( !cfg.readBoolEntry("HorzScroll",0)) { | 1036 | if( !cfg.readBoolEntry("HorzScroll",0)) { |
1025 | te->setWrapAt(0); | 1037 | te->setWrapAt(0); |
1026 | configMenu->setItemChecked( i,TRUE); | 1038 | configMenu->setItemChecked( i,TRUE); |
1027 | } else { | 1039 | } else { |
1028 | te->setWrapAt(90); | 1040 | // te->setWrapAt(90); |
1029 | // te->setWrapAt(120); | 1041 | te->setWrapAt(120); |
1030 | configMenu->setItemChecked( i,FALSE); | 1042 | configMenu->setItemChecked( i,FALSE); |
1031 | } | 1043 | } |
1032 | } | 1044 | } |