-rw-r--r-- | core/apps/embeddedkonsole/MyPty.cpp | 7 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 21 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.h | 6 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/session.h | 2 |
4 files changed, 17 insertions, 19 deletions
diff --git a/core/apps/embeddedkonsole/MyPty.cpp b/core/apps/embeddedkonsole/MyPty.cpp index e7d8274..5a8519a 100644 --- a/core/apps/embeddedkonsole/MyPty.cpp +++ b/core/apps/embeddedkonsole/MyPty.cpp | |||
@@ -1,290 +1,289 @@ | |||
1 | /* -------------------------------------------------------------------------- */ | 1 | /* -------------------------------------------------------------------------- */ |
2 | /* */ | 2 | /* */ |
3 | /* [MyPty.C] Pseudo Terminal Device */ | 3 | /* [MyPty.C] Pseudo Terminal Device */ |
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 for KDE */ | 9 | /* This file is part of Konsole - an X terminal for KDE */ |
10 | /* -------------------------------------------------------------------------- */ | 10 | /* -------------------------------------------------------------------------- */ |
11 | /* */ | 11 | /* */ |
12 | /* Ported Konsole to Qt/Embedded */ | 12 | /* Ported Konsole to Qt/Embedded */ |
13 | /* */ | 13 | /* */ |
14 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | 14 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ |
15 | /* */ | 15 | /* */ |
16 | /* -------------------------------------------------------------------------- */ | 16 | /* -------------------------------------------------------------------------- */ |
17 | 17 | ||
18 | /* If you're compiling konsole on non-Linux platforms and find | 18 | /* If you're compiling konsole on non-Linux platforms and find |
19 | problems that you can track down to this file, please have | 19 | problems that you can track down to this file, please have |
20 | a look into ../README.ports, too. | 20 | a look into ../README.ports, too. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | /*! \file | 23 | /*! \file |
24 | */ | 24 | */ |
25 | 25 | ||
26 | /*! \class TEPty | 26 | /*! \class TEPty |
27 | 27 | ||
28 | \brief Ptys provide a pseudo terminal connection to a program. | 28 | \brief Ptys provide a pseudo terminal connection to a program. |
29 | 29 | ||
30 | Although closely related to pipes, these pseudo terminal connections have | 30 | Although closely related to pipes, these pseudo terminal connections have |
31 | some ability, that makes it nessesary to uses them. Most importent, they | 31 | some ability, that makes it nessesary to uses them. Most importent, they |
32 | know about changing screen sizes and UNIX job control. | 32 | know about changing screen sizes and UNIX job control. |
33 | 33 | ||
34 | Within the terminal emulation framework, this class represents the | 34 | Within the terminal emulation framework, this class represents the |
35 | host side of the terminal together with the connecting serial line. | 35 | host side of the terminal together with the connecting serial line. |
36 | 36 | ||
37 | One can create many instances of this class within a program. | 37 | One can create many instances of this class within a program. |
38 | As a side effect of using this class, a signal(2) handler is | 38 | As a side effect of using this class, a signal(2) handler is |
39 | installed on SIGCHLD. | 39 | installed on SIGCHLD. |
40 | 40 | ||
41 | \par FIXME | 41 | \par FIXME |
42 | 42 | ||
43 | [NOTE: much of the technical stuff below will be replaced by forkpty.] | 43 | [NOTE: much of the technical stuff below will be replaced by forkpty.] |
44 | 44 | ||
45 | publish the SIGCHLD signal if not related to an instance. | 45 | publish the SIGCHLD signal if not related to an instance. |
46 | 46 | ||
47 | clearify TEPty::done vs. TEPty::~TEPty semantics. | 47 | clearify TEPty::done vs. TEPty::~TEPty semantics. |
48 | check if pty is restartable via run after done. | 48 | check if pty is restartable via run after done. |
49 | 49 | ||
50 | \par Pseudo terminals | 50 | \par Pseudo terminals |
51 | 51 | ||
52 | Pseudo terminals are a unique feature of UNIX, and always come in form of | 52 | Pseudo terminals are a unique feature of UNIX, and always come in form of |
53 | pairs of devices (/dev/ptyXX and /dev/ttyXX), which are connected to each | 53 | pairs of devices (/dev/ptyXX and /dev/ttyXX), which are connected to each |
54 | other by the operating system. One may think of them as two serial devices | 54 | other by the operating system. One may think of them as two serial devices |
55 | linked by a null-modem cable. Being based on devices the number of | 55 | linked by a null-modem cable. Being based on devices the number of |
56 | simultanous instances of this class is (globally) limited by the number of | 56 | simultanous instances of this class is (globally) limited by the number of |
57 | those device pairs, which is 256. | 57 | those device pairs, which is 256. |
58 | 58 | ||
59 | Another technic are UNIX 98 PTY's. These are supported also, and prefered | 59 | Another technic are UNIX 98 PTY's. These are supported also, and prefered |
60 | over the (obsolete) predecessor. | 60 | over the (obsolete) predecessor. |
61 | 61 | ||
62 | There's a sinister ioctl(2), signal(2) and job control stuff | 62 | There's a sinister ioctl(2), signal(2) and job control stuff |
63 | nessesary to make everything work as it should. | 63 | nessesary to make everything work as it should. |
64 | */ | 64 | */ |
65 | 65 | ||
66 | 66 | ||
67 | #include <qfileinfo.h> | 67 | #include <qfileinfo.h> |
68 | #include <qapplication.h> | 68 | #include <qapplication.h> |
69 | #include <qsocketnotifier.h> | 69 | #include <qsocketnotifier.h> |
70 | #include <qstring.h> | 70 | #include <qstring.h> |
71 | 71 | ||
72 | #include <stdlib.h> | 72 | #include <stdlib.h> |
73 | #include <stdio.h> | 73 | #include <stdio.h> |
74 | #include <signal.h> | 74 | #include <signal.h> |
75 | #include <fcntl.h> | 75 | #include <fcntl.h> |
76 | #include <unistd.h> | 76 | #include <unistd.h> |
77 | #include <termios.h> | 77 | #include <termios.h> |
78 | #include <sys/types.h> | 78 | #include <sys/types.h> |
79 | #include <sys/ioctl.h> | 79 | #include <sys/ioctl.h> |
80 | #include <sys/wait.h> | 80 | #include <sys/wait.h> |
81 | 81 | ||
82 | #undef HAVE_OPENPTY | ||
83 | #ifdef HAVE_OPENPTY | 82 | #ifdef HAVE_OPENPTY |
84 | #include <pty.h> | 83 | #include <pty.h> |
85 | #endif | 84 | #endif |
86 | 85 | ||
87 | #include "MyPty.h" | 86 | #include "MyPty.h" |
88 | 87 | ||
89 | 88 | ||
90 | #undef VERBOSE_DEBUG | 89 | #undef VERBOSE_DEBUG |
91 | 90 | ||
92 | 91 | ||
93 | /* -------------------------------------------------------------------------- */ | 92 | /* -------------------------------------------------------------------------- */ |
94 | 93 | ||
95 | /*! | 94 | /*! |
96 | Informs the client program about the | 95 | Informs the client program about the |
97 | actual size of the window. | 96 | actual size of the window. |
98 | */ | 97 | */ |
99 | 98 | ||
100 | void MyPty::setSize(int lines, int columns) | 99 | void MyPty::setSize(int lines, int columns) |
101 | { | 100 | { |
102 | struct winsize wsize; | 101 | struct winsize wsize; |
103 | wsize.ws_row = (unsigned short)lines; | 102 | wsize.ws_row = (unsigned short)lines; |
104 | wsize.ws_col = (unsigned short)columns; | 103 | wsize.ws_col = (unsigned short)columns; |
105 | if(fd < 0) return; | 104 | if(fd < 0) return; |
106 | ioctl(fd,TIOCSWINSZ,(char *)&wsize); | 105 | ioctl(fd,TIOCSWINSZ,(char *)&wsize); |
107 | } | 106 | } |
108 | 107 | ||
109 | 108 | ||
110 | void MyPty::donePty() | 109 | void MyPty::donePty() |
111 | { | 110 | { |
112 | // This is code from the Qt DumbTerminal example | 111 | // This is code from the Qt DumbTerminal example |
113 | int status = 0; | 112 | int status = 0; |
114 | 113 | ||
115 | ::close(fd); | 114 | ::close(fd); |
116 | 115 | ||
117 | if (cpid) { | 116 | if (cpid) { |
118 | kill(cpid, SIGHUP); | 117 | kill(cpid, SIGHUP); |
119 | waitpid(cpid, &status, 0); | 118 | waitpid(cpid, &status, 0); |
120 | } | 119 | } |
121 | 120 | ||
122 | emit done(status); | 121 | emit done(status); |
123 | } | 122 | } |
124 | 123 | ||
125 | 124 | ||
126 | const char* MyPty::deviceName() | 125 | const char* MyPty::deviceName() |
127 | { | 126 | { |
128 | return ttynam; | 127 | return ttynam; |
129 | } | 128 | } |
130 | 129 | ||
131 | 130 | ||
132 | void MyPty::error() | 131 | void MyPty::error() |
133 | { | 132 | { |
134 | // This is code from the Qt DumbTerminal example | 133 | // This is code from the Qt DumbTerminal example |
135 | donePty(); | 134 | donePty(); |
136 | } | 135 | } |
137 | 136 | ||
138 | 137 | ||
139 | /*! | 138 | /*! |
140 | start the client program. | 139 | start the client program. |
141 | */ | 140 | */ |
142 | int MyPty::run(const char* cmd, QStrList &, const char*, int) | 141 | int MyPty::run(const char* cmd, QStrList &, const char*, int) |
143 | { | 142 | { |
144 | // This is code from the Qt DumbTerminal example | 143 | // This is code from the Qt DumbTerminal example |
145 | cpid = fork(); | 144 | cpid = fork(); |
146 | 145 | ||
147 | if ( !cpid ) { | 146 | if ( !cpid ) { |
148 | // child - exec shell on tty | 147 | // child - exec shell on tty |
149 | for (int sig = 1; sig < NSIG; sig++) signal(sig,SIG_DFL); | 148 | for (int sig = 1; sig < NSIG; sig++) signal(sig,SIG_DFL); |
150 | 149 | ||
151 | // attempt to keep apm driver from killing us on power on/off | 150 | // attempt to keep apm driver from killing us on power on/off |
152 | signal(SIGSTOP, SIG_IGN); | 151 | signal(SIGSTOP, SIG_IGN); |
153 | signal(SIGCONT, SIG_IGN); | 152 | signal(SIGCONT, SIG_IGN); |
154 | signal(SIGTSTP, SIG_IGN); | 153 | signal(SIGTSTP, SIG_IGN); |
155 | 154 | ||
156 | int ttyfd = open(ttynam, O_RDWR); | 155 | int ttyfd = open(ttynam, O_RDWR); |
157 | dup2(ttyfd, STDIN_FILENO); | 156 | dup2(ttyfd, STDIN_FILENO); |
158 | dup2(ttyfd, STDOUT_FILENO); | 157 | dup2(ttyfd, STDOUT_FILENO); |
159 | dup2(ttyfd, STDERR_FILENO); | 158 | dup2(ttyfd, STDERR_FILENO); |
160 | // should be done with tty, so close it | 159 | // should be done with tty, so close it |
161 | close(ttyfd); | 160 | close(ttyfd); |
162 | static struct termios ttmode; | 161 | static struct termios ttmode; |
163 | if ( setsid() < 0 ) | 162 | if ( setsid() < 0 ) |
164 | perror( "failed to set process group" ); | 163 | perror( "failed to set process group" ); |
165 | #if defined (TIOCSCTTY) | 164 | #if defined (TIOCSCTTY) |
166 | // grabbed from APUE by Stevens | 165 | // grabbed from APUE by Stevens |
167 | ioctl(STDIN_FILENO, TIOCSCTTY, 0); | 166 | ioctl(STDIN_FILENO, TIOCSCTTY, 0); |
168 | #endif | 167 | #endif |
169 | tcgetattr( STDIN_FILENO, &ttmode ); | 168 | tcgetattr( STDIN_FILENO, &ttmode ); |
170 | ttmode.c_cc[VINTR] = 3; | 169 | ttmode.c_cc[VINTR] = 3; |
171 | ttmode.c_cc[VERASE] = 8; | 170 | ttmode.c_cc[VERASE] = 8; |
172 | tcsetattr( STDIN_FILENO, TCSANOW, &ttmode ); | 171 | tcsetattr( STDIN_FILENO, TCSANOW, &ttmode ); |
173 | setenv("TERM","vt100",1); | 172 | setenv("TERM","vt100",1); |
174 | setenv("COLORTERM","0",1); | 173 | setenv("COLORTERM","0",1); |
175 | 174 | ||
176 | if (getuid() == 0) { | 175 | if (getuid() == 0) { |
177 | char msg[] = "WARNING: You are running this shell as root!\n"; | 176 | char msg[] = "WARNING: You are running this shell as root!\n"; |
178 | write(ttyfd, msg, sizeof(msg)); | 177 | write(ttyfd, msg, sizeof(msg)); |
179 | } | 178 | } |
180 | 179 | ||
181 | QString ccmd = "-"+QFileInfo(cmd).fileName(); //creates a login shell | 180 | QString ccmd = "-"+QFileInfo(cmd).fileName(); //creates a login shell |
182 | 181 | ||
183 | execl(cmd, ccmd.latin1(), 0); | 182 | execl(cmd, ccmd.latin1(), 0); |
184 | 183 | ||
185 | donePty(); | 184 | donePty(); |
186 | exit(-1); | 185 | exit(-1); |
187 | } | 186 | } |
188 | 187 | ||
189 | // parent - continue as a widget | 188 | // parent - continue as a widget |
190 | QSocketNotifier* sn_r = new QSocketNotifier(fd,QSocketNotifier::Read,this); | 189 | QSocketNotifier* sn_r = new QSocketNotifier(fd,QSocketNotifier::Read,this); |
191 | QSocketNotifier* sn_e = new QSocketNotifier(fd,QSocketNotifier::Exception,this); | 190 | QSocketNotifier* sn_e = new QSocketNotifier(fd,QSocketNotifier::Exception,this); |
192 | connect(sn_r,SIGNAL(activated(int)),this,SLOT(readPty())); | 191 | connect(sn_r,SIGNAL(activated(int)),this,SLOT(readPty())); |
193 | connect(sn_e,SIGNAL(activated(int)),this,SLOT(error())); | 192 | connect(sn_e,SIGNAL(activated(int)),this,SLOT(error())); |
194 | 193 | ||
195 | return 0; | 194 | return 0; |
196 | } | 195 | } |
197 | 196 | ||
198 | int MyPty::openPty() | 197 | int MyPty::openPty() |
199 | { | 198 | { |
200 | // This is code from the Qt DumbTerminal example | 199 | // This is code from the Qt DumbTerminal example |
201 | int ptyfd = -1; | 200 | int ptyfd = -1; |
202 | 201 | ||
203 | #ifdef HAVE_OPENPTY | 202 | #ifdef HAVE_OPENPTY |
204 | int ttyfd; | 203 | int ttyfd; |
205 | if ( openpty(&ptyfd,&ttyfd,ttynam,0,0) ) | 204 | if ( openpty(&ptyfd,&ttyfd,ttynam,0,0) ) |
206 | ptyfd = -1; | 205 | ptyfd = -1; |
207 | else | 206 | else |
208 | close(ttyfd); // we open the ttynam ourselves. | 207 | close(ttyfd); // we open the ttynam ourselves. |
209 | #else | 208 | #else |
210 | for (const char* c0 = "pqrstuvwxyzabcde"; ptyfd < 0 && *c0 != 0; c0++) { | 209 | for (const char* c0 = "pqrstuvwxyzabcde"; ptyfd < 0 && *c0 != 0; c0++) { |
211 | for (const char* c1 = "0123456789abcdef"; ptyfd < 0 && *c1 != 0; c1++) { | 210 | for (const char* c1 = "0123456789abcdef"; ptyfd < 0 && *c1 != 0; c1++) { |
212 | sprintf(ptynam,"/dev/pty%c%c",*c0,*c1); | 211 | sprintf(ptynam,"/dev/pty%c%c",*c0,*c1); |
213 | sprintf(ttynam,"/dev/tty%c%c",*c0,*c1); | 212 | sprintf(ttynam,"/dev/tty%c%c",*c0,*c1); |
214 | if ((ptyfd = ::open(ptynam,O_RDWR)) >= 0) { | 213 | if ((ptyfd = ::open(ptynam,O_RDWR)) >= 0) { |
215 | if (geteuid() != 0 && !access(ttynam,R_OK|W_OK) == 0) { | 214 | if (geteuid() != 0 && !access(ttynam,R_OK|W_OK) == 0) { |
216 | ::close(ptyfd); | 215 | ::close(ptyfd); |
217 | ptyfd = -1; | 216 | ptyfd = -1; |
218 | } | 217 | } |
219 | } | 218 | } |
220 | } | 219 | } |
221 | } | 220 | } |
222 | #endif | 221 | #endif |
223 | 222 | ||
224 | if ( ptyfd < 0 ) { | 223 | if ( ptyfd < 0 ) { |
225 | qApp->exit(1); | 224 | qApp->exit(1); |
226 | return -1; | 225 | return -1; |
227 | } | 226 | } |
228 | 227 | ||
229 | return ptyfd; | 228 | return ptyfd; |
230 | } | 229 | } |
231 | 230 | ||
232 | /*! | 231 | /*! |
233 | Create an instance. | 232 | Create an instance. |
234 | */ | 233 | */ |
235 | MyPty::MyPty() : cpid(0) | 234 | MyPty::MyPty() : cpid(0) |
236 | { | 235 | { |
237 | fd = openPty(); | 236 | fd = openPty(); |
238 | } | 237 | } |
239 | 238 | ||
240 | /*! | 239 | /*! |
241 | Destructor. | 240 | Destructor. |
242 | Note that the related client program is not killed | 241 | Note that the related client program is not killed |
243 | (yet) when a instance is deleted. | 242 | (yet) when a instance is deleted. |
244 | */ | 243 | */ |
245 | MyPty::~MyPty() | 244 | MyPty::~MyPty() |
246 | { | 245 | { |
247 | donePty(); | 246 | donePty(); |
248 | } | 247 | } |
249 | 248 | ||
250 | 249 | ||
251 | /*! sends len bytes through the line */ | 250 | /*! sends len bytes through the line */ |
252 | void MyPty::send_bytes(const char* s, int len) | 251 | void MyPty::send_bytes(const char* s, int len) |
253 | { | 252 | { |
254 | 253 | ||
255 | #ifdef VERBOSE_DEBUG | 254 | #ifdef VERBOSE_DEBUG |
256 | // verbose debug | 255 | // verbose debug |
257 | printf("sending bytes:\n"); | 256 | printf("sending bytes:\n"); |
258 | for (int i = 0; i < len; i++) | 257 | for (int i = 0; i < len; i++) |
259 | printf("%c", s[i]); | 258 | printf("%c", s[i]); |
260 | printf("\n"); | 259 | printf("\n"); |
261 | #endif | 260 | #endif |
262 | 261 | ||
263 | ::write(fd, s, len); | 262 | ::write(fd, s, len); |
264 | } | 263 | } |
265 | 264 | ||
266 | /*! indicates that a block of data is received */ | 265 | /*! indicates that a block of data is received */ |
267 | void MyPty::readPty() | 266 | void MyPty::readPty() |
268 | { | 267 | { |
269 | char buf[4096]; | 268 | char buf[4096]; |
270 | 269 | ||
271 | int len = ::read( fd, buf, 4096 ); | 270 | int len = ::read( fd, buf, 4096 ); |
272 | 271 | ||
273 | if (len == -1) | 272 | if (len == -1) |
274 | donePty(); | 273 | donePty(); |
275 | 274 | ||
276 | if (len < 0) | 275 | if (len < 0) |
277 | return; | 276 | return; |
278 | 277 | ||
279 | emit block_in(buf,len); | 278 | emit block_in(buf,len); |
280 | 279 | ||
281 | #ifdef VERBOSE_DEBUG | 280 | #ifdef VERBOSE_DEBUG |
282 | // verbose debug | 281 | // verbose debug |
283 | printf("read bytes:\n"); | 282 | printf("read bytes:\n"); |
284 | for (int i = 0; i < len; i++) | 283 | for (int i = 0; i < len; i++) |
285 | printf("%c", buf[i]); | 284 | printf("%c", buf[i]); |
286 | printf("\n"); | 285 | printf("\n"); |
287 | #endif | 286 | #endif |
288 | 287 | ||
289 | } | 288 | } |
290 | 289 | ||
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index b8f009d..1c613a9 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -1,120 +1,119 @@ | |||
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 | //#define QT_QWS_OPIE | ||
25 | 24 | ||
26 | #include <stdlib.h> | 25 | #include <stdlib.h> |
27 | 26 | ||
28 | #ifdef QT_QWS_OPIE | 27 | #ifdef QT_QWS_OPIE |
29 | #include <opie2/ocolorpopupmenu.h> | 28 | #include <opie2/ocolorpopupmenu.h> |
30 | #endif | 29 | #endif |
31 | 30 | ||
32 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
33 | 32 | ||
34 | #include <qdir.h> | 33 | #include <qdir.h> |
35 | #include <qevent.h> | 34 | #include <qevent.h> |
36 | #include <qdragobject.h> | 35 | #include <qdragobject.h> |
37 | #include <qobjectlist.h> | 36 | #include <qobjectlist.h> |
38 | #include <qtoolbutton.h> | 37 | #include <qtoolbutton.h> |
39 | #include <qtoolbar.h> | 38 | #include <qtoolbar.h> |
40 | #include <qpushbutton.h> | 39 | #include <qpushbutton.h> |
41 | #include <qfontdialog.h> | 40 | #include <qfontdialog.h> |
42 | #include <qglobal.h> | 41 | #include <qglobal.h> |
43 | #include <qpainter.h> | 42 | #include <qpainter.h> |
44 | #include <qmenubar.h> | 43 | #include <qmenubar.h> |
45 | #include <qmessagebox.h> | 44 | #include <qmessagebox.h> |
46 | #include <qaction.h> | 45 | #include <qaction.h> |
47 | #include <qapplication.h> | 46 | #include <qapplication.h> |
48 | #include <qfontmetrics.h> | 47 | #include <qfontmetrics.h> |
49 | #include <qcombobox.h> | 48 | #include <qcombobox.h> |
50 | #include <qevent.h> | 49 | #include <qevent.h> |
51 | #include <qtabwidget.h> | 50 | #include <qtabwidget.h> |
52 | #include <qtabbar.h> | 51 | #include <qtabbar.h> |
53 | #include <qpe/config.h> | 52 | #include <qpe/config.h> |
54 | #include <qstringlist.h> | 53 | #include <qstringlist.h> |
55 | #include <qpalette.h> | 54 | #include <qpalette.h> |
56 | #include <qfontdatabase.h> | 55 | #include <qfontdatabase.h> |
57 | #include <qfile.h> | 56 | #include <qfile.h> |
58 | #include <qspinbox.h> | 57 | #include <qspinbox.h> |
59 | #include <qlayout.h> | 58 | #include <qlayout.h> |
60 | #include <qvbox.h> | 59 | #include <qvbox.h> |
61 | 60 | ||
62 | #include <sys/wait.h> | 61 | #include <sys/wait.h> |
63 | #include <stdio.h> | 62 | #include <stdio.h> |
64 | #include <stdlib.h> | 63 | #include <stdlib.h> |
65 | #include <assert.h> | 64 | #include <assert.h> |
66 | 65 | ||
67 | #include "konsole.h" | 66 | #include "konsole.h" |
68 | #include "keytrans.h" | 67 | #include "keytrans.h" |
69 | #include "commandeditdialog.h" | 68 | #include "commandeditdialog.h" |
70 | 69 | ||
71 | class EKNumTabBar : public QTabBar | 70 | class EKNumTabBar : public QTabBar |
72 | { | 71 | { |
73 | public: | 72 | public: |
74 | EKNumTabBar(QWidget *parent = 0, const char *name = 0) : | 73 | EKNumTabBar(QWidget *parent = 0, const char *name = 0) : |
75 | QTabBar(parent, name) | 74 | QTabBar(parent, name) |
76 | {} | 75 | {} |
77 | 76 | ||
78 | // QList<QTab> *getTabList() { return(tabList()); } | 77 | // QList<QTab> *getTabList() { return(tabList()); } |
79 | 78 | ||
80 | void numberTabs() | 79 | void numberTabs() |
81 | { | 80 | { |
82 | // Yes, it really is this messy. QTabWidget needs functions | 81 | // Yes, it really is this messy. QTabWidget needs functions |
83 | // that provide acces to tabs in a sequential way. | 82 | // that provide acces to tabs in a sequential way. |
84 | int m=INT_MIN; | 83 | int m=INT_MIN; |
85 | for (int i=0; i<count(); i++) | 84 | for (int i=0; i<count(); i++) |
86 | { | 85 | { |
87 | QTab* left=0; | 86 | QTab* left=0; |
88 | QListIterator<QTab> it(*tabList()); | 87 | QListIterator<QTab> it(*tabList()); |
89 | int x=INT_MAX; | 88 | int x=INT_MAX; |
90 | for( QTab* t; (t=it.current()); ++it ) | 89 | for( QTab* t; (t=it.current()); ++it ) |
91 | { | 90 | { |
92 | int tx = t->rect().x(); | 91 | int tx = t->rect().x(); |
93 | if ( tx<x && tx>m ) | 92 | if ( tx<x && tx>m ) |
94 | { | 93 | { |
95 | x = tx; | 94 | x = tx; |
96 | left = t; | 95 | left = t; |
97 | } | 96 | } |
98 | } | 97 | } |
99 | if ( left ) | 98 | if ( left ) |
100 | { | 99 | { |
101 | left->setText(QString::number(i+1)); | 100 | left->setText(QString::number(i+1)); |
102 | m = left->rect().x(); | 101 | m = left->rect().x(); |
103 | } | 102 | } |
104 | } | 103 | } |
105 | } | 104 | } |
106 | 105 | ||
107 | virtual QSize sizeHint() const | 106 | virtual QSize sizeHint() const |
108 | { | 107 | { |
109 | if (isHidden()) | 108 | if (isHidden()) |
110 | { | 109 | { |
111 | return(QSize(0,0)); | 110 | return(QSize(0,0)); |
112 | } | 111 | } |
113 | else | 112 | else |
114 | { | 113 | { |
115 | QSize size = QTabBar::sizeHint(); | 114 | QSize size = QTabBar::sizeHint(); |
116 | int shrink = 5; | 115 | int shrink = 5; |
117 | if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600) | 116 | if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600) |
118 | { | 117 | { |
119 | shrink = 10; | 118 | shrink = 10; |
120 | } | 119 | } |
@@ -276,194 +275,194 @@ void Konsole::initCommandList() | |||
276 | // QFile histfile(QString(getenv("HOME")) + "/.bash_history"); | 275 | // QFile histfile(QString(getenv("HOME")) + "/.bash_history"); |
277 | if (histfile.open( IO_ReadOnly )) | 276 | if (histfile.open( IO_ReadOnly )) |
278 | { | 277 | { |
279 | QString line; | 278 | QString line; |
280 | uint i; | 279 | uint i; |
281 | HistoryList items; | 280 | HistoryList items; |
282 | 281 | ||
283 | int lineno = 0; | 282 | int lineno = 0; |
284 | while(!histfile.atEnd()) | 283 | while(!histfile.atEnd()) |
285 | { | 284 | { |
286 | if (histfile.readLine(line, 200) < 0) | 285 | if (histfile.readLine(line, 200) < 0) |
287 | { | 286 | { |
288 | break; | 287 | break; |
289 | } | 288 | } |
290 | line = line.left(line.length()-1); | 289 | line = line.left(line.length()-1); |
291 | lineno++; | 290 | lineno++; |
292 | 291 | ||
293 | for(i=0; i<items.count(); i++) | 292 | for(i=0; i<items.count(); i++) |
294 | { | 293 | { |
295 | if (line == items.at(i)->line) | 294 | if (line == items.at(i)->line) |
296 | { | 295 | { |
297 | // weight recent commands & repeated commands more | 296 | // weight recent commands & repeated commands more |
298 | // by adding up the index of each command | 297 | // by adding up the index of each command |
299 | items.at(i)->count += lineno; | 298 | items.at(i)->count += lineno; |
300 | break; | 299 | break; |
301 | } | 300 | } |
302 | } | 301 | } |
303 | if (i >= items.count()) | 302 | if (i >= items.count()) |
304 | { | 303 | { |
305 | items.append(new HistoryItem(lineno, line)); | 304 | items.append(new HistoryItem(lineno, line)); |
306 | } | 305 | } |
307 | } | 306 | } |
308 | items.sort(); | 307 | items.sort(); |
309 | int n = items.count(); | 308 | int n = items.count(); |
310 | if (n > 40) | 309 | if (n > 40) |
311 | { | 310 | { |
312 | n = 40; | 311 | n = 40; |
313 | } | 312 | } |
314 | for(int i=0; i<n; i++) | 313 | for(int i=0; i<n; i++) |
315 | { | 314 | { |
316 | // should insert start of command, but keep whole thing | 315 | // should insert start of command, but keep whole thing |
317 | if (items.at(items.count()-i-1)->line.length() < 30) | 316 | if (items.at(items.count()-i-1)->line.length() < 30) |
318 | { | 317 | { |
319 | commonCombo->insertItem(items.at(items.count()-i-1)->line); | 318 | commonCombo->insertItem(items.at(items.count()-i-1)->line); |
320 | } | 319 | } |
321 | } | 320 | } |
322 | histfile.close(); | 321 | histfile.close(); |
323 | } | 322 | } |
324 | } | 323 | } |
325 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") | 324 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") |
326 | { | 325 | { |
327 | for (int i = 0; commonCmds[i] != NULL; i++) | 326 | for (int i = 0; commonCmds[i] != NULL; i++) |
328 | { | 327 | { |
329 | commonCombo->insertItem(commonCmds[i]); | 328 | commonCombo->insertItem(commonCmds[i]); |
330 | } | 329 | } |
331 | } | 330 | } |
332 | else | 331 | else |
333 | { | 332 | { |
334 | for (int i = 0; i < 100; i++) | 333 | for (int i = 0; i < 100; i++) |
335 | { | 334 | { |
336 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) | 335 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) |
337 | commonCombo->insertItem(cfg.readEntry( QString::number(i),"")); | 336 | commonCombo->insertItem(cfg.readEntry( QString::number(i),"")); |
338 | } | 337 | } |
339 | } | 338 | } |
340 | 339 | ||
341 | 340 | ||
342 | } | 341 | } |
343 | 342 | ||
344 | static void sig_handler(int x) | 343 | static void sig_handler(int x) |
345 | { | 344 | { |
346 | printf("got signal %d\n",x); | 345 | printf("got signal %d\n",x); |
347 | } | 346 | } |
348 | 347 | ||
349 | void Konsole::init(const char* _pgm, QStrList & _args) | 348 | void Konsole::init(const char* _pgm, QStrList & _args) |
350 | { | 349 | { |
351 | 350 | ||
352 | #if 0 | 351 | #if 0 |
353 | for(int i=1; i<=31; i++) | 352 | for(int i=1; i<=31; i++) |
354 | { | 353 | { |
355 | if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV | 354 | if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV |
356 | && i != SIGINT && i != SIGILL && i != SIGTERM | 355 | && i != SIGINT && i != SIGILL && i != SIGTERM |
357 | && i != SIGBUS) | 356 | && i != SIGBUS) |
358 | signal(i,sig_handler); | 357 | signal(i,sig_handler); |
359 | } | 358 | } |
360 | #endif | 359 | #endif |
361 | signal(SIGSTOP, sig_handler); | 360 | signal(SIGSTOP, sig_handler); |
362 | signal(SIGCONT, sig_handler); | 361 | signal(SIGCONT, sig_handler); |
363 | signal(SIGTSTP, sig_handler); | 362 | signal(SIGTSTP, sig_handler); |
364 | 363 | ||
365 | b_scroll = TRUE; // histon; | 364 | b_scroll = TRUE; // histon; |
366 | n_keytab = 0; | 365 | n_keytab = 0; |
367 | n_render = 0; | 366 | n_render = 0; |
368 | startUp=0; | 367 | startUp=0; |
369 | fromMenu = FALSE; | 368 | fromMenu = FALSE; |
370 | fullscreen = false; | 369 | fullscreen = false; |
371 | 370 | ||
372 | setCaption( "Konsole" ); | 371 | setCaption( tr( "Konsole" ) ); |
373 | setIcon( Resource::loadPixmap( "qkonsole/qkonsole" ) ); | 372 | setIcon( Resource::loadPixmap( "konsole/Terminal" ) ); |
374 | 373 | ||
375 | Config cfg( "Konsole" ); | 374 | Config cfg( "Konsole" ); |
376 | cfg.setGroup("Font"); | 375 | cfg.setGroup("Font"); |
377 | QString tmp; | 376 | QString tmp; |
378 | 377 | ||
379 | // initialize the list of allowed fonts /////////////////////////////////// | 378 | // initialize the list of allowed fonts /////////////////////////////////// |
380 | 379 | ||
381 | QString cfgFontName = cfg.readEntry("FontName","Lcfont"); | 380 | QString cfgFontName = cfg.readEntry("FontName","Lcfont"); |
382 | int cfgFontSize = cfg.readNumEntry("FontSize",18); | 381 | int cfgFontSize = cfg.readNumEntry("FontSize",18); |
383 | 382 | ||
384 | cfont = -1; | 383 | cfont = -1; |
385 | 384 | ||
386 | // this code causes repeated access to all the font files | 385 | // this code causes repeated access to all the font files |
387 | // which does slow down startup | 386 | // which does slow down startup |
388 | QFontDatabase fontDB; | 387 | QFontDatabase fontDB; |
389 | QStringList familyNames; | 388 | QStringList familyNames; |
390 | familyNames = fontDB.families( FALSE ); | 389 | familyNames = fontDB.families( FALSE ); |
391 | QString s; | 390 | QString s; |
392 | int fontIndex = 0; | 391 | int fontIndex = 0; |
393 | int familyNum = 0; | 392 | int familyNum = 0; |
394 | fontList = new QPopupMenu( this ); | 393 | fontList = new QPopupMenu( this ); |
395 | 394 | ||
396 | for(uint j = 0; j < (uint)familyNames.count(); j++) | 395 | for(uint j = 0; j < (uint)familyNames.count(); j++) |
397 | { | 396 | { |
398 | s = familyNames[j]; | 397 | s = familyNames[j]; |
399 | if ( s.contains('-') ) | 398 | if ( s.contains('-') ) |
400 | { | 399 | { |
401 | int i = s.find('-'); | 400 | int i = s.find('-'); |
402 | s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]"; | 401 | s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]"; |
403 | } | 402 | } |
404 | s[0] = s[0].upper(); | 403 | s[0] = s[0].upper(); |
405 | 404 | ||
406 | QValueList<int> sizes = fontDB.pointSizes( familyNames[j] ); | 405 | QValueList<int> sizes = fontDB.pointSizes( familyNames[j] ); |
407 | 406 | ||
408 | 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(), |
409 | sizes.count()); | 408 | sizes.count()); |
410 | 409 | ||
411 | if (sizes.count() > 0) | 410 | if (sizes.count() > 0) |
412 | { | 411 | { |
413 | QPopupMenu *sizeMenu; | 412 | QPopupMenu *sizeMenu; |
414 | QFont f; | 413 | QFont f; |
415 | int last_width = -1; | 414 | int last_width = -1; |
416 | sizeMenu = NULL; | 415 | sizeMenu = NULL; |
417 | 416 | ||
418 | for(uint i = 0; i < (uint)sizes.count() + 4; i++) | 417 | for(uint i = 0; i < (uint)sizes.count() + 4; i++) |
419 | { | 418 | { |
420 | // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]); | 419 | // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]); |
421 | // need to divide by 10 on the Z, but not otherwise | 420 | // need to divide by 10 on the Z, but not otherwise |
422 | int size; | 421 | int size; |
423 | 422 | ||
424 | if (i >= (uint)sizes.count()) | 423 | if (i >= (uint)sizes.count()) |
425 | { | 424 | { |
426 | // try for expandable fonts | 425 | // try for expandable fonts |
427 | size = sizes[sizes.count()-1] + 2 * (i - sizes.count() + 1); | 426 | size = sizes[sizes.count()-1] + 2 * (i - sizes.count() + 1); |
428 | } | 427 | } |
429 | else | 428 | else |
430 | { | 429 | { |
431 | printf("sizes[%d] = %d\n", i, sizes[i]); | 430 | printf("sizes[%d] = %d\n", i, sizes[i]); |
432 | size = sizes[i]; | 431 | size = sizes[i]; |
433 | } | 432 | } |
434 | #ifndef __i386__ | 433 | #ifndef __i386__ |
435 | // a hack, sizes on Z seem to be points*10 | 434 | // a hack, sizes on Z seem to be points*10 |
436 | size /= 10; | 435 | size /= 10; |
437 | #endif | 436 | #endif |
438 | 437 | ||
439 | f = QFont(familyNames[j], size); | 438 | f = QFont(familyNames[j], size); |
440 | f.setFixedPitch(true); | 439 | f.setFixedPitch(true); |
441 | QFontMetrics fm(f); | 440 | QFontMetrics fm(f); |
442 | // don't trust f.fixedPitch() or f.exactMatch(), they lie!! | 441 | // don't trust f.fixedPitch() or f.exactMatch(), they lie!! |
443 | if (fm.width("l") == fm.width("m") | 442 | if (fm.width("l") == fm.width("m") |
444 | && (i < (uint)sizes.count() | 443 | && (i < (uint)sizes.count() |
445 | || fm.width("m") > last_width)) | 444 | || fm.width("m") > last_width)) |
446 | { | 445 | { |
447 | if (i < (uint)sizes.count()) | 446 | if (i < (uint)sizes.count()) |
448 | { | 447 | { |
449 | last_width = fm.width("m"); | 448 | last_width = fm.width("m"); |
450 | } | 449 | } |
451 | if (sizeMenu == NULL) | 450 | if (sizeMenu == NULL) |
452 | { | 451 | { |
453 | sizeMenu = new QPopupMenu(); | 452 | sizeMenu = new QPopupMenu(); |
454 | } | 453 | } |
455 | int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex); | 454 | int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex); |
456 | sizeMenu->setItemParameter(id, fontIndex); | 455 | sizeMenu->setItemParameter(id, fontIndex); |
457 | sizeMenu->connectItem(id, this, SLOT(setFont(int))); | 456 | sizeMenu->connectItem(id, this, SLOT(setFont(int))); |
458 | QString name = s + " " + QString::number(size); | 457 | QString name = s + " " + QString::number(size); |
459 | fonts.append(new VTFont(name, f, familyNames[j], familyNum, size)); | 458 | fonts.append(new VTFont(name, f, familyNames[j], familyNum, size)); |
460 | if (familyNames[j] == cfgFontName && size == cfgFontSize) | 459 | if (familyNames[j] == cfgFontName && size == cfgFontSize) |
461 | { | 460 | { |
462 | cfont = fontIndex; | 461 | cfont = fontIndex; |
463 | } | 462 | } |
464 | printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size); | 463 | printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size); |
465 | fontIndex++; | 464 | fontIndex++; |
466 | } | 465 | } |
467 | } | 466 | } |
468 | if (sizeMenu) | 467 | if (sizeMenu) |
469 | { | 468 | { |
@@ -484,193 +483,193 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
484 | nsessions = 0; | 483 | nsessions = 0; |
485 | 484 | ||
486 | tab = new EKNumTabWidget(this); | 485 | tab = new EKNumTabWidget(this); |
487 | // tab->setMargin(tab->margin()-5); | 486 | // tab->setMargin(tab->margin()-5); |
488 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); | 487 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); |
489 | 488 | ||
490 | // create terminal toolbar //////////////////////////////////////////////// | 489 | // create terminal toolbar //////////////////////////////////////////////// |
491 | setToolBarsMovable( FALSE ); | 490 | setToolBarsMovable( FALSE ); |
492 | menuToolBar = new QToolBar( this ); | 491 | menuToolBar = new QToolBar( this ); |
493 | menuToolBar->setHorizontalStretchable( TRUE ); | 492 | menuToolBar->setHorizontalStretchable( TRUE ); |
494 | 493 | ||
495 | QMenuBar *menuBar = new QMenuBar( menuToolBar ); | 494 | QMenuBar *menuBar = new QMenuBar( menuToolBar ); |
496 | 495 | ||
497 | bool c7xx = false; | 496 | bool c7xx = false; |
498 | if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600) | 497 | if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600) |
499 | { | 498 | { |
500 | c7xx = true; | 499 | c7xx = true; |
501 | } | 500 | } |
502 | QFont menuFont; | 501 | QFont menuFont; |
503 | menuFont.setPointSize(c7xx? 18 : 10); | 502 | menuFont.setPointSize(c7xx? 18 : 10); |
504 | qApp->setFont(menuFont, true); | 503 | qApp->setFont(menuFont, true); |
505 | 504 | ||
506 | setFont(cfont); | 505 | setFont(cfont); |
507 | 506 | ||
508 | configMenu = new QPopupMenu( this); | 507 | configMenu = new QPopupMenu( this); |
509 | colorMenu = new QPopupMenu( this); | 508 | colorMenu = new QPopupMenu( this); |
510 | scrollMenu = new QPopupMenu( this); | 509 | scrollMenu = new QPopupMenu( this); |
511 | editCommandListMenu = new QPopupMenu( this); | 510 | editCommandListMenu = new QPopupMenu( this); |
512 | 511 | ||
513 | configMenu->insertItem(tr("Command List"), editCommandListMenu); | 512 | configMenu->insertItem(tr("Command List"), editCommandListMenu); |
514 | 513 | ||
515 | bool listHidden; | 514 | bool listHidden; |
516 | cfg.setGroup("Menubar"); | 515 | cfg.setGroup("Menubar"); |
517 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") | 516 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") |
518 | { | 517 | { |
519 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" )); | 518 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" )); |
520 | listHidden=TRUE; | 519 | listHidden=TRUE; |
521 | } | 520 | } |
522 | else | 521 | else |
523 | { | 522 | { |
524 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" )); | 523 | ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" )); |
525 | listHidden=FALSE; | 524 | listHidden=FALSE; |
526 | } | 525 | } |
527 | 526 | ||
528 | cfg.setGroup("Tabs"); | 527 | cfg.setGroup("Tabs"); |
529 | 528 | ||
530 | tabMenu = new QPopupMenu(this); | 529 | tabMenu = new QPopupMenu(this); |
531 | tm_bottom = tabMenu->insertItem(tr("Bottom" )); | 530 | tm_bottom = tabMenu->insertItem(tr("Bottom" )); |
532 | tm_top = tabMenu->insertItem(tr("Top")); | 531 | tm_top = tabMenu->insertItem(tr("Top")); |
533 | tm_hidden = tabMenu->insertItem(tr("Hidden")); | 532 | tm_hidden = tabMenu->insertItem(tr("Hidden")); |
534 | 533 | ||
535 | configMenu->insertItem(tr("Tabs"), tabMenu); | 534 | configMenu->insertItem(tr("Tabs"), tabMenu); |
536 | 535 | ||
537 | tmp=cfg.readEntry("Position","Top"); | 536 | tmp=cfg.readEntry("Position","Top"); |
538 | if(tmp=="Top") | 537 | if(tmp=="Top") |
539 | { | 538 | { |
540 | tab->setTabPosition(QTabWidget::Top); | 539 | tab->setTabPosition(QTabWidget::Top); |
541 | tab->getTabBar()->show(); | 540 | tab->getTabBar()->show(); |
542 | tabPos = tm_top; | 541 | tabPos = tm_top; |
543 | } | 542 | } |
544 | else if (tmp=="Bottom") | 543 | else if (tmp=="Bottom") |
545 | { | 544 | { |
546 | tab->setTabPosition(QTabWidget::Bottom); | 545 | tab->setTabPosition(QTabWidget::Bottom); |
547 | tab->getTabBar()->show(); | 546 | tab->getTabBar()->show(); |
548 | tabPos = tm_bottom; | 547 | tabPos = tm_bottom; |
549 | } | 548 | } |
550 | else | 549 | else |
551 | { | 550 | { |
552 | tab->getTabBar()->hide(); | 551 | tab->getTabBar()->hide(); |
553 | tab->setMargin(tab->margin()); | 552 | tab->setMargin(tab->margin()); |
554 | tabPos = tm_hidden; | 553 | tabPos = tm_hidden; |
555 | } | 554 | } |
556 | 555 | ||
557 | cm_bw = colorMenu->insertItem(tr( "Black on White")); | 556 | cm_bw = colorMenu->insertItem(tr( "Black on White")); |
558 | cm_wb = colorMenu->insertItem(tr( "White on Black")); | 557 | cm_wb = colorMenu->insertItem(tr( "White on Black")); |
559 | cm_gb = colorMenu->insertItem(tr( "Green on Black")); | 558 | cm_gb = colorMenu->insertItem(tr( "Green on Black")); |
560 | // cm_bt = colorMenu->insertItem(tr( "Black on Transparent")); | 559 | // cm_bt = colorMenu->insertItem(tr( "Black on Transparent")); |
561 | cm_br = colorMenu->insertItem(tr( "Black on Pink")); | 560 | cm_br = colorMenu->insertItem(tr( "Black on Pink")); |
562 | cm_rb = colorMenu->insertItem(tr( "Pink on Black")); | 561 | cm_rb = colorMenu->insertItem(tr( "Pink on Black")); |
563 | cm_gy = colorMenu->insertItem(tr( "Green on Yellow")); | 562 | cm_gy = colorMenu->insertItem(tr( "Green on Yellow")); |
564 | cm_bm = colorMenu->insertItem(tr( "Blue on Magenta")); | 563 | cm_bm = colorMenu->insertItem(tr( "Blue on Magenta")); |
565 | cm_mb = colorMenu->insertItem(tr( "Magenta on Blue")); | 564 | cm_mb = colorMenu->insertItem(tr( "Magenta on Blue")); |
566 | cm_cw = colorMenu->insertItem(tr( "Cyan on White")); | 565 | cm_cw = colorMenu->insertItem(tr( "Cyan on White")); |
567 | cm_wc = colorMenu->insertItem(tr( "White on Cyan")); | 566 | cm_wc = colorMenu->insertItem(tr( "White on Cyan")); |
568 | cm_bb = colorMenu->insertItem(tr( "Blue on Black")); | 567 | cm_bb = colorMenu->insertItem(tr( "Blue on Black")); |
569 | cm_ab = colorMenu->insertItem(tr( "Amber on Black")); | 568 | cm_ab = colorMenu->insertItem(tr( "Amber on Black")); |
570 | cm_default = colorMenu->insertItem(tr("default")); | 569 | cm_default = colorMenu->insertItem(tr("default")); |
571 | 570 | ||
572 | #ifdef QT_QWS_OPIE | 571 | #ifdef QT_QWS_OPIE |
573 | 572 | ||
574 | colorMenu->insertItem(tr( "Custom")); | 573 | colorMenu->insertItem(tr( "Custom")); |
575 | #endif | 574 | #endif |
576 | 575 | ||
577 | configMenu->insertItem(tr( "Colors") ,colorMenu); | 576 | configMenu->insertItem(tr( "Colors") ,colorMenu); |
578 | 577 | ||
579 | sessionList = new QPopupMenu(this); | 578 | sessionList = new QPopupMenu(this); |
580 | sessionList-> insertItem ( Resource::loadPixmap ( "qkonsole/qkonsole" ), tr( "new session" ), this, | 579 | sessionList-> insertItem ( Resource::loadPixmap ( "konsole/Terminal" ), tr( "new session" ), this, |
581 | SLOT(newSession()) ); | 580 | SLOT(newSession()) ); |
582 | 581 | ||
583 | // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); | 582 | // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); |
584 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); | 583 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); |
585 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); | 584 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); |
586 | connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) )); | 585 | connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) )); |
587 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); | 586 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); |
588 | connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); | 587 | connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); |
589 | connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) ); | 588 | connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) ); |
590 | 589 | ||
591 | menuBar->insertItem( tr("View"), configMenu ); | 590 | menuBar->insertItem( tr("View"), configMenu ); |
592 | menuBar->insertItem( tr("Fonts"), fontList ); | 591 | menuBar->insertItem( tr("Fonts"), fontList ); |
593 | menuBar->insertItem( tr("Sessions"), sessionList ); | 592 | menuBar->insertItem( tr("Sessions"), sessionList ); |
594 | 593 | ||
595 | toolBar = new QToolBar( this ); | 594 | toolBar = new QToolBar( this ); |
596 | 595 | ||
597 | QAction *a; | 596 | QAction *a; |
598 | 597 | ||
599 | // Button Commands | 598 | // Button Commands |
600 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole/Terminal" ), QString::null, 0, this, 0 ); | 599 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole/Terminal" ), QString::null, 0, this, 0 ); |
601 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); | 600 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); |
602 | a->addTo( toolBar ); | 601 | a->addTo( toolBar ); |
603 | 602 | ||
604 | a = new QAction( tr("Full Screen"), Resource::loadPixmap( "fullscreen" ), QString::null, 0, this, 0 ); | 603 | a = new QAction( tr("Full Screen"), Resource::loadPixmap( "fullscreen" ), QString::null, 0, this, 0 ); |
605 | connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) ); | 604 | connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) ); |
606 | a->addTo( toolBar ); | 605 | a->addTo( toolBar ); |
607 | 606 | ||
608 | a = new QAction( tr("Zoom"), Resource::loadPixmap( "zoom" ), QString::null, 0, this, 0 ); | 607 | a = new QAction( tr("Zoom"), Resource::loadPixmap( "zoom" ), QString::null, 0, this, 0 ); |
609 | connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) ); | 608 | connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) ); |
610 | a->addTo( toolBar ); | 609 | a->addTo( toolBar ); |
611 | 610 | ||
612 | 611 | ||
613 | /* | 612 | /* |
614 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); | 613 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); |
615 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar ); | 614 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar ); |
616 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); | 615 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); |
617 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar ); | 616 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar ); |
618 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); | 617 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); |
619 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar ); | 618 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar ); |
620 | */ | 619 | */ |
621 | /* | 620 | /* |
622 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); | 621 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); |
623 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar ); | 622 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar ); |
624 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); | 623 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); |
625 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar ); | 624 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar ); |
626 | */ | 625 | */ |
627 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | 626 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); |
628 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); | 627 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); |
629 | a->addTo( toolBar ); | 628 | a->addTo( toolBar ); |
630 | 629 | ||
631 | secondToolBar = new QToolBar( this ); | 630 | secondToolBar = new QToolBar( this ); |
632 | secondToolBar->setHorizontalStretchable( TRUE ); | 631 | secondToolBar->setHorizontalStretchable( TRUE ); |
633 | 632 | ||
634 | commonCombo = new QComboBox( secondToolBar ); | 633 | commonCombo = new QComboBox( secondToolBar ); |
635 | // commonCombo->setMaximumWidth(236); | 634 | // commonCombo->setMaximumWidth(236); |
636 | 635 | ||
637 | ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) ); | 636 | ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) ); |
638 | if( listHidden) | 637 | if( listHidden) |
639 | { | 638 | { |
640 | secondToolBar->hide(); | 639 | secondToolBar->hide(); |
641 | editCommandListMenu->setItemEnabled(ec_quick ,FALSE); | 640 | editCommandListMenu->setItemEnabled(ec_quick ,FALSE); |
642 | } | 641 | } |
643 | ec_edit = editCommandListMenu->insertItem(tr( "Edit..." ) ); | 642 | ec_edit = editCommandListMenu->insertItem(tr( "Edit..." ) ); |
644 | 643 | ||
645 | cfg.setGroup("Commands"); | 644 | cfg.setGroup("Commands"); |
646 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 645 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
647 | 646 | ||
648 | initCommandList(); | 647 | initCommandList(); |
649 | // for (int i = 0; commonCmds[i] != NULL; i++) { | 648 | // for (int i = 0; commonCmds[i] != NULL; i++) { |
650 | // commonCombo->insertItem( commonCmds[i], i ); | 649 | // commonCombo->insertItem( commonCmds[i], i ); |
651 | // tmp = cfg.readEntry( QString::number(i),""); | 650 | // tmp = cfg.readEntry( QString::number(i),""); |
652 | // if(tmp != "") | 651 | // if(tmp != "") |
653 | // commonCombo->changeItem( tmp,i ); | 652 | // commonCombo->changeItem( tmp,i ); |
654 | // } | 653 | // } |
655 | 654 | ||
656 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); | 655 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); |
657 | 656 | ||
658 | sm_none = scrollMenu->insertItem(tr( "None" )); | 657 | sm_none = scrollMenu->insertItem(tr( "None" )); |
659 | sm_left = scrollMenu->insertItem(tr( "Left" )); | 658 | sm_left = scrollMenu->insertItem(tr( "Left" )); |
660 | sm_right = scrollMenu->insertItem(tr( "Right" )); | 659 | sm_right = scrollMenu->insertItem(tr( "Right" )); |
661 | // scrollMenu->insertSeparator(4); | 660 | // scrollMenu->insertSeparator(4); |
662 | // scrollMenu->insertItem(tr( "Horizontal" )); | 661 | // scrollMenu->insertItem(tr( "Horizontal" )); |
663 | 662 | ||
664 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); | 663 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); |
665 | 664 | ||
666 | configMenu->insertItem(tr( "History..." ), this, SLOT(historyDialog())); | 665 | configMenu->insertItem(tr( "History..." ), this, SLOT(historyDialog())); |
667 | 666 | ||
668 | cm_wrap = configMenu->insertItem(tr( "Wrap" )); | 667 | cm_wrap = configMenu->insertItem(tr( "Wrap" )); |
669 | cfg.setGroup("ScrollBar"); | 668 | cfg.setGroup("ScrollBar"); |
670 | configMenu->setItemChecked(cm_wrap, cfg.readBoolEntry("HorzScroll",0)); | 669 | configMenu->setItemChecked(cm_wrap, cfg.readBoolEntry("HorzScroll",0)); |
671 | 670 | ||
672 | cm_beep = configMenu->insertItem(tr( "Use Beep" )); | 671 | cm_beep = configMenu->insertItem(tr( "Use Beep" )); |
673 | cfg.setGroup("Menubar"); | 672 | cfg.setGroup("Menubar"); |
674 | configMenu->setItemChecked(cm_beep, cfg.readBoolEntry("useBeep",0)); | 673 | configMenu->setItemChecked(cm_beep, cfg.readBoolEntry("useBeep",0)); |
675 | 674 | ||
676 | fullscreen_msg = new QLabel(this); | 675 | fullscreen_msg = new QLabel(this); |
@@ -786,193 +785,193 @@ Konsole::historyDialog() | |||
786 | lay-> addWidget ( l ); | 785 | lay-> addWidget ( l ); |
787 | 786 | ||
788 | Config cfg( "Konsole" ); | 787 | Config cfg( "Konsole" ); |
789 | cfg.setGroup("History"); | 788 | cfg.setGroup("History"); |
790 | int hist = cfg.readNumEntry("history_lines",300); | 789 | int hist = cfg.readNumEntry("history_lines",300); |
791 | int avg_line = cfg.readNumEntry("avg_line_length",60); | 790 | int avg_line = cfg.readNumEntry("avg_line_length",60); |
792 | 791 | ||
793 | QSpinBox *spin = new QSpinBox ( 1, 100000, 20, d ); | 792 | QSpinBox *spin = new QSpinBox ( 1, 100000, 20, d ); |
794 | spin-> setValue ( hist ); | 793 | spin-> setValue ( hist ); |
795 | spin-> setWrapping ( true ); | 794 | spin-> setWrapping ( true ); |
796 | spin-> setButtonSymbols ( QSpinBox::PlusMinus ); | 795 | spin-> setButtonSymbols ( QSpinBox::PlusMinus ); |
797 | lay-> addWidget ( spin ); | 796 | lay-> addWidget ( spin ); |
798 | 797 | ||
799 | if ( d-> exec ( ) == QDialog::Accepted ) | 798 | if ( d-> exec ( ) == QDialog::Accepted ) |
800 | { | 799 | { |
801 | cfg.writeEntry("history_lines", spin->value()); | 800 | cfg.writeEntry("history_lines", spin->value()); |
802 | cfg.writeEntry("avg_line_length", avg_line); | 801 | cfg.writeEntry("avg_line_length", avg_line); |
803 | if (getTe() != NULL) | 802 | if (getTe() != NULL) |
804 | { | 803 | { |
805 | getTe()->currentSession->setHistory(true); | 804 | getTe()->currentSession->setHistory(true); |
806 | } | 805 | } |
807 | } | 806 | } |
808 | 807 | ||
809 | delete d; | 808 | delete d; |
810 | } | 809 | } |
811 | 810 | ||
812 | 811 | ||
813 | void Konsole::cycleZoom() | 812 | void Konsole::cycleZoom() |
814 | { | 813 | { |
815 | TEWidget* te = getTe(); | 814 | TEWidget* te = getTe(); |
816 | QFont font = te->getVTFont(); | 815 | QFont font = te->getVTFont(); |
817 | int size = font.pointSize(); | 816 | int size = font.pointSize(); |
818 | changeFontSize(1); | 817 | changeFontSize(1); |
819 | font = te->getVTFont(); | 818 | font = te->getVTFont(); |
820 | if (font.pointSize() <= size) | 819 | if (font.pointSize() <= size) |
821 | { | 820 | { |
822 | do | 821 | do |
823 | { | 822 | { |
824 | font = te->getVTFont(); | 823 | font = te->getVTFont(); |
825 | size = font.pointSize(); | 824 | size = font.pointSize(); |
826 | changeFontSize(-1); | 825 | changeFontSize(-1); |
827 | font = te->getVTFont(); | 826 | font = te->getVTFont(); |
828 | } | 827 | } |
829 | while (font.pointSize() < size); | 828 | while (font.pointSize() < size); |
830 | } | 829 | } |
831 | } | 830 | } |
832 | 831 | ||
833 | void Konsole::changeFontSize(int delta) | 832 | void Konsole::changeFontSize(int delta) |
834 | { | 833 | { |
835 | // printf("delta font size %d\n", delta); | 834 | // printf("delta font size %d\n", delta); |
836 | TEWidget* te = getTe(); | 835 | TEWidget* te = getTe(); |
837 | QFont font = te->getVTFont(); | 836 | QFont font = te->getVTFont(); |
838 | int size = font.pointSize(); | 837 | int size = font.pointSize(); |
839 | int closest = delta > 0? 10000 : -10000; | 838 | int closest = delta > 0? 10000 : -10000; |
840 | int closest_font = -1; | 839 | int closest_font = -1; |
841 | for(uint i = 0; i < fonts.count(); i++) | 840 | for(uint i = 0; i < fonts.count(); i++) |
842 | { | 841 | { |
843 | if (fonts.at(i)->getFont() == font) | 842 | if (fonts.at(i)->getFont() == font) |
844 | { | 843 | { |
845 | if (delta > 0) | 844 | if (delta > 0) |
846 | { | 845 | { |
847 | if (i+1 < fonts.count() | 846 | if (i+1 < fonts.count() |
848 | && fonts.at(i+1)->getFamilyNum() == fonts.at(i)->getFamilyNum()) | 847 | && fonts.at(i+1)->getFamilyNum() == fonts.at(i)->getFamilyNum()) |
849 | { | 848 | { |
850 | setFont(i+1); | 849 | setFont(i+1); |
851 | printf("font %d\n", i+1); | 850 | printf("font %d\n", i+1); |
852 | return; | 851 | return; |
853 | } | 852 | } |
854 | } | 853 | } |
855 | else if (delta < 0) | 854 | else if (delta < 0) |
856 | { | 855 | { |
857 | if (i > 0 | 856 | if (i > 0 |
858 | && fonts.at(i-1)->getFamilyNum() == fonts.at(i)->getFamilyNum()) | 857 | && fonts.at(i-1)->getFamilyNum() == fonts.at(i)->getFamilyNum()) |
859 | { | 858 | { |
860 | setFont(i-1); | 859 | setFont(i-1); |
861 | printf("font %d\n", i-1); | 860 | printf("font %d\n", i-1); |
862 | return; | 861 | return; |
863 | } | 862 | } |
864 | } | 863 | } |
865 | } | 864 | } |
866 | int fsize = fonts.at(i)->getSize(); | 865 | int fsize = fonts.at(i)->getSize(); |
867 | printf("%d size=%d fsize=%d closest=%d\n", i, size, fsize, closest); | 866 | printf("%d size=%d fsize=%d closest=%d\n", i, size, fsize, closest); |
868 | if ((delta > 0 && fsize > size && fsize < closest) | 867 | if ((delta > 0 && fsize > size && fsize < closest) |
869 | || (delta < 0 && fsize < size && fsize > closest)) | 868 | || (delta < 0 && fsize < size && fsize > closest)) |
870 | { | 869 | { |
871 | closest = fsize; | 870 | closest = fsize; |
872 | closest_font = i; | 871 | closest_font = i; |
873 | } | 872 | } |
874 | } | 873 | } |
875 | if (closest_font >= 0) | 874 | if (closest_font >= 0) |
876 | { | 875 | { |
877 | printf("font closest %d (%d)\n", closest_font, closest); | 876 | printf("font closest %d (%d)\n", closest_font, closest); |
878 | setFont(closest_font); | 877 | setFont(closest_font); |
879 | } | 878 | } |
880 | } | 879 | } |
881 | 880 | ||
882 | int Konsole::findFont(QString name, int size, bool exactMatch) | 881 | int Konsole::findFont(const QString& name, int size, bool exactMatch) |
883 | { | 882 | { |
884 | for(uint i = 0; i < fonts.count(); i++) | 883 | for(uint i = 0; i < fonts.count(); i++) |
885 | { | 884 | { |
886 | if (fonts.at(i)->getName() == name | 885 | if (fonts.at(i)->getName() == name |
887 | && fonts.at(i)->getSize() == size) | 886 | && fonts.at(i)->getSize() == size) |
888 | { | 887 | { |
889 | return(i); | 888 | return(i); |
890 | } | 889 | } |
891 | } | 890 | } |
892 | if (exactMatch) | 891 | if (exactMatch) |
893 | { | 892 | { |
894 | return(-1); | 893 | return(-1); |
895 | } | 894 | } |
896 | for(uint i = 0; i < fonts.count(); i++) | 895 | for(uint i = 0; i < fonts.count(); i++) |
897 | { | 896 | { |
898 | if (fonts.at(i)->getSize() == size) | 897 | if (fonts.at(i)->getSize() == size) |
899 | { | 898 | { |
900 | return(i); | 899 | return(i); |
901 | } | 900 | } |
902 | } | 901 | } |
903 | return(-1); | 902 | return(-1); |
904 | } | 903 | } |
905 | 904 | ||
906 | void Konsole::setFont(int f) | 905 | void Konsole::setFont(int f) |
907 | { | 906 | { |
908 | VTFont* font = fonts.at(f); | 907 | VTFont* font = fonts.at(f); |
909 | if (font) | 908 | if (font) |
910 | { | 909 | { |
911 | TEWidget* te = getTe(); | 910 | TEWidget* te = getTe(); |
912 | if (te != 0) | 911 | if (te != 0) |
913 | { | 912 | { |
914 | te->setVTFont(font->getFont()); | 913 | te->setVTFont(font->getFont()); |
915 | } | 914 | } |
916 | cfont = f; | 915 | cfont = f; |
917 | 916 | ||
918 | int familyNum = font->getFamilyNum(); | 917 | int familyNum = font->getFamilyNum(); |
919 | int size = font->getSize(); | 918 | int size = font->getSize(); |
920 | printf("familyNum = %d size = %d count=%d\n", familyNum, size, | 919 | printf("familyNum = %d size = %d count=%d\n", familyNum, size, |
921 | fontList->count()); | 920 | fontList->count()); |
922 | for(int i = 0; i < (int)fontList->count(); i++) | 921 | for(int i = 0; i < (int)fontList->count(); i++) |
923 | { | 922 | { |
924 | fontList->setItemChecked(i + 1000, i == familyNum); | 923 | fontList->setItemChecked(i + 1000, i == familyNum); |
925 | } | 924 | } |
926 | for(int i = 0; i < (int)fonts.count(); i++) | 925 | for(int i = 0; i < (int)fonts.count(); i++) |
927 | { | 926 | { |
928 | fontList->setItemChecked(i, fonts.at(i)->getFamilyNum() == familyNum | 927 | fontList->setItemChecked(i, fonts.at(i)->getFamilyNum() == familyNum |
929 | && fonts.at(i)->getSize() == size); | 928 | && fonts.at(i)->getSize() == size); |
930 | } | 929 | } |
931 | Config cfg( "Konsole" ); | 930 | Config cfg( "Konsole" ); |
932 | cfg.setGroup("Font"); | 931 | cfg.setGroup("Font"); |
933 | QString ss = "Session"+ QString::number(tab->currentPageIndex()+1); | 932 | QString ss = "Session"+ QString::number(tab->currentPageIndex()+1); |
934 | if (tab->currentPageIndex() == 0) | 933 | if (tab->currentPageIndex() == 0) |
935 | { | 934 | { |
936 | cfg.writeEntry("FontName", fonts.at(cfont)->getFamily()); | 935 | cfg.writeEntry("FontName", fonts.at(cfont)->getFamily()); |
937 | cfg.writeEntry("FontSize", fonts.at(cfont)->getSize()); | 936 | cfg.writeEntry("FontSize", fonts.at(cfont)->getSize()); |
938 | } | 937 | } |
939 | cfg.writeEntry("FontName"+ss, fonts.at(cfont)->getFamily()); | 938 | cfg.writeEntry("FontName"+ss, fonts.at(cfont)->getFamily()); |
940 | cfg.writeEntry("FontSize"+ss, fonts.at(cfont)->getSize()); | 939 | cfg.writeEntry("FontSize"+ss, fonts.at(cfont)->getSize()); |
941 | } | 940 | } |
942 | } | 941 | } |
943 | 942 | ||
944 | #if 0 | 943 | #if 0 |
945 | void Konsole::fontChanged(int f) | 944 | void Konsole::fontChanged(int f) |
946 | { | 945 | { |
947 | VTFont* font = fonts.at(f); | 946 | VTFont* font = fonts.at(f); |
948 | if (font != 0) | 947 | if (font != 0) |
949 | { | 948 | { |
950 | for(uint i = 0; i < fonts.count(); i++) | 949 | for(uint i = 0; i < fonts.count(); i++) |
951 | { | 950 | { |
952 | fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); | 951 | fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); |
953 | } | 952 | } |
954 | 953 | ||
955 | cfont = f; | 954 | cfont = f; |
956 | 955 | ||
957 | TEWidget* te = getTe(); | 956 | TEWidget* te = getTe(); |
958 | if (te != 0) | 957 | if (te != 0) |
959 | { | 958 | { |
960 | te->setVTFont(font->getFont()); | 959 | te->setVTFont(font->getFont()); |
961 | } | 960 | } |
962 | } | 961 | } |
963 | } | 962 | } |
964 | #endif | 963 | #endif |
965 | 964 | ||
966 | 965 | ||
967 | void Konsole::enterCommand(int c) | 966 | void Konsole::enterCommand(int c) |
968 | { | 967 | { |
969 | TEWidget* te = getTe(); | 968 | TEWidget* te = getTe(); |
970 | if (te != 0) | 969 | if (te != 0) |
971 | { | 970 | { |
972 | if(!commonCombo->editable()) | 971 | if(!commonCombo->editable()) |
973 | { | 972 | { |
974 | QString text = commonCombo->text(c); //commonCmds[c]; | 973 | QString text = commonCombo->text(c); //commonCmds[c]; |
975 | te->emitText(text); | 974 | te->emitText(text); |
976 | } | 975 | } |
977 | else | 976 | else |
978 | { | 977 | { |
@@ -1066,347 +1065,347 @@ void Konsole::setColLin(int columns, int lines) | |||
1066 | qDebug("konsole::setColLin:: Columns %d", columns); | 1065 | qDebug("konsole::setColLin:: Columns %d", columns); |
1067 | 1066 | ||
1068 | if ((columns==0) || (lines==0)) | 1067 | if ((columns==0) || (lines==0)) |
1069 | { | 1068 | { |
1070 | if (defaultSize.isEmpty()) // not in config file : set default value | 1069 | if (defaultSize.isEmpty()) // not in config file : set default value |
1071 | { | 1070 | { |
1072 | defaultSize = calcSize(80,24); | 1071 | defaultSize = calcSize(80,24); |
1073 | // notifySize(24,80); // set menu items (strange arg order !) | 1072 | // notifySize(24,80); // set menu items (strange arg order !) |
1074 | } | 1073 | } |
1075 | resize(defaultSize); | 1074 | resize(defaultSize); |
1076 | } | 1075 | } |
1077 | else | 1076 | else |
1078 | { | 1077 | { |
1079 | resize(calcSize(columns, lines)); | 1078 | resize(calcSize(columns, lines)); |
1080 | // notifySize(lines,columns); // set menu items (strange arg order !) | 1079 | // notifySize(lines,columns); // set menu items (strange arg order !) |
1081 | } | 1080 | } |
1082 | } | 1081 | } |
1083 | 1082 | ||
1084 | /* | 1083 | /* |
1085 | void Konsole::setFont(int fontno) | 1084 | void Konsole::setFont(int fontno) |
1086 | { | 1085 | { |
1087 | QFont f; | 1086 | QFont f; |
1088 | if (fontno == 0) | 1087 | if (fontno == 0) |
1089 | f = defaultFont = QFont( "Helvetica", 12 ); | 1088 | f = defaultFont = QFont( "Helvetica", 12 ); |
1090 | else | 1089 | else |
1091 | if (fonts[fontno][0] == '-') | 1090 | if (fonts[fontno][0] == '-') |
1092 | f.setRawName( fonts[fontno] ); | 1091 | f.setRawName( fonts[fontno] ); |
1093 | else | 1092 | else |
1094 | { | 1093 | { |
1095 | f.setFamily(fonts[fontno]); | 1094 | f.setFamily(fonts[fontno]); |
1096 | f.setRawMode( TRUE ); | 1095 | f.setRawMode( TRUE ); |
1097 | } | 1096 | } |
1098 | if ( !f.exactMatch() && fontno != 0) | 1097 | if ( !f.exactMatch() && fontno != 0) |
1099 | { | 1098 | { |
1100 | QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); | 1099 | QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); |
1101 | QMessageBox(this, msg); | 1100 | QMessageBox(this, msg); |
1102 | return; | 1101 | return; |
1103 | } | 1102 | } |
1104 | if (se) se->setFontNo(fontno); | 1103 | if (se) se->setFontNo(fontno); |
1105 | te->setVTFont(f); | 1104 | te->setVTFont(f); |
1106 | n_font = fontno; | 1105 | n_font = fontno; |
1107 | } | 1106 | } |
1108 | */ | 1107 | */ |
1109 | 1108 | ||
1110 | // --| color selection |------------------------------------------------------- | 1109 | // --| color selection |------------------------------------------------------- |
1111 | 1110 | ||
1112 | void Konsole::changeColumns(int /*columns*/) | 1111 | void Konsole::changeColumns(int /*columns*/) |
1113 | { //FIXME this seems to cause silliness when reset command is executed | 1112 | { //FIXME this seems to cause silliness when reset command is executed |
1114 | // qDebug("change columns"); | 1113 | // qDebug("change columns"); |
1115 | // TEWidget* te = getTe(); | 1114 | // TEWidget* te = getTe(); |
1116 | // if (te != 0) { | 1115 | // if (te != 0) { |
1117 | // setColLin(columns,te->Lines()); | 1116 | // setColLin(columns,te->Lines()); |
1118 | // te->update(); | 1117 | // te->update(); |
1119 | // } | 1118 | // } |
1120 | } | 1119 | } |
1121 | 1120 | ||
1122 | //FIXME: If a child dies during session swap, | 1121 | //FIXME: If a child dies during session swap, |
1123 | // this routine might be called before | 1122 | // this routine might be called before |
1124 | // session swap is completed. | 1123 | // session swap is completed. |
1125 | 1124 | ||
1126 | void Konsole::doneSession(TEWidget* te, int ) | 1125 | void Konsole::doneSession(TEWidget* te, int ) |
1127 | { | 1126 | { |
1128 | // TEWidget *te = NULL; | 1127 | // TEWidget *te = NULL; |
1129 | // if (sess->currentSession == tab->currentPage()) { | 1128 | // if (sess->currentSession == tab->currentPage()) { |
1130 | // printf("done current session\n"); | 1129 | // printf("done current session\n"); |
1131 | // te = getTe(); | 1130 | // te = getTe(); |
1132 | // } else { | 1131 | // } else { |
1133 | // int currentPage = tab->currentPageIndex(); | 1132 | // int currentPage = tab->currentPageIndex(); |
1134 | // printf("done not current session\n"); | 1133 | // printf("done not current session\n"); |
1135 | // for(int i = 0; i < nsessions; i++) { | 1134 | // for(int i = 0; i < nsessions; i++) { |
1136 | // tab->setCurrentPage(i); | 1135 | // tab->setCurrentPage(i); |
1137 | // printf("find session %d tab page %x session %x\n", | 1136 | // printf("find session %d tab page %x session %x\n", |
1138 | // i, tab->currentPage(), sess->currentSession); | 1137 | // i, tab->currentPage(), sess->currentSession); |
1139 | // if (tab->currentPage() == sess->currentSession) { | 1138 | // if (tab->currentPage() == sess->currentSession) { |
1140 | // printf("found session %d\n", i); | 1139 | // printf("found session %d\n", i); |
1141 | // te = tab->currentPage(); | 1140 | // te = tab->currentPage(); |
1142 | // break; | 1141 | // break; |
1143 | // } | 1142 | // } |
1144 | // } | 1143 | // } |
1145 | // tab->setCurrentPage(currentPage); | 1144 | // tab->setCurrentPage(currentPage); |
1146 | // } | 1145 | // } |
1147 | if (te != 0) | 1146 | if (te != 0) |
1148 | { | 1147 | { |
1149 | te->currentSession->setConnect(FALSE); | 1148 | te->currentSession->setConnect(FALSE); |
1150 | tab->removeTab(te); | 1149 | tab->removeTab(te); |
1151 | delete te->currentSession; | 1150 | delete te->currentSession; |
1152 | delete te; | 1151 | delete te; |
1153 | sessionList->removeItem(nsessions); | 1152 | sessionList->removeItem(nsessions); |
1154 | nsessions--; | 1153 | nsessions--; |
1155 | } | 1154 | } |
1156 | if (nsessions == 0) | 1155 | if (nsessions == 0) |
1157 | { | 1156 | { |
1158 | close(); | 1157 | close(); |
1159 | } | 1158 | } |
1160 | } | 1159 | } |
1161 | 1160 | ||
1162 | void Konsole::changeTitle(TEWidget* te, QString newTitle ) | 1161 | void Konsole::changeTitle(TEWidget* te, const QString& newTitle ) |
1163 | { | 1162 | { |
1164 | if (te == getTe()) | 1163 | if (te == getTe()) |
1165 | { | 1164 | { |
1166 | setCaption(newTitle + " - QKonsole"); | 1165 | setCaption( newTitle + " - " + tr( "Konsole " ) ); |
1167 | } | 1166 | } |
1168 | } | 1167 | } |
1169 | 1168 | ||
1170 | 1169 | ||
1171 | void Konsole::newSession() | 1170 | void Konsole::newSession() |
1172 | { | 1171 | { |
1173 | if(nsessions < 15) | 1172 | if(nsessions < 15) |
1174 | { // 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? |
1175 | TEWidget* te = new TEWidget(tab); | 1174 | TEWidget* te = new TEWidget(tab); |
1176 | Config cfg( "Konsole" ); | 1175 | Config cfg( "Konsole" ); |
1177 | cfg.setGroup("Menubar"); | 1176 | cfg.setGroup("Menubar"); |
1178 | 1177 | ||
1179 | // FIXME use more defaults from config file | 1178 | // FIXME use more defaults from config file |
1180 | te->useBeep=cfg.readBoolEntry("useBeep",0); | 1179 | te->useBeep=cfg.readBoolEntry("useBeep",0); |
1181 | 1180 | ||
1182 | // te->setBackgroundMode(PaletteBase); //we want transparent!! | 1181 | // te->setBackgroundMode(PaletteBase); //we want transparent!! |
1183 | 1182 | ||
1184 | cfg.setGroup("Font"); | 1183 | cfg.setGroup("Font"); |
1185 | QString sn = "Session" + QString::number(nsessions+1); | 1184 | QString sn = "Session" + QString::number(nsessions+1); |
1186 | printf("read font session %s\n", sn.latin1()); | 1185 | printf("read font session %s\n", sn.latin1()); |
1187 | QString fontName = cfg.readEntry("FontName"+sn, | 1186 | QString fontName = cfg.readEntry("FontName"+sn, |
1188 | cfg.readEntry("FontName", | 1187 | cfg.readEntry("FontName", |
1189 | fonts.at(cfont)->getFamily())); | 1188 | fonts.at(cfont)->getFamily())); |
1190 | int fontSize = cfg.readNumEntry("FontSize"+sn, | 1189 | int fontSize = cfg.readNumEntry("FontSize"+sn, |
1191 | cfg.readNumEntry("FontSize", | 1190 | cfg.readNumEntry("FontSize", |
1192 | fonts.at(cfont)->getSize())); | 1191 | fonts.at(cfont)->getSize())); |
1193 | cfont = findFont(fontName, fontSize, false); | 1192 | cfont = findFont(fontName, fontSize, false); |
1194 | 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); |
1195 | if (cfont < 0) | 1194 | if (cfont < 0) |
1196 | cfont = 0; | 1195 | cfont = 0; |
1197 | te->setVTFont(fonts.at(cfont)->getFont()); | 1196 | te->setVTFont(fonts.at(cfont)->getFont()); |
1198 | 1197 | ||
1199 | tab->addTab(te); | 1198 | tab->addTab(te); |
1200 | TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); | 1199 | TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); |
1201 | te->currentSession = se; | 1200 | te->currentSession = se; |
1202 | connect( se, SIGNAL(done(TEWidget*,int)), this, SLOT(doneSession(TEWidget*,int)) ); | 1201 | connect( se, SIGNAL(done(TEWidget*,int)), this, SLOT(doneSession(TEWidget*,int)) ); |
1203 | connect( se, SIGNAL(changeTitle(TEWidget*,QString)), this, | 1202 | connect( se, SIGNAL(changeTitle(TEWidget*,const QString&)), this, |
1204 | SLOT(changeTitle(TEWidget*,QString)) ); | 1203 | SLOT(changeTitle(TEWidget*,const QString&)) ); |
1205 | connect(te, SIGNAL(changeFontSize(int)), this, SLOT(changeFontSize(int))); | 1204 | connect(te, SIGNAL(changeFontSize(int)), this, SLOT(changeFontSize(int))); |
1206 | connect(te, SIGNAL(changeSession(int)), this, SLOT(changeSession(int))); | 1205 | connect(te, SIGNAL(changeSession(int)), this, SLOT(changeSession(int))); |
1207 | connect(te, SIGNAL(newSession()), this, SLOT(newSession())); | 1206 | connect(te, SIGNAL(newSession()), this, SLOT(newSession())); |
1208 | connect(te, SIGNAL(toggleFullScreen()), this, SLOT(toggleFullScreen())); | 1207 | connect(te, SIGNAL(toggleFullScreen()), this, SLOT(toggleFullScreen())); |
1209 | connect(te, SIGNAL(setFullScreen(bool)), this, SLOT(setFullScreen(bool))); | 1208 | connect(te, SIGNAL(setFullScreen(bool)), this, SLOT(setFullScreen(bool))); |
1210 | se->run(); | 1209 | se->run(); |
1211 | se->setConnect(TRUE); | 1210 | se->setConnect(TRUE); |
1212 | se->setHistory(b_scroll); | 1211 | se->setHistory(b_scroll); |
1213 | nsessions++; | 1212 | nsessions++; |
1214 | sessionList->insertItem(QString::number(nsessions), nsessions); | 1213 | sessionList->insertItem(QString::number(nsessions), nsessions); |
1215 | sessionListSelected(nsessions); | 1214 | sessionListSelected(nsessions); |
1216 | doWrap(); | 1215 | doWrap(); |
1217 | setColor(nsessions-1); | 1216 | setColor(nsessions-1); |
1218 | } | 1217 | } |
1219 | } | 1218 | } |
1220 | 1219 | ||
1221 | TEWidget* Konsole::getTe() | 1220 | TEWidget* Konsole::getTe() |
1222 | { | 1221 | { |
1223 | if (nsessions) | 1222 | if (nsessions) |
1224 | { | 1223 | { |
1225 | return (TEWidget *) tab->currentPage(); | 1224 | return (TEWidget *) tab->currentPage(); |
1226 | } | 1225 | } |
1227 | else | 1226 | else |
1228 | { | 1227 | { |
1229 | return 0; | 1228 | return 0; |
1230 | } | 1229 | } |
1231 | } | 1230 | } |
1232 | 1231 | ||
1233 | void Konsole::sessionListSelected(int id) | 1232 | void Konsole::sessionListSelected(int id) |
1234 | { | 1233 | { |
1235 | if (id < 0) | 1234 | if (id < 0) |
1236 | { | 1235 | { |
1237 | return; | 1236 | return; |
1238 | } | 1237 | } |
1239 | QString selected = sessionList->text(id); | 1238 | QString selected = sessionList->text(id); |
1240 | EKNumTabBar *tabBar = tab->getTabBar(); | 1239 | EKNumTabBar *tabBar = tab->getTabBar(); |
1241 | 1240 | ||
1242 | int n = 0; | 1241 | int n = 0; |
1243 | for(int i = 0; n < tabBar->count(); i++) | 1242 | for(int i = 0; n < tabBar->count(); i++) |
1244 | { | 1243 | { |
1245 | if (tabBar->tab(i)) | 1244 | if (tabBar->tab(i)) |
1246 | { | 1245 | { |
1247 | // printf("selected = %s tab %d = %s\n", selected.latin1(), | 1246 | // printf("selected = %s tab %d = %s\n", selected.latin1(), |
1248 | // i, tabBar->tab(i)->text().latin1()); | 1247 | // i, tabBar->tab(i)->text().latin1()); |
1249 | if (tabBar->tab(i)->text() == selected) | 1248 | if (tabBar->tab(i)->text() == selected) |
1250 | { | 1249 | { |
1251 | tab->setCurrentPage(i); | 1250 | tab->setCurrentPage(i); |
1252 | break; | 1251 | break; |
1253 | } | 1252 | } |
1254 | n++; | 1253 | n++; |
1255 | } | 1254 | } |
1256 | } | 1255 | } |
1257 | } | 1256 | } |
1258 | 1257 | ||
1259 | 1258 | ||
1260 | void Konsole::changeSession(int delta) | 1259 | void Konsole::changeSession(int delta) |
1261 | { | 1260 | { |
1262 | printf("delta session %d\n", delta); | 1261 | printf("delta session %d\n", delta); |
1263 | QTabBar *tabBar = tab->getTabBar(); | 1262 | QTabBar *tabBar = tab->getTabBar(); |
1264 | int i = tabBar->tab(tabBar->currentTab())->text().toInt() - 1; | 1263 | int i = tabBar->tab(tabBar->currentTab())->text().toInt() - 1; |
1265 | i += delta; | 1264 | i += delta; |
1266 | if (i < 0) | 1265 | if (i < 0) |
1267 | i += tabBar->count(); | 1266 | i += tabBar->count(); |
1268 | if (i >= tabBar->count()) | 1267 | if (i >= tabBar->count()) |
1269 | i -= tabBar->count(); | 1268 | i -= tabBar->count(); |
1270 | 1269 | ||
1271 | QString selected = QString::number(i+1); | 1270 | QString selected = QString::number(i+1); |
1272 | int n = 0; | 1271 | int n = 0; |
1273 | for(int i = 0; n < tabBar->count(); i++) | 1272 | for(int i = 0; n < tabBar->count(); i++) |
1274 | { | 1273 | { |
1275 | if (tabBar->tab(i)) | 1274 | if (tabBar->tab(i)) |
1276 | { | 1275 | { |
1277 | printf("selected = %s tab %d = %s\n", selected.latin1(), | 1276 | printf("selected = %s tab %d = %s\n", selected.latin1(), |
1278 | i, tabBar->tab(i)->text().latin1()); | 1277 | i, tabBar->tab(i)->text().latin1()); |
1279 | if (tabBar->tab(i)->text() == selected) | 1278 | if (tabBar->tab(i)->text() == selected) |
1280 | { | 1279 | { |
1281 | tab->setCurrentPage(i); | 1280 | tab->setCurrentPage(i); |
1282 | break; | 1281 | break; |
1283 | } | 1282 | } |
1284 | n++; | 1283 | n++; |
1285 | } | 1284 | } |
1286 | } | 1285 | } |
1287 | } | 1286 | } |
1288 | 1287 | ||
1289 | void Konsole::switchSession(QWidget* w) | 1288 | void Konsole::switchSession(QWidget* w) |
1290 | { | 1289 | { |
1291 | TEWidget* te = (TEWidget *) w; | 1290 | TEWidget* te = (TEWidget *) w; |
1292 | QFont teFnt = te->getVTFont(); | 1291 | QFont teFnt = te->getVTFont(); |
1293 | int familyNum = -1; | 1292 | int familyNum = -1; |
1294 | 1293 | ||
1295 | for(uint i = 0; i < fonts.count(); i++) | 1294 | for(uint i = 0; i < fonts.count(); i++) |
1296 | { | 1295 | { |
1297 | VTFont *fnt = fonts.at(i); | 1296 | VTFont *fnt = fonts.at(i); |
1298 | bool cf = fnt->getFont() == teFnt; | 1297 | bool cf = fnt->getFont() == teFnt; |
1299 | fontList->setItemChecked(i, cf); | 1298 | fontList->setItemChecked(i, cf); |
1300 | if (cf) | 1299 | if (cf) |
1301 | { | 1300 | { |
1302 | cfont = i; | 1301 | cfont = i; |
1303 | familyNum = fnt->getFamilyNum(); | 1302 | familyNum = fnt->getFamilyNum(); |
1304 | } | 1303 | } |
1305 | } | 1304 | } |
1306 | for(int i = 0; i < (int)fontList->count(); i++) | 1305 | for(int i = 0; i < (int)fontList->count(); i++) |
1307 | { | 1306 | { |
1308 | fontList->setItemChecked(i + 1000, i == familyNum); | 1307 | fontList->setItemChecked(i + 1000, i == familyNum); |
1309 | } | 1308 | } |
1310 | if (! te->currentSession->Title().isEmpty() ) | 1309 | if (! te->currentSession->Title().isEmpty() ) |
1311 | { | 1310 | { |
1312 | setCaption(te->currentSession->Title() + " - QKonsole"); | 1311 | setCaption( te->currentSession->Title() + " - " + tr( "Konsole" ) ); |
1313 | } | 1312 | } |
1314 | else | 1313 | else |
1315 | { | 1314 | { |
1316 | setCaption( "Konsole" ); | 1315 | setCaption( tr( "Konsole" ) ); |
1317 | } | 1316 | } |
1318 | // colorMenuSelected(te->color_menu_item); | 1317 | // colorMenuSelected(te->color_menu_item); |
1319 | } | 1318 | } |
1320 | 1319 | ||
1321 | 1320 | ||
1322 | void Konsole::toggleFullScreen() | 1321 | void Konsole::toggleFullScreen() |
1323 | { | 1322 | { |
1324 | setFullScreen(! fullscreen); | 1323 | setFullScreen(! fullscreen); |
1325 | } | 1324 | } |
1326 | 1325 | ||
1327 | void Konsole::setFullScreen ( bool b ) | 1326 | void Konsole::setFullScreen ( bool b ) |
1328 | { | 1327 | { |
1329 | static QSize normalsize; | 1328 | static QSize normalsize; |
1330 | static bool listHidden; | 1329 | static bool listHidden; |
1331 | 1330 | ||
1332 | if (b == fullscreen) | 1331 | if (b == fullscreen) |
1333 | { | 1332 | { |
1334 | return; | 1333 | return; |
1335 | } | 1334 | } |
1336 | 1335 | ||
1337 | fullscreen = b; | 1336 | fullscreen = b; |
1338 | 1337 | ||
1339 | if ( b ) | 1338 | if ( b ) |
1340 | { | 1339 | { |
1341 | if ( !normalsize. isValid ( )) | 1340 | if ( !normalsize. isValid ( )) |
1342 | { | 1341 | { |
1343 | normalsize = size ( ); | 1342 | normalsize = size ( ); |
1344 | } | 1343 | } |
1345 | 1344 | ||
1346 | setFixedSize ( qApp-> desktop ( )-> size ( )); | 1345 | setFixedSize ( qApp-> desktop ( )-> size ( )); |
1347 | showNormal ( ); | 1346 | showNormal ( ); |
1348 | reparent ( 0, WStyle_Customize | WStyle_NoBorder, | 1347 | reparent ( 0, WStyle_Customize | WStyle_NoBorder, |
1349 | QPoint ( 0, 0 )); | 1348 | QPoint ( 0, 0 )); |
1350 | showFullScreen ( ); | 1349 | showFullScreen ( ); |
1351 | 1350 | ||
1352 | menuToolBar->hide(); | 1351 | menuToolBar->hide(); |
1353 | toolBar->hide(); | 1352 | toolBar->hide(); |
1354 | listHidden = secondToolBar->isHidden(); | 1353 | listHidden = secondToolBar->isHidden(); |
1355 | secondToolBar->hide(); | 1354 | secondToolBar->hide(); |
1356 | // commonCombo->hide(); | 1355 | // commonCombo->hide(); |
1357 | tab->getTabBar()->hide(); | 1356 | tab->getTabBar()->hide(); |
1358 | tab->setMargin(tab->margin()); | 1357 | tab->setMargin(tab->margin()); |
1359 | 1358 | ||
1360 | if (show_fullscreen_msg) | 1359 | if (show_fullscreen_msg) |
1361 | { | 1360 | { |
1362 | 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, |
1363 | qApp->desktop()->height()/16 - fullscreen_msg->height()/2); | 1362 | qApp->desktop()->height()/16 - fullscreen_msg->height()/2); |
1364 | fullscreen_msg->show(); | 1363 | fullscreen_msg->show(); |
1365 | fullscreen_timer->start(3000, true); | 1364 | fullscreen_timer->start(3000, true); |
1366 | show_fullscreen_msg = false; | 1365 | show_fullscreen_msg = false; |
1367 | } | 1366 | } |
1368 | } | 1367 | } |
1369 | else | 1368 | else |
1370 | { | 1369 | { |
1371 | showNormal ( ); | 1370 | showNormal ( ); |
1372 | reparent ( 0, WStyle_Customize, QPoint ( 0, 0 )); | 1371 | reparent ( 0, WStyle_Customize, QPoint ( 0, 0 )); |
1373 | resize ( normalsize ); | 1372 | resize ( normalsize ); |
1374 | showMaximized ( ); | 1373 | showMaximized ( ); |
1375 | normalsize = QSize ( ); | 1374 | normalsize = QSize ( ); |
1376 | 1375 | ||
1377 | menuToolBar->show(); | 1376 | menuToolBar->show(); |
1378 | toolBar->show(); | 1377 | toolBar->show(); |
1379 | if(! listHidden) | 1378 | if(! listHidden) |
1380 | { | 1379 | { |
1381 | secondToolBar->show(); | 1380 | secondToolBar->show(); |
1382 | } | 1381 | } |
1383 | // commonCombo->show(); | 1382 | // commonCombo->show(); |
1384 | menuToolBar->show(); | 1383 | menuToolBar->show(); |
1385 | if (tabPos != tm_hidden) | 1384 | if (tabPos != tm_hidden) |
1386 | { | 1385 | { |
1387 | tab->getTabBar()->show(); | 1386 | tab->getTabBar()->show(); |
1388 | } | 1387 | } |
1389 | } | 1388 | } |
1390 | tab->setMargin(tab->margin()); // cause setup to run | 1389 | tab->setMargin(tab->margin()); // cause setup to run |
1391 | } | 1390 | } |
1392 | 1391 | ||
1393 | 1392 | ||
1394 | void Konsole::fullscreenTimeout() | 1393 | void Konsole::fullscreenTimeout() |
1395 | { | 1394 | { |
1396 | fullscreen_msg->hide(); | 1395 | fullscreen_msg->hide(); |
1397 | } | 1396 | } |
1398 | 1397 | ||
1399 | void Konsole::colorMenuIsSelected(int iD) | 1398 | void Konsole::colorMenuIsSelected(int iD) |
1400 | { | 1399 | { |
1401 | fromMenu = TRUE; | 1400 | fromMenu = TRUE; |
1402 | colorMenuSelected(iD); | 1401 | colorMenuSelected(iD); |
1403 | } | 1402 | } |
1404 | 1403 | ||
1405 | /// ------------------------------- some new stuff by L.J. Potter | 1404 | /// ------------------------------- some new stuff by L.J. Potter |
1406 | 1405 | ||
1407 | 1406 | ||
1408 | void Konsole::colorMenuSelected(int iD) | 1407 | void Konsole::colorMenuSelected(int iD) |
1409 | { | 1408 | { |
1410 | // this is NOT pretty, elegant or anything else besides functional | 1409 | // this is NOT pretty, elegant or anything else besides functional |
1411 | // QString temp; | 1410 | // QString temp; |
1412 | // qDebug( temp.sprintf("colormenu %d", iD)); | 1411 | // qDebug( temp.sprintf("colormenu %d", iD)); |
diff --git a/core/apps/embeddedkonsole/konsole.h b/core/apps/embeddedkonsole/konsole.h index 37babbb..e163cb8 100644 --- a/core/apps/embeddedkonsole/konsole.h +++ b/core/apps/embeddedkonsole/konsole.h | |||
@@ -1,206 +1,206 @@ | |||
1 | /* ----------------------------------------------------------------------- */ | 1 | /* ----------------------------------------------------------------------- */ |
2 | /* */ | 2 | /* */ |
3 | /* [konsole.h] Konsole */ | 3 | /* [konsole.h] 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 | #ifndef KONSOLE_H | 22 | #ifndef KONSOLE_H |
23 | #define KONSOLE_H | 23 | #define KONSOLE_H |
24 | 24 | ||
25 | 25 | ||
26 | #include <qmainwindow.h> | 26 | #include <qmainwindow.h> |
27 | #include <qaction.h> | 27 | #include <qaction.h> |
28 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
29 | #include <qstrlist.h> | 29 | #include <qstrlist.h> |
30 | #include <qintdict.h> | 30 | #include <qintdict.h> |
31 | #include <qptrdict.h> | 31 | #include <qptrdict.h> |
32 | #include <qtabwidget.h> | 32 | #include <qtabwidget.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | #include <qcolor.h> | 35 | #include <qcolor.h> |
36 | 36 | ||
37 | #include "MyPty.h" | 37 | #include "MyPty.h" |
38 | #include "TEWidget.h" | 38 | #include "TEWidget.h" |
39 | #include "TEmuVt102.h" | 39 | #include "TEmuVt102.h" |
40 | #include "session.h" | 40 | #include "session.h" |
41 | 41 | ||
42 | class EKNumTabWidget; | 42 | class EKNumTabWidget; |
43 | 43 | ||
44 | class Konsole : public QMainWindow | 44 | class Konsole : public QMainWindow |
45 | { | 45 | { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | 47 | ||
48 | public: | 48 | public: |
49 | 49 | ||
50 | static QString appName() | 50 | static QString appName() |
51 | { | 51 | { |
52 | return QString::fromLatin1("embeddedkonsole"); | 52 | return QString::fromLatin1("embeddedkonsole"); |
53 | } | 53 | } |
54 | 54 | ||
55 | Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); | 55 | Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); |
56 | Konsole(const char * name, const char* pgm, QStrList & _args, int histon); | 56 | Konsole(const char * name, const char* pgm, QStrList & _args, int histon); |
57 | ~Konsole(); | 57 | ~Konsole(); |
58 | void setColLin(int columns, int lines); | 58 | void setColLin(int columns, int lines); |
59 | QToolBar *secondToolBar; | 59 | QToolBar *secondToolBar; |
60 | void show(); | 60 | void show(); |
61 | void setColor(int); | 61 | void setColor(int); |
62 | int lastSelectedMenu; | 62 | int lastSelectedMenu; |
63 | int startUp; | 63 | int startUp; |
64 | 64 | ||
65 | public slots: | 65 | public slots: |
66 | void changeFontSize(int); | 66 | void changeFontSize(int); |
67 | void toggleFullScreen(); | 67 | void toggleFullScreen(); |
68 | void setFullScreen(bool); | 68 | void setFullScreen(bool); |
69 | void changeSession(int); | 69 | void changeSession(int); |
70 | void cycleZoom(); | 70 | void cycleZoom(); |
71 | void newSession(); | 71 | void newSession(); |
72 | 72 | ||
73 | private slots: | 73 | private slots: |
74 | void setDocument(const QString &); | 74 | void setDocument(const QString &); |
75 | void doneSession(TEWidget*,int); | 75 | void doneSession(TEWidget*,int); |
76 | void changeTitle(TEWidget*,QString); | 76 | void changeTitle(TEWidget*, const QString&); |
77 | void changeColumns(int); | 77 | void changeColumns(int); |
78 | void setFont(int); | 78 | void setFont(int); |
79 | // void fontChanged(int); | 79 | // void fontChanged(int); |
80 | void configMenuSelected(int ); | 80 | void configMenuSelected(int ); |
81 | void colorMenuSelected(int); | 81 | void colorMenuSelected(int); |
82 | void colorMenuIsSelected(int); | 82 | void colorMenuIsSelected(int); |
83 | void tabMenuSelected(int); | 83 | void tabMenuSelected(int); |
84 | void sessionListSelected(int); | 84 | void sessionListSelected(int); |
85 | 85 | ||
86 | void enterCommand(int); | 86 | void enterCommand(int); |
87 | void hitEnter(); | 87 | void hitEnter(); |
88 | void hitSpace(); | 88 | void hitSpace(); |
89 | void hitTab(); | 89 | void hitTab(); |
90 | void hitPaste(); | 90 | void hitPaste(); |
91 | void hitUp(); | 91 | void hitUp(); |
92 | void hitDown(); | 92 | void hitDown(); |
93 | void switchSession(QWidget *); | 93 | void switchSession(QWidget *); |
94 | void changeCommand(const QString &, int); | 94 | void changeCommand(const QString &, int); |
95 | void initCommandList(); | 95 | void initCommandList(); |
96 | void scrollMenuSelected(int); | 96 | void scrollMenuSelected(int); |
97 | void editCommandListMenuSelected(int); | 97 | void editCommandListMenuSelected(int); |
98 | void parseCommandLine(); | 98 | void parseCommandLine(); |
99 | void changeForegroundColor(const QColor &); | 99 | void changeForegroundColor(const QColor &); |
100 | void changeBackgroundColor(const QColor &); | 100 | void changeBackgroundColor(const QColor &); |
101 | 101 | ||
102 | void historyDialog(); | 102 | void historyDialog(); |
103 | void fullscreenTimeout(); | 103 | void fullscreenTimeout(); |
104 | 104 | ||
105 | private: | 105 | private: |
106 | void doWrap(); | 106 | void doWrap(); |
107 | void init(const char* _pgm, QStrList & _args); | 107 | void init(const char* _pgm, QStrList & _args); |
108 | void initSession(const char* _pgm, QStrList & _args); | 108 | void initSession(const char* _pgm, QStrList & _args); |
109 | void runSession(TESession* s); | 109 | void runSession(TESession* s); |
110 | void setColorPixmaps(); | 110 | void setColorPixmaps(); |
111 | void setHistory(bool); | 111 | void setHistory(bool); |
112 | void setColors(QColor foreground, QColor background); | 112 | void setColors(QColor foreground, QColor background); |
113 | int findFont(QString name, int size, bool exact = false); | 113 | int findFont(const QString& name, int size, bool exact = false); |
114 | QSize calcSize(int columns, int lines); | 114 | QSize calcSize(int columns, int lines); |
115 | TEWidget* getTe(); | 115 | TEWidget* getTe(); |
116 | QStringList commands; | 116 | QStringList commands; |
117 | QLabel * msgLabel; | 117 | QLabel * msgLabel; |
118 | QColor foreground, background; | 118 | QColor foreground, background; |
119 | bool fromMenu; | 119 | bool fromMenu; |
120 | 120 | ||
121 | bool fullscreen; | 121 | bool fullscreen; |
122 | 122 | ||
123 | private: | 123 | private: |
124 | class VTFont | 124 | class VTFont |
125 | { | 125 | { |
126 | public: | 126 | public: |
127 | VTFont(QString name, QFont& font, QString family, int familyNum, int size) | 127 | VTFont(const QString& name, QFont& font, const QString& family, int familyNum, int size) |
128 | { | 128 | { |
129 | this->name = name; | 129 | this->name = name; |
130 | this->font = font; | 130 | this->font = font; |
131 | this->family = family; | 131 | this->family = family; |
132 | this->size = size; | 132 | this->size = size; |
133 | this->familyNum = familyNum; | 133 | this->familyNum = familyNum; |
134 | } | 134 | } |
135 | 135 | ||
136 | QFont& getFont() | 136 | QFont& getFont() |
137 | { | 137 | { |
138 | return font; | 138 | return font; |
139 | } | 139 | } |
140 | QString getName() | 140 | QString getName() |
141 | { | 141 | { |
142 | return name; | 142 | return name; |
143 | } | 143 | } |
144 | int getSize() | 144 | int getSize() |
145 | { | 145 | { |
146 | return(size); | 146 | return(size); |
147 | } | 147 | } |
148 | QString getFamily() | 148 | QString getFamily() |
149 | { | 149 | { |
150 | return(family); | 150 | return(family); |
151 | } | 151 | } |
152 | int getFamilyNum() | 152 | int getFamilyNum() |
153 | { | 153 | { |
154 | return(familyNum); | 154 | return(familyNum); |
155 | } | 155 | } |
156 | 156 | ||
157 | private: | 157 | private: |
158 | QFont font; | 158 | QFont font; |
159 | QString name; | 159 | QString name; |
160 | QString family; | 160 | QString family; |
161 | int familyNum; | 161 | int familyNum; |
162 | int size; | 162 | int size; |
163 | }; | 163 | }; |
164 | 164 | ||
165 | EKNumTabWidget* tab; | 165 | EKNumTabWidget* tab; |
166 | int tabPos; | 166 | int tabPos; |
167 | int nsessions; | 167 | int nsessions; |
168 | QList<VTFont> fonts; | 168 | QList<VTFont> fonts; |
169 | int cfont; | 169 | int cfont; |
170 | QCString se_pgm; | 170 | QCString se_pgm; |
171 | QStrList se_args; | 171 | QStrList se_args; |
172 | 172 | ||
173 | QToolBar *menuToolBar; | 173 | QToolBar *menuToolBar; |
174 | QToolBar *toolBar; | 174 | QToolBar *toolBar; |
175 | QComboBox *commonCombo; | 175 | QComboBox *commonCombo; |
176 | 176 | ||
177 | QPopupMenu *fontList,*configMenu,*colorMenu,*scrollMenu,*editCommandListMenu; | 177 | QPopupMenu *fontList,*configMenu,*colorMenu,*scrollMenu,*editCommandListMenu; |
178 | QPopupMenu *sessionList, *tabMenu; | 178 | QPopupMenu *sessionList, *tabMenu; |
179 | 179 | ||
180 | int sm_none, sm_left, sm_right; | 180 | int sm_none, sm_left, sm_right; |
181 | int cm_beep, cm_wrap; | 181 | int cm_beep, cm_wrap; |
182 | int cm_default; | 182 | int cm_default; |
183 | int cm_bw, cm_wb, cm_gb, cm_bt, cm_br, cm_rb, cm_gy, cm_bm, cm_mb, cm_cw, cm_wc, cm_bb, cm_ab; | 183 | int cm_bw, cm_wb, cm_gb, cm_bt, cm_br, cm_rb, cm_gy, cm_bm, cm_mb, cm_cw, cm_wc, cm_bb, cm_ab; |
184 | int tm_top, tm_bottom, tm_hidden; | 184 | int tm_top, tm_bottom, tm_hidden; |
185 | int ec_edit, ec_cmdlist, ec_quick; | 185 | int ec_edit, ec_cmdlist, ec_quick; |
186 | 186 | ||
187 | bool show_fullscreen_msg; | 187 | bool show_fullscreen_msg; |
188 | QTimer *fullscreen_timer; | 188 | QTimer *fullscreen_timer; |
189 | QLabel *fullscreen_msg; | 189 | QLabel *fullscreen_msg; |
190 | 190 | ||
191 | 191 | ||
192 | // history scrolling I think | 192 | // history scrolling I think |
193 | bool b_scroll; | 193 | bool b_scroll; |
194 | 194 | ||
195 | int n_keytab; | 195 | int n_keytab; |
196 | int n_scroll; | 196 | int n_scroll; |
197 | int n_render; | 197 | int n_render; |
198 | QString pmPath; // pixmap path | 198 | QString pmPath; // pixmap path |
199 | QString dropText; | 199 | QString dropText; |
200 | QFont defaultFont; | 200 | QFont defaultFont; |
201 | QSize defaultSize; | 201 | QSize defaultSize; |
202 | 202 | ||
203 | }; | 203 | }; |
204 | 204 | ||
205 | #endif | 205 | #endif |
206 | 206 | ||
diff --git a/core/apps/embeddedkonsole/session.h b/core/apps/embeddedkonsole/session.h index f399e96..a4b33e2 100644 --- a/core/apps/embeddedkonsole/session.h +++ b/core/apps/embeddedkonsole/session.h | |||
@@ -1,94 +1,94 @@ | |||
1 | /* -------------------------------------------------------------------------- */ | 1 | /* -------------------------------------------------------------------------- */ |
2 | /* */ | 2 | /* */ |
3 | /* [session.h] Testbed for TE framework */ | 3 | /* [session.h] Testbed for TE framework */ |
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 | /* -------------------------------------------------------------------------- */ | 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 | 18 | ||
19 | #ifndef SESSION_H | 19 | #ifndef SESSION_H |
20 | #define SESSION_H | 20 | #define SESSION_H |
21 | 21 | ||
22 | #include <qapplication.h> | 22 | #include <qapplication.h> |
23 | #include <qmainwindow.h> | 23 | #include <qmainwindow.h> |
24 | #include <qstrlist.h> | 24 | #include <qstrlist.h> |
25 | 25 | ||
26 | #include "MyPty.h" | 26 | #include "MyPty.h" |
27 | #include "TEWidget.h" | 27 | #include "TEWidget.h" |
28 | #include "TEmuVt102.h" | 28 | #include "TEmuVt102.h" |
29 | 29 | ||
30 | class TESession : public QObject | 30 | class TESession : public QObject |
31 | { Q_OBJECT | 31 | { Q_OBJECT |
32 | 32 | ||
33 | public: | 33 | public: |
34 | 34 | ||
35 | TESession(QMainWindow* main, TEWidget* w, | 35 | TESession(QMainWindow* main, TEWidget* w, |
36 | const char* pgm, QStrList & _args, | 36 | const char* pgm, QStrList & _args, |
37 | const char* term); | 37 | const char* term); |
38 | ~TESession(); | 38 | ~TESession(); |
39 | 39 | ||
40 | public: | 40 | public: |
41 | 41 | ||
42 | void setConnect(bool r); | 42 | void setConnect(bool r); |
43 | TEmulation* getEmulation(); // to control emulation | 43 | TEmulation* getEmulation(); // to control emulation |
44 | bool isSecure(); | 44 | bool isSecure(); |
45 | 45 | ||
46 | public: | 46 | public: |
47 | 47 | ||
48 | int schemaNo(); | 48 | int schemaNo(); |
49 | int fontNo(); | 49 | int fontNo(); |
50 | const char* emuName(); | 50 | const char* emuName(); |
51 | const QString& Title(); | 51 | const QString& Title(); |
52 | bool history(); | 52 | bool history(); |
53 | int keymap(); | 53 | int keymap(); |
54 | 54 | ||
55 | void setHistory(bool on); | 55 | void setHistory(bool on); |
56 | void setSchemaNo(int sn); | 56 | void setSchemaNo(int sn); |
57 | void setKeymapNo(int kn); | 57 | void setKeymapNo(int kn); |
58 | void setFontNo(int fn); | 58 | void setFontNo(int fn); |
59 | void kill(int signal); | 59 | void kill(int signal); |
60 | 60 | ||
61 | public slots: | 61 | public slots: |
62 | 62 | ||
63 | void run(); | 63 | void run(); |
64 | void done(int status); | 64 | void done(int status); |
65 | void terminate(); | 65 | void terminate(); |
66 | void changeTitle(int, const QString& title); | 66 | void changeTitle(int, const QString& title); |
67 | 67 | ||
68 | signals: | 68 | signals: |
69 | 69 | ||
70 | void done(TEWidget*, int); | 70 | void done(TEWidget*, int); |
71 | void changeTitle(TEWidget*, QString); | 71 | void changeTitle(TEWidget*, const QString&); |
72 | 72 | ||
73 | private: | 73 | private: |
74 | 74 | ||
75 | // TEPty* sh; | 75 | // TEPty* sh; |
76 | MyPty* sh; | 76 | MyPty* sh; |
77 | TEWidget* te; | 77 | TEWidget* te; |
78 | TEmulation* em; | 78 | TEmulation* em; |
79 | 79 | ||
80 | //FIXME: using the indices here | 80 | //FIXME: using the indices here |
81 | // is propably very bad. We should | 81 | // is propably very bad. We should |
82 | // use a persistent reference instead. | 82 | // use a persistent reference instead. |
83 | int schema_no; | 83 | int schema_no; |
84 | int font_no; | 84 | int font_no; |
85 | int keymap_no; | 85 | int keymap_no; |
86 | QString title; | 86 | QString title; |
87 | 87 | ||
88 | const char* pgm; | 88 | const char* pgm; |
89 | QStrList args; | 89 | QStrList args; |
90 | 90 | ||
91 | QCString term; | 91 | QCString term; |
92 | }; | 92 | }; |
93 | 93 | ||
94 | #endif | 94 | #endif |