author | drw <drw> | 2004-02-24 00:01:04 (UTC) |
---|---|---|
committer | drw <drw> | 2004-02-24 00:01:04 (UTC) |
commit | 99bcf9b87929dfba62449f6e365eff561ed3fab9 (patch) (unidiff) | |
tree | 26cda4ab533b907126a97056b5c96c3f9ab504df | |
parent | da044756096aef5819add4c0faf5f305b155648f (diff) | |
download | opie-99bcf9b87929dfba62449f6e365eff561ed3fab9.zip opie-99bcf9b87929dfba62449f6e365eff561ed3fab9.tar.gz opie-99bcf9b87929dfba62449f6e365eff561ed3fab9.tar.bz2 |
Embedded Konsole: libopie->libopie2
-rw-r--r-- | core/apps/embeddedkonsole/config.in | 2 | ||||
-rwxr-xr-x | core/apps/embeddedkonsole/embeddedkonsole.pro | 4 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 12 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/main.cpp | 12 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/opie-embeddedkonsole.control | 2 |
5 files changed, 11 insertions, 21 deletions
diff --git a/core/apps/embeddedkonsole/config.in b/core/apps/embeddedkonsole/config.in index 3a421d6..a3a1844 100644 --- a/core/apps/embeddedkonsole/config.in +++ b/core/apps/embeddedkonsole/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config EMBEDDEDKONSOLE | 1 | config EMBEDDEDKONSOLE |
2 | boolean "opie-embeddedkonsole (konsole from KDE adapted for Qt/Embedded)" | 2 | boolean "opie-embeddedkonsole (konsole from KDE adapted for Qt/Embedded)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBQTAUX |
diff --git a/core/apps/embeddedkonsole/embeddedkonsole.pro b/core/apps/embeddedkonsole/embeddedkonsole.pro index 427c013..2743488 100755 --- a/core/apps/embeddedkonsole/embeddedkonsole.pro +++ b/core/apps/embeddedkonsole/embeddedkonsole.pro | |||
@@ -1,38 +1,38 @@ | |||
1 | QMAKE_CFLAGS = -DHAVE_OPENPTY | 1 | QMAKE_CFLAGS = -DHAVE_OPENPTY |
2 | TMAKE_FLAGS += -DHAVE_OPENPTY | 2 | TMAKE_FLAGS += -DHAVE_OPENPTY |
3 | QMAKE_LIBS = -lutil | 3 | QMAKE_LIBS = -lutil |
4 | CONFIG += qt warn_on release quick-app | 4 | CONFIG += qt warn_on release quick-app |
5 | HEADERS = TEWidget.h \ | 5 | HEADERS = TEWidget.h \ |
6 | TEScreen.h \ | 6 | TEScreen.h \ |
7 | TECommon.h \ | 7 | TECommon.h \ |
8 | TEHistory.h \ | 8 | TEHistory.h \ |
9 | TEmulation.h \ | 9 | TEmulation.h \ |
10 | TEmuVt102.h \ | 10 | TEmuVt102.h \ |
11 | session.h \ | 11 | session.h \ |
12 | keytrans.h \ | 12 | keytrans.h \ |
13 | konsole.h \ | 13 | konsole.h \ |
14 | commandeditdialog.h \ | 14 | commandeditdialog.h \ |
15 | commandeditwidget.h \ | 15 | commandeditwidget.h \ |
16 | playlistselection.h \ | 16 | playlistselection.h \ |
17 | MyPty.h | 17 | MyPty.h |
18 | SOURCES = TEScreen.cpp \ | 18 | SOURCES = TEScreen.cpp \ |
19 | TEWidget.cpp \ | 19 | TEWidget.cpp \ |
20 | TEHistory.cpp \ | 20 | TEHistory.cpp \ |
21 | TEmulation.cpp \ | 21 | TEmulation.cpp \ |
22 | TEmuVt102.cpp \ | 22 | TEmuVt102.cpp \ |
23 | session.cpp \ | 23 | session.cpp \ |
24 | keytrans.cpp \ | 24 | keytrans.cpp \ |
25 | konsole.cpp \ | 25 | konsole.cpp \ |
26 | commandeditdialog.cpp \ | 26 | commandeditdialog.cpp \ |
27 | commandeditwidget.cpp \ | 27 | commandeditwidget.cpp \ |
28 | playlistselection.cpp \ | 28 | playlistselection.cpp \ |
29 | MyPty.cpp \ | 29 | MyPty.cpp \ |
30 | main.cpp | 30 | main.cpp |
31 | INTERFACES = commandeditdialogbase.ui smallcommandeditdialogbase.ui | 31 | INTERFACES = commandeditdialogbase.ui smallcommandeditdialogbase.ui |
32 | TARGET = embeddedkonsole | 32 | TARGET = embeddedkonsole |
33 | INCLUDEPATH += $(OPIEDIR)/include | 33 | INCLUDEPATH += $(OPIEDIR)/include |
34 | DEPENDPATH += $(OPIEDIR)/include | 34 | DEPENDPATH += $(OPIEDIR)/include |
35 | LIBS += -lqpe -lopie | 35 | LIBS += -lqpe -lopiecore2 -lqtaux2 |
36 | TMAKE_CXXFLAGS += -DQT_QWS_OPIE -DHAVE_OPENPTY | 36 | TMAKE_CXXFLAGS += -DQT_QWS_OPIE -DHAVE_OPENPTY |
37 | 37 | ||
38 | include ( $(OPIEDIR)/include.pro ) | 38 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index d10b66d..46c0203 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -1,453 +1,453 @@ | |||
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 | //#define QT_QWS_OPIE | 23 | //#define QT_QWS_OPIE |
24 | 24 | ||
25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
26 | 26 | ||
27 | #ifdef QT_QWS_OPIE | ||
28 | #include <opie2/ocolorpopupmenu.h> | ||
29 | #endif | ||
30 | |||
27 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
28 | 32 | ||
29 | #include <qdir.h> | 33 | #include <qdir.h> |
30 | #include <qevent.h> | 34 | #include <qevent.h> |
31 | #include <qdragobject.h> | 35 | #include <qdragobject.h> |
32 | #include <qobjectlist.h> | 36 | #include <qobjectlist.h> |
33 | #include <qtoolbutton.h> | 37 | #include <qtoolbutton.h> |
34 | #include <qtoolbar.h> | 38 | #include <qtoolbar.h> |
35 | #include <qpushbutton.h> | 39 | #include <qpushbutton.h> |
36 | #include <qfontdialog.h> | 40 | #include <qfontdialog.h> |
37 | #include <qglobal.h> | 41 | #include <qglobal.h> |
38 | #include <qpainter.h> | 42 | #include <qpainter.h> |
39 | #include <qmenubar.h> | 43 | #include <qmenubar.h> |
40 | #include <qmessagebox.h> | 44 | #include <qmessagebox.h> |
41 | #include <qaction.h> | 45 | #include <qaction.h> |
42 | #include <qapplication.h> | 46 | #include <qapplication.h> |
43 | #include <qfontmetrics.h> | 47 | #include <qfontmetrics.h> |
44 | #include <qcombobox.h> | 48 | #include <qcombobox.h> |
45 | #include <qevent.h> | 49 | #include <qevent.h> |
46 | #include <qtabwidget.h> | 50 | #include <qtabwidget.h> |
47 | #include <qtabbar.h> | 51 | #include <qtabbar.h> |
48 | #include <qpe/config.h> | 52 | #include <qpe/config.h> |
49 | #include <qstringlist.h> | 53 | #include <qstringlist.h> |
50 | #include <qpalette.h> | 54 | #include <qpalette.h> |
51 | #include <qfontdatabase.h> | 55 | #include <qfontdatabase.h> |
52 | #include <qfile.h> | 56 | #include <qfile.h> |
53 | #include <qspinbox.h> | 57 | #include <qspinbox.h> |
54 | #include <qlayout.h> | 58 | #include <qlayout.h> |
55 | #include <qvbox.h> | 59 | #include <qvbox.h> |
56 | 60 | ||
57 | #include <sys/wait.h> | 61 | #include <sys/wait.h> |
58 | #include <stdio.h> | 62 | #include <stdio.h> |
59 | #include <stdlib.h> | 63 | #include <stdlib.h> |
60 | #include <assert.h> | 64 | #include <assert.h> |
61 | 65 | ||
62 | #include "konsole.h" | 66 | #include "konsole.h" |
63 | #include "keytrans.h" | 67 | #include "keytrans.h" |
64 | #include "commandeditdialog.h" | 68 | #include "commandeditdialog.h" |
65 | 69 | ||
66 | #ifdef QT_QWS_OPIE | ||
67 | #include <opie/colorpopupmenu.h> | ||
68 | #endif | ||
69 | |||
70 | class EKNumTabBar : public QTabBar | 70 | class EKNumTabBar : public QTabBar |
71 | { | 71 | { |
72 | public: | 72 | public: |
73 | EKNumTabBar(QWidget *parent = 0, const char *name = 0) : | 73 | EKNumTabBar(QWidget *parent = 0, const char *name = 0) : |
74 | QTabBar(parent, name) | 74 | QTabBar(parent, name) |
75 | {} | 75 | {} |
76 | 76 | ||
77 | // QList<QTab> *getTabList() { return(tabList()); } | 77 | // QList<QTab> *getTabList() { return(tabList()); } |
78 | 78 | ||
79 | void numberTabs() | 79 | void numberTabs() |
80 | { | 80 | { |
81 | // Yes, it really is this messy. QTabWidget needs functions | 81 | // Yes, it really is this messy. QTabWidget needs functions |
82 | // that provide acces to tabs in a sequential way. | 82 | // that provide acces to tabs in a sequential way. |
83 | int m=INT_MIN; | 83 | int m=INT_MIN; |
84 | for (int i=0; i<count(); i++) | 84 | for (int i=0; i<count(); i++) |
85 | { | 85 | { |
86 | QTab* left=0; | 86 | QTab* left=0; |
87 | QListIterator<QTab> it(*tabList()); | 87 | QListIterator<QTab> it(*tabList()); |
88 | int x=INT_MAX; | 88 | int x=INT_MAX; |
89 | for( QTab* t; (t=it.current()); ++it ) | 89 | for( QTab* t; (t=it.current()); ++it ) |
90 | { | 90 | { |
91 | int tx = t->rect().x(); | 91 | int tx = t->rect().x(); |
92 | if ( tx<x && tx>m ) | 92 | if ( tx<x && tx>m ) |
93 | { | 93 | { |
94 | x = tx; | 94 | x = tx; |
95 | left = t; | 95 | left = t; |
96 | } | 96 | } |
97 | } | 97 | } |
98 | if ( left ) | 98 | if ( left ) |
99 | { | 99 | { |
100 | left->setText(QString::number(i+1)); | 100 | left->setText(QString::number(i+1)); |
101 | m = left->rect().x(); | 101 | m = left->rect().x(); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
106 | virtual QSize sizeHint() const | 106 | virtual QSize sizeHint() const |
107 | { | 107 | { |
108 | if (isHidden()) | 108 | if (isHidden()) |
109 | { | 109 | { |
110 | return(QSize(0,0)); | 110 | return(QSize(0,0)); |
111 | } | 111 | } |
112 | else | 112 | else |
113 | { | 113 | { |
114 | QSize size = QTabBar::sizeHint(); | 114 | QSize size = QTabBar::sizeHint(); |
115 | int shrink = 5; | 115 | int shrink = 5; |
116 | if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600) | 116 | if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600) |
117 | { | 117 | { |
118 | shrink = 10; | 118 | shrink = 10; |
119 | } | 119 | } |
120 | size.setHeight(size.height() - shrink); | 120 | size.setHeight(size.height() - shrink); |
121 | return(size); | 121 | return(size); |
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | }; | 125 | }; |
126 | 126 | ||
127 | class EKNumTabWidget : public QTabWidget | 127 | class EKNumTabWidget : public QTabWidget |
128 | { | 128 | { |
129 | public: | 129 | public: |
130 | EKNumTabWidget(QWidget* parent) : QTabWidget(parent) | 130 | EKNumTabWidget(QWidget* parent) : QTabWidget(parent) |
131 | { | 131 | { |
132 | setTabBar(new EKNumTabBar(parent,"EKTabBar")); | 132 | setTabBar(new EKNumTabBar(parent,"EKTabBar")); |
133 | setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); | 133 | setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); |
134 | } | 134 | } |
135 | 135 | ||
136 | EKNumTabBar *getTabBar() const | 136 | EKNumTabBar *getTabBar() const |
137 | { | 137 | { |
138 | return ((EKNumTabBar*)tabBar()); | 138 | return ((EKNumTabBar*)tabBar()); |
139 | } | 139 | } |
140 | 140 | ||
141 | 141 | ||
142 | void addTab(QWidget* w) | 142 | void addTab(QWidget* w) |
143 | { | 143 | { |
144 | QTab* t = new QTab(QString::number(tabBar()->count()+1)); | 144 | QTab* t = new QTab(QString::number(tabBar()->count()+1)); |
145 | QTabWidget::addTab(w,t); | 145 | QTabWidget::addTab(w,t); |
146 | } | 146 | } |
147 | 147 | ||
148 | void removeTab(QWidget* w) | 148 | void removeTab(QWidget* w) |
149 | { | 149 | { |
150 | removePage(w); | 150 | removePage(w); |
151 | ((EKNumTabBar*)tabBar())->numberTabs(); | 151 | ((EKNumTabBar*)tabBar())->numberTabs(); |
152 | } | 152 | } |
153 | }; | 153 | }; |
154 | 154 | ||
155 | // This could be configurable or dynamicly generated from the bash history | 155 | // This could be configurable or dynamicly generated from the bash history |
156 | // file of the user | 156 | // file of the user |
157 | static const char *commonCmds[] = | 157 | static const char *commonCmds[] = |
158 | { | 158 | { |
159 | "ls ", // I left this here, cause it looks better than the first alpha | 159 | "ls ", // I left this here, cause it looks better than the first alpha |
160 | "cardctl eject", | 160 | "cardctl eject", |
161 | "cat ", | 161 | "cat ", |
162 | "cd ", | 162 | "cd ", |
163 | "chmod ", | 163 | "chmod ", |
164 | "clear", | 164 | "clear", |
165 | "cp ", | 165 | "cp ", |
166 | "dc ", | 166 | "dc ", |
167 | "df ", | 167 | "df ", |
168 | "dmesg", | 168 | "dmesg", |
169 | "echo ", | 169 | "echo ", |
170 | "env", | 170 | "env", |
171 | "find ", | 171 | "find ", |
172 | "free", | 172 | "free", |
173 | "grep ", | 173 | "grep ", |
174 | "ifconfig ", | 174 | "ifconfig ", |
175 | "ipkg ", | 175 | "ipkg ", |
176 | "mkdir ", | 176 | "mkdir ", |
177 | "mv ", | 177 | "mv ", |
178 | "nc localhost 7776", | 178 | "nc localhost 7776", |
179 | "nc localhost 7777", | 179 | "nc localhost 7777", |
180 | "netstat ", | 180 | "netstat ", |
181 | "nslookup ", | 181 | "nslookup ", |
182 | "ping ", | 182 | "ping ", |
183 | "ps aux", | 183 | "ps aux", |
184 | "pwd ", | 184 | "pwd ", |
185 | "qcop QPE/System 'linkChanged(QString)' ''", | 185 | "qcop QPE/System 'linkChanged(QString)' ''", |
186 | "qcop QPE/System 'restart()'", | 186 | "qcop QPE/System 'restart()'", |
187 | "qcop QPE/System 'quit()'", | 187 | "qcop QPE/System 'quit()'", |
188 | "rm ", | 188 | "rm ", |
189 | "rmdir ", | 189 | "rmdir ", |
190 | "route ", | 190 | "route ", |
191 | "set ", | 191 | "set ", |
192 | "traceroute", | 192 | "traceroute", |
193 | 193 | ||
194 | /* | 194 | /* |
195 | "gzip", | 195 | "gzip", |
196 | "gunzip", | 196 | "gunzip", |
197 | "chgrp", | 197 | "chgrp", |
198 | "chown", | 198 | "chown", |
199 | "date", | 199 | "date", |
200 | "dd", | 200 | "dd", |
201 | "df", | 201 | "df", |
202 | "dmesg", | 202 | "dmesg", |
203 | "fuser", | 203 | "fuser", |
204 | "hostname", | 204 | "hostname", |
205 | "kill", | 205 | "kill", |
206 | "killall", | 206 | "killall", |
207 | "ln", | 207 | "ln", |
208 | "ping", | 208 | "ping", |
209 | "mount", | 209 | "mount", |
210 | "more", | 210 | "more", |
211 | "sort", | 211 | "sort", |
212 | "touch", | 212 | "touch", |
213 | "umount", | 213 | "umount", |
214 | "mknod", | 214 | "mknod", |
215 | "netstat", | 215 | "netstat", |
216 | */ | 216 | */ |
217 | 217 | ||
218 | "exit", | 218 | "exit", |
219 | NULL | 219 | NULL |
220 | }; | 220 | }; |
221 | 221 | ||
222 | 222 | ||
223 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : | 223 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : |
224 | QMainWindow(parent, name, fl) | 224 | QMainWindow(parent, name, fl) |
225 | { | 225 | { |
226 | QStrList args; | 226 | QStrList args; |
227 | init("/bin/bash",args); | 227 | init("/bin/bash",args); |
228 | } | 228 | } |
229 | 229 | ||
230 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) | 230 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) |
231 | : QMainWindow(0, name) | 231 | : QMainWindow(0, name) |
232 | { | 232 | { |
233 | init(_pgm,_args); | 233 | init(_pgm,_args); |
234 | } | 234 | } |
235 | 235 | ||
236 | struct HistoryItem | 236 | struct HistoryItem |
237 | { | 237 | { |
238 | HistoryItem(int c, const QString &l) | 238 | HistoryItem(int c, const QString &l) |
239 | { | 239 | { |
240 | count = c; | 240 | count = c; |
241 | line = l; | 241 | line = l; |
242 | } | 242 | } |
243 | int count; | 243 | int count; |
244 | QString line; | 244 | QString line; |
245 | }; | 245 | }; |
246 | 246 | ||
247 | class HistoryList : public QList<HistoryItem> | 247 | class HistoryList : public QList<HistoryItem> |
248 | { | 248 | { |
249 | virtual int compareItems( QCollection::Item item1, QCollection::Item item2) | 249 | virtual int compareItems( QCollection::Item item1, QCollection::Item item2) |
250 | { | 250 | { |
251 | int c1 = ((HistoryItem*)item1)->count; | 251 | int c1 = ((HistoryItem*)item1)->count; |
252 | int c2 = ((HistoryItem*)item2)->count; | 252 | int c2 = ((HistoryItem*)item2)->count; |
253 | if (c1 > c2) | 253 | if (c1 > c2) |
254 | return(1); | 254 | return(1); |
255 | if (c1 < c2) | 255 | if (c1 < c2) |
256 | return(-1); | 256 | return(-1); |
257 | return(0); | 257 | return(0); |
258 | } | 258 | } |
259 | }; | 259 | }; |
260 | 260 | ||
261 | void Konsole::initCommandList() | 261 | void Konsole::initCommandList() |
262 | { | 262 | { |
263 | // qDebug("Konsole::initCommandList"); | 263 | // qDebug("Konsole::initCommandList"); |
264 | Config cfg("Qkonsole"); | 264 | Config cfg("Qkonsole"); |
265 | cfg.setGroup("Commands"); | 265 | cfg.setGroup("Commands"); |
266 | // commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 266 | // commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
267 | commonCombo->clear(); | 267 | commonCombo->clear(); |
268 | 268 | ||
269 | if (cfg.readEntry("ShellHistory","TRUE") == "TRUE") | 269 | if (cfg.readEntry("ShellHistory","TRUE") == "TRUE") |
270 | { | 270 | { |
271 | QString histfilename = QString(getenv("HOME")) + "/.bash_history"; | 271 | QString histfilename = QString(getenv("HOME")) + "/.bash_history"; |
272 | histfilename = cfg.readEntry("ShellHistoryPath",histfilename); | 272 | histfilename = cfg.readEntry("ShellHistoryPath",histfilename); |
273 | QFile histfile(histfilename); | 273 | QFile histfile(histfilename); |
274 | // note: compiler barfed on: | 274 | // note: compiler barfed on: |
275 | // QFile histfile(QString(getenv("HOME")) + "/.bash_history"); | 275 | // QFile histfile(QString(getenv("HOME")) + "/.bash_history"); |
276 | if (histfile.open( IO_ReadOnly )) | 276 | if (histfile.open( IO_ReadOnly )) |
277 | { | 277 | { |
278 | QString line; | 278 | QString line; |
279 | uint i; | 279 | uint i; |
280 | HistoryList items; | 280 | HistoryList items; |
281 | 281 | ||
282 | int lineno = 0; | 282 | int lineno = 0; |
283 | while(!histfile.atEnd()) | 283 | while(!histfile.atEnd()) |
284 | { | 284 | { |
285 | if (histfile.readLine(line, 200) < 0) | 285 | if (histfile.readLine(line, 200) < 0) |
286 | { | 286 | { |
287 | break; | 287 | break; |
288 | } | 288 | } |
289 | line = line.left(line.length()-1); | 289 | line = line.left(line.length()-1); |
290 | lineno++; | 290 | lineno++; |
291 | 291 | ||
292 | for(i=0; i<items.count(); i++) | 292 | for(i=0; i<items.count(); i++) |
293 | { | 293 | { |
294 | if (line == items.at(i)->line) | 294 | if (line == items.at(i)->line) |
295 | { | 295 | { |
296 | // weight recent commands & repeated commands more | 296 | // weight recent commands & repeated commands more |
297 | // by adding up the index of each command | 297 | // by adding up the index of each command |
298 | items.at(i)->count += lineno; | 298 | items.at(i)->count += lineno; |
299 | break; | 299 | break; |
300 | } | 300 | } |
301 | } | 301 | } |
302 | if (i >= items.count()) | 302 | if (i >= items.count()) |
303 | { | 303 | { |
304 | items.append(new HistoryItem(lineno, line)); | 304 | items.append(new HistoryItem(lineno, line)); |
305 | } | 305 | } |
306 | } | 306 | } |
307 | items.sort(); | 307 | items.sort(); |
308 | int n = items.count(); | 308 | int n = items.count(); |
309 | if (n > 40) | 309 | if (n > 40) |
310 | { | 310 | { |
311 | n = 40; | 311 | n = 40; |
312 | } | 312 | } |
313 | for(int i=0; i<n; i++) | 313 | for(int i=0; i<n; i++) |
314 | { | 314 | { |
315 | // should insert start of command, but keep whole thing | 315 | // should insert start of command, but keep whole thing |
316 | if (items.at(items.count()-i-1)->line.length() < 30) | 316 | if (items.at(items.count()-i-1)->line.length() < 30) |
317 | { | 317 | { |
318 | commonCombo->insertItem(items.at(items.count()-i-1)->line); | 318 | commonCombo->insertItem(items.at(items.count()-i-1)->line); |
319 | } | 319 | } |
320 | } | 320 | } |
321 | histfile.close(); | 321 | histfile.close(); |
322 | } | 322 | } |
323 | } | 323 | } |
324 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") | 324 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") |
325 | { | 325 | { |
326 | for (int i = 0; commonCmds[i] != NULL; i++) | 326 | for (int i = 0; commonCmds[i] != NULL; i++) |
327 | { | 327 | { |
328 | commonCombo->insertItem(commonCmds[i]); | 328 | commonCombo->insertItem(commonCmds[i]); |
329 | } | 329 | } |
330 | } | 330 | } |
331 | else | 331 | else |
332 | { | 332 | { |
333 | for (int i = 0; i < 100; i++) | 333 | for (int i = 0; i < 100; i++) |
334 | { | 334 | { |
335 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) | 335 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) |
336 | commonCombo->insertItem(cfg.readEntry( QString::number(i),"")); | 336 | commonCombo->insertItem(cfg.readEntry( QString::number(i),"")); |
337 | } | 337 | } |
338 | } | 338 | } |
339 | 339 | ||
340 | 340 | ||
341 | } | 341 | } |
342 | 342 | ||
343 | static void sig_handler(int x) | 343 | static void sig_handler(int x) |
344 | { | 344 | { |
345 | printf("got signal %d\n",x); | 345 | printf("got signal %d\n",x); |
346 | } | 346 | } |
347 | 347 | ||
348 | void Konsole::init(const char* _pgm, QStrList & _args) | 348 | void Konsole::init(const char* _pgm, QStrList & _args) |
349 | { | 349 | { |
350 | 350 | ||
351 | #if 0 | 351 | #if 0 |
352 | for(int i=1; i<=31; i++) | 352 | for(int i=1; i<=31; i++) |
353 | { | 353 | { |
354 | if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV | 354 | if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV |
355 | && i != SIGINT && i != SIGILL && i != SIGTERM | 355 | && i != SIGINT && i != SIGILL && i != SIGTERM |
356 | && i != SIGBUS) | 356 | && i != SIGBUS) |
357 | signal(i,sig_handler); | 357 | signal(i,sig_handler); |
358 | } | 358 | } |
359 | #endif | 359 | #endif |
360 | signal(SIGSTOP, sig_handler); | 360 | signal(SIGSTOP, sig_handler); |
361 | signal(SIGCONT, sig_handler); | 361 | signal(SIGCONT, sig_handler); |
362 | signal(SIGTSTP, sig_handler); | 362 | signal(SIGTSTP, sig_handler); |
363 | 363 | ||
364 | b_scroll = TRUE; // histon; | 364 | b_scroll = TRUE; // histon; |
365 | n_keytab = 0; | 365 | n_keytab = 0; |
366 | n_render = 0; | 366 | n_render = 0; |
367 | startUp=0; | 367 | startUp=0; |
368 | fromMenu = FALSE; | 368 | fromMenu = FALSE; |
369 | fullscreen = false; | 369 | fullscreen = false; |
370 | 370 | ||
371 | setCaption( "Qkonsole" ); | 371 | setCaption( "Qkonsole" ); |
372 | setIcon( Resource::loadPixmap( "qkonsole/qkonsole" ) ); | 372 | setIcon( Resource::loadPixmap( "qkonsole/qkonsole" ) ); |
373 | 373 | ||
374 | Config cfg("Qkonsole"); | 374 | Config cfg("Qkonsole"); |
375 | cfg.setGroup("Font"); | 375 | cfg.setGroup("Font"); |
376 | QString tmp; | 376 | QString tmp; |
377 | 377 | ||
378 | // initialize the list of allowed fonts /////////////////////////////////// | 378 | // initialize the list of allowed fonts /////////////////////////////////// |
379 | 379 | ||
380 | QString cfgFontName = cfg.readEntry("FontName","Lcfont"); | 380 | QString cfgFontName = cfg.readEntry("FontName","Lcfont"); |
381 | int cfgFontSize = cfg.readNumEntry("FontSize",18); | 381 | int cfgFontSize = cfg.readNumEntry("FontSize",18); |
382 | 382 | ||
383 | cfont = -1; | 383 | cfont = -1; |
384 | 384 | ||
385 | // this code causes repeated access to all the font files | 385 | // this code causes repeated access to all the font files |
386 | // which does slow down startup | 386 | // which does slow down startup |
387 | QFontDatabase fontDB; | 387 | QFontDatabase fontDB; |
388 | QStringList familyNames; | 388 | QStringList familyNames; |
389 | familyNames = fontDB.families( FALSE ); | 389 | familyNames = fontDB.families( FALSE ); |
390 | QString s; | 390 | QString s; |
391 | int fontIndex = 0; | 391 | int fontIndex = 0; |
392 | int familyNum = 0; | 392 | int familyNum = 0; |
393 | fontList = new QPopupMenu( this ); | 393 | fontList = new QPopupMenu( this ); |
394 | 394 | ||
395 | for(uint j = 0; j < (uint)familyNames.count(); j++) | 395 | for(uint j = 0; j < (uint)familyNames.count(); j++) |
396 | { | 396 | { |
397 | s = familyNames[j]; | 397 | s = familyNames[j]; |
398 | if ( s.contains('-') ) | 398 | if ( s.contains('-') ) |
399 | { | 399 | { |
400 | int i = s.find('-'); | 400 | int i = s.find('-'); |
401 | s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]"; | 401 | s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]"; |
402 | } | 402 | } |
403 | s[0] = s[0].upper(); | 403 | s[0] = s[0].upper(); |
404 | 404 | ||
405 | QValueList<int> sizes = fontDB.pointSizes( familyNames[j] ); | 405 | QValueList<int> sizes = fontDB.pointSizes( familyNames[j] ); |
406 | 406 | ||
407 | printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(), | 407 | printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(), |
408 | sizes.count()); | 408 | sizes.count()); |
409 | 409 | ||
410 | if (sizes.count() > 0) | 410 | if (sizes.count() > 0) |
411 | { | 411 | { |
412 | QPopupMenu *sizeMenu; | 412 | QPopupMenu *sizeMenu; |
413 | QFont f; | 413 | QFont f; |
414 | int last_width = -1; | 414 | int last_width = -1; |
415 | sizeMenu = NULL; | 415 | sizeMenu = NULL; |
416 | 416 | ||
417 | for(uint i = 0; i < (uint)sizes.count() + 4; i++) | 417 | for(uint i = 0; i < (uint)sizes.count() + 4; i++) |
418 | { | 418 | { |
419 | // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]); | 419 | // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]); |
420 | // need to divide by 10 on the Z, but not otherwise | 420 | // need to divide by 10 on the Z, but not otherwise |
421 | int size; | 421 | int size; |
422 | 422 | ||
423 | if (i >= (uint)sizes.count()) | 423 | if (i >= (uint)sizes.count()) |
424 | { | 424 | { |
425 | // try for expandable fonts | 425 | // try for expandable fonts |
426 | size = sizes[sizes.count()-1] + 2 * (i - sizes.count() + 1); | 426 | size = sizes[sizes.count()-1] + 2 * (i - sizes.count() + 1); |
427 | } | 427 | } |
428 | else | 428 | else |
429 | { | 429 | { |
430 | printf("sizes[%d] = %d\n", i, sizes[i]); | 430 | printf("sizes[%d] = %d\n", i, sizes[i]); |
431 | size = sizes[i]; | 431 | size = sizes[i]; |
432 | } | 432 | } |
433 | #ifndef __i386__ | 433 | #ifndef __i386__ |
434 | // a hack, sizes on Z seem to be points*10 | 434 | // a hack, sizes on Z seem to be points*10 |
435 | size /= 10; | 435 | size /= 10; |
436 | #endif | 436 | #endif |
437 | 437 | ||
438 | f = QFont(familyNames[j], size); | 438 | f = QFont(familyNames[j], size); |
439 | f.setFixedPitch(true); | 439 | f.setFixedPitch(true); |
440 | QFontMetrics fm(f); | 440 | QFontMetrics fm(f); |
441 | // don't trust f.fixedPitch() or f.exactMatch(), they lie!! | 441 | // don't trust f.fixedPitch() or f.exactMatch(), they lie!! |
442 | if (fm.width("l") == fm.width("m") | 442 | if (fm.width("l") == fm.width("m") |
443 | && (i < (uint)sizes.count() | 443 | && (i < (uint)sizes.count() |
444 | || fm.width("m") > last_width)) | 444 | || fm.width("m") > last_width)) |
445 | { | 445 | { |
446 | if (i < (uint)sizes.count()) | 446 | if (i < (uint)sizes.count()) |
447 | { | 447 | { |
448 | last_width = fm.width("m"); | 448 | last_width = fm.width("m"); |
449 | } | 449 | } |
450 | if (sizeMenu == NULL) | 450 | if (sizeMenu == NULL) |
451 | { | 451 | { |
452 | sizeMenu = new QPopupMenu(); | 452 | sizeMenu = new QPopupMenu(); |
453 | } | 453 | } |
@@ -1146,773 +1146,773 @@ void Konsole::doneSession(TEWidget* te, int ) | |||
1146 | if (te != 0) | 1146 | if (te != 0) |
1147 | { | 1147 | { |
1148 | te->currentSession->setConnect(FALSE); | 1148 | te->currentSession->setConnect(FALSE); |
1149 | tab->removeTab(te); | 1149 | tab->removeTab(te); |
1150 | delete te->currentSession; | 1150 | delete te->currentSession; |
1151 | delete te; | 1151 | delete te; |
1152 | sessionList->removeItem(nsessions); | 1152 | sessionList->removeItem(nsessions); |
1153 | nsessions--; | 1153 | nsessions--; |
1154 | } | 1154 | } |
1155 | if (nsessions == 0) | 1155 | if (nsessions == 0) |
1156 | { | 1156 | { |
1157 | close(); | 1157 | close(); |
1158 | } | 1158 | } |
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | void Konsole::changeTitle(TEWidget* te, QString newTitle ) | 1161 | void Konsole::changeTitle(TEWidget* te, QString newTitle ) |
1162 | { | 1162 | { |
1163 | if (te == getTe()) | 1163 | if (te == getTe()) |
1164 | { | 1164 | { |
1165 | setCaption(newTitle + " - QKonsole"); | 1165 | setCaption(newTitle + " - QKonsole"); |
1166 | } | 1166 | } |
1167 | } | 1167 | } |
1168 | 1168 | ||
1169 | 1169 | ||
1170 | void Konsole::newSession() | 1170 | void Konsole::newSession() |
1171 | { | 1171 | { |
1172 | if(nsessions < 15) | 1172 | if(nsessions < 15) |
1173 | { // seems to be something weird about 16 tabs on the Zaurus.... memory? | 1173 | { // seems to be something weird about 16 tabs on the Zaurus.... memory? |
1174 | TEWidget* te = new TEWidget(tab); | 1174 | TEWidget* te = new TEWidget(tab); |
1175 | Config cfg("Qkonsole"); | 1175 | Config cfg("Qkonsole"); |
1176 | cfg.setGroup("Menubar"); | 1176 | cfg.setGroup("Menubar"); |
1177 | 1177 | ||
1178 | // FIXME use more defaults from config file | 1178 | // FIXME use more defaults from config file |
1179 | te->useBeep=cfg.readBoolEntry("useBeep",0); | 1179 | te->useBeep=cfg.readBoolEntry("useBeep",0); |
1180 | 1180 | ||
1181 | // te->setBackgroundMode(PaletteBase); //we want transparent!! | 1181 | // te->setBackgroundMode(PaletteBase); //we want transparent!! |
1182 | 1182 | ||
1183 | cfg.setGroup("Font"); | 1183 | cfg.setGroup("Font"); |
1184 | QString sn = "Session" + QString::number(nsessions+1); | 1184 | QString sn = "Session" + QString::number(nsessions+1); |
1185 | printf("read font session %s\n", sn.latin1()); | 1185 | printf("read font session %s\n", sn.latin1()); |
1186 | QString fontName = cfg.readEntry("FontName"+sn, | 1186 | QString fontName = cfg.readEntry("FontName"+sn, |
1187 | cfg.readEntry("FontName", | 1187 | cfg.readEntry("FontName", |
1188 | fonts.at(cfont)->getFamily())); | 1188 | fonts.at(cfont)->getFamily())); |
1189 | int fontSize = cfg.readNumEntry("FontSize"+sn, | 1189 | int fontSize = cfg.readNumEntry("FontSize"+sn, |
1190 | cfg.readNumEntry("FontSize", | 1190 | cfg.readNumEntry("FontSize", |
1191 | fonts.at(cfont)->getSize())); | 1191 | fonts.at(cfont)->getSize())); |
1192 | cfont = findFont(fontName, fontSize, false); | 1192 | cfont = findFont(fontName, fontSize, false); |
1193 | printf("lookup font %s size %d got %d\n", fontName.latin1(), fontSize, cfont); | 1193 | printf("lookup font %s size %d got %d\n", fontName.latin1(), fontSize, cfont); |
1194 | if (cfont < 0) | 1194 | if (cfont < 0) |
1195 | cfont = 0; | 1195 | cfont = 0; |
1196 | te->setVTFont(fonts.at(cfont)->getFont()); | 1196 | te->setVTFont(fonts.at(cfont)->getFont()); |
1197 | 1197 | ||
1198 | tab->addTab(te); | 1198 | tab->addTab(te); |
1199 | TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); | 1199 | TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); |
1200 | te->currentSession = se; | 1200 | te->currentSession = se; |
1201 | connect( se, SIGNAL(done(TEWidget*,int)), this, SLOT(doneSession(TEWidget*,int)) ); | 1201 | connect( se, SIGNAL(done(TEWidget*,int)), this, SLOT(doneSession(TEWidget*,int)) ); |
1202 | connect( se, SIGNAL(changeTitle(TEWidget*,QString)), this, | 1202 | connect( se, SIGNAL(changeTitle(TEWidget*,QString)), this, |
1203 | SLOT(changeTitle(TEWidget*,QString)) ); | 1203 | SLOT(changeTitle(TEWidget*,QString)) ); |
1204 | connect(te, SIGNAL(changeFontSize(int)), this, SLOT(changeFontSize(int))); | 1204 | connect(te, SIGNAL(changeFontSize(int)), this, SLOT(changeFontSize(int))); |
1205 | connect(te, SIGNAL(changeSession(int)), this, SLOT(changeSession(int))); | 1205 | connect(te, SIGNAL(changeSession(int)), this, SLOT(changeSession(int))); |
1206 | connect(te, SIGNAL(newSession()), this, SLOT(newSession())); | 1206 | connect(te, SIGNAL(newSession()), this, SLOT(newSession())); |
1207 | connect(te, SIGNAL(toggleFullScreen()), this, SLOT(toggleFullScreen())); | 1207 | connect(te, SIGNAL(toggleFullScreen()), this, SLOT(toggleFullScreen())); |
1208 | connect(te, SIGNAL(setFullScreen(bool)), this, SLOT(setFullScreen(bool))); | 1208 | connect(te, SIGNAL(setFullScreen(bool)), this, SLOT(setFullScreen(bool))); |
1209 | se->run(); | 1209 | se->run(); |
1210 | se->setConnect(TRUE); | 1210 | se->setConnect(TRUE); |
1211 | se->setHistory(b_scroll); | 1211 | se->setHistory(b_scroll); |
1212 | nsessions++; | 1212 | nsessions++; |
1213 | sessionList->insertItem(QString::number(nsessions), nsessions); | 1213 | sessionList->insertItem(QString::number(nsessions), nsessions); |
1214 | sessionListSelected(nsessions); | 1214 | sessionListSelected(nsessions); |
1215 | doWrap(); | 1215 | doWrap(); |
1216 | setColor(nsessions-1); | 1216 | setColor(nsessions-1); |
1217 | } | 1217 | } |
1218 | } | 1218 | } |
1219 | 1219 | ||
1220 | TEWidget* Konsole::getTe() | 1220 | TEWidget* Konsole::getTe() |
1221 | { | 1221 | { |
1222 | if (nsessions) | 1222 | if (nsessions) |
1223 | { | 1223 | { |
1224 | return (TEWidget *) tab->currentPage(); | 1224 | return (TEWidget *) tab->currentPage(); |
1225 | } | 1225 | } |
1226 | else | 1226 | else |
1227 | { | 1227 | { |
1228 | return 0; | 1228 | return 0; |
1229 | } | 1229 | } |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | void Konsole::sessionListSelected(int id) | 1232 | void Konsole::sessionListSelected(int id) |
1233 | { | 1233 | { |
1234 | if (id < 0) | 1234 | if (id < 0) |
1235 | { | 1235 | { |
1236 | return; | 1236 | return; |
1237 | } | 1237 | } |
1238 | QString selected = sessionList->text(id); | 1238 | QString selected = sessionList->text(id); |
1239 | EKNumTabBar *tabBar = tab->getTabBar(); | 1239 | EKNumTabBar *tabBar = tab->getTabBar(); |
1240 | 1240 | ||
1241 | int n = 0; | 1241 | int n = 0; |
1242 | for(int i = 0; n < tabBar->count(); i++) | 1242 | for(int i = 0; n < tabBar->count(); i++) |
1243 | { | 1243 | { |
1244 | if (tabBar->tab(i)) | 1244 | if (tabBar->tab(i)) |
1245 | { | 1245 | { |
1246 | // printf("selected = %s tab %d = %s\n", selected.latin1(), | 1246 | // printf("selected = %s tab %d = %s\n", selected.latin1(), |
1247 | // i, tabBar->tab(i)->text().latin1()); | 1247 | // i, tabBar->tab(i)->text().latin1()); |
1248 | if (tabBar->tab(i)->text() == selected) | 1248 | if (tabBar->tab(i)->text() == selected) |
1249 | { | 1249 | { |
1250 | tab->setCurrentPage(i); | 1250 | tab->setCurrentPage(i); |
1251 | break; | 1251 | break; |
1252 | } | 1252 | } |
1253 | n++; | 1253 | n++; |
1254 | } | 1254 | } |
1255 | } | 1255 | } |
1256 | } | 1256 | } |
1257 | 1257 | ||
1258 | 1258 | ||
1259 | void Konsole::changeSession(int delta) | 1259 | void Konsole::changeSession(int delta) |
1260 | { | 1260 | { |
1261 | printf("delta session %d\n", delta); | 1261 | printf("delta session %d\n", delta); |
1262 | QTabBar *tabBar = tab->getTabBar(); | 1262 | QTabBar *tabBar = tab->getTabBar(); |
1263 | int i = tabBar->tab(tabBar->currentTab())->text().toInt() - 1; | 1263 | int i = tabBar->tab(tabBar->currentTab())->text().toInt() - 1; |
1264 | i += delta; | 1264 | i += delta; |
1265 | if (i < 0) | 1265 | if (i < 0) |
1266 | i += tabBar->count(); | 1266 | i += tabBar->count(); |
1267 | if (i >= tabBar->count()) | 1267 | if (i >= tabBar->count()) |
1268 | i -= tabBar->count(); | 1268 | i -= tabBar->count(); |
1269 | 1269 | ||
1270 | QString selected = QString::number(i+1); | 1270 | QString selected = QString::number(i+1); |
1271 | int n = 0; | 1271 | int n = 0; |
1272 | for(int i = 0; n < tabBar->count(); i++) | 1272 | for(int i = 0; n < tabBar->count(); i++) |
1273 | { | 1273 | { |
1274 | if (tabBar->tab(i)) | 1274 | if (tabBar->tab(i)) |
1275 | { | 1275 | { |
1276 | printf("selected = %s tab %d = %s\n", selected.latin1(), | 1276 | printf("selected = %s tab %d = %s\n", selected.latin1(), |
1277 | i, tabBar->tab(i)->text().latin1()); | 1277 | i, tabBar->tab(i)->text().latin1()); |
1278 | if (tabBar->tab(i)->text() == selected) | 1278 | if (tabBar->tab(i)->text() == selected) |
1279 | { | 1279 | { |
1280 | tab->setCurrentPage(i); | 1280 | tab->setCurrentPage(i); |
1281 | break; | 1281 | break; |
1282 | } | 1282 | } |
1283 | n++; | 1283 | n++; |
1284 | } | 1284 | } |
1285 | } | 1285 | } |
1286 | } | 1286 | } |
1287 | 1287 | ||
1288 | void Konsole::switchSession(QWidget* w) | 1288 | void Konsole::switchSession(QWidget* w) |
1289 | { | 1289 | { |
1290 | TEWidget* te = (TEWidget *) w; | 1290 | TEWidget* te = (TEWidget *) w; |
1291 | QFont teFnt = te->getVTFont(); | 1291 | QFont teFnt = te->getVTFont(); |
1292 | int familyNum = -1; | 1292 | int familyNum = -1; |
1293 | 1293 | ||
1294 | for(uint i = 0; i < fonts.count(); i++) | 1294 | for(uint i = 0; i < fonts.count(); i++) |
1295 | { | 1295 | { |
1296 | VTFont *fnt = fonts.at(i); | 1296 | VTFont *fnt = fonts.at(i); |
1297 | bool cf = fnt->getFont() == teFnt; | 1297 | bool cf = fnt->getFont() == teFnt; |
1298 | fontList->setItemChecked(i, cf); | 1298 | fontList->setItemChecked(i, cf); |
1299 | if (cf) | 1299 | if (cf) |
1300 | { | 1300 | { |
1301 | cfont = i; | 1301 | cfont = i; |
1302 | familyNum = fnt->getFamilyNum(); | 1302 | familyNum = fnt->getFamilyNum(); |
1303 | } | 1303 | } |
1304 | } | 1304 | } |
1305 | for(int i = 0; i < (int)fontList->count(); i++) | 1305 | for(int i = 0; i < (int)fontList->count(); i++) |
1306 | { | 1306 | { |
1307 | fontList->setItemChecked(i + 1000, i == familyNum); | 1307 | fontList->setItemChecked(i + 1000, i == familyNum); |
1308 | } | 1308 | } |
1309 | if (! te->currentSession->Title().isEmpty() ) | 1309 | if (! te->currentSession->Title().isEmpty() ) |
1310 | { | 1310 | { |
1311 | setCaption(te->currentSession->Title() + " - QKonsole"); | 1311 | setCaption(te->currentSession->Title() + " - QKonsole"); |
1312 | } | 1312 | } |
1313 | else | 1313 | else |
1314 | { | 1314 | { |
1315 | setCaption( "Qkonsole" ); | 1315 | setCaption( "Qkonsole" ); |
1316 | } | 1316 | } |
1317 | // colorMenuSelected(te->color_menu_item); | 1317 | // colorMenuSelected(te->color_menu_item); |
1318 | } | 1318 | } |
1319 | 1319 | ||
1320 | 1320 | ||
1321 | void Konsole::toggleFullScreen() | 1321 | void Konsole::toggleFullScreen() |
1322 | { | 1322 | { |
1323 | setFullScreen(! fullscreen); | 1323 | setFullScreen(! fullscreen); |
1324 | } | 1324 | } |
1325 | 1325 | ||
1326 | void Konsole::setFullScreen ( bool b ) | 1326 | void Konsole::setFullScreen ( bool b ) |
1327 | { | 1327 | { |
1328 | static QSize normalsize; | 1328 | static QSize normalsize; |
1329 | static bool listHidden; | 1329 | static bool listHidden; |
1330 | 1330 | ||
1331 | if (b == fullscreen) | 1331 | if (b == fullscreen) |
1332 | { | 1332 | { |
1333 | return; | 1333 | return; |
1334 | } | 1334 | } |
1335 | 1335 | ||
1336 | fullscreen = b; | 1336 | fullscreen = b; |
1337 | 1337 | ||
1338 | if ( b ) | 1338 | if ( b ) |
1339 | { | 1339 | { |
1340 | if ( !normalsize. isValid ( )) | 1340 | if ( !normalsize. isValid ( )) |
1341 | { | 1341 | { |
1342 | normalsize = size ( ); | 1342 | normalsize = size ( ); |
1343 | } | 1343 | } |
1344 | 1344 | ||
1345 | setFixedSize ( qApp-> desktop ( )-> size ( )); | 1345 | setFixedSize ( qApp-> desktop ( )-> size ( )); |
1346 | showNormal ( ); | 1346 | showNormal ( ); |
1347 | reparent ( 0, WStyle_Customize | WStyle_NoBorder, | 1347 | reparent ( 0, WStyle_Customize | WStyle_NoBorder, |
1348 | QPoint ( 0, 0 )); | 1348 | QPoint ( 0, 0 )); |
1349 | showFullScreen ( ); | 1349 | showFullScreen ( ); |
1350 | 1350 | ||
1351 | menuToolBar->hide(); | 1351 | menuToolBar->hide(); |
1352 | toolBar->hide(); | 1352 | toolBar->hide(); |
1353 | listHidden = secondToolBar->isHidden(); | 1353 | listHidden = secondToolBar->isHidden(); |
1354 | secondToolBar->hide(); | 1354 | secondToolBar->hide(); |
1355 | // commonCombo->hide(); | 1355 | // commonCombo->hide(); |
1356 | tab->getTabBar()->hide(); | 1356 | tab->getTabBar()->hide(); |
1357 | tab->setMargin(tab->margin()); | 1357 | tab->setMargin(tab->margin()); |
1358 | 1358 | ||
1359 | if (show_fullscreen_msg) | 1359 | if (show_fullscreen_msg) |
1360 | { | 1360 | { |
1361 | fullscreen_msg-> move(tab->x() + tab->width()/2 - fullscreen_msg->width()/2, | 1361 | fullscreen_msg-> move(tab->x() + tab->width()/2 - fullscreen_msg->width()/2, |
1362 | qApp->desktop()->height()/16 - fullscreen_msg->height()/2); | 1362 | qApp->desktop()->height()/16 - fullscreen_msg->height()/2); |
1363 | fullscreen_msg->show(); | 1363 | fullscreen_msg->show(); |
1364 | fullscreen_timer->start(3000, true); | 1364 | fullscreen_timer->start(3000, true); |
1365 | show_fullscreen_msg = false; | 1365 | show_fullscreen_msg = false; |
1366 | } | 1366 | } |
1367 | } | 1367 | } |
1368 | else | 1368 | else |
1369 | { | 1369 | { |
1370 | showNormal ( ); | 1370 | showNormal ( ); |
1371 | reparent ( 0, WStyle_Customize, QPoint ( 0, 0 )); | 1371 | reparent ( 0, WStyle_Customize, QPoint ( 0, 0 )); |
1372 | resize ( normalsize ); | 1372 | resize ( normalsize ); |
1373 | showMaximized ( ); | 1373 | showMaximized ( ); |
1374 | normalsize = QSize ( ); | 1374 | normalsize = QSize ( ); |
1375 | 1375 | ||
1376 | menuToolBar->show(); | 1376 | menuToolBar->show(); |
1377 | toolBar->show(); | 1377 | toolBar->show(); |
1378 | if(! listHidden) | 1378 | if(! listHidden) |
1379 | { | 1379 | { |
1380 | secondToolBar->show(); | 1380 | secondToolBar->show(); |
1381 | } | 1381 | } |
1382 | // commonCombo->show(); | 1382 | // commonCombo->show(); |
1383 | menuToolBar->show(); | 1383 | menuToolBar->show(); |
1384 | if (tabPos != tm_hidden) | 1384 | if (tabPos != tm_hidden) |
1385 | { | 1385 | { |
1386 | tab->getTabBar()->show(); | 1386 | tab->getTabBar()->show(); |
1387 | } | 1387 | } |
1388 | } | 1388 | } |
1389 | tab->setMargin(tab->margin()); // cause setup to run | 1389 | tab->setMargin(tab->margin()); // cause setup to run |
1390 | } | 1390 | } |
1391 | 1391 | ||
1392 | 1392 | ||
1393 | void Konsole::fullscreenTimeout() | 1393 | void Konsole::fullscreenTimeout() |
1394 | { | 1394 | { |
1395 | fullscreen_msg->hide(); | 1395 | fullscreen_msg->hide(); |
1396 | } | 1396 | } |
1397 | 1397 | ||
1398 | void Konsole::colorMenuIsSelected(int iD) | 1398 | void Konsole::colorMenuIsSelected(int iD) |
1399 | { | 1399 | { |
1400 | fromMenu = TRUE; | 1400 | fromMenu = TRUE; |
1401 | colorMenuSelected(iD); | 1401 | colorMenuSelected(iD); |
1402 | } | 1402 | } |
1403 | 1403 | ||
1404 | /// ------------------------------- some new stuff by L.J. Potter | 1404 | /// ------------------------------- some new stuff by L.J. Potter |
1405 | 1405 | ||
1406 | 1406 | ||
1407 | void Konsole::colorMenuSelected(int iD) | 1407 | void Konsole::colorMenuSelected(int iD) |
1408 | { | 1408 | { |
1409 | // this is NOT pretty, elegant or anything else besides functional | 1409 | // this is NOT pretty, elegant or anything else besides functional |
1410 | // QString temp; | 1410 | // QString temp; |
1411 | // qDebug( temp.sprintf("colormenu %d", iD)); | 1411 | // qDebug( temp.sprintf("colormenu %d", iD)); |
1412 | 1412 | ||
1413 | TEWidget* te = getTe(); | 1413 | TEWidget* te = getTe(); |
1414 | Config cfg("Qkonsole"); | 1414 | Config cfg("Qkonsole"); |
1415 | cfg.setGroup("Colors"); | 1415 | cfg.setGroup("Colors"); |
1416 | 1416 | ||
1417 | ColorEntry m_table[TABLE_COLORS]; | 1417 | ColorEntry m_table[TABLE_COLORS]; |
1418 | const ColorEntry * defaultCt=te->getdefaultColorTable(); | 1418 | const ColorEntry * defaultCt=te->getdefaultColorTable(); |
1419 | 1419 | ||
1420 | int i; | 1420 | int i; |
1421 | 1421 | ||
1422 | // te->color_menu_item = iD; | 1422 | // te->color_menu_item = iD; |
1423 | 1423 | ||
1424 | colorMenu->setItemChecked(cm_ab,FALSE); | 1424 | colorMenu->setItemChecked(cm_ab,FALSE); |
1425 | colorMenu->setItemChecked(cm_bb,FALSE); | 1425 | colorMenu->setItemChecked(cm_bb,FALSE); |
1426 | colorMenu->setItemChecked(cm_wc,FALSE); | 1426 | colorMenu->setItemChecked(cm_wc,FALSE); |
1427 | colorMenu->setItemChecked(cm_cw,FALSE); | 1427 | colorMenu->setItemChecked(cm_cw,FALSE); |
1428 | colorMenu->setItemChecked(cm_mb,FALSE); | 1428 | colorMenu->setItemChecked(cm_mb,FALSE); |
1429 | colorMenu->setItemChecked(cm_bm,FALSE); | 1429 | colorMenu->setItemChecked(cm_bm,FALSE); |
1430 | colorMenu->setItemChecked(cm_gy,FALSE); | 1430 | colorMenu->setItemChecked(cm_gy,FALSE); |
1431 | colorMenu->setItemChecked(cm_rb,FALSE); | 1431 | colorMenu->setItemChecked(cm_rb,FALSE); |
1432 | colorMenu->setItemChecked(cm_br,FALSE); | 1432 | colorMenu->setItemChecked(cm_br,FALSE); |
1433 | colorMenu->setItemChecked(cm_wb,FALSE); | 1433 | colorMenu->setItemChecked(cm_wb,FALSE); |
1434 | colorMenu->setItemChecked(cm_bw,FALSE); | 1434 | colorMenu->setItemChecked(cm_bw,FALSE); |
1435 | colorMenu->setItemChecked(cm_gb,FALSE); | 1435 | colorMenu->setItemChecked(cm_gb,FALSE); |
1436 | 1436 | ||
1437 | if(iD==cm_default) | 1437 | if(iD==cm_default) |
1438 | { // default default | 1438 | { // default default |
1439 | printf("default colors\n"); | 1439 | printf("default colors\n"); |
1440 | for (i = 0; i < TABLE_COLORS; i++) | 1440 | for (i = 0; i < TABLE_COLORS; i++) |
1441 | { | 1441 | { |
1442 | m_table[i].color = defaultCt[i].color; | 1442 | m_table[i].color = defaultCt[i].color; |
1443 | if(i==1 || i == 11) | 1443 | if(i==1 || i == 11) |
1444 | m_table[i].transparent=1; | 1444 | m_table[i].transparent=1; |
1445 | colorMenu->setItemChecked(cm_default,TRUE); | 1445 | colorMenu->setItemChecked(cm_default,TRUE); |
1446 | } | 1446 | } |
1447 | te->setColorTable(m_table); | 1447 | te->setColorTable(m_table); |
1448 | } | 1448 | } |
1449 | if(iD==cm_gb) | 1449 | if(iD==cm_gb) |
1450 | { // green black | 1450 | { // green black |
1451 | foreground.setRgb(100,255,100); // (0x18,255,0x18); | 1451 | foreground.setRgb(100,255,100); // (0x18,255,0x18); |
1452 | background.setRgb(0x00,0x00,0x00); | 1452 | background.setRgb(0x00,0x00,0x00); |
1453 | colorMenu->setItemChecked(cm_gb,TRUE); | 1453 | colorMenu->setItemChecked(cm_gb,TRUE); |
1454 | } | 1454 | } |
1455 | if(iD==cm_bw) | 1455 | if(iD==cm_bw) |
1456 | { // black white | 1456 | { // black white |
1457 | foreground.setRgb(0x00,0x00,0x00); | 1457 | foreground.setRgb(0x00,0x00,0x00); |
1458 | background.setRgb(0xFF,0xFF,0xFF); | 1458 | background.setRgb(0xFF,0xFF,0xFF); |
1459 | colorMenu->setItemChecked(cm_bw,TRUE); | 1459 | colorMenu->setItemChecked(cm_bw,TRUE); |
1460 | } | 1460 | } |
1461 | if(iD==cm_wb) | 1461 | if(iD==cm_wb) |
1462 | { // white black | 1462 | { // white black |
1463 | foreground.setRgb(0xFF,0xFF,0xFF); | 1463 | foreground.setRgb(0xFF,0xFF,0xFF); |
1464 | background.setRgb(0x00,0x00,0x00); | 1464 | background.setRgb(0x00,0x00,0x00); |
1465 | colorMenu->setItemChecked(cm_wb,TRUE); | 1465 | colorMenu->setItemChecked(cm_wb,TRUE); |
1466 | } | 1466 | } |
1467 | if(iD==cm_br) | 1467 | if(iD==cm_br) |
1468 | {// Black, Red | 1468 | {// Black, Red |
1469 | foreground.setRgb(0x00,0x00,0x00); | 1469 | foreground.setRgb(0x00,0x00,0x00); |
1470 | background.setRgb(255,85,85); //(0xB2,0x18,0x18); | 1470 | background.setRgb(255,85,85); //(0xB2,0x18,0x18); |
1471 | colorMenu->setItemChecked(cm_br,TRUE); | 1471 | colorMenu->setItemChecked(cm_br,TRUE); |
1472 | } | 1472 | } |
1473 | if(iD==cm_rb) | 1473 | if(iD==cm_rb) |
1474 | {// Red, Black | 1474 | {// Red, Black |
1475 | foreground.setRgb(255,85,85); | 1475 | foreground.setRgb(255,85,85); |
1476 | background.setRgb(0x00,0x00,0x00); | 1476 | background.setRgb(0x00,0x00,0x00); |
1477 | colorMenu->setItemChecked(cm_rb,TRUE); | 1477 | colorMenu->setItemChecked(cm_rb,TRUE); |
1478 | } | 1478 | } |
1479 | if(iD==cm_gy) | 1479 | if(iD==cm_gy) |
1480 | {// Green, Yellow - is ugly | 1480 | {// Green, Yellow - is ugly |
1481 | // foreground.setRgb(0x18,0xB2,0x18); | 1481 | // foreground.setRgb(0x18,0xB2,0x18); |
1482 | foreground.setRgb(15,115,0); | 1482 | foreground.setRgb(15,115,0); |
1483 | // background.setRgb(0xB2,0x68,0x18); | 1483 | // background.setRgb(0xB2,0x68,0x18); |
1484 | background.setRgb(255,255,0); | 1484 | background.setRgb(255,255,0); |
1485 | colorMenu->setItemChecked(cm_gy,TRUE); | 1485 | colorMenu->setItemChecked(cm_gy,TRUE); |
1486 | } | 1486 | } |
1487 | if(iD==cm_bm) | 1487 | if(iD==cm_bm) |
1488 | {// Blue, Magenta | 1488 | {// Blue, Magenta |
1489 | foreground.setRgb(3,24,132); | 1489 | foreground.setRgb(3,24,132); |
1490 | background.setRgb(225,2,255); | 1490 | background.setRgb(225,2,255); |
1491 | colorMenu->setItemChecked(cm_bm,TRUE); | 1491 | colorMenu->setItemChecked(cm_bm,TRUE); |
1492 | } | 1492 | } |
1493 | if(iD==cm_mb) | 1493 | if(iD==cm_mb) |
1494 | {// Magenta, Blue | 1494 | {// Magenta, Blue |
1495 | foreground.setRgb(225,2,255); | 1495 | foreground.setRgb(225,2,255); |
1496 | background.setRgb(3,24,132); | 1496 | background.setRgb(3,24,132); |
1497 | colorMenu->setItemChecked(cm_mb,TRUE); | 1497 | colorMenu->setItemChecked(cm_mb,TRUE); |
1498 | } | 1498 | } |
1499 | if(iD==cm_cw) | 1499 | if(iD==cm_cw) |
1500 | {// Cyan, White | 1500 | {// Cyan, White |
1501 | foreground.setRgb(8,91,129); | 1501 | foreground.setRgb(8,91,129); |
1502 | background.setRgb(0xFF,0xFF,0xFF); | 1502 | background.setRgb(0xFF,0xFF,0xFF); |
1503 | colorMenu->setItemChecked(cm_cw,TRUE); | 1503 | colorMenu->setItemChecked(cm_cw,TRUE); |
1504 | } | 1504 | } |
1505 | if(iD==cm_wc) | 1505 | if(iD==cm_wc) |
1506 | {// White, Cyan | 1506 | {// White, Cyan |
1507 | background.setRgb(8,91,129); | 1507 | background.setRgb(8,91,129); |
1508 | foreground.setRgb(0xFF,0xFF,0xFF); | 1508 | foreground.setRgb(0xFF,0xFF,0xFF); |
1509 | colorMenu->setItemChecked(cm_wc,TRUE); | 1509 | colorMenu->setItemChecked(cm_wc,TRUE); |
1510 | } | 1510 | } |
1511 | if(iD==cm_bb) | 1511 | if(iD==cm_bb) |
1512 | {// Black, Blue | 1512 | {// Black, Blue |
1513 | background.setRgb(0x00,0x00,0x00); | 1513 | background.setRgb(0x00,0x00,0x00); |
1514 | foreground.setRgb(127,147,225); | 1514 | foreground.setRgb(127,147,225); |
1515 | colorMenu->setItemChecked(cm_bb,TRUE); | 1515 | colorMenu->setItemChecked(cm_bb,TRUE); |
1516 | } | 1516 | } |
1517 | if(iD==cm_ab) | 1517 | if(iD==cm_ab) |
1518 | {// Black, Gold | 1518 | {// Black, Gold |
1519 | background.setRgb(0x00,0x00,0x00); | 1519 | background.setRgb(0x00,0x00,0x00); |
1520 | foreground.setRgb(255,215,105); | 1520 | foreground.setRgb(255,215,105); |
1521 | colorMenu->setItemChecked(cm_ab,TRUE); | 1521 | colorMenu->setItemChecked(cm_ab,TRUE); |
1522 | } | 1522 | } |
1523 | #ifdef QT_QWS_OPIE | 1523 | #ifdef QT_QWS_OPIE |
1524 | if(iD==-19) | 1524 | if(iD==-19) |
1525 | { | 1525 | { |
1526 | // Custom | 1526 | // Custom |
1527 | qDebug("do custom"); | 1527 | qDebug("do custom"); |
1528 | if(fromMenu) | 1528 | if(fromMenu) |
1529 | { | 1529 | { |
1530 | OColorPopupMenu* penColorPopupMenu = new OColorPopupMenu(Qt::black, this, "foreground color"); | 1530 | Opie::OColorPopupMenu* penColorPopupMenu = new Opie::OColorPopupMenu(Qt::black, this, "foreground color"); |
1531 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, | 1531 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, |
1532 | SLOT(changeForegroundColor(const QColor&))); | 1532 | SLOT(changeForegroundColor(const QColor&))); |
1533 | penColorPopupMenu->exec(); | 1533 | penColorPopupMenu->exec(); |
1534 | } | 1534 | } |
1535 | if(!fromMenu) | 1535 | if(!fromMenu) |
1536 | { | 1536 | { |
1537 | foreground.setNamedColor(cfg.readEntry("foreground","")); | 1537 | foreground.setNamedColor(cfg.readEntry("foreground","")); |
1538 | background.setNamedColor(cfg.readEntry("background","")); | 1538 | background.setNamedColor(cfg.readEntry("background","")); |
1539 | } | 1539 | } |
1540 | fromMenu=FALSE; | 1540 | fromMenu=FALSE; |
1541 | colorMenu->setItemChecked(-19,TRUE); | 1541 | colorMenu->setItemChecked(-19,TRUE); |
1542 | } | 1542 | } |
1543 | #endif | 1543 | #endif |
1544 | 1544 | ||
1545 | lastSelectedMenu = iD; | 1545 | lastSelectedMenu = iD; |
1546 | 1546 | ||
1547 | setColors(foreground, background); | 1547 | setColors(foreground, background); |
1548 | 1548 | ||
1549 | QTabBar *tabBar = tab->getTabBar(); | 1549 | QTabBar *tabBar = tab->getTabBar(); |
1550 | QString ss = QString("Session%1").arg(tabBar->currentTab()); | 1550 | QString ss = QString("Session%1").arg(tabBar->currentTab()); |
1551 | // printf("current tab = %d\n", tabBar->currentTab()); | 1551 | // printf("current tab = %d\n", tabBar->currentTab()); |
1552 | 1552 | ||
1553 | if (tabBar->currentTab() == 0) | 1553 | if (tabBar->currentTab() == 0) |
1554 | { | 1554 | { |
1555 | cfg.writeEntry("foregroundRed",QString::number(foreground.red())); | 1555 | cfg.writeEntry("foregroundRed",QString::number(foreground.red())); |
1556 | cfg.writeEntry("foregroundGreen",QString::number(foreground.green())); | 1556 | cfg.writeEntry("foregroundGreen",QString::number(foreground.green())); |
1557 | cfg.writeEntry("foregroundBlue",QString::number(foreground.blue())); | 1557 | cfg.writeEntry("foregroundBlue",QString::number(foreground.blue())); |
1558 | cfg.writeEntry("backgroundRed",QString::number(background.red())); | 1558 | cfg.writeEntry("backgroundRed",QString::number(background.red())); |
1559 | cfg.writeEntry("backgroundGreen",QString::number(background.green())); | 1559 | cfg.writeEntry("backgroundGreen",QString::number(background.green())); |
1560 | cfg.writeEntry("backgroundBlue",QString::number(background.blue())); | 1560 | cfg.writeEntry("backgroundBlue",QString::number(background.blue())); |
1561 | } | 1561 | } |
1562 | cfg.writeEntry("foregroundRed"+ss,QString::number(foreground.red())); | 1562 | cfg.writeEntry("foregroundRed"+ss,QString::number(foreground.red())); |
1563 | cfg.writeEntry("foregroundGreen"+ss,QString::number(foreground.green())); | 1563 | cfg.writeEntry("foregroundGreen"+ss,QString::number(foreground.green())); |
1564 | cfg.writeEntry("foregroundBlue"+ss,QString::number(foreground.blue())); | 1564 | cfg.writeEntry("foregroundBlue"+ss,QString::number(foreground.blue())); |
1565 | cfg.writeEntry("backgroundRed"+ss,QString::number(background.red())); | 1565 | cfg.writeEntry("backgroundRed"+ss,QString::number(background.red())); |
1566 | cfg.writeEntry("backgroundGreen"+ss,QString::number(background.green())); | 1566 | cfg.writeEntry("backgroundGreen"+ss,QString::number(background.green())); |
1567 | cfg.writeEntry("backgroundBlue"+ss,QString::number(background.blue())); | 1567 | cfg.writeEntry("backgroundBlue"+ss,QString::number(background.blue())); |
1568 | 1568 | ||
1569 | update(); | 1569 | update(); |
1570 | } | 1570 | } |
1571 | 1571 | ||
1572 | void Konsole::setColors(QColor foreground, QColor background) | 1572 | void Konsole::setColors(QColor foreground, QColor background) |
1573 | { | 1573 | { |
1574 | int i; | 1574 | int i; |
1575 | ColorEntry m_table[TABLE_COLORS]; | 1575 | ColorEntry m_table[TABLE_COLORS]; |
1576 | TEWidget* te = getTe(); | 1576 | TEWidget* te = getTe(); |
1577 | const ColorEntry * defaultCt=te->getdefaultColorTable(); | 1577 | const ColorEntry * defaultCt=te->getdefaultColorTable(); |
1578 | 1578 | ||
1579 | for (i = 0; i < TABLE_COLORS; i++) | 1579 | for (i = 0; i < TABLE_COLORS; i++) |
1580 | { | 1580 | { |
1581 | if(i==0 || i == 10) | 1581 | if(i==0 || i == 10) |
1582 | { | 1582 | { |
1583 | m_table[i].color = foreground; | 1583 | m_table[i].color = foreground; |
1584 | } | 1584 | } |
1585 | else if(i==1 || i == 11) | 1585 | else if(i==1 || i == 11) |
1586 | { | 1586 | { |
1587 | m_table[i].color = background; | 1587 | m_table[i].color = background; |
1588 | m_table[i].transparent=0; | 1588 | m_table[i].transparent=0; |
1589 | } | 1589 | } |
1590 | else | 1590 | else |
1591 | m_table[i].color = defaultCt[i].color; | 1591 | m_table[i].color = defaultCt[i].color; |
1592 | } | 1592 | } |
1593 | te->setColorTable(m_table); | 1593 | te->setColorTable(m_table); |
1594 | } | 1594 | } |
1595 | 1595 | ||
1596 | void Konsole::tabMenuSelected(int id) | 1596 | void Konsole::tabMenuSelected(int id) |
1597 | { | 1597 | { |
1598 | Config cfg("Qkonsole"); | 1598 | Config cfg("Qkonsole"); |
1599 | cfg.setGroup("Tabs"); | 1599 | cfg.setGroup("Tabs"); |
1600 | tabMenu->setItemChecked(tabPos, false); | 1600 | tabMenu->setItemChecked(tabPos, false); |
1601 | if (id == tm_bottom) | 1601 | if (id == tm_bottom) |
1602 | { | 1602 | { |
1603 | printf("set bottom tab\n"); | 1603 | printf("set bottom tab\n"); |
1604 | tab->getTabBar()->show(); | 1604 | tab->getTabBar()->show(); |
1605 | tab->setTabPosition(QTabWidget::Bottom); | 1605 | tab->setTabPosition(QTabWidget::Bottom); |
1606 | tab->getTabBar()->show(); | 1606 | tab->getTabBar()->show(); |
1607 | cfg.writeEntry("Position","Bottom"); | 1607 | cfg.writeEntry("Position","Bottom"); |
1608 | } | 1608 | } |
1609 | else if (id == tm_top) | 1609 | else if (id == tm_top) |
1610 | { | 1610 | { |
1611 | printf("set top tab\n"); | 1611 | printf("set top tab\n"); |
1612 | tab->getTabBar()->show(); | 1612 | tab->getTabBar()->show(); |
1613 | tab->setTabPosition(QTabWidget::Bottom); | 1613 | tab->setTabPosition(QTabWidget::Bottom); |
1614 | tab->setTabPosition(QTabWidget::Top); | 1614 | tab->setTabPosition(QTabWidget::Top); |
1615 | tab->getTabBar()->show(); | 1615 | tab->getTabBar()->show(); |
1616 | cfg.writeEntry("Position","Top"); | 1616 | cfg.writeEntry("Position","Top"); |
1617 | } | 1617 | } |
1618 | else if (id == tm_hidden) | 1618 | else if (id == tm_hidden) |
1619 | { | 1619 | { |
1620 | tab->getTabBar()->hide(); | 1620 | tab->getTabBar()->hide(); |
1621 | tab->setMargin(tab->margin()); | 1621 | tab->setMargin(tab->margin()); |
1622 | cfg.writeEntry("Position","Hidden"); | 1622 | cfg.writeEntry("Position","Hidden"); |
1623 | } | 1623 | } |
1624 | tabMenu->setItemChecked(id, true); | 1624 | tabMenu->setItemChecked(id, true); |
1625 | tabPos = id; | 1625 | tabPos = id; |
1626 | } | 1626 | } |
1627 | 1627 | ||
1628 | 1628 | ||
1629 | void Konsole::configMenuSelected(int iD) | 1629 | void Konsole::configMenuSelected(int iD) |
1630 | { | 1630 | { |
1631 | // QString temp; | 1631 | // QString temp; |
1632 | // qDebug( temp.sprintf("configmenu %d",iD)); | 1632 | // qDebug( temp.sprintf("configmenu %d",iD)); |
1633 | 1633 | ||
1634 | TEWidget* te = getTe(); | 1634 | TEWidget* te = getTe(); |
1635 | Config cfg("Qkonsole"); | 1635 | Config cfg("Qkonsole"); |
1636 | cfg.setGroup("Menubar"); | 1636 | cfg.setGroup("Menubar"); |
1637 | if(iD == cm_wrap) | 1637 | if(iD == cm_wrap) |
1638 | { | 1638 | { |
1639 | cfg.setGroup("ScrollBar"); | 1639 | cfg.setGroup("ScrollBar"); |
1640 | bool b=cfg.readBoolEntry("HorzScroll",0); | 1640 | bool b=cfg.readBoolEntry("HorzScroll",0); |
1641 | b=!b; | 1641 | b=!b; |
1642 | cfg.writeEntry("HorzScroll", b ); | 1642 | cfg.writeEntry("HorzScroll", b ); |
1643 | cfg.write(); | 1643 | cfg.write(); |
1644 | doWrap(); | 1644 | doWrap(); |
1645 | if(cfg.readNumEntry("Position",2) == 0) | 1645 | if(cfg.readNumEntry("Position",2) == 0) |
1646 | { | 1646 | { |
1647 | te->setScrollbarLocation(1); | 1647 | te->setScrollbarLocation(1); |
1648 | } | 1648 | } |
1649 | else | 1649 | else |
1650 | { | 1650 | { |
1651 | te->setScrollbarLocation(0); | 1651 | te->setScrollbarLocation(0); |
1652 | } | 1652 | } |
1653 | te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 1653 | te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
1654 | } | 1654 | } |
1655 | if(iD == cm_beep) | 1655 | if(iD == cm_beep) |
1656 | { | 1656 | { |
1657 | cfg.setGroup("Menubar"); | 1657 | cfg.setGroup("Menubar"); |
1658 | bool b=cfg.readBoolEntry("useBeep",0); | 1658 | bool b=cfg.readBoolEntry("useBeep",0); |
1659 | b=!b; | 1659 | b=!b; |
1660 | cfg.writeEntry("useBeep", b ); | 1660 | cfg.writeEntry("useBeep", b ); |
1661 | cfg.write(); | 1661 | cfg.write(); |
1662 | configMenu->setItemChecked(cm_beep,b); | 1662 | configMenu->setItemChecked(cm_beep,b); |
1663 | te->useBeep=b; | 1663 | te->useBeep=b; |
1664 | } | 1664 | } |
1665 | } | 1665 | } |
1666 | 1666 | ||
1667 | void Konsole::changeCommand(const QString &text, int c) | 1667 | void Konsole::changeCommand(const QString &text, int c) |
1668 | { | 1668 | { |
1669 | Config cfg("Qkonsole"); | 1669 | Config cfg("Qkonsole"); |
1670 | cfg.setGroup("Commands"); | 1670 | cfg.setGroup("Commands"); |
1671 | if(commonCmds[c] != text) | 1671 | if(commonCmds[c] != text) |
1672 | { | 1672 | { |
1673 | cfg.writeEntry(QString::number(c),text); | 1673 | cfg.writeEntry(QString::number(c),text); |
1674 | commonCombo->clearEdit(); | 1674 | commonCombo->clearEdit(); |
1675 | commonCombo->setCurrentItem(c); | 1675 | commonCombo->setCurrentItem(c); |
1676 | } | 1676 | } |
1677 | } | 1677 | } |
1678 | 1678 | ||
1679 | void Konsole::setColor(int sess) | 1679 | void Konsole::setColor(int sess) |
1680 | { | 1680 | { |
1681 | Config cfg("Qkonsole"); | 1681 | Config cfg("Qkonsole"); |
1682 | cfg.setGroup("Colors"); | 1682 | cfg.setGroup("Colors"); |
1683 | QColor foreground, background; | 1683 | QColor foreground, background; |
1684 | QString ss = QString("Session") + QString::number(sess); | 1684 | QString ss = QString("Session") + QString::number(sess); |
1685 | foreground.setRgb(cfg.readNumEntry("foregroundRed"+ss, | 1685 | foreground.setRgb(cfg.readNumEntry("foregroundRed"+ss, |
1686 | cfg.readNumEntry("foregroundRed",0xff)), | 1686 | cfg.readNumEntry("foregroundRed",0xff)), |
1687 | cfg.readNumEntry("foregroundGreen"+ss, | 1687 | cfg.readNumEntry("foregroundGreen"+ss, |
1688 | cfg.readNumEntry("foregroundGreen",0xff)), | 1688 | cfg.readNumEntry("foregroundGreen",0xff)), |
1689 | cfg.readNumEntry("foregroundBlue"+ss, | 1689 | cfg.readNumEntry("foregroundBlue"+ss, |
1690 | cfg.readNumEntry("foregroundBlue",0xff))); | 1690 | cfg.readNumEntry("foregroundBlue",0xff))); |
1691 | background.setRgb(cfg.readNumEntry("backgroundRed"+ss, | 1691 | background.setRgb(cfg.readNumEntry("backgroundRed"+ss, |
1692 | cfg.readNumEntry("backgroundRed",0)), | 1692 | cfg.readNumEntry("backgroundRed",0)), |
1693 | cfg.readNumEntry("backgroundGreen"+ss, | 1693 | cfg.readNumEntry("backgroundGreen"+ss, |
1694 | cfg.readNumEntry("backgroundGreen",0)), | 1694 | cfg.readNumEntry("backgroundGreen",0)), |
1695 | cfg.readNumEntry("backgroundBlue"+ss, | 1695 | cfg.readNumEntry("backgroundBlue"+ss, |
1696 | cfg.readNumEntry("backgroundBlue",0))); | 1696 | cfg.readNumEntry("backgroundBlue",0))); |
1697 | setColors(foreground, background); | 1697 | setColors(foreground, background); |
1698 | } | 1698 | } |
1699 | 1699 | ||
1700 | void Konsole::scrollMenuSelected(int index) | 1700 | void Konsole::scrollMenuSelected(int index) |
1701 | { | 1701 | { |
1702 | // qDebug( "scrollbar menu %d",index); | 1702 | // qDebug( "scrollbar menu %d",index); |
1703 | 1703 | ||
1704 | TEWidget* te = getTe(); | 1704 | TEWidget* te = getTe(); |
1705 | Config cfg("Qkonsole"); | 1705 | Config cfg("Qkonsole"); |
1706 | cfg.setGroup("ScrollBar"); | 1706 | cfg.setGroup("ScrollBar"); |
1707 | 1707 | ||
1708 | if(index == sm_none) | 1708 | if(index == sm_none) |
1709 | { | 1709 | { |
1710 | te->setScrollbarLocation(0); | 1710 | te->setScrollbarLocation(0); |
1711 | cfg.writeEntry("Position",0); | 1711 | cfg.writeEntry("Position",0); |
1712 | } | 1712 | } |
1713 | else if(index == sm_left) | 1713 | else if(index == sm_left) |
1714 | { | 1714 | { |
1715 | te->setScrollbarLocation(1); | 1715 | te->setScrollbarLocation(1); |
1716 | cfg.writeEntry("Position",1); | 1716 | cfg.writeEntry("Position",1); |
1717 | } | 1717 | } |
1718 | else if(index == sm_right) | 1718 | else if(index == sm_right) |
1719 | { | 1719 | { |
1720 | te->setScrollbarLocation(2); | 1720 | te->setScrollbarLocation(2); |
1721 | cfg.writeEntry("Position",2); | 1721 | cfg.writeEntry("Position",2); |
1722 | } | 1722 | } |
1723 | scrollMenu->setItemChecked(sm_none, index == sm_none); | 1723 | scrollMenu->setItemChecked(sm_none, index == sm_none); |
1724 | scrollMenu->setItemChecked(sm_left, index == sm_left); | 1724 | scrollMenu->setItemChecked(sm_left, index == sm_left); |
1725 | scrollMenu->setItemChecked(sm_right, index == sm_right); | 1725 | scrollMenu->setItemChecked(sm_right, index == sm_right); |
1726 | } | 1726 | } |
1727 | 1727 | ||
1728 | // case -29: { | 1728 | // case -29: { |
1729 | // bool b=cfg.readBoolEntry("HorzScroll",0); | 1729 | // bool b=cfg.readBoolEntry("HorzScroll",0); |
1730 | // cfg.writeEntry("HorzScroll", !b ); | 1730 | // cfg.writeEntry("HorzScroll", !b ); |
1731 | // cfg.write(); | 1731 | // cfg.write(); |
1732 | // if(cfg.readNumEntry("Position",2) == 0) { | 1732 | // if(cfg.readNumEntry("Position",2) == 0) { |
1733 | // te->setScrollbarLocation(1); | 1733 | // te->setScrollbarLocation(1); |
1734 | // te->setWrapAt(0); | 1734 | // te->setWrapAt(0); |
1735 | // } else { | 1735 | // } else { |
1736 | // te->setScrollbarLocation(0); | 1736 | // te->setScrollbarLocation(0); |
1737 | // te->setWrapAt(120); | 1737 | // te->setWrapAt(120); |
1738 | // } | 1738 | // } |
1739 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 1739 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
1740 | // } | 1740 | // } |
1741 | // break; | 1741 | // break; |
1742 | 1742 | ||
1743 | void Konsole::editCommandListMenuSelected(int iD) | 1743 | void Konsole::editCommandListMenuSelected(int iD) |
1744 | { | 1744 | { |
1745 | // QString temp; | 1745 | // QString temp; |
1746 | // qDebug( temp.sprintf("edit command list %d",iD)); | 1746 | // qDebug( temp.sprintf("edit command list %d",iD)); |
1747 | 1747 | ||
1748 | // FIXME: more cleanup needed here | 1748 | // FIXME: more cleanup needed here |
1749 | 1749 | ||
1750 | 1750 | ||
1751 | TEWidget* te = getTe(); | 1751 | TEWidget* te = getTe(); |
1752 | Config cfg("Qkonsole"); | 1752 | Config cfg("Qkonsole"); |
1753 | cfg.setGroup("Menubar"); | 1753 | cfg.setGroup("Menubar"); |
1754 | if( iD == ec_cmdlist) | 1754 | if( iD == ec_cmdlist) |
1755 | { | 1755 | { |
1756 | if(!secondToolBar->isHidden()) | 1756 | if(!secondToolBar->isHidden()) |
1757 | { | 1757 | { |
1758 | secondToolBar->hide(); | 1758 | secondToolBar->hide(); |
1759 | configMenu->changeItem( iD,tr( "Show Command List" )); | 1759 | configMenu->changeItem( iD,tr( "Show Command List" )); |
1760 | cfg.writeEntry("Hidden","TRUE"); | 1760 | cfg.writeEntry("Hidden","TRUE"); |
1761 | configMenu->setItemEnabled(ec_edit ,FALSE); | 1761 | configMenu->setItemEnabled(ec_edit ,FALSE); |
1762 | configMenu->setItemEnabled(ec_quick ,FALSE); | 1762 | configMenu->setItemEnabled(ec_quick ,FALSE); |
1763 | } | 1763 | } |
1764 | else | 1764 | else |
1765 | { | 1765 | { |
1766 | secondToolBar->show(); | 1766 | secondToolBar->show(); |
1767 | configMenu->changeItem( iD,tr( "Hide Command List" )); | 1767 | configMenu->changeItem( iD,tr( "Hide Command List" )); |
1768 | cfg.writeEntry("Hidden","FALSE"); | 1768 | cfg.writeEntry("Hidden","FALSE"); |
1769 | configMenu->setItemEnabled(ec_edit ,TRUE); | 1769 | configMenu->setItemEnabled(ec_edit ,TRUE); |
1770 | configMenu->setItemEnabled(ec_quick ,TRUE); | 1770 | configMenu->setItemEnabled(ec_quick ,TRUE); |
1771 | 1771 | ||
1772 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") | 1772 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") |
1773 | { | 1773 | { |
1774 | configMenu->setItemChecked(ec_edit,TRUE); | 1774 | configMenu->setItemChecked(ec_edit,TRUE); |
1775 | commonCombo->setEditable( TRUE ); | 1775 | commonCombo->setEditable( TRUE ); |
1776 | } | 1776 | } |
1777 | else | 1777 | else |
1778 | { | 1778 | { |
1779 | configMenu->setItemChecked(ec_edit,FALSE); | 1779 | configMenu->setItemChecked(ec_edit,FALSE); |
1780 | commonCombo->setEditable( FALSE ); | 1780 | commonCombo->setEditable( FALSE ); |
1781 | } | 1781 | } |
1782 | } | 1782 | } |
1783 | } | 1783 | } |
1784 | if( iD == ec_quick) | 1784 | if( iD == ec_quick) |
1785 | { | 1785 | { |
1786 | cfg.setGroup("Commands"); | 1786 | cfg.setGroup("Commands"); |
1787 | // qDebug("enableCommandEdit"); | 1787 | // qDebug("enableCommandEdit"); |
1788 | if( !configMenu->isItemChecked(iD) ) | 1788 | if( !configMenu->isItemChecked(iD) ) |
1789 | { | 1789 | { |
1790 | commonCombo->setEditable( TRUE ); | 1790 | commonCombo->setEditable( TRUE ); |
1791 | configMenu->setItemChecked(iD,TRUE); | 1791 | configMenu->setItemChecked(iD,TRUE); |
1792 | commonCombo->setCurrentItem(0); | 1792 | commonCombo->setCurrentItem(0); |
1793 | cfg.writeEntry("EditEnabled","TRUE"); | 1793 | cfg.writeEntry("EditEnabled","TRUE"); |
1794 | } | 1794 | } |
1795 | else | 1795 | else |
1796 | { | 1796 | { |
1797 | commonCombo->setEditable( FALSE ); | 1797 | commonCombo->setEditable( FALSE ); |
1798 | configMenu->setItemChecked(iD,FALSE); | 1798 | configMenu->setItemChecked(iD,FALSE); |
1799 | cfg.writeEntry("EditEnabled","FALSE"); | 1799 | cfg.writeEntry("EditEnabled","FALSE"); |
1800 | commonCombo->setFocusPolicy(QWidget::NoFocus); | 1800 | commonCombo->setFocusPolicy(QWidget::NoFocus); |
1801 | te->setFocus(); | 1801 | te->setFocus(); |
1802 | } | 1802 | } |
1803 | } | 1803 | } |
1804 | if(iD == ec_edit) | 1804 | if(iD == ec_edit) |
1805 | { | 1805 | { |
1806 | // "edit commands" | 1806 | // "edit commands" |
1807 | CommandEditDialog *m = new CommandEditDialog(this); | 1807 | CommandEditDialog *m = new CommandEditDialog(this); |
1808 | connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList())); | 1808 | connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList())); |
1809 | m->showMaximized(); | 1809 | m->showMaximized(); |
1810 | } | 1810 | } |
1811 | 1811 | ||
1812 | } | 1812 | } |
1813 | 1813 | ||
1814 | // $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' | 1814 | // $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' |
1815 | void Konsole::setDocument( const QString &cmd) | 1815 | void Konsole::setDocument( const QString &cmd) |
1816 | { | 1816 | { |
1817 | newSession(); | 1817 | newSession(); |
1818 | TEWidget* te = getTe(); | 1818 | TEWidget* te = getTe(); |
1819 | if(cmd.find("-e", 0, TRUE) != -1) | 1819 | if(cmd.find("-e", 0, TRUE) != -1) |
1820 | { | 1820 | { |
1821 | QString cmd2; | 1821 | QString cmd2; |
1822 | cmd2=cmd.right(cmd.length()-3)+" &"; | 1822 | cmd2=cmd.right(cmd.length()-3)+" &"; |
1823 | system(cmd2.latin1()); | 1823 | system(cmd2.latin1()); |
1824 | if(startUp <= 1 && nsessions < 2) | 1824 | if(startUp <= 1 && nsessions < 2) |
1825 | { | 1825 | { |
1826 | doneSession(getTe(), 0); | 1826 | doneSession(getTe(), 0); |
1827 | exit(0); | 1827 | exit(0); |
1828 | } | 1828 | } |
1829 | else | 1829 | else |
1830 | doneSession(getTe(), 0); | 1830 | doneSession(getTe(), 0); |
1831 | } | 1831 | } |
1832 | else | 1832 | else |
1833 | { | 1833 | { |
1834 | if (te != 0) | 1834 | if (te != 0) |
1835 | { | 1835 | { |
1836 | te->emitText(cmd+"\r"); | 1836 | te->emitText(cmd+"\r"); |
1837 | } | 1837 | } |
1838 | } | 1838 | } |
1839 | startUp++; | 1839 | startUp++; |
1840 | } | 1840 | } |
1841 | 1841 | ||
1842 | 1842 | ||
1843 | // what is the point of this when you can just | 1843 | // what is the point of this when you can just |
1844 | // run commands by using the shell directly?? | 1844 | // run commands by using the shell directly?? |
1845 | void Konsole::parseCommandLine() | 1845 | void Konsole::parseCommandLine() |
1846 | { | 1846 | { |
1847 | QString cmd; | 1847 | QString cmd; |
1848 | // newSession(); | 1848 | // newSession(); |
1849 | for (int i=1;i< qApp->argc();i++) | 1849 | for (int i=1;i< qApp->argc();i++) |
1850 | { | 1850 | { |
1851 | if( QString(qApp->argv()[i]) == "-e") | 1851 | if( QString(qApp->argv()[i]) == "-e") |
1852 | { | 1852 | { |
1853 | i++; | 1853 | i++; |
1854 | for ( int j=i;j< qApp->argc();j++) | 1854 | for ( int j=i;j< qApp->argc();j++) |
1855 | { | 1855 | { |
1856 | cmd+=QString(qApp->argv()[j])+" "; | 1856 | cmd+=QString(qApp->argv()[j])+" "; |
1857 | } | 1857 | } |
1858 | cmd.stripWhiteSpace(); | 1858 | cmd.stripWhiteSpace(); |
1859 | system(cmd.latin1()); | 1859 | system(cmd.latin1()); |
1860 | exit(0);//close(); | 1860 | exit(0);//close(); |
1861 | } // end -e switch | 1861 | } // end -e switch |
1862 | } | 1862 | } |
1863 | startUp++; | 1863 | startUp++; |
1864 | } | 1864 | } |
1865 | 1865 | ||
1866 | void Konsole::changeForegroundColor(const QColor &color) | 1866 | void Konsole::changeForegroundColor(const QColor &color) |
1867 | { | 1867 | { |
1868 | Config cfg("Qkonsole"); | 1868 | Config cfg("Qkonsole"); |
1869 | cfg.setGroup("Colors"); | 1869 | cfg.setGroup("Colors"); |
1870 | int r, g, b; | 1870 | int r, g, b; |
1871 | color.rgb(&r,&g,&b); | 1871 | color.rgb(&r,&g,&b); |
1872 | foreground.setRgb(r,g,b); | 1872 | foreground.setRgb(r,g,b); |
1873 | 1873 | ||
1874 | cfg.writeEntry("foreground",color.name()); | 1874 | cfg.writeEntry("foreground",color.name()); |
1875 | qDebug("foreground "+color.name()); | 1875 | qDebug("foreground "+color.name()); |
1876 | cfg.write(); | 1876 | cfg.write(); |
1877 | 1877 | ||
1878 | qDebug("do other dialog"); | 1878 | qDebug("do other dialog"); |
1879 | #ifdef QT_QWS_OPIE | 1879 | #ifdef QT_QWS_OPIE |
1880 | 1880 | ||
1881 | OColorPopupMenu* penColorPopupMenu2 = new OColorPopupMenu(Qt::black, this,"background color"); | 1881 | Opie::OColorPopupMenu* penColorPopupMenu2 = new Opie::OColorPopupMenu(Qt::black, this,"background color"); |
1882 | connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, | 1882 | connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, |
1883 | SLOT(changeBackgroundColor(const QColor&))); | 1883 | SLOT(changeBackgroundColor(const QColor&))); |
1884 | penColorPopupMenu2->exec(); | 1884 | penColorPopupMenu2->exec(); |
1885 | #endif | 1885 | #endif |
1886 | } | 1886 | } |
1887 | 1887 | ||
1888 | void Konsole::changeBackgroundColor(const QColor &color) | 1888 | void Konsole::changeBackgroundColor(const QColor &color) |
1889 | { | 1889 | { |
1890 | 1890 | ||
1891 | qDebug("Change background"); | 1891 | qDebug("Change background"); |
1892 | Config cfg("Qkonsole"); | 1892 | Config cfg("Qkonsole"); |
1893 | cfg.setGroup("Colors"); | 1893 | cfg.setGroup("Colors"); |
1894 | int r, g, b; | 1894 | int r, g, b; |
1895 | color.rgb(&r,&g,&b); | 1895 | color.rgb(&r,&g,&b); |
1896 | background.setRgb(r,g,b); | 1896 | background.setRgb(r,g,b); |
1897 | cfg.writeEntry("background",color.name()); | 1897 | cfg.writeEntry("background",color.name()); |
1898 | qDebug("background "+color.name()); | 1898 | qDebug("background "+color.name()); |
1899 | cfg.write(); | 1899 | cfg.write(); |
1900 | } | 1900 | } |
1901 | 1901 | ||
1902 | void Konsole::doWrap() | 1902 | void Konsole::doWrap() |
1903 | { | 1903 | { |
1904 | Config cfg("Qkonsole"); | 1904 | Config cfg("Qkonsole"); |
1905 | cfg.setGroup("ScrollBar"); | 1905 | cfg.setGroup("ScrollBar"); |
1906 | TEWidget* te = getTe(); | 1906 | TEWidget* te = getTe(); |
1907 | if( !cfg.readBoolEntry("HorzScroll",0)) | 1907 | if( !cfg.readBoolEntry("HorzScroll",0)) |
1908 | { | 1908 | { |
1909 | te->setWrapAt(0); | 1909 | te->setWrapAt(0); |
1910 | configMenu->setItemChecked( cm_wrap,TRUE); | 1910 | configMenu->setItemChecked( cm_wrap,TRUE); |
1911 | } | 1911 | } |
1912 | else | 1912 | else |
1913 | { | 1913 | { |
1914 | // te->setWrapAt(90); | 1914 | // te->setWrapAt(90); |
1915 | te->setWrapAt(120); | 1915 | te->setWrapAt(120); |
1916 | configMenu->setItemChecked( cm_wrap,FALSE); | 1916 | configMenu->setItemChecked( cm_wrap,FALSE); |
1917 | } | 1917 | } |
1918 | } | 1918 | } |
diff --git a/core/apps/embeddedkonsole/main.cpp b/core/apps/embeddedkonsole/main.cpp index a6a079c..fe30b7e 100644 --- a/core/apps/embeddedkonsole/main.cpp +++ b/core/apps/embeddedkonsole/main.cpp | |||
@@ -1,39 +1,29 @@ | |||
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 | #include <qpe/qpeapplication.h> | 24 | #include <opie2/oapplicationfactory.h> |
25 | #include <opie/oapplicationfactory.h> | ||
26 | |||
27 | #include <qfile.h> | ||
28 | |||
29 | #include <unistd.h> | ||
30 | #include <stdio.h> | ||
31 | #include <stdlib.h> | ||
32 | |||
33 | #include <pwd.h> | ||
34 | #include <sys/types.h> | ||
35 | 25 | ||
36 | 26 | ||
37 | /* --| main |------------------------------------------------------ */ | 27 | /* --| main |------------------------------------------------------ */ |
38 | OPIE_EXPORT_APP( OApplicationFactory<Konsole> ) | 28 | OPIE_EXPORT_APP( OApplicationFactory<Konsole> ) |
39 | 29 | ||
diff --git a/core/apps/embeddedkonsole/opie-embeddedkonsole.control b/core/apps/embeddedkonsole/opie-embeddedkonsole.control index 5807cd1..a338e19 100644 --- a/core/apps/embeddedkonsole/opie-embeddedkonsole.control +++ b/core/apps/embeddedkonsole/opie-embeddedkonsole.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-embeddedkonsole | 1 | Package: opie-embeddedkonsole |
2 | Files: plugins/application/libembeddedkonsole.so* bin/embeddedkonsole apps/Applications/embeddedkonsole.desktop pics/konsole | 2 | Files: plugins/application/libembeddedkonsole.so* bin/embeddedkonsole apps/Applications/embeddedkonsole.desktop pics/konsole |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: L.J. Potter <lpotter@trolltech.com> | 5 | Maintainer: L.J. Potter <lpotter@trolltech.com> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal, libopie1, opie-keytabs | 7 | Depends: task-opie-minimal, libopiecore2, libqtaux2, opie-keytabs |
8 | Description: KDE's konsole (shell terminal) | 8 | Description: KDE's konsole (shell terminal) |
9 | Ported to the Opie environment. | 9 | Ported to the Opie environment. |
10 | Version: $QPE_VERSION$EXTRAVERSION | 10 | Version: $QPE_VERSION$EXTRAVERSION |