author | ar <ar> | 2004-05-02 16:22:24 (UTC) |
---|---|---|
committer | ar <ar> | 2004-05-02 16:22:24 (UTC) |
commit | 34f1234b010fa80f9ca06e65f46130713f7362d9 (patch) (unidiff) | |
tree | 6ded6dcd83ed00b436f312f2403f7afc9f399435 | |
parent | 4e7ab937501b6495ce5635a7515e66a75e04d37e (diff) | |
download | opie-34f1234b010fa80f9ca06e65f46130713f7362d9.zip opie-34f1234b010fa80f9ca06e65f46130713f7362d9.tar.gz opie-34f1234b010fa80f9ca06e65f46130713f7362d9.tar.bz2 |
- convert qDebug to odebug
-rw-r--r-- | core/apps/embeddedkonsole/TEScreen.cpp | 2 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/TEWidget.cpp | 6 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/commandeditdialog.cpp | 4 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 41 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/main.cpp | 8 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/playlistselection.cpp | 11 |
6 files changed, 38 insertions, 34 deletions
diff --git a/core/apps/embeddedkonsole/TEScreen.cpp b/core/apps/embeddedkonsole/TEScreen.cpp index 3dbcec2..8e69a88 100644 --- a/core/apps/embeddedkonsole/TEScreen.cpp +++ b/core/apps/embeddedkonsole/TEScreen.cpp | |||
@@ -8,129 +8,129 @@ | |||
8 | /* */ | 8 | /* */ |
9 | /* This file is part of Konsole - an X terminal for KDE */ | 9 | /* This file is part of Konsole - an X terminal for KDE */ |
10 | /* */ | 10 | /* */ |
11 | /* -------------------------------------------------------------------------- */ | 11 | /* -------------------------------------------------------------------------- */ |
12 | /* */ | 12 | /* */ |
13 | /* Ported Konsole to Qt/Embedded */ | 13 | /* Ported Konsole to Qt/Embedded */ |
14 | /* */ | 14 | /* */ |
15 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | 15 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ |
16 | /* */ | 16 | /* */ |
17 | /* -------------------------------------------------------------------------- */ | 17 | /* -------------------------------------------------------------------------- */ |
18 | // enhancements added by L.J. Potter <ljp@llornkcor.com> | 18 | // enhancements added by L.J. Potter <ljp@llornkcor.com> |
19 | 19 | ||
20 | /*! \file | 20 | /*! \file |
21 | */ | 21 | */ |
22 | 22 | ||
23 | /*! \class TEScreen | 23 | /*! \class TEScreen |
24 | 24 | ||
25 | \brief The image manipulated by the emulation. | 25 | \brief The image manipulated by the emulation. |
26 | 26 | ||
27 | This class implements the operations of the terminal emulation framework. | 27 | This class implements the operations of the terminal emulation framework. |
28 | It is a complete passive device, driven by the emulation decoder | 28 | It is a complete passive device, driven by the emulation decoder |
29 | (TEmuVT102). By this it forms in fact an ADT, that defines operations | 29 | (TEmuVT102). By this it forms in fact an ADT, that defines operations |
30 | on a rectangular image. | 30 | on a rectangular image. |
31 | 31 | ||
32 | It does neither know how to display its image nor about escape sequences. | 32 | It does neither know how to display its image nor about escape sequences. |
33 | It is further independent of the underlying toolkit. By this, one can even | 33 | It is further independent of the underlying toolkit. By this, one can even |
34 | use this module for an ordinary text surface. | 34 | use this module for an ordinary text surface. |
35 | 35 | ||
36 | Since the operations are called by a specific emulation decoder, one may | 36 | Since the operations are called by a specific emulation decoder, one may |
37 | collect their different operations here. | 37 | collect their different operations here. |
38 | 38 | ||
39 | The state manipulated by the operations is mainly kept in `image', though | 39 | The state manipulated by the operations is mainly kept in `image', though |
40 | it is a little more complex bejond this. See the header file of the class. | 40 | it is a little more complex bejond this. See the header file of the class. |
41 | 41 | ||
42 | \sa TEWidget \sa VT102Emulation | 42 | \sa TEWidget \sa VT102Emulation |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <stdio.h> | 45 | #include <stdio.h> |
46 | #include <stdlib.h> | 46 | #include <stdlib.h> |
47 | #include <unistd.h> | 47 | #include <unistd.h> |
48 | // #include <kdebug.h> | 48 | // #include <kdebug.h> |
49 | 49 | ||
50 | #include <assert.h> | 50 | #include <assert.h> |
51 | #include <string.h> | 51 | #include <string.h> |
52 | #include <ctype.h> | 52 | #include <ctype.h> |
53 | 53 | ||
54 | #include <qpe/config.h> | 54 | #include <qpe/config.h> |
55 | #include "TEScreen.h" | 55 | #include "TEScreen.h" |
56 | 56 | ||
57 | #define HERE printf("%s(%d): here\n",__FILE__,__LINE__) | 57 | #define HERE printf("%s(%d): here\n",__FILE__,__LINE__) |
58 | 58 | ||
59 | //FIXME: this is emulation specific. Use FALSE for xterm, TRUE for ANSI. | 59 | //FIXME: this is emulation specific. Use FALSE for xterm, TRUE for ANSI. |
60 | //FIXME: see if we can get this from terminfo. | 60 | //FIXME: see if we can get this from terminfo. |
61 | #define BS_CLEARS FALSE | 61 | #define BS_CLEARS FALSE |
62 | 62 | ||
63 | #define loc(X,Y) ((Y) * columns + (X)) | 63 | #define loc(X,Y) ((Y) * columns + (X)) |
64 | 64 | ||
65 | /*! creates a `TEScreen' of `lines' lines and `columns' columns. | 65 | /*! creates a `TEScreen' of `lines' lines and `columns' columns. |
66 | */ | 66 | */ |
67 | 67 | ||
68 | TEScreen::TEScreen(int lines, int columns) | 68 | TEScreen::TEScreen(int lines, int columns) |
69 | { | 69 | { |
70 | this->lines = lines; | 70 | this->lines = lines; |
71 | this->columns = columns; | 71 | this->columns = columns; |
72 | // qDebug("Columns %d", columns); | 72 | // odebug << "Columns " << columns << "" << oendl; |
73 | 73 | ||
74 | image = (ca*) malloc(lines*columns*sizeof(ca)); | 74 | image = (ca*) malloc(lines*columns*sizeof(ca)); |
75 | tabstops = NULL; initTabStops(); | 75 | tabstops = NULL; initTabStops(); |
76 | 76 | ||
77 | histCursor = 0; | 77 | histCursor = 0; |
78 | horzCursor = 0; | 78 | horzCursor = 0; |
79 | 79 | ||
80 | clearSelection(); | 80 | clearSelection(); |
81 | reset(); | 81 | reset(); |
82 | } | 82 | } |
83 | 83 | ||
84 | /*! Destructor | 84 | /*! Destructor |
85 | */ | 85 | */ |
86 | 86 | ||
87 | TEScreen::~TEScreen() | 87 | TEScreen::~TEScreen() |
88 | { | 88 | { |
89 | free(image); | 89 | free(image); |
90 | if (tabstops) free(tabstops); | 90 | if (tabstops) free(tabstops); |
91 | } | 91 | } |
92 | 92 | ||
93 | /* ------------------------------------------------------------------------- */ | 93 | /* ------------------------------------------------------------------------- */ |
94 | /* */ | 94 | /* */ |
95 | /* Normalized Screen Operations */ | 95 | /* Normalized Screen Operations */ |
96 | /* */ | 96 | /* */ |
97 | /* ------------------------------------------------------------------------- */ | 97 | /* ------------------------------------------------------------------------- */ |
98 | 98 | ||
99 | // Cursor Setting -------------------------------------------------------------- | 99 | // Cursor Setting -------------------------------------------------------------- |
100 | 100 | ||
101 | /*! \section Cursor | 101 | /*! \section Cursor |
102 | 102 | ||
103 | The `cursor' is a location within the screen that is implicitely used in | 103 | The `cursor' is a location within the screen that is implicitely used in |
104 | many operations. The operations within this section allow to manipulate | 104 | many operations. The operations within this section allow to manipulate |
105 | the cursor explicitly and to obtain it's value. | 105 | the cursor explicitly and to obtain it's value. |
106 | 106 | ||
107 | The position of the cursor is guarantied to be between (including) 0 and | 107 | The position of the cursor is guarantied to be between (including) 0 and |
108 | `columns-1' and `lines-1'. | 108 | `columns-1' and `lines-1'. |
109 | */ | 109 | */ |
110 | 110 | ||
111 | /*! | 111 | /*! |
112 | Move the cursor up. | 112 | Move the cursor up. |
113 | 113 | ||
114 | The cursor will not be moved beyond the top margin. | 114 | The cursor will not be moved beyond the top margin. |
115 | */ | 115 | */ |
116 | 116 | ||
117 | void TEScreen::cursorUp(int n) | 117 | void TEScreen::cursorUp(int n) |
118 | //=CUU | 118 | //=CUU |
119 | { | 119 | { |
120 | if (n == 0) n = 1; // Default | 120 | if (n == 0) n = 1; // Default |
121 | int stop = cuY < tmargin ? 0 : tmargin; | 121 | int stop = cuY < tmargin ? 0 : tmargin; |
122 | cuX = QMIN(columns-1,cuX); // nowrap! | 122 | cuX = QMIN(columns-1,cuX); // nowrap! |
123 | cuY = QMAX(stop,cuY-n); | 123 | cuY = QMAX(stop,cuY-n); |
124 | } | 124 | } |
125 | 125 | ||
126 | /*! | 126 | /*! |
127 | Move the cursor down. | 127 | Move the cursor down. |
128 | 128 | ||
129 | The cursor will not be moved beyond the bottom margin. | 129 | The cursor will not be moved beyond the bottom margin. |
130 | */ | 130 | */ |
131 | 131 | ||
132 | void TEScreen::cursorDown(int n) | 132 | void TEScreen::cursorDown(int n) |
133 | //=CUD | 133 | //=CUD |
134 | { | 134 | { |
135 | if (n == 0) n = 1; // Default | 135 | if (n == 0) n = 1; // Default |
136 | int stop = cuY > bmargin ? lines-1 : bmargin; | 136 | int stop = cuY > bmargin ? lines-1 : bmargin; |
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp index 93348f4..3cb1c0a 100644 --- a/core/apps/embeddedkonsole/TEWidget.cpp +++ b/core/apps/embeddedkonsole/TEWidget.cpp | |||
@@ -880,255 +880,255 @@ void TEWidget::mouseDoubleClickEvent(QMouseEvent* ev) | |||
880 | endSel.setX(x); | 880 | endSel.setX(x); |
881 | actSel = 2; // within selection | 881 | actSel = 2; // within selection |
882 | emit extendSelectionSignal( endSel.x(), endSel.y() ); | 882 | emit extendSelectionSignal( endSel.x(), endSel.y() ); |
883 | emit endSelectionSignal(preserve_line_breaks); | 883 | emit endSelectionSignal(preserve_line_breaks); |
884 | preserve_line_breaks = TRUE; | 884 | preserve_line_breaks = TRUE; |
885 | } | 885 | } |
886 | } | 886 | } |
887 | 887 | ||
888 | void TEWidget::focusInEvent( QFocusEvent * ) | 888 | void TEWidget::focusInEvent( QFocusEvent * ) |
889 | { | 889 | { |
890 | 890 | ||
891 | // do nothing, to prevent repainting | 891 | // do nothing, to prevent repainting |
892 | } | 892 | } |
893 | 893 | ||
894 | 894 | ||
895 | void TEWidget::focusOutEvent( QFocusEvent * ) | 895 | void TEWidget::focusOutEvent( QFocusEvent * ) |
896 | { | 896 | { |
897 | // do nothing, to prevent repainting | 897 | // do nothing, to prevent repainting |
898 | } | 898 | } |
899 | 899 | ||
900 | bool TEWidget::focusNextPrevChild( bool next ) | 900 | bool TEWidget::focusNextPrevChild( bool next ) |
901 | { | 901 | { |
902 | if (next) | 902 | if (next) |
903 | return false; // This disables changing the active part in konqueror | 903 | return false; // This disables changing the active part in konqueror |
904 | // when pressing Tab | 904 | // when pressing Tab |
905 | return QFrame::focusNextPrevChild( next ); | 905 | return QFrame::focusNextPrevChild( next ); |
906 | } | 906 | } |
907 | 907 | ||
908 | 908 | ||
909 | int TEWidget::charClass(char ch) const | 909 | int TEWidget::charClass(char ch) const |
910 | { | 910 | { |
911 | // This might seem like overkill, but imagine if ch was a Unicode | 911 | // This might seem like overkill, but imagine if ch was a Unicode |
912 | // character (Qt 2.0 QChar) - it might then be sensible to separate | 912 | // character (Qt 2.0 QChar) - it might then be sensible to separate |
913 | // the different language ranges, etc. | 913 | // the different language ranges, etc. |
914 | 914 | ||
915 | if ( isspace(ch) ) return ' '; | 915 | if ( isspace(ch) ) return ' '; |
916 | 916 | ||
917 | static const char *word_characters = ":@-./_~"; | 917 | static const char *word_characters = ":@-./_~"; |
918 | if ( isalnum(ch) || strchr(word_characters, ch) ) | 918 | if ( isalnum(ch) || strchr(word_characters, ch) ) |
919 | return 'a'; | 919 | return 'a'; |
920 | 920 | ||
921 | // Everything else is weird | 921 | // Everything else is weird |
922 | return 1; | 922 | return 1; |
923 | } | 923 | } |
924 | 924 | ||
925 | void TEWidget::setMouseMarks(bool on) | 925 | void TEWidget::setMouseMarks(bool on) |
926 | { | 926 | { |
927 | mouse_marks = on; | 927 | mouse_marks = on; |
928 | setCursor( mouse_marks ? ibeamCursor : arrowCursor ); | 928 | setCursor( mouse_marks ? ibeamCursor : arrowCursor ); |
929 | } | 929 | } |
930 | 930 | ||
931 | /* ------------------------------------------------------------------------- */ | 931 | /* ------------------------------------------------------------------------- */ |
932 | /* */ | 932 | /* */ |
933 | /* Clipboard */ | 933 | /* Clipboard */ |
934 | /* */ | 934 | /* */ |
935 | /* ------------------------------------------------------------------------- */ | 935 | /* ------------------------------------------------------------------------- */ |
936 | 936 | ||
937 | #undef KeyPress | 937 | #undef KeyPress |
938 | 938 | ||
939 | void TEWidget::emitSelection() | 939 | void TEWidget::emitSelection() |
940 | // Paste Clipboard by simulating keypress events | 940 | // Paste Clipboard by simulating keypress events |
941 | { | 941 | { |
942 | #ifndef QT_NO_CLIPBOARD | 942 | #ifndef QT_NO_CLIPBOARD |
943 | QString text = QApplication::clipboard()->text(); | 943 | QString text = QApplication::clipboard()->text(); |
944 | //qDebug(text); | 944 | //odebug << text << oendl; |
945 | if ( ! text.isNull()) | 945 | if ( ! text.isNull()) |
946 | { | 946 | { |
947 | text.replace(QRegExp("\n"), "\r"); | 947 | text.replace(QRegExp("\n"), "\r"); |
948 | QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text); | 948 | QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text); |
949 | emit keyPressedSignal(&e); // expose as a big fat keypress event | 949 | emit keyPressedSignal(&e); // expose as a big fat keypress event |
950 | emit clearSelectionSignal(); | 950 | emit clearSelectionSignal(); |
951 | } | 951 | } |
952 | #endif | 952 | #endif |
953 | } | 953 | } |
954 | 954 | ||
955 | void TEWidget::emitText(QString text) | 955 | void TEWidget::emitText(QString text) |
956 | { | 956 | { |
957 | QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text); | 957 | QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text); |
958 | emit keyPressedSignal(&e); // expose as a big fat keypress event | 958 | emit keyPressedSignal(&e); // expose as a big fat keypress event |
959 | } | 959 | } |
960 | 960 | ||
961 | void TEWidget::pasteClipboard( ) | 961 | void TEWidget::pasteClipboard( ) |
962 | { | 962 | { |
963 | emitSelection(); | 963 | emitSelection(); |
964 | } | 964 | } |
965 | 965 | ||
966 | void TEWidget::setSelection(const QString& t) | 966 | void TEWidget::setSelection(const QString& t) |
967 | { | 967 | { |
968 | #ifndef QT_NO_CLIPBOARD | 968 | #ifndef QT_NO_CLIPBOARD |
969 | // Disconnect signal while WE set the clipboard | 969 | // Disconnect signal while WE set the clipboard |
970 | QObject *cb = QApplication::clipboard(); | 970 | QObject *cb = QApplication::clipboard(); |
971 | QObject::disconnect( cb, SIGNAL(dataChanged()), | 971 | QObject::disconnect( cb, SIGNAL(dataChanged()), |
972 | this, SLOT(onClearSelection()) ); | 972 | this, SLOT(onClearSelection()) ); |
973 | 973 | ||
974 | QApplication::clipboard()->setText(t); | 974 | QApplication::clipboard()->setText(t); |
975 | 975 | ||
976 | QObject::connect( cb, SIGNAL(dataChanged()), | 976 | QObject::connect( cb, SIGNAL(dataChanged()), |
977 | this, SLOT(onClearSelection()) ); | 977 | this, SLOT(onClearSelection()) ); |
978 | #endif | 978 | #endif |
979 | } | 979 | } |
980 | 980 | ||
981 | void TEWidget::onClearSelection() | 981 | void TEWidget::onClearSelection() |
982 | { | 982 | { |
983 | emit clearSelectionSignal(); | 983 | emit clearSelectionSignal(); |
984 | } | 984 | } |
985 | 985 | ||
986 | /* ------------------------------------------------------------------------- */ | 986 | /* ------------------------------------------------------------------------- */ |
987 | /* */ | 987 | /* */ |
988 | /* Keyboard */ | 988 | /* Keyboard */ |
989 | /* */ | 989 | /* */ |
990 | /* ------------------------------------------------------------------------- */ | 990 | /* ------------------------------------------------------------------------- */ |
991 | 991 | ||
992 | //FIXME: an `eventFilter' has been installed instead of a `keyPressEvent' | 992 | //FIXME: an `eventFilter' has been installed instead of a `keyPressEvent' |
993 | // due to a bug in `QT' or the ignorance of the author to prevent | 993 | // due to a bug in `QT' or the ignorance of the author to prevent |
994 | // repaint events being emitted to the screen whenever one leaves | 994 | // repaint events being emitted to the screen whenever one leaves |
995 | // or reenters the screen to/from another application. | 995 | // or reenters the screen to/from another application. |
996 | // | 996 | // |
997 | // Troll says one needs to change focusInEvent() and focusOutEvent(), | 997 | // Troll says one needs to change focusInEvent() and focusOutEvent(), |
998 | // which would also let you have an in-focus cursor and an out-focus | 998 | // which would also let you have an in-focus cursor and an out-focus |
999 | // cursor like xterm does. | 999 | // cursor like xterm does. |
1000 | 1000 | ||
1001 | // for the auto-hide cursor feature, I added empty focusInEvent() and | 1001 | // for the auto-hide cursor feature, I added empty focusInEvent() and |
1002 | // focusOutEvent() so that update() isn't called. | 1002 | // focusOutEvent() so that update() isn't called. |
1003 | // For auto-hide, we need to get keypress-events, but we only get them when | 1003 | // For auto-hide, we need to get keypress-events, but we only get them when |
1004 | // we have focus. | 1004 | // we have focus. |
1005 | 1005 | ||
1006 | void TEWidget::doScroll(int lines) | 1006 | void TEWidget::doScroll(int lines) |
1007 | { | 1007 | { |
1008 | scrollbar->setValue(scrollbar->value()+lines); | 1008 | scrollbar->setValue(scrollbar->value()+lines); |
1009 | } | 1009 | } |
1010 | 1010 | ||
1011 | void TEWidget::doHScroll(int lines) { | 1011 | void TEWidget::doHScroll(int lines) { |
1012 | hScrollbar->setValue( hScrollbar->value()+lines); | 1012 | hScrollbar->setValue( hScrollbar->value()+lines); |
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | bool TEWidget::eventFilter( QObject *obj, QEvent *e ) | 1015 | bool TEWidget::eventFilter( QObject *obj, QEvent *e ) |
1016 | { | 1016 | { |
1017 | if ( (e->type() == QEvent::Accel || | 1017 | if ( (e->type() == QEvent::Accel || |
1018 | e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { | 1018 | e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { |
1019 | static_cast<QKeyEvent *>( e )->ignore(); | 1019 | static_cast<QKeyEvent *>( e )->ignore(); |
1020 | return true; | 1020 | return true; |
1021 | } | 1021 | } |
1022 | if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) | 1022 | if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) |
1023 | return FALSE; // not us | 1023 | return FALSE; // not us |
1024 | if ( e->type() == QEvent::Wheel) { | 1024 | if ( e->type() == QEvent::Wheel) { |
1025 | QApplication::sendEvent(scrollbar, e); | 1025 | QApplication::sendEvent(scrollbar, e); |
1026 | } | 1026 | } |
1027 | 1027 | ||
1028 | #ifdef FAKE_CTRL_AND_ALT | 1028 | #ifdef FAKE_CTRL_AND_ALT |
1029 | static bool control = FALSE; | 1029 | static bool control = FALSE; |
1030 | static bool alt = FALSE; | 1030 | static bool alt = FALSE; |
1031 | // qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); | 1031 | // odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl; |
1032 | bool dele=FALSE; | 1032 | bool dele=FALSE; |
1033 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { | 1033 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { |
1034 | QKeyEvent* ke = (QKeyEvent*)e; | 1034 | QKeyEvent* ke = (QKeyEvent*)e; |
1035 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); | 1035 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); |
1036 | switch (ke->key()) { | 1036 | switch (ke->key()) { |
1037 | case Key_F9: // let this be "Control" | 1037 | case Key_F9: // let this be "Control" |
1038 | control = keydown; | 1038 | control = keydown; |
1039 | e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); | 1039 | e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); |
1040 | dele=TRUE; | 1040 | dele=TRUE; |
1041 | break; | 1041 | break; |
1042 | case Key_F13: // let this be "Alt" | 1042 | case Key_F13: // let this be "Alt" |
1043 | alt = keydown; | 1043 | alt = keydown; |
1044 | e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); | 1044 | e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); |
1045 | dele=TRUE; | 1045 | dele=TRUE; |
1046 | break; | 1046 | break; |
1047 | default: | 1047 | default: |
1048 | if ( control ) { | 1048 | if ( control ) { |
1049 | int a = toupper(ke->ascii())-64; | 1049 | int a = toupper(ke->ascii())-64; |
1050 | if ( a >= 0 && a < ' ' ) { | 1050 | if ( a >= 0 && a < ' ' ) { |
1051 | e = new QKeyEvent(e->type(), ke->key(), | 1051 | e = new QKeyEvent(e->type(), ke->key(), |
1052 | a, ke->state()|ControlButton, QChar(a,0)); | 1052 | a, ke->state()|ControlButton, QChar(a,0)); |
1053 | dele=TRUE; | 1053 | dele=TRUE; |
1054 | } | 1054 | } |
1055 | } | 1055 | } |
1056 | if ( alt ) { | 1056 | if ( alt ) { |
1057 | e = new QKeyEvent(e->type(), ke->key(), | 1057 | e = new QKeyEvent(e->type(), ke->key(), |
1058 | ke->ascii(), ke->state()|AltButton, ke->text()); | 1058 | ke->ascii(), ke->state()|AltButton, ke->text()); |
1059 | dele=TRUE; | 1059 | dele=TRUE; |
1060 | } | 1060 | } |
1061 | } | 1061 | } |
1062 | } | 1062 | } |
1063 | #endif | 1063 | #endif |
1064 | 1064 | ||
1065 | if ( e->type() == QEvent::KeyPress ) { | 1065 | if ( e->type() == QEvent::KeyPress ) { |
1066 | QKeyEvent* ke = (QKeyEvent*)e; | 1066 | QKeyEvent* ke = (QKeyEvent*)e; |
1067 | actSel=0; // Key stroke implies a screen update, so TEWidget won't | 1067 | actSel=0; // Key stroke implies a screen update, so TEWidget won't |
1068 | // know where the current selection is. | 1068 | // know where the current selection is. |
1069 | 1069 | ||
1070 | // qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state()); | 1070 | // odebug << "key pressed is 0x" << ke->key() << ", ascii is 0x" << ke->ascii() << ", state " << ke->state() << "" << oendl; |
1071 | 1071 | ||
1072 | bool special_function = true; | 1072 | bool special_function = true; |
1073 | switch(ke->key()) { | 1073 | switch(ke->key()) { |
1074 | //case 0x201b: // fn-5 | 1074 | //case 0x201b: // fn-5 |
1075 | //case Key_F1: | 1075 | //case Key_F1: |
1076 | // switch sessions (?) | 1076 | // switch sessions (?) |
1077 | // emitText("\\"); // expose (??) | 1077 | // emitText("\\"); // expose (??) |
1078 | // break; | 1078 | // break; |
1079 | 1079 | ||
1080 | case 0x2016: // fn-p | 1080 | case 0x2016: // fn-p |
1081 | case Key_F2: | 1081 | case Key_F2: |
1082 | pasteClipboard(); | 1082 | pasteClipboard(); |
1083 | break; | 1083 | break; |
1084 | 1084 | ||
1085 | case 0x2018: // fn-S | 1085 | case 0x2018: // fn-S |
1086 | case Key_F3: | 1086 | case Key_F3: |
1087 | emit changeSession(1); | 1087 | emit changeSession(1); |
1088 | break; | 1088 | break; |
1089 | 1089 | ||
1090 | case 0x2019: // fn-n | 1090 | case 0x2019: // fn-n |
1091 | emit newSession(); | 1091 | emit newSession(); |
1092 | break; | 1092 | break; |
1093 | 1093 | ||
1094 | case Qt::Key_Tab: | 1094 | case Qt::Key_Tab: |
1095 | if (ke->state() == ControlButton) { | 1095 | if (ke->state() == ControlButton) { |
1096 | emit changeSession(1); | 1096 | emit changeSession(1); |
1097 | } else { | 1097 | } else { |
1098 | special_function = false; | 1098 | special_function = false; |
1099 | } | 1099 | } |
1100 | break; | 1100 | break; |
1101 | 1101 | ||
1102 | #if 0 | 1102 | #if 0 |
1103 | case Qt::Key_Left: | 1103 | case Qt::Key_Left: |
1104 | if (vcolumns == 0) { | 1104 | if (vcolumns == 0) { |
1105 | emit changeSession(-1); | 1105 | emit changeSession(-1); |
1106 | } else { | 1106 | } else { |
1107 | special_function = false; | 1107 | special_function = false; |
1108 | } | 1108 | } |
1109 | break; | 1109 | break; |
1110 | 1110 | ||
1111 | case Qt::Key_Right: | 1111 | case Qt::Key_Right: |
1112 | if (vcolumns == 0) { | 1112 | if (vcolumns == 0) { |
1113 | emit changeSession(1); | 1113 | emit changeSession(1); |
1114 | } else { | 1114 | } else { |
1115 | special_function = false; | 1115 | special_function = false; |
1116 | } | 1116 | } |
1117 | break; | 1117 | break; |
1118 | #endif | 1118 | #endif |
1119 | 1119 | ||
1120 | case 0x201b: // fn-5 | 1120 | case 0x201b: // fn-5 |
1121 | case Key_F4: | 1121 | case Key_F4: |
1122 | emit toggleFullScreen(); | 1122 | emit toggleFullScreen(); |
1123 | break; | 1123 | break; |
1124 | 1124 | ||
1125 | case 0x200f: // fn-1 magnify minus | 1125 | case 0x200f: // fn-1 magnify minus |
1126 | case Key_F5: | 1126 | case Key_F5: |
1127 | emit changeFontSize(-1); | 1127 | emit changeFontSize(-1); |
1128 | break; | 1128 | break; |
1129 | 1129 | ||
1130 | case 0x2010: // fn-2 magnify plus | 1130 | case 0x2010: // fn-2 magnify plus |
1131 | case Key_F6: | 1131 | case Key_F6: |
1132 | emit changeFontSize(1); | 1132 | emit changeFontSize(1); |
1133 | break; | 1133 | break; |
1134 | 1134 | ||
diff --git a/core/apps/embeddedkonsole/commandeditdialog.cpp b/core/apps/embeddedkonsole/commandeditdialog.cpp index 6587b26..697bf72 100644 --- a/core/apps/embeddedkonsole/commandeditdialog.cpp +++ b/core/apps/embeddedkonsole/commandeditdialog.cpp | |||
@@ -90,102 +90,102 @@ connect(ToolButton5,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedDown( | |||
90 | 90 | ||
91 | 91 | ||
92 | QListViewItem *current = m_SuggestedCommandList->selectedItem(); | 92 | QListViewItem *current = m_SuggestedCommandList->selectedItem(); |
93 | if ( current ) | 93 | if ( current ) |
94 | item->moveItem( current ); | 94 | item->moveItem( current ); |
95 | m_SuggestedCommandList->setSelected( item, TRUE ); | 95 | m_SuggestedCommandList->setSelected( item, TRUE ); |
96 | m_SuggestedCommandList->ensureItemVisible( m_SuggestedCommandList->selectedItem() ); | 96 | m_SuggestedCommandList->ensureItemVisible( m_SuggestedCommandList->selectedItem() ); |
97 | Config cfg( "Konsole" ); | 97 | Config cfg( "Konsole" ); |
98 | cfg.setGroup("Commands"); | 98 | cfg.setGroup("Commands"); |
99 | if (cfg.readEntry("Commands Set","FALSE") == "TRUE") { | 99 | if (cfg.readEntry("Commands Set","FALSE") == "TRUE") { |
100 | for (int i = 0; i < 100; i++) { | 100 | for (int i = 0; i < 100; i++) { |
101 | QString tmp; | 101 | QString tmp; |
102 | tmp = cfg.readEntry( QString::number(i),""); | 102 | tmp = cfg.readEntry( QString::number(i),""); |
103 | if (!tmp.isEmpty()) | 103 | if (!tmp.isEmpty()) |
104 | m_PlayListSelection->addStringToSelection(tmp); | 104 | m_PlayListSelection->addStringToSelection(tmp); |
105 | } | 105 | } |
106 | } else { | 106 | } else { |
107 | 107 | ||
108 | m_PlayListSelection->addStringToSelection("ls "); | 108 | m_PlayListSelection->addStringToSelection("ls "); |
109 | m_PlayListSelection->addStringToSelection("cardctl eject"); | 109 | m_PlayListSelection->addStringToSelection("cardctl eject"); |
110 | m_PlayListSelection->addStringToSelection("cat "); | 110 | m_PlayListSelection->addStringToSelection("cat "); |
111 | m_PlayListSelection->addStringToSelection("cd "); | 111 | m_PlayListSelection->addStringToSelection("cd "); |
112 | m_PlayListSelection->addStringToSelection("chmod "); | 112 | m_PlayListSelection->addStringToSelection("chmod "); |
113 | m_PlayListSelection->addStringToSelection("cp "); | 113 | m_PlayListSelection->addStringToSelection("cp "); |
114 | m_PlayListSelection->addStringToSelection("dc "); | 114 | m_PlayListSelection->addStringToSelection("dc "); |
115 | m_PlayListSelection->addStringToSelection("df "); | 115 | m_PlayListSelection->addStringToSelection("df "); |
116 | m_PlayListSelection->addStringToSelection("dmesg"); | 116 | m_PlayListSelection->addStringToSelection("dmesg"); |
117 | m_PlayListSelection->addStringToSelection("echo "); | 117 | m_PlayListSelection->addStringToSelection("echo "); |
118 | m_PlayListSelection->addStringToSelection("env"); | 118 | m_PlayListSelection->addStringToSelection("env"); |
119 | m_PlayListSelection->addStringToSelection("find "); | 119 | m_PlayListSelection->addStringToSelection("find "); |
120 | m_PlayListSelection->addStringToSelection("free"); | 120 | m_PlayListSelection->addStringToSelection("free"); |
121 | m_PlayListSelection->addStringToSelection("grep "); | 121 | m_PlayListSelection->addStringToSelection("grep "); |
122 | m_PlayListSelection->addStringToSelection("ifconfig "); | 122 | m_PlayListSelection->addStringToSelection("ifconfig "); |
123 | m_PlayListSelection->addStringToSelection("ipkg "); | 123 | m_PlayListSelection->addStringToSelection("ipkg "); |
124 | m_PlayListSelection->addStringToSelection("mkdir "); | 124 | m_PlayListSelection->addStringToSelection("mkdir "); |
125 | m_PlayListSelection->addStringToSelection("mv "); | 125 | m_PlayListSelection->addStringToSelection("mv "); |
126 | m_PlayListSelection->addStringToSelection("nc localhost 7776"); | 126 | m_PlayListSelection->addStringToSelection("nc localhost 7776"); |
127 | m_PlayListSelection->addStringToSelection("nc localhost 7777"); | 127 | m_PlayListSelection->addStringToSelection("nc localhost 7777"); |
128 | m_PlayListSelection->addStringToSelection("nslookup "); | 128 | m_PlayListSelection->addStringToSelection("nslookup "); |
129 | m_PlayListSelection->addStringToSelection("ping "); | 129 | m_PlayListSelection->addStringToSelection("ping "); |
130 | m_PlayListSelection->addStringToSelection("ps aux"); | 130 | m_PlayListSelection->addStringToSelection("ps aux"); |
131 | m_PlayListSelection->addStringToSelection("pwd "); | 131 | m_PlayListSelection->addStringToSelection("pwd "); |
132 | m_PlayListSelection->addStringToSelection("rm "); | 132 | m_PlayListSelection->addStringToSelection("rm "); |
133 | m_PlayListSelection->addStringToSelection("rmdir "); | 133 | m_PlayListSelection->addStringToSelection("rmdir "); |
134 | m_PlayListSelection->addStringToSelection("route "); | 134 | m_PlayListSelection->addStringToSelection("route "); |
135 | m_PlayListSelection->addStringToSelection("set "); | 135 | m_PlayListSelection->addStringToSelection("set "); |
136 | m_PlayListSelection->addStringToSelection("traceroute"); | 136 | m_PlayListSelection->addStringToSelection("traceroute"); |
137 | 137 | ||
138 | } | 138 | } |
139 | } | 139 | } |
140 | CommandEditDialog::~CommandEditDialog() | 140 | CommandEditDialog::~CommandEditDialog() |
141 | { | 141 | { |
142 | } | 142 | } |
143 | 143 | ||
144 | void CommandEditDialog::accept() | 144 | void CommandEditDialog::accept() |
145 | { | 145 | { |
146 | int i = 0; | 146 | int i = 0; |
147 | Config *cfg = new Config("Konsole"); | 147 | Config *cfg = new Config("Konsole"); |
148 | cfg->setGroup("Commands"); | 148 | cfg->setGroup("Commands"); |
149 | cfg->clearGroup(); | 149 | cfg->clearGroup(); |
150 | 150 | ||
151 | QListViewItemIterator it( m_PlayListSelection ); | 151 | QListViewItemIterator it( m_PlayListSelection ); |
152 | 152 | ||
153 | for ( ; it.current(); ++it ) { | 153 | for ( ; it.current(); ++it ) { |
154 | // qDebug(it.current()->text(0)); | 154 | // odebug << it.current()->text(0) << oendl; |
155 | cfg->writeEntry(QString::number(i),it.current()->text(0)); | 155 | cfg->writeEntry(QString::number(i),it.current()->text(0)); |
156 | i++; | 156 | i++; |
157 | 157 | ||
158 | } | 158 | } |
159 | cfg->writeEntry("Commands Set","TRUE"); | 159 | cfg->writeEntry("Commands Set","TRUE"); |
160 | // qDebug("CommandEditDialog::accept() - written"); | 160 | // odebug << "CommandEditDialog::accept() - written" << oendl; |
161 | delete cfg; | 161 | delete cfg; |
162 | emit commandsEdited(); | 162 | emit commandsEdited(); |
163 | close(); | 163 | close(); |
164 | 164 | ||
165 | 165 | ||
166 | 166 | ||
167 | 167 | ||
168 | 168 | ||
169 | } | 169 | } |
170 | 170 | ||
171 | void CommandEditDialog::showEditDialog() | 171 | void CommandEditDialog::showEditDialog() |
172 | { | 172 | { |
173 | editCommandBase *d = new editCommandBase(this,"smalleditdialog", TRUE); | 173 | editCommandBase *d = new editCommandBase(this,"smalleditdialog", TRUE); |
174 | d->setCaption("Edit command"); | 174 | d->setCaption("Edit command"); |
175 | d->TextLabel->setText("Edit command:"); | 175 | d->TextLabel->setText("Edit command:"); |
176 | d->commandEdit->setText(m_PlayListSelection->currentItem()->text(0)); | 176 | d->commandEdit->setText(m_PlayListSelection->currentItem()->text(0)); |
177 | int i = d->exec(); | 177 | int i = d->exec(); |
178 | if ((i==1) && (!(d->commandEdit->text()).isEmpty())) | 178 | if ((i==1) && (!(d->commandEdit->text()).isEmpty())) |
179 | m_PlayListSelection->currentItem()->setText(0,(d->commandEdit->text())); | 179 | m_PlayListSelection->currentItem()->setText(0,(d->commandEdit->text())); |
180 | } | 180 | } |
181 | 181 | ||
182 | void CommandEditDialog::showAddDialog() | 182 | void CommandEditDialog::showAddDialog() |
183 | { | 183 | { |
184 | 184 | ||
185 | editCommandBase *d = new editCommandBase(this,"smalleditdialog", TRUE); | 185 | editCommandBase *d = new editCommandBase(this,"smalleditdialog", TRUE); |
186 | int i = d->exec(); | 186 | int i = d->exec(); |
187 | if ((i==1) && (!(d->commandEdit->text()).isEmpty())) | 187 | if ((i==1) && (!(d->commandEdit->text()).isEmpty())) |
188 | m_PlayListSelection->addStringToSelection(d->commandEdit->text()); | 188 | m_PlayListSelection->addStringToSelection(d->commandEdit->text()); |
189 | 189 | ||
190 | } | 190 | } |
191 | 191 | ||
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 8207f23..80c8223 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -1,95 +1,96 @@ | |||
1 | 1 | ||
2 | /* ---------------------------------------------------------------------- */ | 2 | /* ---------------------------------------------------------------------- */ |
3 | /* */ | 3 | /* */ |
4 | /* [main.C] Konsole */ | 4 | /* [main.C] Konsole */ |
5 | /* */ | 5 | /* */ |
6 | /* ---------------------------------------------------------------------- */ | 6 | /* ---------------------------------------------------------------------- */ |
7 | /* */ | 7 | /* */ |
8 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ | 8 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ |
9 | /* */ | 9 | /* */ |
10 | /* This file is part of Konsole, an X terminal. */ | 10 | /* This file is part of Konsole, an X terminal. */ |
11 | /* */ | 11 | /* */ |
12 | /* The material contained in here more or less directly orginates from */ | 12 | /* The material contained in here more or less directly orginates from */ |
13 | /* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ | 13 | /* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ |
14 | /* */ | 14 | /* */ |
15 | /* ---------------------------------------------------------------------- */ | 15 | /* ---------------------------------------------------------------------- */ |
16 | /* */ | 16 | /* */ |
17 | /* Ported Konsole to Qt/Embedded */ | 17 | /* Ported Konsole to Qt/Embedded */ |
18 | /* */ | 18 | /* */ |
19 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | 19 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ |
20 | /* */ | 20 | /* */ |
21 | /* -------------------------------------------------------------------------- */ | 21 | /* -------------------------------------------------------------------------- */ |
22 | // enhancements added by L.J. Potter <ljp@llornkcor.com> | 22 | // enhancements added by L.J. Potter <ljp@llornkcor.com> |
23 | // enhancements added by Phillip Kuhn | 23 | // enhancements added by Phillip Kuhn |
24 | 24 | ||
25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
26 | #include <sys/types.h> | 26 | #include <sys/types.h> |
27 | #include <pwd.h> | 27 | #include <pwd.h> |
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | 29 | ||
30 | #ifdef QT_QWS_OPIE | 30 | #ifdef QT_QWS_OPIE |
31 | #include <opie2/ocolorpopupmenu.h> | 31 | #include <opie2/ocolorpopupmenu.h> |
32 | #include <opie2/odebug.h> | ||
32 | using namespace Opie; | 33 | using namespace Opie; |
33 | #endif | 34 | #endif |
34 | 35 | ||
35 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
36 | 37 | ||
37 | #include <qmenubar.h> | 38 | #include <qmenubar.h> |
38 | #include <qtabbar.h> | 39 | #include <qtabbar.h> |
39 | #include <qpe/config.h> | 40 | #include <qpe/config.h> |
40 | #include <qfontdatabase.h> | 41 | #include <qfontdatabase.h> |
41 | #include <qfile.h> | 42 | #include <qfile.h> |
42 | #include <qspinbox.h> | 43 | #include <qspinbox.h> |
43 | #include <qlayout.h> | 44 | #include <qlayout.h> |
44 | 45 | ||
45 | #include <sys/wait.h> | 46 | #include <sys/wait.h> |
46 | #include <stdio.h> | 47 | #include <stdio.h> |
47 | #include <stdlib.h> | 48 | #include <stdlib.h> |
48 | #include <assert.h> | 49 | #include <assert.h> |
49 | 50 | ||
50 | #include "konsole.h" | 51 | #include "konsole.h" |
51 | #include "commandeditdialog.h" | 52 | #include "commandeditdialog.h" |
52 | 53 | ||
53 | class EKNumTabBar : public QTabBar | 54 | class EKNumTabBar : public QTabBar |
54 | { | 55 | { |
55 | public: | 56 | public: |
56 | EKNumTabBar(QWidget *parent = 0, const char *name = 0) : | 57 | EKNumTabBar(QWidget *parent = 0, const char *name = 0) : |
57 | QTabBar(parent, name) | 58 | QTabBar(parent, name) |
58 | {} | 59 | {} |
59 | 60 | ||
60 | // QList<QTab> *getTabList() { return(tabList()); } | 61 | // QList<QTab> *getTabList() { return(tabList()); } |
61 | 62 | ||
62 | void numberTabs() | 63 | void numberTabs() |
63 | { | 64 | { |
64 | // Yes, it really is this messy. QTabWidget needs functions | 65 | // Yes, it really is this messy. QTabWidget needs functions |
65 | // that provide acces to tabs in a sequential way. | 66 | // that provide acces to tabs in a sequential way. |
66 | int m=INT_MIN; | 67 | int m=INT_MIN; |
67 | for (int i=0; i<count(); i++) | 68 | for (int i=0; i<count(); i++) |
68 | { | 69 | { |
69 | QTab* left=0; | 70 | QTab* left=0; |
70 | QListIterator<QTab> it(*tabList()); | 71 | QListIterator<QTab> it(*tabList()); |
71 | int x=INT_MAX; | 72 | int x=INT_MAX; |
72 | for( QTab* t; (t=it.current()); ++it ) | 73 | for( QTab* t; (t=it.current()); ++it ) |
73 | { | 74 | { |
74 | int tx = t->rect().x(); | 75 | int tx = t->rect().x(); |
75 | if ( tx<x && tx>m ) | 76 | if ( tx<x && tx>m ) |
76 | { | 77 | { |
77 | x = tx; | 78 | x = tx; |
78 | left = t; | 79 | left = t; |
79 | } | 80 | } |
80 | } | 81 | } |
81 | if ( left ) | 82 | if ( left ) |
82 | { | 83 | { |
83 | left->setText(QString::number(i+1)); | 84 | left->setText(QString::number(i+1)); |
84 | m = left->rect().x(); | 85 | m = left->rect().x(); |
85 | } | 86 | } |
86 | } | 87 | } |
87 | } | 88 | } |
88 | 89 | ||
89 | virtual QSize sizeHint() const | 90 | virtual QSize sizeHint() const |
90 | { | 91 | { |
91 | if (isHidden()) | 92 | if (isHidden()) |
92 | { | 93 | { |
93 | return(QSize(0,0)); | 94 | return(QSize(0,0)); |
94 | } | 95 | } |
95 | else | 96 | else |
@@ -143,206 +144,206 @@ static const char *commonCmds[] = | |||
143 | "cardctl eject", | 144 | "cardctl eject", |
144 | "cat ", | 145 | "cat ", |
145 | "cd ", | 146 | "cd ", |
146 | "chmod ", | 147 | "chmod ", |
147 | "clear", | 148 | "clear", |
148 | "cp ", | 149 | "cp ", |
149 | "dc ", | 150 | "dc ", |
150 | "df ", | 151 | "df ", |
151 | "dmesg", | 152 | "dmesg", |
152 | "echo ", | 153 | "echo ", |
153 | "env", | 154 | "env", |
154 | "find ", | 155 | "find ", |
155 | "free", | 156 | "free", |
156 | "grep ", | 157 | "grep ", |
157 | "ifconfig ", | 158 | "ifconfig ", |
158 | "ipkg ", | 159 | "ipkg ", |
159 | "mkdir ", | 160 | "mkdir ", |
160 | "mv ", | 161 | "mv ", |
161 | "nc localhost 7776", | 162 | "nc localhost 7776", |
162 | "nc localhost 7777", | 163 | "nc localhost 7777", |
163 | "netstat ", | 164 | "netstat ", |
164 | "nslookup ", | 165 | "nslookup ", |
165 | "ping ", | 166 | "ping ", |
166 | "ps aux", | 167 | "ps aux", |
167 | "pwd ", | 168 | "pwd ", |
168 | "qcop QPE/System 'linkChanged(QString)' ''", | 169 | "qcop QPE/System 'linkChanged(QString)' ''", |
169 | "qcop QPE/System 'restart()'", | 170 | "qcop QPE/System 'restart()'", |
170 | "qcop QPE/System 'quit()'", | 171 | "qcop QPE/System 'quit()'", |
171 | "rm ", | 172 | "rm ", |
172 | "rmdir ", | 173 | "rmdir ", |
173 | "route ", | 174 | "route ", |
174 | "set ", | 175 | "set ", |
175 | "traceroute", | 176 | "traceroute", |
176 | 177 | ||
177 | /* | 178 | /* |
178 | "gzip", | 179 | "gzip", |
179 | "gunzip", | 180 | "gunzip", |
180 | "chgrp", | 181 | "chgrp", |
181 | "chown", | 182 | "chown", |
182 | "date", | 183 | "date", |
183 | "dd", | 184 | "dd", |
184 | "df", | 185 | "df", |
185 | "dmesg", | 186 | "dmesg", |
186 | "fuser", | 187 | "fuser", |
187 | "hostname", | 188 | "hostname", |
188 | "kill", | 189 | "kill", |
189 | "killall", | 190 | "killall", |
190 | "ln", | 191 | "ln", |
191 | "ping", | 192 | "ping", |
192 | "mount", | 193 | "mount", |
193 | "more", | 194 | "more", |
194 | "sort", | 195 | "sort", |
195 | "touch", | 196 | "touch", |
196 | "umount", | 197 | "umount", |
197 | "mknod", | 198 | "mknod", |
198 | "netstat", | 199 | "netstat", |
199 | */ | 200 | */ |
200 | 201 | ||
201 | "exit", | 202 | "exit", |
202 | NULL | 203 | NULL |
203 | }; | 204 | }; |
204 | 205 | ||
205 | 206 | ||
206 | static void konsoleInit(const char** shell) { | 207 | static void konsoleInit(const char** shell) { |
207 | if(setuid(getuid()) !=0) qDebug("setuid failed"); | 208 | if(setuid(getuid()) !=0) odebug << "setuid failed" << oendl; |
208 | if(setgid(getgid()) != 0) qDebug("setgid failed"); // drop privileges | 209 | if(setgid(getgid()) != 0) odebug << "setgid failed" << oendl; // drop privileges |
209 | 210 | ||
210 | 211 | ||
211 | // QPEApplication::grabKeyboard(); // for CTRL and ALT | 212 | // QPEApplication::grabKeyboard(); // for CTRL and ALT |
212 | 213 | ||
213 | qDebug("keyboard grabbed"); | 214 | odebug << "keyboard grabbed" << oendl; |
214 | #ifdef FAKE_CTRL_AND_ALT | 215 | #ifdef FAKE_CTRL_AND_ALT |
215 | qDebug("Fake Ctrl and Alt defined"); | 216 | odebug << "Fake Ctrl and Alt defined" << oendl; |
216 | QPEApplication::grabKeyboard(); // for CTRL and ALT | 217 | QPEApplication::grabKeyboard(); // for CTRL and ALT |
217 | #endif | 218 | #endif |
218 | 219 | ||
219 | *shell = getenv("SHELL"); | 220 | *shell = getenv("SHELL"); |
220 | qWarning("SHell initially is %s", *shell ); | 221 | owarn << "SHell initially is " << *shell << "" << oendl; |
221 | 222 | ||
222 | if (shell == NULL || *shell == '\0') { | 223 | if (shell == NULL || *shell == '\0') { |
223 | struct passwd *ent = 0; | 224 | struct passwd *ent = 0; |
224 | uid_t me = getuid(); | 225 | uid_t me = getuid(); |
225 | *shell = "/bin/sh"; | 226 | *shell = "/bin/sh"; |
226 | 227 | ||
227 | while ( (ent = getpwent()) != 0 ) { | 228 | while ( (ent = getpwent()) != 0 ) { |
228 | if (ent->pw_uid == me) { | 229 | if (ent->pw_uid == me) { |
229 | if (ent->pw_shell != "") | 230 | if (ent->pw_shell != "") |
230 | *shell = ent->pw_shell; | 231 | *shell = ent->pw_shell; |
231 | break; | 232 | break; |
232 | } | 233 | } |
233 | } | 234 | } |
234 | endpwent(); | 235 | endpwent(); |
235 | } | 236 | } |
236 | 237 | ||
237 | if( putenv((char*)"COLORTERM=") !=0) | 238 | if( putenv((char*)"COLORTERM=") !=0) |
238 | qDebug("putenv failed"); // to trigger mc's color detection | 239 | odebug << "putenv failed" << oendl; // to trigger mc's color detection |
239 | } | 240 | } |
240 | 241 | ||
241 | 242 | ||
242 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : | 243 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : |
243 | QMainWindow(parent, name, fl) | 244 | QMainWindow(parent, name, fl) |
244 | { | 245 | { |
245 | QStrList tmp; const char* shell; | 246 | QStrList tmp; const char* shell; |
246 | 247 | ||
247 | konsoleInit( &shell); | 248 | konsoleInit( &shell); |
248 | init(shell,tmp); | 249 | init(shell,tmp); |
249 | } | 250 | } |
250 | 251 | ||
251 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) | 252 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) |
252 | : QMainWindow(0, name) | 253 | : QMainWindow(0, name) |
253 | { | 254 | { |
254 | init(_pgm,_args); | 255 | init(_pgm,_args); |
255 | } | 256 | } |
256 | 257 | ||
257 | struct HistoryItem | 258 | struct HistoryItem |
258 | { | 259 | { |
259 | HistoryItem(int c, const QString &l) | 260 | HistoryItem(int c, const QString &l) |
260 | { | 261 | { |
261 | count = c; | 262 | count = c; |
262 | line = l; | 263 | line = l; |
263 | } | 264 | } |
264 | int count; | 265 | int count; |
265 | QString line; | 266 | QString line; |
266 | }; | 267 | }; |
267 | 268 | ||
268 | class HistoryList : public QList<HistoryItem> | 269 | class HistoryList : public QList<HistoryItem> |
269 | { | 270 | { |
270 | virtual int compareItems( QCollection::Item item1, QCollection::Item item2) | 271 | virtual int compareItems( QCollection::Item item1, QCollection::Item item2) |
271 | { | 272 | { |
272 | int c1 = ((HistoryItem*)item1)->count; | 273 | int c1 = ((HistoryItem*)item1)->count; |
273 | int c2 = ((HistoryItem*)item2)->count; | 274 | int c2 = ((HistoryItem*)item2)->count; |
274 | if (c1 > c2) | 275 | if (c1 > c2) |
275 | return(1); | 276 | return(1); |
276 | if (c1 < c2) | 277 | if (c1 < c2) |
277 | return(-1); | 278 | return(-1); |
278 | return(0); | 279 | return(0); |
279 | } | 280 | } |
280 | }; | 281 | }; |
281 | 282 | ||
282 | void Konsole::initCommandList() | 283 | void Konsole::initCommandList() |
283 | { | 284 | { |
284 | // qDebug("Konsole::initCommandList"); | 285 | // odebug << "Konsole::initCommandList" << oendl; |
285 | Config cfg( "Konsole" ); | 286 | Config cfg( "Konsole" ); |
286 | cfg.setGroup("Commands"); | 287 | cfg.setGroup("Commands"); |
287 | // commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 288 | // commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
288 | commonCombo->clear(); | 289 | commonCombo->clear(); |
289 | 290 | ||
290 | if (cfg.readEntry("ShellHistory","TRUE") == "TRUE") | 291 | if (cfg.readEntry("ShellHistory","TRUE") == "TRUE") |
291 | { | 292 | { |
292 | QString histfilename = QString(getenv("HOME")) + "/.bash_history"; | 293 | QString histfilename = QString(getenv("HOME")) + "/.bash_history"; |
293 | histfilename = cfg.readEntry("ShellHistoryPath",histfilename); | 294 | histfilename = cfg.readEntry("ShellHistoryPath",histfilename); |
294 | QFile histfile(histfilename); | 295 | QFile histfile(histfilename); |
295 | // note: compiler barfed on: | 296 | // note: compiler barfed on: |
296 | // QFile histfile(QString(getenv("HOME")) + "/.bash_history"); | 297 | // QFile histfile(QString(getenv("HOME")) + "/.bash_history"); |
297 | if (histfile.open( IO_ReadOnly )) | 298 | if (histfile.open( IO_ReadOnly )) |
298 | { | 299 | { |
299 | QString line; | 300 | QString line; |
300 | uint i; | 301 | uint i; |
301 | HistoryList items; | 302 | HistoryList items; |
302 | 303 | ||
303 | int lineno = 0; | 304 | int lineno = 0; |
304 | while(!histfile.atEnd()) | 305 | while(!histfile.atEnd()) |
305 | { | 306 | { |
306 | if (histfile.readLine(line, 200) < 0) | 307 | if (histfile.readLine(line, 200) < 0) |
307 | { | 308 | { |
308 | break; | 309 | break; |
309 | } | 310 | } |
310 | line = line.left(line.length()-1); | 311 | line = line.left(line.length()-1); |
311 | lineno++; | 312 | lineno++; |
312 | 313 | ||
313 | for(i=0; i<items.count(); i++) | 314 | for(i=0; i<items.count(); i++) |
314 | { | 315 | { |
315 | if (line == items.at(i)->line) | 316 | if (line == items.at(i)->line) |
316 | { | 317 | { |
317 | // weight recent commands & repeated commands more | 318 | // weight recent commands & repeated commands more |
318 | // by adding up the index of each command | 319 | // by adding up the index of each command |
319 | items.at(i)->count += lineno; | 320 | items.at(i)->count += lineno; |
320 | break; | 321 | break; |
321 | } | 322 | } |
322 | } | 323 | } |
323 | if (i >= items.count()) | 324 | if (i >= items.count()) |
324 | { | 325 | { |
325 | items.append(new HistoryItem(lineno, line)); | 326 | items.append(new HistoryItem(lineno, line)); |
326 | } | 327 | } |
327 | } | 328 | } |
328 | items.sort(); | 329 | items.sort(); |
329 | int n = items.count(); | 330 | int n = items.count(); |
330 | if (n > 40) | 331 | if (n > 40) |
331 | { | 332 | { |
332 | n = 40; | 333 | n = 40; |
333 | } | 334 | } |
334 | for(int i=0; i<n; i++) | 335 | for(int i=0; i<n; i++) |
335 | { | 336 | { |
336 | // should insert start of command, but keep whole thing | 337 | // should insert start of command, but keep whole thing |
337 | if (items.at(items.count()-i-1)->line.length() < 30) | 338 | if (items.at(items.count()-i-1)->line.length() < 30) |
338 | { | 339 | { |
339 | commonCombo->insertItem(items.at(items.count()-i-1)->line); | 340 | commonCombo->insertItem(items.at(items.count()-i-1)->line); |
340 | } | 341 | } |
341 | } | 342 | } |
342 | histfile.close(); | 343 | histfile.close(); |
343 | } | 344 | } |
344 | } | 345 | } |
345 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") | 346 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") |
346 | { | 347 | { |
347 | for (int i = 0; commonCmds[i] != NULL; i++) | 348 | for (int i = 0; commonCmds[i] != NULL; i++) |
348 | { | 349 | { |
@@ -452,129 +453,129 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
452 | size = sizes[i]; | 453 | size = sizes[i]; |
453 | } | 454 | } |
454 | 455 | ||
455 | f = QFont(familyNames[j], size); | 456 | f = QFont(familyNames[j], size); |
456 | f.setFixedPitch(true); | 457 | f.setFixedPitch(true); |
457 | QFontMetrics fm(f); | 458 | QFontMetrics fm(f); |
458 | // don't trust f.fixedPitch() or f.exactMatch(), they lie!! | 459 | // don't trust f.fixedPitch() or f.exactMatch(), they lie!! |
459 | if (fm.width("l") == fm.width("m") | 460 | if (fm.width("l") == fm.width("m") |
460 | && (i < (uint)sizes.count() | 461 | && (i < (uint)sizes.count() |
461 | || fm.width("m") > last_width)) | 462 | || fm.width("m") > last_width)) |
462 | { | 463 | { |
463 | if (i < (uint)sizes.count()) | 464 | if (i < (uint)sizes.count()) |
464 | { | 465 | { |
465 | last_width = fm.width("m"); | 466 | last_width = fm.width("m"); |
466 | } | 467 | } |
467 | if (sizeMenu == NULL) | 468 | if (sizeMenu == NULL) |
468 | { | 469 | { |
469 | sizeMenu = new QPopupMenu(); | 470 | sizeMenu = new QPopupMenu(); |
470 | } | 471 | } |
471 | int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex); | 472 | int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex); |
472 | sizeMenu->setItemParameter(id, fontIndex); | 473 | sizeMenu->setItemParameter(id, fontIndex); |
473 | sizeMenu->connectItem(id, this, SLOT(setFont(int))); | 474 | sizeMenu->connectItem(id, this, SLOT(setFont(int))); |
474 | QString name = s + " " + QString::number(size); | 475 | QString name = s + " " + QString::number(size); |
475 | fonts.append(new VTFont(name, f, familyNames[j], familyNum, size)); | 476 | fonts.append(new VTFont(name, f, familyNames[j], familyNum, size)); |
476 | if (familyNames[j] == cfgFontName && size == cfgFontSize) | 477 | if (familyNames[j] == cfgFontName && size == cfgFontSize) |
477 | { | 478 | { |
478 | cfont = fontIndex; | 479 | cfont = fontIndex; |
479 | } | 480 | } |
480 | printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size); | 481 | printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size); |
481 | fontIndex++; | 482 | fontIndex++; |
482 | } | 483 | } |
483 | } | 484 | } |
484 | if (sizeMenu) | 485 | if (sizeMenu) |
485 | { | 486 | { |
486 | fontList->insertItem(s, sizeMenu, familyNum + 1000); | 487 | fontList->insertItem(s, sizeMenu, familyNum + 1000); |
487 | 488 | ||
488 | familyNum++; | 489 | familyNum++; |
489 | } | 490 | } |
490 | } | 491 | } |
491 | 492 | ||
492 | } | 493 | } |
493 | 494 | ||
494 | if (cfont < 0 || cfont >= (int)fonts.count()) | 495 | if (cfont < 0 || cfont >= (int)fonts.count()) |
495 | { | 496 | { |
496 | cfont = 0; | 497 | cfont = 0; |
497 | } | 498 | } |
498 | 499 | ||
499 | // create terminal emulation framework //////////////////////////////////// | 500 | // create terminal emulation framework //////////////////////////////////// |
500 | nsessions = 0; | 501 | nsessions = 0; |
501 | 502 | ||
502 | tab = new EKNumTabWidget(this); | 503 | tab = new EKNumTabWidget(this); |
503 | // tab->setMargin(tab->margin()-5); | 504 | // tab->setMargin(tab->margin()-5); |
504 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); | 505 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); |
505 | 506 | ||
506 | // create terminal toolbar //////////////////////////////////////////////// | 507 | // create terminal toolbar //////////////////////////////////////////////// |
507 | setToolBarsMovable( FALSE ); | 508 | setToolBarsMovable( FALSE ); |
508 | menuToolBar = new QToolBar( this ); | 509 | menuToolBar = new QToolBar( this ); |
509 | menuToolBar->setHorizontalStretchable( TRUE ); | 510 | menuToolBar->setHorizontalStretchable( TRUE ); |
510 | 511 | ||
511 | QMenuBar *menuBar = new QMenuBar( menuToolBar ); | 512 | QMenuBar *menuBar = new QMenuBar( menuToolBar ); |
512 | 513 | ||
513 | setFont(cfont); | 514 | setFont(cfont); |
514 | 515 | ||
515 | configMenu = new QPopupMenu( this); | 516 | configMenu = new QPopupMenu( this); |
516 | colorMenu = new QPopupMenu( this); | 517 | colorMenu = new QPopupMenu( this); |
517 | scrollMenu = new QPopupMenu( this); | 518 | scrollMenu = new QPopupMenu( this); |
518 | editCommandListMenu = new QPopupMenu( this); | 519 | editCommandListMenu = new QPopupMenu( this); |
519 | 520 | ||
520 | configMenu->insertItem(tr("Command List"), editCommandListMenu); | 521 | configMenu->insertItem(tr("Command List"), editCommandListMenu); |
521 | 522 | ||
522 | bool listHidden; | 523 | bool listHidden; |
523 | cfg.setGroup("Menubar"); | 524 | cfg.setGroup("Menubar"); |
524 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") | 525 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") |
525 | { | 526 | { |
526 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" )); | 527 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" )); |
527 | listHidden=TRUE; | 528 | listHidden=TRUE; |
528 | } | 529 | } |
529 | else | 530 | else |
530 | { | 531 | { |
531 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" )); | 532 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" )); |
532 | listHidden=FALSE; | 533 | listHidden=FALSE; |
533 | } | 534 | } |
534 | 535 | ||
535 | cfg.setGroup("Tabs"); | 536 | cfg.setGroup("Tabs"); |
536 | 537 | ||
537 | tabMenu = new QPopupMenu(this); | 538 | tabMenu = new QPopupMenu(this); |
538 | tm_bottom = tabMenu->insertItem(tr("Bottom" )); | 539 | tm_bottom = tabMenu->insertItem(tr("Bottom" )); |
539 | tm_top = tabMenu->insertItem(tr("Top")); | 540 | tm_top = tabMenu->insertItem(tr("Top")); |
540 | tm_hidden = tabMenu->insertItem(tr("Hidden")); | 541 | tm_hidden = tabMenu->insertItem(tr("Hidden")); |
541 | 542 | ||
542 | configMenu->insertItem(tr("Tabs"), tabMenu); | 543 | configMenu->insertItem(tr("Tabs"), tabMenu); |
543 | 544 | ||
544 | tmp=cfg.readEntry("Position","Top"); | 545 | tmp=cfg.readEntry("Position","Top"); |
545 | if(tmp=="Top") | 546 | if(tmp=="Top") |
546 | { | 547 | { |
547 | tab->setTabPosition(QTabWidget::Top); | 548 | tab->setTabPosition(QTabWidget::Top); |
548 | tab->getTabBar()->show(); | 549 | tab->getTabBar()->show(); |
549 | tabPos = tm_top; | 550 | tabPos = tm_top; |
550 | } | 551 | } |
551 | else if (tmp=="Bottom") | 552 | else if (tmp=="Bottom") |
552 | { | 553 | { |
553 | tab->setTabPosition(QTabWidget::Bottom); | 554 | tab->setTabPosition(QTabWidget::Bottom); |
554 | tab->getTabBar()->show(); | 555 | tab->getTabBar()->show(); |
555 | tabPos = tm_bottom; | 556 | tabPos = tm_bottom; |
556 | } | 557 | } |
557 | else | 558 | else |
558 | { | 559 | { |
559 | tab->getTabBar()->hide(); | 560 | tab->getTabBar()->hide(); |
560 | tab->setMargin(tab->margin()); | 561 | tab->setMargin(tab->margin()); |
561 | tabPos = tm_hidden; | 562 | tabPos = tm_hidden; |
562 | } | 563 | } |
563 | 564 | ||
564 | cm_bw = colorMenu->insertItem(tr( "Black on White")); | 565 | cm_bw = colorMenu->insertItem(tr( "Black on White")); |
565 | cm_wb = colorMenu->insertItem(tr( "White on Black")); | 566 | cm_wb = colorMenu->insertItem(tr( "White on Black")); |
566 | cm_gb = colorMenu->insertItem(tr( "Green on Black")); | 567 | cm_gb = colorMenu->insertItem(tr( "Green on Black")); |
567 | // cm_bt = colorMenu->insertItem(tr( "Black on Transparent")); | 568 | // cm_bt = colorMenu->insertItem(tr( "Black on Transparent")); |
568 | cm_br = colorMenu->insertItem(tr( "Black on Pink")); | 569 | cm_br = colorMenu->insertItem(tr( "Black on Pink")); |
569 | cm_rb = colorMenu->insertItem(tr( "Pink on Black")); | 570 | cm_rb = colorMenu->insertItem(tr( "Pink on Black")); |
570 | cm_gy = colorMenu->insertItem(tr( "Green on Yellow")); | 571 | cm_gy = colorMenu->insertItem(tr( "Green on Yellow")); |
571 | cm_bm = colorMenu->insertItem(tr( "Blue on Magenta")); | 572 | cm_bm = colorMenu->insertItem(tr( "Blue on Magenta")); |
572 | cm_mb = colorMenu->insertItem(tr( "Magenta on Blue")); | 573 | cm_mb = colorMenu->insertItem(tr( "Magenta on Blue")); |
573 | cm_cw = colorMenu->insertItem(tr( "Cyan on White")); | 574 | cm_cw = colorMenu->insertItem(tr( "Cyan on White")); |
574 | cm_wc = colorMenu->insertItem(tr( "White on Cyan")); | 575 | cm_wc = colorMenu->insertItem(tr( "White on Cyan")); |
575 | cm_bb = colorMenu->insertItem(tr( "Blue on Black")); | 576 | cm_bb = colorMenu->insertItem(tr( "Blue on Black")); |
576 | cm_ab = colorMenu->insertItem(tr( "Amber on Black")); | 577 | cm_ab = colorMenu->insertItem(tr( "Amber on Black")); |
577 | cm_default = colorMenu->insertItem(tr("default")); | 578 | cm_default = colorMenu->insertItem(tr("default")); |
578 | 579 | ||
579 | #ifdef QT_QWS_OPIE | 580 | #ifdef QT_QWS_OPIE |
580 | 581 | ||
@@ -1006,177 +1007,177 @@ void Konsole::hitSpace() | |||
1006 | void Konsole::hitTab() | 1007 | void Konsole::hitTab() |
1007 | { | 1008 | { |
1008 | TEWidget* te = getTe(); | 1009 | TEWidget* te = getTe(); |
1009 | if (te != 0) | 1010 | if (te != 0) |
1010 | { | 1011 | { |
1011 | te->emitText(QString("\t")); | 1012 | te->emitText(QString("\t")); |
1012 | } | 1013 | } |
1013 | } | 1014 | } |
1014 | 1015 | ||
1015 | void Konsole::hitPaste() | 1016 | void Konsole::hitPaste() |
1016 | { | 1017 | { |
1017 | TEWidget* te = getTe(); | 1018 | TEWidget* te = getTe(); |
1018 | if (te != 0) | 1019 | if (te != 0) |
1019 | { | 1020 | { |
1020 | te->pasteClipboard(); | 1021 | te->pasteClipboard(); |
1021 | } | 1022 | } |
1022 | } | 1023 | } |
1023 | 1024 | ||
1024 | void Konsole::hitUp() | 1025 | void Konsole::hitUp() |
1025 | { | 1026 | { |
1026 | TEWidget* te = getTe(); | 1027 | TEWidget* te = getTe(); |
1027 | if (te != 0) | 1028 | if (te != 0) |
1028 | { | 1029 | { |
1029 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0); | 1030 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0); |
1030 | QApplication::sendEvent( te, &ke ); | 1031 | QApplication::sendEvent( te, &ke ); |
1031 | } | 1032 | } |
1032 | } | 1033 | } |
1033 | 1034 | ||
1034 | void Konsole::hitDown() | 1035 | void Konsole::hitDown() |
1035 | { | 1036 | { |
1036 | TEWidget* te = getTe(); | 1037 | TEWidget* te = getTe(); |
1037 | if (te != 0) | 1038 | if (te != 0) |
1038 | { | 1039 | { |
1039 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0); | 1040 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0); |
1040 | QApplication::sendEvent( te, &ke ); | 1041 | QApplication::sendEvent( te, &ke ); |
1041 | } | 1042 | } |
1042 | } | 1043 | } |
1043 | 1044 | ||
1044 | /** | 1045 | /** |
1045 | This function calculates the size of the external widget | 1046 | This function calculates the size of the external widget |
1046 | needed for the internal widget to be | 1047 | needed for the internal widget to be |
1047 | */ | 1048 | */ |
1048 | QSize Konsole::calcSize(int columns, int lines) | 1049 | QSize Konsole::calcSize(int columns, int lines) |
1049 | { | 1050 | { |
1050 | TEWidget* te = getTe(); | 1051 | TEWidget* te = getTe(); |
1051 | if (te != 0) | 1052 | if (te != 0) |
1052 | { | 1053 | { |
1053 | QSize size = te->calcSize(columns, lines); | 1054 | QSize size = te->calcSize(columns, lines); |
1054 | return size; | 1055 | return size; |
1055 | } | 1056 | } |
1056 | else | 1057 | else |
1057 | { | 1058 | { |
1058 | QSize size; | 1059 | QSize size; |
1059 | return size; | 1060 | return size; |
1060 | } | 1061 | } |
1061 | } | 1062 | } |
1062 | 1063 | ||
1063 | /** | 1064 | /** |
1064 | sets application window to a size based on columns X lines of the te | 1065 | sets application window to a size based on columns X lines of the te |
1065 | guest widget. Call with (0,0) for setting default size. | 1066 | guest widget. Call with (0,0) for setting default size. |
1066 | */ | 1067 | */ |
1067 | 1068 | ||
1068 | void Konsole::setColLin(int columns, int lines) | 1069 | void Konsole::setColLin(int columns, int lines) |
1069 | { | 1070 | { |
1070 | qDebug("konsole::setColLin:: Columns %d", columns); | 1071 | odebug << "konsole::setColLin:: Columns " << columns << "" << oendl; |
1071 | 1072 | ||
1072 | if ((columns==0) || (lines==0)) | 1073 | if ((columns==0) || (lines==0)) |
1073 | { | 1074 | { |
1074 | if (defaultSize.isEmpty()) // not in config file : set default value | 1075 | if (defaultSize.isEmpty()) // not in config file : set default value |
1075 | { | 1076 | { |
1076 | defaultSize = calcSize(80,24); | 1077 | defaultSize = calcSize(80,24); |
1077 | // notifySize(24,80); // set menu items (strange arg order !) | 1078 | // notifySize(24,80); // set menu items (strange arg order !) |
1078 | } | 1079 | } |
1079 | resize(defaultSize); | 1080 | resize(defaultSize); |
1080 | } | 1081 | } |
1081 | else | 1082 | else |
1082 | { | 1083 | { |
1083 | resize(calcSize(columns, lines)); | 1084 | resize(calcSize(columns, lines)); |
1084 | // notifySize(lines,columns); // set menu items (strange arg order !) | 1085 | // notifySize(lines,columns); // set menu items (strange arg order !) |
1085 | } | 1086 | } |
1086 | } | 1087 | } |
1087 | 1088 | ||
1088 | /* | 1089 | /* |
1089 | void Konsole::setFont(int fontno) | 1090 | void Konsole::setFont(int fontno) |
1090 | { | 1091 | { |
1091 | QFont f; | 1092 | QFont f; |
1092 | if (fontno == 0) | 1093 | if (fontno == 0) |
1093 | f = defaultFont = QFont( "Helvetica", 12 ); | 1094 | f = defaultFont = QFont( "Helvetica", 12 ); |
1094 | else | 1095 | else |
1095 | if (fonts[fontno][0] == '-') | 1096 | if (fonts[fontno][0] == '-') |
1096 | f.setRawName( fonts[fontno] ); | 1097 | f.setRawName( fonts[fontno] ); |
1097 | else | 1098 | else |
1098 | { | 1099 | { |
1099 | f.setFamily(fonts[fontno]); | 1100 | f.setFamily(fonts[fontno]); |
1100 | f.setRawMode( TRUE ); | 1101 | f.setRawMode( TRUE ); |
1101 | } | 1102 | } |
1102 | if ( !f.exactMatch() && fontno != 0) | 1103 | if ( !f.exactMatch() && fontno != 0) |
1103 | { | 1104 | { |
1104 | QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); | 1105 | QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); |
1105 | QMessageBox(this, msg); | 1106 | QMessageBox(this, msg); |
1106 | return; | 1107 | return; |
1107 | } | 1108 | } |
1108 | if (se) se->setFontNo(fontno); | 1109 | if (se) se->setFontNo(fontno); |
1109 | te->setVTFont(f); | 1110 | te->setVTFont(f); |
1110 | n_font = fontno; | 1111 | n_font = fontno; |
1111 | } | 1112 | } |
1112 | */ | 1113 | */ |
1113 | 1114 | ||
1114 | // --| color selection |------------------------------------------------------- | 1115 | // --| color selection |------------------------------------------------------- |
1115 | 1116 | ||
1116 | void Konsole::changeColumns(int /*columns*/) | 1117 | void Konsole::changeColumns(int /*columns*/) |
1117 | { //FIXME this seems to cause silliness when reset command is executed | 1118 | { //FIXME this seems to cause silliness when reset command is executed |
1118 | // qDebug("change columns"); | 1119 | // odebug << "change columns" << oendl; |
1119 | // TEWidget* te = getTe(); | 1120 | // TEWidget* te = getTe(); |
1120 | // if (te != 0) { | 1121 | // if (te != 0) { |
1121 | // setColLin(columns,te->Lines()); | 1122 | // setColLin(columns,te->Lines()); |
1122 | // te->update(); | 1123 | // te->update(); |
1123 | // } | 1124 | // } |
1124 | } | 1125 | } |
1125 | 1126 | ||
1126 | //FIXME: If a child dies during session swap, | 1127 | //FIXME: If a child dies during session swap, |
1127 | // this routine might be called before | 1128 | // this routine might be called before |
1128 | // session swap is completed. | 1129 | // session swap is completed. |
1129 | 1130 | ||
1130 | void Konsole::doneSession(TEWidget* te, int ) | 1131 | void Konsole::doneSession(TEWidget* te, int ) |
1131 | { | 1132 | { |
1132 | // TEWidget *te = NULL; | 1133 | // TEWidget *te = NULL; |
1133 | // if (sess->currentSession == tab->currentPage()) { | 1134 | // if (sess->currentSession == tab->currentPage()) { |
1134 | // printf("done current session\n"); | 1135 | // printf("done current session\n"); |
1135 | // te = getTe(); | 1136 | // te = getTe(); |
1136 | // } else { | 1137 | // } else { |
1137 | // int currentPage = tab->currentPageIndex(); | 1138 | // int currentPage = tab->currentPageIndex(); |
1138 | // printf("done not current session\n"); | 1139 | // printf("done not current session\n"); |
1139 | // for(int i = 0; i < nsessions; i++) { | 1140 | // for(int i = 0; i < nsessions; i++) { |
1140 | // tab->setCurrentPage(i); | 1141 | // tab->setCurrentPage(i); |
1141 | // printf("find session %d tab page %x session %x\n", | 1142 | // printf("find session %d tab page %x session %x\n", |
1142 | // i, tab->currentPage(), sess->currentSession); | 1143 | // i, tab->currentPage(), sess->currentSession); |
1143 | // if (tab->currentPage() == sess->currentSession) { | 1144 | // if (tab->currentPage() == sess->currentSession) { |
1144 | // printf("found session %d\n", i); | 1145 | // printf("found session %d\n", i); |
1145 | // te = tab->currentPage(); | 1146 | // te = tab->currentPage(); |
1146 | // break; | 1147 | // break; |
1147 | // } | 1148 | // } |
1148 | // } | 1149 | // } |
1149 | // tab->setCurrentPage(currentPage); | 1150 | // tab->setCurrentPage(currentPage); |
1150 | // } | 1151 | // } |
1151 | if (te != 0) | 1152 | if (te != 0) |
1152 | { | 1153 | { |
1153 | te->currentSession->setConnect(FALSE); | 1154 | te->currentSession->setConnect(FALSE); |
1154 | tab->removeTab(te); | 1155 | tab->removeTab(te); |
1155 | delete te->currentSession; | 1156 | delete te->currentSession; |
1156 | delete te; | 1157 | delete te; |
1157 | sessionList->removeItem(nsessions); | 1158 | sessionList->removeItem(nsessions); |
1158 | nsessions--; | 1159 | nsessions--; |
1159 | } | 1160 | } |
1160 | if (nsessions == 0) | 1161 | if (nsessions == 0) |
1161 | { | 1162 | { |
1162 | close(); | 1163 | close(); |
1163 | } | 1164 | } |
1164 | } | 1165 | } |
1165 | 1166 | ||
1166 | void Konsole::changeTitle(TEWidget* te, const QString& newTitle ) | 1167 | void Konsole::changeTitle(TEWidget* te, const QString& newTitle ) |
1167 | { | 1168 | { |
1168 | if (te == getTe()) | 1169 | if (te == getTe()) |
1169 | { | 1170 | { |
1170 | setCaption( newTitle + " - " + tr( "Konsole " ) ); | 1171 | setCaption( newTitle + " - " + tr( "Konsole " ) ); |
1171 | } | 1172 | } |
1172 | } | 1173 | } |
1173 | 1174 | ||
1174 | 1175 | ||
1175 | void Konsole::newSession() | 1176 | void Konsole::newSession() |
1176 | { | 1177 | { |
1177 | if(nsessions < 15) | 1178 | if(nsessions < 15) |
1178 | { // seems to be something weird about 16 tabs on the Zaurus.... memory? | 1179 | { // seems to be something weird about 16 tabs on the Zaurus.... memory? |
1179 | TEWidget* te = new TEWidget(tab); | 1180 | TEWidget* te = new TEWidget(tab); |
1180 | Config cfg( "Konsole" ); | 1181 | Config cfg( "Konsole" ); |
1181 | cfg.setGroup("Menubar"); | 1182 | cfg.setGroup("Menubar"); |
1182 | 1183 | ||
@@ -1352,572 +1353,572 @@ void Konsole::setFullScreen ( bool b ) | |||
1352 | reparent ( 0, WStyle_Customize | WStyle_NoBorder, | 1353 | reparent ( 0, WStyle_Customize | WStyle_NoBorder, |
1353 | QPoint ( 0, 0 )); | 1354 | QPoint ( 0, 0 )); |
1354 | showFullScreen ( ); | 1355 | showFullScreen ( ); |
1355 | 1356 | ||
1356 | menuToolBar->hide(); | 1357 | menuToolBar->hide(); |
1357 | toolBar->hide(); | 1358 | toolBar->hide(); |
1358 | listHidden = secondToolBar->isHidden(); | 1359 | listHidden = secondToolBar->isHidden(); |
1359 | secondToolBar->hide(); | 1360 | secondToolBar->hide(); |
1360 | // commonCombo->hide(); | 1361 | // commonCombo->hide(); |
1361 | tab->getTabBar()->hide(); | 1362 | tab->getTabBar()->hide(); |
1362 | tab->setMargin(tab->margin()); | 1363 | tab->setMargin(tab->margin()); |
1363 | 1364 | ||
1364 | if (show_fullscreen_msg) | 1365 | if (show_fullscreen_msg) |
1365 | { | 1366 | { |
1366 | fullscreen_msg-> move(tab->x() + tab->width()/2 - fullscreen_msg->width()/2, | 1367 | fullscreen_msg-> move(tab->x() + tab->width()/2 - fullscreen_msg->width()/2, |
1367 | qApp->desktop()->height()/16 - fullscreen_msg->height()/2); | 1368 | qApp->desktop()->height()/16 - fullscreen_msg->height()/2); |
1368 | fullscreen_msg->show(); | 1369 | fullscreen_msg->show(); |
1369 | fullscreen_timer->start(3000, true); | 1370 | fullscreen_timer->start(3000, true); |
1370 | show_fullscreen_msg = false; | 1371 | show_fullscreen_msg = false; |
1371 | } | 1372 | } |
1372 | } | 1373 | } |
1373 | else | 1374 | else |
1374 | { | 1375 | { |
1375 | showNormal ( ); | 1376 | showNormal ( ); |
1376 | reparent ( 0, WStyle_Customize, QPoint ( 0, 0 )); | 1377 | reparent ( 0, WStyle_Customize, QPoint ( 0, 0 )); |
1377 | resize ( normalsize ); | 1378 | resize ( normalsize ); |
1378 | showMaximized ( ); | 1379 | showMaximized ( ); |
1379 | normalsize = QSize ( ); | 1380 | normalsize = QSize ( ); |
1380 | 1381 | ||
1381 | menuToolBar->show(); | 1382 | menuToolBar->show(); |
1382 | toolBar->show(); | 1383 | toolBar->show(); |
1383 | if(! listHidden) | 1384 | if(! listHidden) |
1384 | { | 1385 | { |
1385 | secondToolBar->show(); | 1386 | secondToolBar->show(); |
1386 | } | 1387 | } |
1387 | // commonCombo->show(); | 1388 | // commonCombo->show(); |
1388 | menuToolBar->show(); | 1389 | menuToolBar->show(); |
1389 | if (tabPos != tm_hidden) | 1390 | if (tabPos != tm_hidden) |
1390 | { | 1391 | { |
1391 | tab->getTabBar()->show(); | 1392 | tab->getTabBar()->show(); |
1392 | } | 1393 | } |
1393 | } | 1394 | } |
1394 | tab->setMargin(tab->margin()); // cause setup to run | 1395 | tab->setMargin(tab->margin()); // cause setup to run |
1395 | } | 1396 | } |
1396 | 1397 | ||
1397 | 1398 | ||
1398 | void Konsole::fullscreenTimeout() | 1399 | void Konsole::fullscreenTimeout() |
1399 | { | 1400 | { |
1400 | fullscreen_msg->hide(); | 1401 | fullscreen_msg->hide(); |
1401 | } | 1402 | } |
1402 | 1403 | ||
1403 | void Konsole::colorMenuIsSelected(int iD) | 1404 | void Konsole::colorMenuIsSelected(int iD) |
1404 | { | 1405 | { |
1405 | fromMenu = TRUE; | 1406 | fromMenu = TRUE; |
1406 | colorMenuSelected(iD); | 1407 | colorMenuSelected(iD); |
1407 | } | 1408 | } |
1408 | 1409 | ||
1409 | /// ------------------------------- some new stuff by L.J. Potter | 1410 | /// ------------------------------- some new stuff by L.J. Potter |
1410 | 1411 | ||
1411 | 1412 | ||
1412 | void Konsole::colorMenuSelected(int iD) | 1413 | void Konsole::colorMenuSelected(int iD) |
1413 | { | 1414 | { |
1414 | // this is NOT pretty, elegant or anything else besides functional | 1415 | // this is NOT pretty, elegant or anything else besides functional |
1415 | // QString temp; | 1416 | // QString temp; |
1416 | // qDebug( temp.sprintf("colormenu %d", iD)); | 1417 | // odebug << temp.sprintf("colormenu " << iD) << "" << oendl; |
1417 | 1418 | ||
1418 | TEWidget* te = getTe(); | 1419 | TEWidget* te = getTe(); |
1419 | Config cfg( "Konsole" ); | 1420 | Config cfg( "Konsole" ); |
1420 | cfg.setGroup("Colors"); | 1421 | cfg.setGroup("Colors"); |
1421 | 1422 | ||
1422 | ColorEntry m_table[TABLE_COLORS]; | 1423 | ColorEntry m_table[TABLE_COLORS]; |
1423 | const ColorEntry * defaultCt=te->getdefaultColorTable(); | 1424 | const ColorEntry * defaultCt=te->getdefaultColorTable(); |
1424 | 1425 | ||
1425 | int i; | 1426 | int i; |
1426 | 1427 | ||
1427 | // te->color_menu_item = iD; | 1428 | // te->color_menu_item = iD; |
1428 | 1429 | ||
1429 | colorMenu->setItemChecked(cm_ab,FALSE); | 1430 | colorMenu->setItemChecked(cm_ab,FALSE); |
1430 | colorMenu->setItemChecked(cm_bb,FALSE); | 1431 | colorMenu->setItemChecked(cm_bb,FALSE); |
1431 | colorMenu->setItemChecked(cm_wc,FALSE); | 1432 | colorMenu->setItemChecked(cm_wc,FALSE); |
1432 | colorMenu->setItemChecked(cm_cw,FALSE); | 1433 | colorMenu->setItemChecked(cm_cw,FALSE); |
1433 | colorMenu->setItemChecked(cm_mb,FALSE); | 1434 | colorMenu->setItemChecked(cm_mb,FALSE); |
1434 | colorMenu->setItemChecked(cm_bm,FALSE); | 1435 | colorMenu->setItemChecked(cm_bm,FALSE); |
1435 | colorMenu->setItemChecked(cm_gy,FALSE); | 1436 | colorMenu->setItemChecked(cm_gy,FALSE); |
1436 | colorMenu->setItemChecked(cm_rb,FALSE); | 1437 | colorMenu->setItemChecked(cm_rb,FALSE); |
1437 | colorMenu->setItemChecked(cm_br,FALSE); | 1438 | colorMenu->setItemChecked(cm_br,FALSE); |
1438 | colorMenu->setItemChecked(cm_wb,FALSE); | 1439 | colorMenu->setItemChecked(cm_wb,FALSE); |
1439 | colorMenu->setItemChecked(cm_bw,FALSE); | 1440 | colorMenu->setItemChecked(cm_bw,FALSE); |
1440 | colorMenu->setItemChecked(cm_gb,FALSE); | 1441 | colorMenu->setItemChecked(cm_gb,FALSE); |
1441 | 1442 | ||
1442 | if(iD==cm_default) | 1443 | if(iD==cm_default) |
1443 | { // default default | 1444 | { // default default |
1444 | printf("default colors\n"); | 1445 | printf("default colors\n"); |
1445 | for (i = 0; i < TABLE_COLORS; i++) | 1446 | for (i = 0; i < TABLE_COLORS; i++) |
1446 | { | 1447 | { |
1447 | m_table[i].color = defaultCt[i].color; | 1448 | m_table[i].color = defaultCt[i].color; |
1448 | if(i==1 || i == 11) | 1449 | if(i==1 || i == 11) |
1449 | m_table[i].transparent=1; | 1450 | m_table[i].transparent=1; |
1450 | colorMenu->setItemChecked(cm_default,TRUE); | 1451 | colorMenu->setItemChecked(cm_default,TRUE); |
1451 | } | 1452 | } |
1452 | te->setColorTable(m_table); | 1453 | te->setColorTable(m_table); |
1453 | } | 1454 | } |
1454 | if(iD==cm_gb) | 1455 | if(iD==cm_gb) |
1455 | { // green black | 1456 | { // green black |
1456 | foreground.setRgb(100,255,100); // (0x18,255,0x18); | 1457 | foreground.setRgb(100,255,100); // (0x18,255,0x18); |
1457 | background.setRgb(0x00,0x00,0x00); | 1458 | background.setRgb(0x00,0x00,0x00); |
1458 | colorMenu->setItemChecked(cm_gb,TRUE); | 1459 | colorMenu->setItemChecked(cm_gb,TRUE); |
1459 | } | 1460 | } |
1460 | if(iD==cm_bw) | 1461 | if(iD==cm_bw) |
1461 | { // black white | 1462 | { // black white |
1462 | foreground.setRgb(0x00,0x00,0x00); | 1463 | foreground.setRgb(0x00,0x00,0x00); |
1463 | background.setRgb(0xFF,0xFF,0xFF); | 1464 | background.setRgb(0xFF,0xFF,0xFF); |
1464 | colorMenu->setItemChecked(cm_bw,TRUE); | 1465 | colorMenu->setItemChecked(cm_bw,TRUE); |
1465 | } | 1466 | } |
1466 | if(iD==cm_wb) | 1467 | if(iD==cm_wb) |
1467 | { // white black | 1468 | { // white black |
1468 | foreground.setRgb(0xFF,0xFF,0xFF); | 1469 | foreground.setRgb(0xFF,0xFF,0xFF); |
1469 | background.setRgb(0x00,0x00,0x00); | 1470 | background.setRgb(0x00,0x00,0x00); |
1470 | colorMenu->setItemChecked(cm_wb,TRUE); | 1471 | colorMenu->setItemChecked(cm_wb,TRUE); |
1471 | } | 1472 | } |
1472 | if(iD==cm_br) | 1473 | if(iD==cm_br) |
1473 | {// Black, Red | 1474 | {// Black, Red |
1474 | foreground.setRgb(0x00,0x00,0x00); | 1475 | foreground.setRgb(0x00,0x00,0x00); |
1475 | background.setRgb(255,85,85); //(0xB2,0x18,0x18); | 1476 | background.setRgb(255,85,85); //(0xB2,0x18,0x18); |
1476 | colorMenu->setItemChecked(cm_br,TRUE); | 1477 | colorMenu->setItemChecked(cm_br,TRUE); |
1477 | } | 1478 | } |
1478 | if(iD==cm_rb) | 1479 | if(iD==cm_rb) |
1479 | {// Red, Black | 1480 | {// Red, Black |
1480 | foreground.setRgb(255,85,85); | 1481 | foreground.setRgb(255,85,85); |
1481 | background.setRgb(0x00,0x00,0x00); | 1482 | background.setRgb(0x00,0x00,0x00); |
1482 | colorMenu->setItemChecked(cm_rb,TRUE); | 1483 | colorMenu->setItemChecked(cm_rb,TRUE); |
1483 | } | 1484 | } |
1484 | if(iD==cm_gy) | 1485 | if(iD==cm_gy) |
1485 | {// Green, Yellow - is ugly | 1486 | {// Green, Yellow - is ugly |
1486 | // foreground.setRgb(0x18,0xB2,0x18); | 1487 | // foreground.setRgb(0x18,0xB2,0x18); |
1487 | foreground.setRgb(15,115,0); | 1488 | foreground.setRgb(15,115,0); |
1488 | // background.setRgb(0xB2,0x68,0x18); | 1489 | // background.setRgb(0xB2,0x68,0x18); |
1489 | background.setRgb(255,255,0); | 1490 | background.setRgb(255,255,0); |
1490 | colorMenu->setItemChecked(cm_gy,TRUE); | 1491 | colorMenu->setItemChecked(cm_gy,TRUE); |
1491 | } | 1492 | } |
1492 | if(iD==cm_bm) | 1493 | if(iD==cm_bm) |
1493 | {// Blue, Magenta | 1494 | {// Blue, Magenta |
1494 | foreground.setRgb(3,24,132); | 1495 | foreground.setRgb(3,24,132); |
1495 | background.setRgb(225,2,255); | 1496 | background.setRgb(225,2,255); |
1496 | colorMenu->setItemChecked(cm_bm,TRUE); | 1497 | colorMenu->setItemChecked(cm_bm,TRUE); |
1497 | } | 1498 | } |
1498 | if(iD==cm_mb) | 1499 | if(iD==cm_mb) |
1499 | {// Magenta, Blue | 1500 | {// Magenta, Blue |
1500 | foreground.setRgb(225,2,255); | 1501 | foreground.setRgb(225,2,255); |
1501 | background.setRgb(3,24,132); | 1502 | background.setRgb(3,24,132); |
1502 | colorMenu->setItemChecked(cm_mb,TRUE); | 1503 | colorMenu->setItemChecked(cm_mb,TRUE); |
1503 | } | 1504 | } |
1504 | if(iD==cm_cw) | 1505 | if(iD==cm_cw) |
1505 | {// Cyan, White | 1506 | {// Cyan, White |
1506 | foreground.setRgb(8,91,129); | 1507 | foreground.setRgb(8,91,129); |
1507 | background.setRgb(0xFF,0xFF,0xFF); | 1508 | background.setRgb(0xFF,0xFF,0xFF); |
1508 | colorMenu->setItemChecked(cm_cw,TRUE); | 1509 | colorMenu->setItemChecked(cm_cw,TRUE); |
1509 | } | 1510 | } |
1510 | if(iD==cm_wc) | 1511 | if(iD==cm_wc) |
1511 | {// White, Cyan | 1512 | {// White, Cyan |
1512 | background.setRgb(8,91,129); | 1513 | background.setRgb(8,91,129); |
1513 | foreground.setRgb(0xFF,0xFF,0xFF); | 1514 | foreground.setRgb(0xFF,0xFF,0xFF); |
1514 | colorMenu->setItemChecked(cm_wc,TRUE); | 1515 | colorMenu->setItemChecked(cm_wc,TRUE); |
1515 | } | 1516 | } |
1516 | if(iD==cm_bb) | 1517 | if(iD==cm_bb) |
1517 | {// Black, Blue | 1518 | {// Black, Blue |
1518 | background.setRgb(0x00,0x00,0x00); | 1519 | background.setRgb(0x00,0x00,0x00); |
1519 | foreground.setRgb(127,147,225); | 1520 | foreground.setRgb(127,147,225); |
1520 | colorMenu->setItemChecked(cm_bb,TRUE); | 1521 | colorMenu->setItemChecked(cm_bb,TRUE); |
1521 | } | 1522 | } |
1522 | if(iD==cm_ab) | 1523 | if(iD==cm_ab) |
1523 | {// Black, Gold | 1524 | {// Black, Gold |
1524 | background.setRgb(0x00,0x00,0x00); | 1525 | background.setRgb(0x00,0x00,0x00); |
1525 | foreground.setRgb(255,215,105); | 1526 | foreground.setRgb(255,215,105); |
1526 | colorMenu->setItemChecked(cm_ab,TRUE); | 1527 | colorMenu->setItemChecked(cm_ab,TRUE); |
1527 | } | 1528 | } |
1528 | #ifdef QT_QWS_OPIE | 1529 | #ifdef QT_QWS_OPIE |
1529 | if(iD==-19) | 1530 | if(iD==-19) |
1530 | { | 1531 | { |
1531 | // Custom | 1532 | // Custom |
1532 | qDebug("do custom"); | 1533 | odebug << "do custom" << oendl; |
1533 | if(fromMenu) | 1534 | if(fromMenu) |
1534 | { | 1535 | { |
1535 | Opie::OColorPopupMenu* penColorPopupMenu = new Opie::OColorPopupMenu(Qt::black, this, "foreground color"); | 1536 | Opie::OColorPopupMenu* penColorPopupMenu = new Opie::OColorPopupMenu(Qt::black, this, "foreground color"); |
1536 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, | 1537 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, |
1537 | SLOT(changeForegroundColor(const QColor&))); | 1538 | SLOT(changeForegroundColor(const QColor&))); |
1538 | penColorPopupMenu->exec(); | 1539 | penColorPopupMenu->exec(); |
1539 | } | 1540 | } |
1540 | if(!fromMenu) | 1541 | if(!fromMenu) |
1541 | { | 1542 | { |
1542 | foreground.setNamedColor(cfg.readEntry("foreground","")); | 1543 | foreground.setNamedColor(cfg.readEntry("foreground","")); |
1543 | background.setNamedColor(cfg.readEntry("background","")); | 1544 | background.setNamedColor(cfg.readEntry("background","")); |
1544 | } | 1545 | } |
1545 | fromMenu=FALSE; | 1546 | fromMenu=FALSE; |
1546 | colorMenu->setItemChecked(-19,TRUE); | 1547 | colorMenu->setItemChecked(-19,TRUE); |
1547 | } | 1548 | } |
1548 | #endif | 1549 | #endif |
1549 | 1550 | ||
1550 | lastSelectedMenu = iD; | 1551 | lastSelectedMenu = iD; |
1551 | 1552 | ||
1552 | setColors(foreground, background); | 1553 | setColors(foreground, background); |
1553 | 1554 | ||
1554 | QTabBar *tabBar = tab->getTabBar(); | 1555 | QTabBar *tabBar = tab->getTabBar(); |
1555 | QString ss = QString("Session%1").arg(tabBar->currentTab()); | 1556 | QString ss = QString("Session%1").arg(tabBar->currentTab()); |
1556 | // printf("current tab = %d\n", tabBar->currentTab()); | 1557 | // printf("current tab = %d\n", tabBar->currentTab()); |
1557 | 1558 | ||
1558 | if (tabBar->currentTab() == 0) | 1559 | if (tabBar->currentTab() == 0) |
1559 | { | 1560 | { |
1560 | cfg.writeEntry("foregroundRed",QString::number(foreground.red())); | 1561 | cfg.writeEntry("foregroundRed",QString::number(foreground.red())); |
1561 | cfg.writeEntry("foregroundGreen",QString::number(foreground.green())); | 1562 | cfg.writeEntry("foregroundGreen",QString::number(foreground.green())); |
1562 | cfg.writeEntry("foregroundBlue",QString::number(foreground.blue())); | 1563 | cfg.writeEntry("foregroundBlue",QString::number(foreground.blue())); |
1563 | cfg.writeEntry("backgroundRed",QString::number(background.red())); | 1564 | cfg.writeEntry("backgroundRed",QString::number(background.red())); |
1564 | cfg.writeEntry("backgroundGreen",QString::number(background.green())); | 1565 | cfg.writeEntry("backgroundGreen",QString::number(background.green())); |
1565 | cfg.writeEntry("backgroundBlue",QString::number(background.blue())); | 1566 | cfg.writeEntry("backgroundBlue",QString::number(background.blue())); |
1566 | } | 1567 | } |
1567 | cfg.writeEntry("foregroundRed"+ss,QString::number(foreground.red())); | 1568 | cfg.writeEntry("foregroundRed"+ss,QString::number(foreground.red())); |
1568 | cfg.writeEntry("foregroundGreen"+ss,QString::number(foreground.green())); | 1569 | cfg.writeEntry("foregroundGreen"+ss,QString::number(foreground.green())); |
1569 | cfg.writeEntry("foregroundBlue"+ss,QString::number(foreground.blue())); | 1570 | cfg.writeEntry("foregroundBlue"+ss,QString::number(foreground.blue())); |
1570 | cfg.writeEntry("backgroundRed"+ss,QString::number(background.red())); | 1571 | cfg.writeEntry("backgroundRed"+ss,QString::number(background.red())); |
1571 | cfg.writeEntry("backgroundGreen"+ss,QString::number(background.green())); | 1572 | cfg.writeEntry("backgroundGreen"+ss,QString::number(background.green())); |
1572 | cfg.writeEntry("backgroundBlue"+ss,QString::number(background.blue())); | 1573 | cfg.writeEntry("backgroundBlue"+ss,QString::number(background.blue())); |
1573 | 1574 | ||
1574 | update(); | 1575 | update(); |
1575 | } | 1576 | } |
1576 | 1577 | ||
1577 | void Konsole::setColors(QColor foreground, QColor background) | 1578 | void Konsole::setColors(QColor foreground, QColor background) |
1578 | { | 1579 | { |
1579 | int i; | 1580 | int i; |
1580 | ColorEntry m_table[TABLE_COLORS]; | 1581 | ColorEntry m_table[TABLE_COLORS]; |
1581 | TEWidget* te = getTe(); | 1582 | TEWidget* te = getTe(); |
1582 | const ColorEntry * defaultCt=te->getdefaultColorTable(); | 1583 | const ColorEntry * defaultCt=te->getdefaultColorTable(); |
1583 | 1584 | ||
1584 | for (i = 0; i < TABLE_COLORS; i++) | 1585 | for (i = 0; i < TABLE_COLORS; i++) |
1585 | { | 1586 | { |
1586 | if(i==0 || i == 10) | 1587 | if(i==0 || i == 10) |
1587 | { | 1588 | { |
1588 | m_table[i].color = foreground; | 1589 | m_table[i].color = foreground; |
1589 | } | 1590 | } |
1590 | else if(i==1 || i == 11) | 1591 | else if(i==1 || i == 11) |
1591 | { | 1592 | { |
1592 | m_table[i].color = background; | 1593 | m_table[i].color = background; |
1593 | m_table[i].transparent=0; | 1594 | m_table[i].transparent=0; |
1594 | } | 1595 | } |
1595 | else | 1596 | else |
1596 | m_table[i].color = defaultCt[i].color; | 1597 | m_table[i].color = defaultCt[i].color; |
1597 | } | 1598 | } |
1598 | te->setColorTable(m_table); | 1599 | te->setColorTable(m_table); |
1599 | } | 1600 | } |
1600 | 1601 | ||
1601 | void Konsole::tabMenuSelected(int id) | 1602 | void Konsole::tabMenuSelected(int id) |
1602 | { | 1603 | { |
1603 | Config cfg( "Konsole" ); | 1604 | Config cfg( "Konsole" ); |
1604 | cfg.setGroup("Tabs"); | 1605 | cfg.setGroup("Tabs"); |
1605 | tabMenu->setItemChecked(tabPos, false); | 1606 | tabMenu->setItemChecked(tabPos, false); |
1606 | if (id == tm_bottom) | 1607 | if (id == tm_bottom) |
1607 | { | 1608 | { |
1608 | printf("set bottom tab\n"); | 1609 | printf("set bottom tab\n"); |
1609 | tab->getTabBar()->show(); | 1610 | tab->getTabBar()->show(); |
1610 | tab->setTabPosition(QTabWidget::Bottom); | 1611 | tab->setTabPosition(QTabWidget::Bottom); |
1611 | tab->getTabBar()->show(); | 1612 | tab->getTabBar()->show(); |
1612 | cfg.writeEntry("Position","Bottom"); | 1613 | cfg.writeEntry("Position","Bottom"); |
1613 | } | 1614 | } |
1614 | else if (id == tm_top) | 1615 | else if (id == tm_top) |
1615 | { | 1616 | { |
1616 | printf("set top tab\n"); | 1617 | printf("set top tab\n"); |
1617 | tab->getTabBar()->show(); | 1618 | tab->getTabBar()->show(); |
1618 | tab->setTabPosition(QTabWidget::Bottom); | 1619 | tab->setTabPosition(QTabWidget::Bottom); |
1619 | tab->setTabPosition(QTabWidget::Top); | 1620 | tab->setTabPosition(QTabWidget::Top); |
1620 | tab->getTabBar()->show(); | 1621 | tab->getTabBar()->show(); |
1621 | cfg.writeEntry("Position","Top"); | 1622 | cfg.writeEntry("Position","Top"); |
1622 | } | 1623 | } |
1623 | else if (id == tm_hidden) | 1624 | else if (id == tm_hidden) |
1624 | { | 1625 | { |
1625 | tab->getTabBar()->hide(); | 1626 | tab->getTabBar()->hide(); |
1626 | tab->setMargin(tab->margin()); | 1627 | tab->setMargin(tab->margin()); |
1627 | cfg.writeEntry("Position","Hidden"); | 1628 | cfg.writeEntry("Position","Hidden"); |
1628 | } | 1629 | } |
1629 | tabMenu->setItemChecked(id, true); | 1630 | tabMenu->setItemChecked(id, true); |
1630 | tabPos = id; | 1631 | tabPos = id; |
1631 | } | 1632 | } |
1632 | 1633 | ||
1633 | 1634 | ||
1634 | void Konsole::configMenuSelected(int iD) | 1635 | void Konsole::configMenuSelected(int iD) |
1635 | { | 1636 | { |
1636 | // QString temp; | 1637 | // QString temp; |
1637 | // qDebug( temp.sprintf("configmenu %d",iD)); | 1638 | // odebug << temp.sprintf("configmenu " << iD) << "" << oendl; |
1638 | 1639 | ||
1639 | TEWidget* te = getTe(); | 1640 | TEWidget* te = getTe(); |
1640 | Config cfg( "Konsole" ); | 1641 | Config cfg( "Konsole" ); |
1641 | cfg.setGroup("Menubar"); | 1642 | cfg.setGroup("Menubar"); |
1642 | if(iD == cm_wrap) | 1643 | if(iD == cm_wrap) |
1643 | { | 1644 | { |
1644 | cfg.setGroup("ScrollBar"); | 1645 | cfg.setGroup("ScrollBar"); |
1645 | bool b=cfg.readBoolEntry("HorzScroll",0); | 1646 | bool b=cfg.readBoolEntry("HorzScroll",0); |
1646 | b=!b; | 1647 | b=!b; |
1647 | cfg.writeEntry("HorzScroll", b ); | 1648 | cfg.writeEntry("HorzScroll", b ); |
1648 | cfg.write(); | 1649 | cfg.write(); |
1649 | doWrap(); | 1650 | doWrap(); |
1650 | if(cfg.readNumEntry("Position",2) == 0) | 1651 | if(cfg.readNumEntry("Position",2) == 0) |
1651 | { | 1652 | { |
1652 | te->setScrollbarLocation(1); | 1653 | te->setScrollbarLocation(1); |
1653 | } | 1654 | } |
1654 | else | 1655 | else |
1655 | { | 1656 | { |
1656 | te->setScrollbarLocation(0); | 1657 | te->setScrollbarLocation(0); |
1657 | } | 1658 | } |
1658 | te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 1659 | te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
1659 | } | 1660 | } |
1660 | if(iD == cm_beep) | 1661 | if(iD == cm_beep) |
1661 | { | 1662 | { |
1662 | cfg.setGroup("Menubar"); | 1663 | cfg.setGroup("Menubar"); |
1663 | bool b=cfg.readBoolEntry("useBeep",0); | 1664 | bool b=cfg.readBoolEntry("useBeep",0); |
1664 | b=!b; | 1665 | b=!b; |
1665 | cfg.writeEntry("useBeep", b ); | 1666 | cfg.writeEntry("useBeep", b ); |
1666 | cfg.write(); | 1667 | cfg.write(); |
1667 | configMenu->setItemChecked(cm_beep,b); | 1668 | configMenu->setItemChecked(cm_beep,b); |
1668 | te->useBeep=b; | 1669 | te->useBeep=b; |
1669 | } | 1670 | } |
1670 | } | 1671 | } |
1671 | 1672 | ||
1672 | void Konsole::changeCommand(const QString &text, int c) | 1673 | void Konsole::changeCommand(const QString &text, int c) |
1673 | { | 1674 | { |
1674 | Config cfg( "Konsole" ); | 1675 | Config cfg( "Konsole" ); |
1675 | cfg.setGroup("Commands"); | 1676 | cfg.setGroup("Commands"); |
1676 | if(commonCmds[c] != text) | 1677 | if(commonCmds[c] != text) |
1677 | { | 1678 | { |
1678 | cfg.writeEntry(QString::number(c),text); | 1679 | cfg.writeEntry(QString::number(c),text); |
1679 | commonCombo->clearEdit(); | 1680 | commonCombo->clearEdit(); |
1680 | commonCombo->setCurrentItem(c); | 1681 | commonCombo->setCurrentItem(c); |
1681 | } | 1682 | } |
1682 | } | 1683 | } |
1683 | 1684 | ||
1684 | void Konsole::setColor(int sess) | 1685 | void Konsole::setColor(int sess) |
1685 | { | 1686 | { |
1686 | Config cfg( "Konsole" ); | 1687 | Config cfg( "Konsole" ); |
1687 | cfg.setGroup("Colors"); | 1688 | cfg.setGroup("Colors"); |
1688 | QColor foreground, background; | 1689 | QColor foreground, background; |
1689 | QString ss = QString("Session") + QString::number(sess); | 1690 | QString ss = QString("Session") + QString::number(sess); |
1690 | foreground.setRgb(cfg.readNumEntry("foregroundRed"+ss, | 1691 | foreground.setRgb(cfg.readNumEntry("foregroundRed"+ss, |
1691 | cfg.readNumEntry("foregroundRed",0xff)), | 1692 | cfg.readNumEntry("foregroundRed",0xff)), |
1692 | cfg.readNumEntry("foregroundGreen"+ss, | 1693 | cfg.readNumEntry("foregroundGreen"+ss, |
1693 | cfg.readNumEntry("foregroundGreen",0xff)), | 1694 | cfg.readNumEntry("foregroundGreen",0xff)), |
1694 | cfg.readNumEntry("foregroundBlue"+ss, | 1695 | cfg.readNumEntry("foregroundBlue"+ss, |
1695 | cfg.readNumEntry("foregroundBlue",0xff))); | 1696 | cfg.readNumEntry("foregroundBlue",0xff))); |
1696 | background.setRgb(cfg.readNumEntry("backgroundRed"+ss, | 1697 | background.setRgb(cfg.readNumEntry("backgroundRed"+ss, |
1697 | cfg.readNumEntry("backgroundRed",0)), | 1698 | cfg.readNumEntry("backgroundRed",0)), |
1698 | cfg.readNumEntry("backgroundGreen"+ss, | 1699 | cfg.readNumEntry("backgroundGreen"+ss, |
1699 | cfg.readNumEntry("backgroundGreen",0)), | 1700 | cfg.readNumEntry("backgroundGreen",0)), |
1700 | cfg.readNumEntry("backgroundBlue"+ss, | 1701 | cfg.readNumEntry("backgroundBlue"+ss, |
1701 | cfg.readNumEntry("backgroundBlue",0))); | 1702 | cfg.readNumEntry("backgroundBlue",0))); |
1702 | setColors(foreground, background); | 1703 | setColors(foreground, background); |
1703 | } | 1704 | } |
1704 | 1705 | ||
1705 | void Konsole::scrollMenuSelected(int index) | 1706 | void Konsole::scrollMenuSelected(int index) |
1706 | { | 1707 | { |
1707 | // qDebug( "scrollbar menu %d",index); | 1708 | // odebug << "scrollbar menu " << index << "" << oendl; |
1708 | 1709 | ||
1709 | TEWidget* te = getTe(); | 1710 | TEWidget* te = getTe(); |
1710 | Config cfg( "Konsole" ); | 1711 | Config cfg( "Konsole" ); |
1711 | cfg.setGroup("ScrollBar"); | 1712 | cfg.setGroup("ScrollBar"); |
1712 | 1713 | ||
1713 | if(index == sm_none) | 1714 | if(index == sm_none) |
1714 | { | 1715 | { |
1715 | te->setScrollbarLocation(0); | 1716 | te->setScrollbarLocation(0); |
1716 | cfg.writeEntry("Position",0); | 1717 | cfg.writeEntry("Position",0); |
1717 | } | 1718 | } |
1718 | else if(index == sm_left) | 1719 | else if(index == sm_left) |
1719 | { | 1720 | { |
1720 | te->setScrollbarLocation(1); | 1721 | te->setScrollbarLocation(1); |
1721 | cfg.writeEntry("Position",1); | 1722 | cfg.writeEntry("Position",1); |
1722 | } | 1723 | } |
1723 | else if(index == sm_right) | 1724 | else if(index == sm_right) |
1724 | { | 1725 | { |
1725 | te->setScrollbarLocation(2); | 1726 | te->setScrollbarLocation(2); |
1726 | cfg.writeEntry("Position",2); | 1727 | cfg.writeEntry("Position",2); |
1727 | } | 1728 | } |
1728 | scrollMenu->setItemChecked(sm_none, index == sm_none); | 1729 | scrollMenu->setItemChecked(sm_none, index == sm_none); |
1729 | scrollMenu->setItemChecked(sm_left, index == sm_left); | 1730 | scrollMenu->setItemChecked(sm_left, index == sm_left); |
1730 | scrollMenu->setItemChecked(sm_right, index == sm_right); | 1731 | scrollMenu->setItemChecked(sm_right, index == sm_right); |
1731 | } | 1732 | } |
1732 | 1733 | ||
1733 | // case -29: { | 1734 | // case -29: { |
1734 | // bool b=cfg.readBoolEntry("HorzScroll",0); | 1735 | // bool b=cfg.readBoolEntry("HorzScroll",0); |
1735 | // cfg.writeEntry("HorzScroll", !b ); | 1736 | // cfg.writeEntry("HorzScroll", !b ); |
1736 | // cfg.write(); | 1737 | // cfg.write(); |
1737 | // if(cfg.readNumEntry("Position",2) == 0) { | 1738 | // if(cfg.readNumEntry("Position",2) == 0) { |
1738 | // te->setScrollbarLocation(1); | 1739 | // te->setScrollbarLocation(1); |
1739 | // te->setWrapAt(0); | 1740 | // te->setWrapAt(0); |
1740 | // } else { | 1741 | // } else { |
1741 | // te->setScrollbarLocation(0); | 1742 | // te->setScrollbarLocation(0); |
1742 | // te->setWrapAt(120); | 1743 | // te->setWrapAt(120); |
1743 | // } | 1744 | // } |
1744 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 1745 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
1745 | // } | 1746 | // } |
1746 | // break; | 1747 | // break; |
1747 | 1748 | ||
1748 | void Konsole::editCommandListMenuSelected(int iD) | 1749 | void Konsole::editCommandListMenuSelected(int iD) |
1749 | { | 1750 | { |
1750 | // QString temp; | 1751 | // QString temp; |
1751 | // qDebug( temp.sprintf("edit command list %d",iD)); | 1752 | // odebug << temp.sprintf("edit command list " << iD) << "" << oendl; |
1752 | 1753 | ||
1753 | // FIXME: more cleanup needed here | 1754 | // FIXME: more cleanup needed here |
1754 | 1755 | ||
1755 | 1756 | ||
1756 | TEWidget* te = getTe(); | 1757 | TEWidget* te = getTe(); |
1757 | Config cfg( "Konsole" ); | 1758 | Config cfg( "Konsole" ); |
1758 | cfg.setGroup("Menubar"); | 1759 | cfg.setGroup("Menubar"); |
1759 | if( iD == ec_cmdlist) | 1760 | if( iD == ec_cmdlist) |
1760 | { | 1761 | { |
1761 | if(!secondToolBar->isHidden()) | 1762 | if(!secondToolBar->isHidden()) |
1762 | { | 1763 | { |
1763 | secondToolBar->hide(); | 1764 | secondToolBar->hide(); |
1764 | configMenu->changeItem( iD,tr( "Show Command List" )); | 1765 | configMenu->changeItem( iD,tr( "Show Command List" )); |
1765 | cfg.writeEntry("Hidden","TRUE"); | 1766 | cfg.writeEntry("Hidden","TRUE"); |
1766 | configMenu->setItemEnabled(ec_edit ,FALSE); | 1767 | configMenu->setItemEnabled(ec_edit ,FALSE); |
1767 | configMenu->setItemEnabled(ec_quick ,FALSE); | 1768 | configMenu->setItemEnabled(ec_quick ,FALSE); |
1768 | } | 1769 | } |
1769 | else | 1770 | else |
1770 | { | 1771 | { |
1771 | secondToolBar->show(); | 1772 | secondToolBar->show(); |
1772 | configMenu->changeItem( iD,tr( "Hide Command List" )); | 1773 | configMenu->changeItem( iD,tr( "Hide Command List" )); |
1773 | cfg.writeEntry("Hidden","FALSE"); | 1774 | cfg.writeEntry("Hidden","FALSE"); |
1774 | configMenu->setItemEnabled(ec_edit ,TRUE); | 1775 | configMenu->setItemEnabled(ec_edit ,TRUE); |
1775 | configMenu->setItemEnabled(ec_quick ,TRUE); | 1776 | configMenu->setItemEnabled(ec_quick ,TRUE); |
1776 | 1777 | ||
1777 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") | 1778 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") |
1778 | { | 1779 | { |
1779 | configMenu->setItemChecked(ec_edit,TRUE); | 1780 | configMenu->setItemChecked(ec_edit,TRUE); |
1780 | commonCombo->setEditable( TRUE ); | 1781 | commonCombo->setEditable( TRUE ); |
1781 | } | 1782 | } |
1782 | else | 1783 | else |
1783 | { | 1784 | { |
1784 | configMenu->setItemChecked(ec_edit,FALSE); | 1785 | configMenu->setItemChecked(ec_edit,FALSE); |
1785 | commonCombo->setEditable( FALSE ); | 1786 | commonCombo->setEditable( FALSE ); |
1786 | } | 1787 | } |
1787 | } | 1788 | } |
1788 | } | 1789 | } |
1789 | if( iD == ec_quick) | 1790 | if( iD == ec_quick) |
1790 | { | 1791 | { |
1791 | cfg.setGroup("Commands"); | 1792 | cfg.setGroup("Commands"); |
1792 | // qDebug("enableCommandEdit"); | 1793 | // odebug << "enableCommandEdit" << oendl; |
1793 | if( !configMenu->isItemChecked(iD) ) | 1794 | if( !configMenu->isItemChecked(iD) ) |
1794 | { | 1795 | { |
1795 | commonCombo->setEditable( TRUE ); | 1796 | commonCombo->setEditable( TRUE ); |
1796 | configMenu->setItemChecked(iD,TRUE); | 1797 | configMenu->setItemChecked(iD,TRUE); |
1797 | commonCombo->setCurrentItem(0); | 1798 | commonCombo->setCurrentItem(0); |
1798 | cfg.writeEntry("EditEnabled","TRUE"); | 1799 | cfg.writeEntry("EditEnabled","TRUE"); |
1799 | } | 1800 | } |
1800 | else | 1801 | else |
1801 | { | 1802 | { |
1802 | commonCombo->setEditable( FALSE ); | 1803 | commonCombo->setEditable( FALSE ); |
1803 | configMenu->setItemChecked(iD,FALSE); | 1804 | configMenu->setItemChecked(iD,FALSE); |
1804 | cfg.writeEntry("EditEnabled","FALSE"); | 1805 | cfg.writeEntry("EditEnabled","FALSE"); |
1805 | commonCombo->setFocusPolicy(QWidget::NoFocus); | 1806 | commonCombo->setFocusPolicy(QWidget::NoFocus); |
1806 | te->setFocus(); | 1807 | te->setFocus(); |
1807 | } | 1808 | } |
1808 | } | 1809 | } |
1809 | if(iD == ec_edit) | 1810 | if(iD == ec_edit) |
1810 | { | 1811 | { |
1811 | // "edit commands" | 1812 | // "edit commands" |
1812 | CommandEditDialog *m = new CommandEditDialog(this); | 1813 | CommandEditDialog *m = new CommandEditDialog(this); |
1813 | connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList())); | 1814 | connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList())); |
1814 | m->showMaximized(); | 1815 | m->showMaximized(); |
1815 | } | 1816 | } |
1816 | 1817 | ||
1817 | } | 1818 | } |
1818 | 1819 | ||
1819 | // $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' | 1820 | // $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' |
1820 | void Konsole::setDocument( const QString &cmd) | 1821 | void Konsole::setDocument( const QString &cmd) |
1821 | { | 1822 | { |
1822 | newSession(); | 1823 | newSession(); |
1823 | TEWidget* te = getTe(); | 1824 | TEWidget* te = getTe(); |
1824 | if(cmd.find("-e", 0, TRUE) != -1) | 1825 | if(cmd.find("-e", 0, TRUE) != -1) |
1825 | { | 1826 | { |
1826 | QString cmd2; | 1827 | QString cmd2; |
1827 | cmd2=cmd.right(cmd.length()-3)+" &"; | 1828 | cmd2=cmd.right(cmd.length()-3)+" &"; |
1828 | system(cmd2.latin1()); | 1829 | system(cmd2.latin1()); |
1829 | if(startUp <= 1 && nsessions < 2) | 1830 | if(startUp <= 1 && nsessions < 2) |
1830 | { | 1831 | { |
1831 | doneSession(getTe(), 0); | 1832 | doneSession(getTe(), 0); |
1832 | exit(0); | 1833 | exit(0); |
1833 | } | 1834 | } |
1834 | else | 1835 | else |
1835 | doneSession(getTe(), 0); | 1836 | doneSession(getTe(), 0); |
1836 | } | 1837 | } |
1837 | else | 1838 | else |
1838 | { | 1839 | { |
1839 | if (te != 0) | 1840 | if (te != 0) |
1840 | { | 1841 | { |
1841 | te->emitText(cmd+"\r"); | 1842 | te->emitText(cmd+"\r"); |
1842 | } | 1843 | } |
1843 | } | 1844 | } |
1844 | startUp++; | 1845 | startUp++; |
1845 | } | 1846 | } |
1846 | 1847 | ||
1847 | 1848 | ||
1848 | // what is the point of this when you can just | 1849 | // what is the point of this when you can just |
1849 | // run commands by using the shell directly?? | 1850 | // run commands by using the shell directly?? |
1850 | void Konsole::parseCommandLine() | 1851 | void Konsole::parseCommandLine() |
1851 | { | 1852 | { |
1852 | QString cmd; | 1853 | QString cmd; |
1853 | // newSession(); | 1854 | // newSession(); |
1854 | for (int i=1;i< qApp->argc();i++) | 1855 | for (int i=1;i< qApp->argc();i++) |
1855 | { | 1856 | { |
1856 | if( QString(qApp->argv()[i]) == "-e") | 1857 | if( QString(qApp->argv()[i]) == "-e") |
1857 | { | 1858 | { |
1858 | i++; | 1859 | i++; |
1859 | for ( int j=i;j< qApp->argc();j++) | 1860 | for ( int j=i;j< qApp->argc();j++) |
1860 | { | 1861 | { |
1861 | cmd+=QString(qApp->argv()[j])+" "; | 1862 | cmd+=QString(qApp->argv()[j])+" "; |
1862 | } | 1863 | } |
1863 | cmd.stripWhiteSpace(); | 1864 | cmd.stripWhiteSpace(); |
1864 | system(cmd.latin1()); | 1865 | system(cmd.latin1()); |
1865 | exit(0);//close(); | 1866 | exit(0);//close(); |
1866 | } // end -e switch | 1867 | } // end -e switch |
1867 | } | 1868 | } |
1868 | startUp++; | 1869 | startUp++; |
1869 | } | 1870 | } |
1870 | 1871 | ||
1871 | void Konsole::changeForegroundColor(const QColor &color) | 1872 | void Konsole::changeForegroundColor(const QColor &color) |
1872 | { | 1873 | { |
1873 | Config cfg( "Konsole" ); | 1874 | Config cfg( "Konsole" ); |
1874 | cfg.setGroup("Colors"); | 1875 | cfg.setGroup("Colors"); |
1875 | int r, g, b; | 1876 | int r, g, b; |
1876 | color.rgb(&r,&g,&b); | 1877 | color.rgb(&r,&g,&b); |
1877 | foreground.setRgb(r,g,b); | 1878 | foreground.setRgb(r,g,b); |
1878 | 1879 | ||
1879 | cfg.writeEntry("foreground",color.name()); | 1880 | cfg.writeEntry("foreground",color.name()); |
1880 | qDebug("foreground "+color.name()); | 1881 | odebug << "foreground "+color.name() << oendl; |
1881 | cfg.write(); | 1882 | cfg.write(); |
1882 | 1883 | ||
1883 | qDebug("do other dialog"); | 1884 | odebug << "do other dialog" << oendl; |
1884 | #ifdef QT_QWS_OPIE | 1885 | #ifdef QT_QWS_OPIE |
1885 | 1886 | ||
1886 | Opie::OColorPopupMenu* penColorPopupMenu2 = new Opie::OColorPopupMenu(Qt::black, this,"background color"); | 1887 | Opie::OColorPopupMenu* penColorPopupMenu2 = new Opie::OColorPopupMenu(Qt::black, this,"background color"); |
1887 | connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, | 1888 | connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, |
1888 | SLOT(changeBackgroundColor(const QColor&))); | 1889 | SLOT(changeBackgroundColor(const QColor&))); |
1889 | penColorPopupMenu2->exec(); | 1890 | penColorPopupMenu2->exec(); |
1890 | #endif | 1891 | #endif |
1891 | } | 1892 | } |
1892 | 1893 | ||
1893 | void Konsole::changeBackgroundColor(const QColor &color) | 1894 | void Konsole::changeBackgroundColor(const QColor &color) |
1894 | { | 1895 | { |
1895 | 1896 | ||
1896 | qDebug("Change background"); | 1897 | odebug << "Change background" << oendl; |
1897 | Config cfg( "Konsole" ); | 1898 | Config cfg( "Konsole" ); |
1898 | cfg.setGroup("Colors"); | 1899 | cfg.setGroup("Colors"); |
1899 | int r, g, b; | 1900 | int r, g, b; |
1900 | color.rgb(&r,&g,&b); | 1901 | color.rgb(&r,&g,&b); |
1901 | background.setRgb(r,g,b); | 1902 | background.setRgb(r,g,b); |
1902 | cfg.writeEntry("background",color.name()); | 1903 | cfg.writeEntry("background",color.name()); |
1903 | qDebug("background "+color.name()); | 1904 | odebug << "background "+color.name() << oendl; |
1904 | cfg.write(); | 1905 | cfg.write(); |
1905 | } | 1906 | } |
1906 | 1907 | ||
1907 | void Konsole::doWrap() | 1908 | void Konsole::doWrap() |
1908 | { | 1909 | { |
1909 | Config cfg( "Konsole" ); | 1910 | Config cfg( "Konsole" ); |
1910 | cfg.setGroup("ScrollBar"); | 1911 | cfg.setGroup("ScrollBar"); |
1911 | TEWidget* te = getTe(); | 1912 | TEWidget* te = getTe(); |
1912 | if( !cfg.readBoolEntry("HorzScroll",0)) | 1913 | if( !cfg.readBoolEntry("HorzScroll",0)) |
1913 | { | 1914 | { |
1914 | te->setWrapAt(0); | 1915 | te->setWrapAt(0); |
1915 | configMenu->setItemChecked( cm_wrap,TRUE); | 1916 | configMenu->setItemChecked( cm_wrap,TRUE); |
1916 | } | 1917 | } |
1917 | else | 1918 | else |
1918 | { | 1919 | { |
1919 | // te->setWrapAt(90); | 1920 | // te->setWrapAt(90); |
1920 | te->setWrapAt(120); | 1921 | te->setWrapAt(120); |
1921 | configMenu->setItemChecked( cm_wrap,FALSE); | 1922 | configMenu->setItemChecked( cm_wrap,FALSE); |
1922 | } | 1923 | } |
1923 | } | 1924 | } |
diff --git a/core/apps/embeddedkonsole/main.cpp b/core/apps/embeddedkonsole/main.cpp index b851d3e..131e782 100644 --- a/core/apps/embeddedkonsole/main.cpp +++ b/core/apps/embeddedkonsole/main.cpp | |||
@@ -1,85 +1,85 @@ | |||
1 | /* ---------------------------------------------------------------------- */ | 1 | /* ---------------------------------------------------------------------- */ |
2 | /* */ | 2 | /* */ |
3 | /* [main.C] Konsole */ | 3 | /* [main.C] Konsole */ |
4 | /* */ | 4 | /* */ |
5 | /* ---------------------------------------------------------------------- */ | 5 | /* ---------------------------------------------------------------------- */ |
6 | /* */ | 6 | /* */ |
7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ | 7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ |
8 | /* */ | 8 | /* */ |
9 | /* This file is part of Konsole, an X terminal. */ | 9 | /* This file is part of Konsole, an X terminal. */ |
10 | /* */ | 10 | /* */ |
11 | /* The material contained in here more or less directly orginates from */ | 11 | /* The material contained in here more or less directly orginates from */ |
12 | /* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ | 12 | /* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ |
13 | /* */ | 13 | /* */ |
14 | /* ---------------------------------------------------------------------- */ | 14 | /* ---------------------------------------------------------------------- */ |
15 | /* */ | 15 | /* */ |
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 | 21 | ||
22 | #include "konsole.h" | 22 | #include "konsole.h" |
23 | 23 | ||
24 | #ifdef QT_QWS_OPIE | 24 | #ifdef QT_QWS_OPIE |
25 | 25 | ||
26 | #include <opie2/oapplicationfactory.h> | 26 | #include <opie2/oapplicationfactory.h> |
27 | 27 | ||
28 | /* --| main |------------------------------------------------------ */ | 28 | /* --| main |------------------------------------------------------ */ |
29 | using namespace Opie::Core; | 29 | using namespace Opie::Core; |
30 | OPIE_EXPORT_APP( OApplicationFactory<Konsole> ) | 30 | OPIE_EXPORT_APP( OApplicationFactory<Konsole> ) |
31 | 31 | ||
32 | #else //for non opie builds | 32 | #else //for non opie builds |
33 | 33 | ||
34 | #include <qpe/qpeapplication.h> | 34 | #include <qpe/qpeapplication.h> |
35 | 35 | ||
36 | #include <qfile.h> | 36 | #include <qfile.h> |
37 | 37 | ||
38 | #include <unistd.h> | 38 | #include <unistd.h> |
39 | #include <stdio.h> | 39 | #include <stdio.h> |
40 | #include <stdlib.h> | 40 | #include <stdlib.h> |
41 | 41 | ||
42 | #include <pwd.h> | 42 | #include <pwd.h> |
43 | #include <sys/types.h> | 43 | #include <sys/types.h> |
44 | 44 | ||
45 | 45 | ||
46 | /* --| main |------------------------------------------------------ */ | 46 | /* --| main |------------------------------------------------------ */ |
47 | int main(int argc, char* argv[]) { | 47 | int main(int argc, char* argv[]) { |
48 | if(setuid(getuid()) !=0) qDebug("setuid failed"); | 48 | if(setuid(getuid()) !=0) odebug << "setuid failed" << oendl; |
49 | if(setgid(getgid()) != 0) qDebug("setgid failed"); // drop privileges | 49 | if(setgid(getgid()) != 0) odebug << "setgid failed" << oendl; // drop privileges |
50 | 50 | ||
51 | QPEApplication a( argc, argv ); | 51 | QPEApplication a( argc, argv ); |
52 | #ifdef FAKE_CTRL_AND_ALT | 52 | #ifdef FAKE_CTRL_AND_ALT |
53 | qDebug("Fake Ctrl and Alt defined"); | 53 | odebug << "Fake Ctrl and Alt defined" << oendl; |
54 | QPEApplication::grabKeyboard(); // for CTRL and ALT | 54 | QPEApplication::grabKeyboard(); // for CTRL and ALT |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | QStrList tmp; | 57 | QStrList tmp; |
58 | const char* shell = getenv("SHELL"); | 58 | const char* shell = getenv("SHELL"); |
59 | 59 | ||
60 | if (shell == NULL || *shell == '\0') { | 60 | if (shell == NULL || *shell == '\0') { |
61 | struct passwd *ent = 0; | 61 | struct passwd *ent = 0; |
62 | uid_t me = getuid(); | 62 | uid_t me = getuid(); |
63 | shell = "/bin/sh"; | 63 | shell = "/bin/sh"; |
64 | 64 | ||
65 | while ( (ent = getpwent()) != 0 ) { | 65 | while ( (ent = getpwent()) != 0 ) { |
66 | if (ent->pw_uid == me) { | 66 | if (ent->pw_uid == me) { |
67 | if (ent->pw_shell != "") | 67 | if (ent->pw_shell != "") |
68 | shell = ent->pw_shell; | 68 | shell = ent->pw_shell; |
69 | break; | 69 | break; |
70 | } | 70 | } |
71 | } | 71 | } |
72 | endpwent(); | 72 | endpwent(); |
73 | } | 73 | } |
74 | 74 | ||
75 | if( putenv((char*)"COLORTERM=") !=0) | 75 | if( putenv((char*)"COLORTERM=") !=0) |
76 | qDebug("putenv failed"); // to trigger mc's color detection | 76 | odebug << "putenv failed" << oendl; // to trigger mc's color detection |
77 | 77 | ||
78 | Konsole m( "test", shell, tmp, TRUE ); | 78 | Konsole m( "test", shell, tmp, TRUE ); |
79 | m.setCaption( Konsole::tr("Terminal") ); | 79 | m.setCaption( Konsole::tr("Terminal") ); |
80 | a.showMainWidget( &m ); | 80 | a.showMainWidget( &m ); |
81 | 81 | ||
82 | return a.exec(); | 82 | return a.exec(); |
83 | } | 83 | } |
84 | 84 | ||
85 | #endif | 85 | #endif |
diff --git a/core/apps/embeddedkonsole/playlistselection.cpp b/core/apps/embeddedkonsole/playlistselection.cpp index fc5330f..096d36a 100644 --- a/core/apps/embeddedkonsole/playlistselection.cpp +++ b/core/apps/embeddedkonsole/playlistselection.cpp | |||
@@ -1,148 +1,151 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qheader.h> | ||
21 | 20 | ||
22 | #include "playlistselection.h" | 21 | #include "playlistselection.h" |
23 | 22 | ||
24 | #include <stdlib.h> | 23 | /* OPIE */ |
25 | 24 | #include <opie2/odebug.h> | |
26 | 25 | ||
26 | /* Qt */ | ||
27 | #include <qheader.h> | ||
27 | 28 | ||
29 | /* STD */ | ||
30 | #include <stdlib.h> | ||
28 | 31 | ||
29 | 32 | ||
30 | PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) | 33 | PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) |
31 | : QListView( parent, name ) | 34 | : QListView( parent, name ) |
32 | { | 35 | { |
33 | setAllColumnsShowFocus( TRUE ); | 36 | setAllColumnsShowFocus( TRUE ); |
34 | addColumn( tr( "Command Selection" ) ); | 37 | addColumn( tr( "Command Selection" ) ); |
35 | header()->hide(); | 38 | header()->hide(); |
36 | setSorting( -1, FALSE ); | 39 | setSorting( -1, FALSE ); |
37 | } | 40 | } |
38 | 41 | ||
39 | 42 | ||
40 | PlayListSelection::~PlayListSelection() { | 43 | PlayListSelection::~PlayListSelection() { |
41 | } | 44 | } |
42 | 45 | ||
43 | 46 | ||
44 | 47 | ||
45 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { | 48 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { |
46 | if ( event->state() == QMouseEvent::LeftButton ) { | 49 | if ( event->state() == QMouseEvent::LeftButton ) { |
47 | QListViewItem *currentItem = selectedItem(); | 50 | QListViewItem *currentItem = selectedItem(); |
48 | QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); | 51 | QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); |
49 | if ( currentItem && currentItem->itemAbove() == itemUnder ) | 52 | if ( currentItem && currentItem->itemAbove() == itemUnder ) |
50 | moveSelectedUp(); | 53 | moveSelectedUp(); |
51 | else if ( currentItem && currentItem->itemBelow() == itemUnder ) | 54 | else if ( currentItem && currentItem->itemBelow() == itemUnder ) |
52 | moveSelectedDown(); | 55 | moveSelectedDown(); |
53 | } | 56 | } |
54 | } | 57 | } |
55 | 58 | ||
56 | 59 | ||
57 | const QString *PlayListSelection::current() { | 60 | const QString *PlayListSelection::current() { |
58 | PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); | 61 | PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); |
59 | if ( item ) | 62 | if ( item ) |
60 | return item->file(); | 63 | return item->file(); |
61 | return NULL; | 64 | return NULL; |
62 | } | 65 | } |
63 | 66 | ||
64 | 67 | ||
65 | void PlayListSelection::addToSelection( QListViewItem *lnk ) { | 68 | void PlayListSelection::addToSelection( QListViewItem *lnk ) { |
66 | PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk->text(0) ) ); | 69 | PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk->text(0) ) ); |
67 | QListViewItem *current = selectedItem(); | 70 | QListViewItem *current = selectedItem(); |
68 | if ( current ) | 71 | if ( current ) |
69 | item->moveItem( current ); | 72 | item->moveItem( current ); |
70 | setSelected( item, TRUE ); | 73 | setSelected( item, TRUE ); |
71 | ensureItemVisible( selectedItem() ); | 74 | ensureItemVisible( selectedItem() ); |
72 | } | 75 | } |
73 | 76 | ||
74 | void PlayListSelection::addStringToSelection (const QString & lnk) { | 77 | void PlayListSelection::addStringToSelection (const QString & lnk) { |
75 | PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk ) ); | 78 | PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk ) ); |
76 | QListViewItem *current = selectedItem(); | 79 | QListViewItem *current = selectedItem(); |
77 | if ( current ) | 80 | if ( current ) |
78 | item->moveItem( current ); | 81 | item->moveItem( current ); |
79 | setSelected( item, TRUE ); | 82 | setSelected( item, TRUE ); |
80 | ensureItemVisible( selectedItem() ); | 83 | ensureItemVisible( selectedItem() ); |
81 | 84 | ||
82 | } | 85 | } |
83 | void PlayListSelection::removeSelected() { | 86 | void PlayListSelection::removeSelected() { |
84 | qDebug("removeSelected()"); | 87 | odebug << "removeSelected()" << oendl; |
85 | QListViewItem *item = selectedItem(); | 88 | QListViewItem *item = selectedItem(); |
86 | if ( item ) | 89 | if ( item ) |
87 | delete item; | 90 | delete item; |
88 | setSelected( currentItem(), TRUE ); | 91 | setSelected( currentItem(), TRUE ); |
89 | ensureItemVisible( selectedItem() ); | 92 | ensureItemVisible( selectedItem() ); |
90 | } | 93 | } |
91 | 94 | ||
92 | 95 | ||
93 | void PlayListSelection::moveSelectedUp() { | 96 | void PlayListSelection::moveSelectedUp() { |
94 | QListViewItem *item = selectedItem(); | 97 | QListViewItem *item = selectedItem(); |
95 | if ( item && item->itemAbove() ) | 98 | if ( item && item->itemAbove() ) |
96 | item->itemAbove()->moveItem( item ); | 99 | item->itemAbove()->moveItem( item ); |
97 | ensureItemVisible( selectedItem() ); | 100 | ensureItemVisible( selectedItem() ); |
98 | } | 101 | } |
99 | 102 | ||
100 | 103 | ||
101 | void PlayListSelection::moveSelectedDown() { | 104 | void PlayListSelection::moveSelectedDown() { |
102 | QListViewItem *item = selectedItem(); | 105 | QListViewItem *item = selectedItem(); |
103 | if ( item && item->itemBelow() ) | 106 | if ( item && item->itemBelow() ) |
104 | item->moveItem( item->itemBelow() ); | 107 | item->moveItem( item->itemBelow() ); |
105 | ensureItemVisible( selectedItem() ); | 108 | ensureItemVisible( selectedItem() ); |
106 | } | 109 | } |
107 | 110 | ||
108 | 111 | ||
109 | bool PlayListSelection::prev() { | 112 | bool PlayListSelection::prev() { |
110 | QListViewItem *item = selectedItem(); | 113 | QListViewItem *item = selectedItem(); |
111 | if ( item && item->itemAbove() ) | 114 | if ( item && item->itemAbove() ) |
112 | setSelected( item->itemAbove(), TRUE ); | 115 | setSelected( item->itemAbove(), TRUE ); |
113 | else | 116 | else |
114 | return FALSE; | 117 | return FALSE; |
115 | ensureItemVisible( selectedItem() ); | 118 | ensureItemVisible( selectedItem() ); |
116 | return TRUE; | 119 | return TRUE; |
117 | } | 120 | } |
118 | 121 | ||
119 | 122 | ||
120 | bool PlayListSelection::next() { | 123 | bool PlayListSelection::next() { |
121 | QListViewItem *item = selectedItem(); | 124 | QListViewItem *item = selectedItem(); |
122 | if ( item && item->itemBelow() ) | 125 | if ( item && item->itemBelow() ) |
123 | setSelected( item->itemBelow(), TRUE ); | 126 | setSelected( item->itemBelow(), TRUE ); |
124 | else | 127 | else |
125 | return FALSE; | 128 | return FALSE; |
126 | ensureItemVisible( selectedItem() ); | 129 | ensureItemVisible( selectedItem() ); |
127 | return TRUE; | 130 | return TRUE; |
128 | } | 131 | } |
129 | 132 | ||
130 | 133 | ||
131 | bool PlayListSelection::first() { | 134 | bool PlayListSelection::first() { |
132 | QListViewItem *item = firstChild(); | 135 | QListViewItem *item = firstChild(); |
133 | if ( item ) | 136 | if ( item ) |
134 | setSelected( item, TRUE ); | 137 | setSelected( item, TRUE ); |
135 | else | 138 | else |
136 | return FALSE; | 139 | return FALSE; |
137 | ensureItemVisible( selectedItem() ); | 140 | ensureItemVisible( selectedItem() ); |
138 | return TRUE; | 141 | return TRUE; |
139 | } | 142 | } |
140 | 143 | ||
141 | 144 | ||
142 | bool PlayListSelection::last() { | 145 | bool PlayListSelection::last() { |
143 | QListViewItem *prevItem = NULL; | 146 | QListViewItem *prevItem = NULL; |
144 | QListViewItem *item = firstChild(); | 147 | QListViewItem *item = firstChild(); |
145 | while ( ( item = item->nextSibling() ) ) | 148 | while ( ( item = item->nextSibling() ) ) |
146 | prevItem = item; | 149 | prevItem = item; |
147 | if ( prevItem ) | 150 | if ( prevItem ) |
148 | setSelected( prevItem, TRUE ); | 151 | setSelected( prevItem, TRUE ); |