-rw-r--r-- | core/apps/embeddedkonsole/MyPty.cpp | 1 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/TEWidget.cpp | 9 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/TEmuVt102.cpp | 5 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/TEmulation.cpp | 3 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/commandeditdialog.cpp | 8 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/commandeditwidget.cpp | 4 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/keytrans.cpp | 3 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 21 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/playlistselection.cpp | 7 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/session.cpp | 1 | ||||
-rw-r--r-- | core/apps/helpbrowser/helpbrowser.cpp | 24 | ||||
-rw-r--r-- | core/apps/helpbrowser/magictextbrowser.cpp | 2 | ||||
-rw-r--r-- | core/apps/oapp/oappplugin.cpp | 3 | ||||
-rw-r--r-- | core/apps/qcop/main.cpp | 2 | ||||
-rw-r--r-- | core/apps/taboapp/main.cpp | 1 | ||||
-rw-r--r-- | core/apps/textedit/filePermissions.cpp | 4 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 18 |
17 files changed, 2 insertions, 114 deletions
diff --git a/core/apps/embeddedkonsole/MyPty.cpp b/core/apps/embeddedkonsole/MyPty.cpp index 5a8519a..d05e31e 100644 --- a/core/apps/embeddedkonsole/MyPty.cpp +++ b/core/apps/embeddedkonsole/MyPty.cpp @@ -22,97 +22,96 @@ /*! \file */ /*! \class TEPty \brief Ptys provide a pseudo terminal connection to a program. Although closely related to pipes, these pseudo terminal connections have some ability, that makes it nessesary to uses them. Most importent, they know about changing screen sizes and UNIX job control. Within the terminal emulation framework, this class represents the host side of the terminal together with the connecting serial line. One can create many instances of this class within a program. As a side effect of using this class, a signal(2) handler is installed on SIGCHLD. \par FIXME [NOTE: much of the technical stuff below will be replaced by forkpty.] publish the SIGCHLD signal if not related to an instance. clearify TEPty::done vs. TEPty::~TEPty semantics. check if pty is restartable via run after done. \par Pseudo terminals Pseudo terminals are a unique feature of UNIX, and always come in form of pairs of devices (/dev/ptyXX and /dev/ttyXX), which are connected to each other by the operating system. One may think of them as two serial devices linked by a null-modem cable. Being based on devices the number of simultanous instances of this class is (globally) limited by the number of those device pairs, which is 256. Another technic are UNIX 98 PTY's. These are supported also, and prefered over the (obsolete) predecessor. There's a sinister ioctl(2), signal(2) and job control stuff nessesary to make everything work as it should. */ #include <qfileinfo.h> #include <qapplication.h> #include <qsocketnotifier.h> -#include <qstring.h> #include <stdlib.h> #include <stdio.h> #include <signal.h> #include <fcntl.h> #include <unistd.h> #include <termios.h> #include <sys/types.h> #include <sys/ioctl.h> #include <sys/wait.h> #ifdef HAVE_OPENPTY #include <pty.h> #endif #include "MyPty.h" #undef VERBOSE_DEBUG /* -------------------------------------------------------------------------- */ /*! Informs the client program about the actual size of the window. */ void MyPty::setSize(int lines, int columns) { struct winsize wsize; wsize.ws_row = (unsigned short)lines; wsize.ws_col = (unsigned short)columns; if(fd < 0) return; ioctl(fd,TIOCSWINSZ,(char *)&wsize); } void MyPty::donePty() { // This is code from the Qt DumbTerminal example int status = 0; ::close(fd); if (cpid) { kill(cpid, SIGHUP); waitpid(cpid, &status, 0); diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp index de5e585..8206e4b 100644 --- a/core/apps/embeddedkonsole/TEWidget.cpp +++ b/core/apps/embeddedkonsole/TEWidget.cpp @@ -7,111 +7,102 @@ /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ /* */ /* This file is part of Konsole - an X terminal for KDE */ /* */ /* ------------------------------------------------------------------------ */ /* */ /* Ported Konsole to Qt/Embedded */ /* */ /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ /* */ /* -------------------------------------------------------------------------- */ /*! \class TEWidget \brief Visible screen contents This class is responsible to map the `image' of a terminal emulation to the display. All the dependency of the emulation to a specific GUI or toolkit is localized here. Further, this widget has no knowledge about being part of an emulation, it simply work within the terminal emulation framework by exposing size and key events and by being ordered to show a new image. <ul> <li> The internal image has the size of the widget (evtl. rounded up) <li> The external image used in setImage can have any size. <li> (internally) the external image is simply copied to the internal when a setImage happens. During a resizeEvent no painting is done a paintEvent is expected to follow anyway. </ul> \sa TEScreen \sa Emulation */ /* FIXME: - 'image' may also be used uninitialized (it isn't in fact) in resizeEvent - 'font_a' not used in mouse events - add destructor */ /* TODO - evtl. be sensitive to `paletteChange' while using default colors. - set different 'rounding' styles? I.e. have a mode to show clipped chars? */ // #include "config.h" #include "TEWidget.h" #include "session.h" #include <qpe/config.h> -#include <qpe/resource.h> -#include <qpe/sound.h> #if !(QT_NO_COP) #include <qpe/qcopenvelope_qws.h> #endif -#include <qcursor.h> -#include <qregexp.h> -#include <qpainter.h> #include <qclipboard.h> -#include <qstyle.h> -#include <qfile.h> -#include <qdragobject.h> -#include <qnamespace.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <ctype.h> #include <sys/stat.h> #include <sys/types.h> #include <signal.h> #include <assert.h> // #include "TEWidget.moc" //#include <kapp.h> //#include <kcursor.h> //#include <kurl.h> //#include <kdebug.h> //#include <klocale.h> #define HERE printf("%s(%d): %s\n",__FILE__,__LINE__,__FUNCTION__) #define HCNT(Name) // { static int cnt = 1; printf("%s(%d): %s %d\n",__FILE__,__LINE__,Name,cnt++); } #define loc(X,Y) ((Y)*columns+(X)) //FIXME: the rim should normally be 1, 0 only when running in full screen mode. #define rimX 0 // left/right rim width #define rimY 0 // top/bottom rim high #define SCRWIDTH 16 // width of the scrollbar #define yMouseScroll 1 // scroll increment used when dragging selection at top/bottom of window. /* ------------------------------------------------------------------------- */ /* */ /* Colors */ /* */ /* ------------------------------------------------------------------------- */ //FIXME: the default color table is in session.C now. // We need a way to get rid of this one, here. static const ColorEntry base_color_table[TABLE_COLORS] = // The following are almost IBM standard color codes, with some slight // gamma correction for the dim colors to compensate for bright X screens. // It contains the 8 ansiterm/xterm colors in 2 intensities. { // Fixme: could add faint colors here, also. // normal ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback diff --git a/core/apps/embeddedkonsole/TEmuVt102.cpp b/core/apps/embeddedkonsole/TEmuVt102.cpp index 275c18d..0d6aef5 100644 --- a/core/apps/embeddedkonsole/TEmuVt102.cpp +++ b/core/apps/embeddedkonsole/TEmuVt102.cpp @@ -1,82 +1,77 @@ /* ------------------------------------------------------------------------- */ /* */ /* [TEmuVt102.C] VT102 Terminal Emulation */ /* */ /* ------------------------------------------------------------------------- */ /* */ /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ /* */ /* This file is part of Konsole - an X terminal for KDE */ /* */ /* ------------------------------------------------------------------------- */ /* */ /* Ported Konsole to Qt/Embedded */ /* */ /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ /* */ /* -------------------------------------------------------------------------- */ /*! \class TEmuVt102 \brief Actual Emulation for Konsole \sa TEWidget \sa TEScreen */ #include "TEmuVt102.h" -#include "TEWidget.h" -#include "TEScreen.h" -#include "keytrans.h" #include <stdio.h> #include <unistd.h> -#include <qkeycode.h> -#include <qtextcodec.h> /* VT102 Terminal Emulation This class puts together the screens, the pty and the widget to a complete terminal emulation. Beside combining it's componentes, it handles the emulations's protocol. This module consists of the following sections: - Constructor/Destructor - Incoming Bytes Event pipeline - Outgoing Bytes - Mouse Events - Keyboard Events - Modes and Charset State - Diagnostics */ /* ------------------------------------------------------------------------- */ /* */ /* Constructor / Destructor */ /* */ /* ------------------------------------------------------------------------- */ /* Nothing really intesting happens here. */ /*! */ TEmuVt102::TEmuVt102(TEWidget* gui) : TEmulation(gui) { QObject::connect(gui,SIGNAL(mouseSignal(int,int,int)), this,SLOT(onMouse(int,int,int))); initTokenizer(); reset(); } /*! */ TEmuVt102::~TEmuVt102() { } diff --git a/core/apps/embeddedkonsole/TEmulation.cpp b/core/apps/embeddedkonsole/TEmulation.cpp index a539757..54f408e 100644 --- a/core/apps/embeddedkonsole/TEmulation.cpp +++ b/core/apps/embeddedkonsole/TEmulation.cpp @@ -25,102 +25,99 @@ Thus this module knows mainly about decoding escapes sequences and is a stateless device w.r.t. the semantics. It is also responsible to refresh the TEWidget by certain rules. \sa TEWidget \sa TEScreen \par A note on refreshing Although the modifications to the current screen image could immediately be propagated via `TEWidget' to the graphical surface, we have chosen another way here. The reason for doing so is twofold. First, experiments show that directly displaying the operation results in slowing down the overall performance of emulations. Displaying individual characters using X11 creates a lot of overhead. Second, by using the following refreshing method, the screen operations can be completely separated from the displaying. This greatly simplifies the programmer's task of coding and maintaining the screen operations, since one need not worry about differential modifications on the display affecting the operation of concern. We use a refreshing algorithm here that has been adoped from rxvt/kvt. By this, refreshing is driven by a timer, which is (re)started whenever a new bunch of data to be interpreted by the emulation arives at `onRcvBlock'. As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger refresh. This rule suits both bulk display operation as done by curses as well as individual characters typed. (BULK_TIMEOUT < 1000 / max characters received from keyboard per second). Additionally, we trigger refreshing by newlines comming in to make visual snapshots of lists as produced by `cat', `ls' and likely programs, thereby producing the illusion of a permanent and immediate display operation. As a sort of catch-all needed for cases where none of the above conditions catch, the screen refresh is also triggered by a count of incoming bulks (`bulk_incnt'). */ /* FIXME - evtl. the bulk operations could be made more transparent. */ #include "TEmulation.h" -#include "TEWidget.h" -#include "TEScreen.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <qkeycode.h> /* ------------------------------------------------------------------------- */ /* */ /* TEmulation */ /* */ /* ------------------------------------------------------------------------- */ #define CNTL(c) ((c)-'@') /*! */ TEmulation::TEmulation(TEWidget* gui) : decoder((QTextDecoder*)NULL) { this->gui = gui; screen[0] = new TEScreen(gui->Lines(),gui->Columns()); screen[1] = new TEScreen(gui->Lines(),gui->Columns()); scr = screen[0]; bulk_nlcnt = 0; // reset bulk newline counter bulk_incnt = 0; // reset bulk counter connected = FALSE; QObject::connect(&bulk_timer, SIGNAL(timeout()), this, SLOT(showBulk()) ); QObject::connect(gui,SIGNAL(changedImageSizeSignal(int,int)), this,SLOT(onImageSizeChange(int,int))); QObject::connect(gui,SIGNAL(changedHistoryCursor(int)), this,SLOT(onHistoryCursorChange(int))); QObject::connect(gui,SIGNAL(changedHorzCursor(int)), this,SLOT(onHorzCursorChange(int))); QObject::connect(gui,SIGNAL(keyPressedSignal(QKeyEvent*)), this,SLOT(onKeyPress(QKeyEvent*))); QObject::connect(gui,SIGNAL(beginSelectionSignal(const int,const int)), this,SLOT(onSelectionBegin(const int,const int)) ); QObject::connect(gui,SIGNAL(extendSelectionSignal(const int,const int)), this,SLOT(onSelectionExtend(const int,const int)) ); QObject::connect(gui,SIGNAL(endSelectionSignal(const BOOL)), this,SLOT(setSelection(const BOOL)) ); diff --git a/core/apps/embeddedkonsole/commandeditdialog.cpp b/core/apps/embeddedkonsole/commandeditdialog.cpp index e4255f3..c0066d8 100644 --- a/core/apps/embeddedkonsole/commandeditdialog.cpp +++ b/core/apps/embeddedkonsole/commandeditdialog.cpp @@ -1,66 +1,58 @@ //comandeditdialog.cpp #include "commandeditdialog.h" #include "playlistselection.h" -#include <qstring.h> #include <qpe/config.h> -#include <qtoolbar.h> -#include <qwidget.h> -#include <qmenubar.h> #include <qpe/resource.h> -#include <qlist.h> #include <qtoolbutton.h> -#include <qvbox.h> -#include <qlistview.h> #include <qlineedit.h> #include <qheader.h> #include <qlabel.h> -#include <qmessagebox.h> #include "smallcommandeditdialogbase.h" CommandEditDialog::CommandEditDialog(QWidget *parent, const char* name, WFlags fl ) : CommandEditDialogBase(parent, name, TRUE, fl) { m_SuggestedCommandList->addColumn( tr("Command Selection") ); m_SuggestedCommandList->header()->hide(); m_SuggestedCommandList->setSorting(-1,FALSE); m_SuggestedCommandList->clearSelection(); m_SuggestedCommandList->setSorting(0,TRUE); QListViewItem *item; item = new QListViewItem( m_SuggestedCommandList,"export "); item = new QListViewItem( m_SuggestedCommandList,"ifconfig "); item = new QListViewItem( m_SuggestedCommandList,"ipkg "); item = new QListViewItem( m_SuggestedCommandList,"gzip "); item = new QListViewItem( m_SuggestedCommandList,"gunzip "); item = new QListViewItem( m_SuggestedCommandList,"chgrp "); item = new QListViewItem( m_SuggestedCommandList,"chown "); item = new QListViewItem( m_SuggestedCommandList,"date "); item = new QListViewItem( m_SuggestedCommandList,"dd "); item = new QListViewItem( m_SuggestedCommandList,"dmesg "); item = new QListViewItem( m_SuggestedCommandList,"fuser "); item = new QListViewItem( m_SuggestedCommandList,"hostname "); item = new QListViewItem( m_SuggestedCommandList,"kill "); item = new QListViewItem( m_SuggestedCommandList,"killall "); item = new QListViewItem( m_SuggestedCommandList,"ln "); item = new QListViewItem( m_SuggestedCommandList,"ln -s "); item = new QListViewItem( m_SuggestedCommandList,"lsmod"); item = new QListViewItem( m_SuggestedCommandList,"depmod -a"); item = new QListViewItem( m_SuggestedCommandList,"modprobe "); item = new QListViewItem( m_SuggestedCommandList,"mount "); item = new QListViewItem( m_SuggestedCommandList,"more "); item = new QListViewItem( m_SuggestedCommandList,"sort "); item = new QListViewItem( m_SuggestedCommandList,"touch "); item = new QListViewItem( m_SuggestedCommandList,"umount "); item = new QListViewItem( m_SuggestedCommandList,"mknod "); item = new QListViewItem( m_SuggestedCommandList,"netstat "); item = new QListViewItem( m_SuggestedCommandList,"route "); item = new QListViewItem( m_SuggestedCommandList,"cardctl eject "); m_SuggestedCommandList->setSelected(m_SuggestedCommandList->firstChild(),TRUE); m_SuggestedCommandList->sort(); connect( m_SuggestedCommandList, SIGNAL( clicked( QListViewItem * ) ), m_PlayListSelection, SLOT( addToSelection( QListViewItem *) ) ); ToolButton1->setTextLabel("new"); diff --git a/core/apps/embeddedkonsole/commandeditwidget.cpp b/core/apps/embeddedkonsole/commandeditwidget.cpp index 6a2c482..ed8dade 100644 --- a/core/apps/embeddedkonsole/commandeditwidget.cpp +++ b/core/apps/embeddedkonsole/commandeditwidget.cpp @@ -1,64 +1,60 @@ /* This file is part of the Opie Project Copyright (c) 2002 L. Potter <ljp@llornkcor.com> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "commandeditwidget.h" -#include <qpushbutton.h> #include "playlistselection.h" #include <qlayout.h> -#include <qvariant.h> -#include <qtooltip.h> -#include <qwhatsthis.h> /* * Constructs a Form1 which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ Form1::Form1( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { if ( !name ) resize( 596, 480 ); Form1Layout = new QGridLayout( this ); Form1Layout->setSpacing( 6 ); Form1Layout->setMargin( 11 ); MyCustomWidget1 = new PlayListSelection( this, "MyCustomWidget1" ); Form1Layout->addWidget( MyCustomWidget1, 0, 0 ); } /* * Destroys the object and frees any allocated resources */ Form1::~Form1() { // no need to delete child widgets, Qt does it all for us } diff --git a/core/apps/embeddedkonsole/keytrans.cpp b/core/apps/embeddedkonsole/keytrans.cpp index d569ae0..45a7960 100644 --- a/core/apps/embeddedkonsole/keytrans.cpp +++ b/core/apps/embeddedkonsole/keytrans.cpp @@ -368,97 +368,97 @@ Loop: assertSyntax(sym == SYMOpr && !strcmp(res.latin1(),":"), "':' expected") getSymbol(); // string or command assertSyntax(sym == SYMName || sym == SYMString,"Command or string expected") int cmd = 0; if (sym == SYMName) { assertSyntax(syms->oprsyms[res], "Unknown operator name") cmd = (int)syms->oprsyms[res]-1; //printf(": do %s(%d)",res.latin1(),(int)syms->oprsyms[res]-1); } if (sym == SYMString) { cmd = CMD_send; //printf(": send"); //for (unsigned i = 0; i < res.length(); i++) //printf(" %02x(%c)",res.latin1()[i],res.latin1()[i]>=' '?res.latin1()[i]:'?'); } //printf(". summary %04x,%02x,%02x,%d\n",key,mode,mask,cmd); KeyTrans::KeyEntry* ke = kt->addEntry(slinno,key,mode,mask,cmd,res); if (ke) { fprintf(stderr,"%s(%d): keystroke already assigned in line %d.\n",path.ascii(),slinno,ke->ref); } getSymbol(); assertSyntax(sym == SYMEol, "Unexpected text") goto Loop; } if (sym == SYMEol) { getSymbol(); goto Loop; } assertSyntax(sym == SYMEof, "Undecodable Line") buf->close(); return; ERROR: while (sym != SYMEol && sym != SYMEof) getSymbol(); // eoln goto Loop; } KeyTrans* KeyTrans::defaultKeyTrans() { QCString txt = -#include "default.keytab.h" + #include "default.keytab.h" ; QBuffer buf(txt); return fromDevice("[buildin]",buf); } KeyTrans* KeyTrans::fromFile(const char* path) { QFile file(path); return fromDevice(path,file); } // local symbol tables --------------------------------------------------------------------- // material needed for parsing the config file. // This is incomplete work. void KeyTransSymbols::defKeySym(const char* key, int val) { keysyms.insert(key,(QObject*)(val+1)); } void KeyTransSymbols::defOprSym(const char* key, int val) { oprsyms.insert(key,(QObject*)(val+1)); } void KeyTransSymbols::defModSym(const char* key, int val) { modsyms.insert(key,(QObject*)(val+1)); } void KeyTransSymbols::defOprSyms() { // Modifier defOprSym("scrollLineUp", CMD_scrollLineUp ); defOprSym("scrollLineDown",CMD_scrollLineDown); defOprSym("scrollPageUp", CMD_scrollPageUp ); defOprSym("scrollPageDown",CMD_scrollPageDown); defOprSym("emitSelection", CMD_emitSelection ); defOprSym("prevSession", CMD_prevSession ); defOprSym("nextSession", CMD_nextSession ); } void KeyTransSymbols::defModSyms() { // Modifier defModSym("Shift", BITS_Shift ); defModSym("Control", BITS_Control ); defModSym("Alt", BITS_Alt ); @@ -652,55 +652,54 @@ void KeyTrans::addKeyTrans() void KeyTrans::loadAll() { if (!numb2keymap) numb2keymap = new QIntDict<KeyTrans>; if (!path2keymap) path2keymap = new QDict<KeyTrans>; if (!syms) syms = new KeyTransSymbols; defaultKeyTrans()->addKeyTrans(); QString path = QPEApplication::qpeDir() + "etc/keytabs"; QDir dir(path); QStringList lst = dir.entryList("*.keytab"); for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { QFile file(path + "/" + *it); KeyTrans* sc = KeyTrans::fromDevice(*it, file); if (sc) { sc->addKeyTrans(); } } } // Debugging material ----------------------------------------------------------- /* void TestTokenizer(QBuffer &buf) { // opening sequence buf.open(IO_ReadOnly); cc = buf.getch(); lineno = 1; // Test tokenizer while (getSymbol(buf)) ReportToken(); buf.close(); } void test() { // Opening sequence QCString txt = -#include "default.keytab.h" ; QBuffer buf(txt); if (0) TestTokenizer(buf); if (1) { KeyTrans kt; kt.scanTable(buf); } } */ diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 084c39d..281835e 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp @@ -1,118 +1,97 @@ /* ---------------------------------------------------------------------- */ /* */ /* [main.C] Konsole */ /* */ /* ---------------------------------------------------------------------- */ /* */ /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ /* */ /* This file is part of Konsole, an X terminal. */ /* */ /* The material contained in here more or less directly orginates from */ /* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ /* */ /* ---------------------------------------------------------------------- */ /* */ /* Ported Konsole to Qt/Embedded */ /* */ /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ /* */ /* -------------------------------------------------------------------------- */ // enhancements added by L.J. Potter <ljp@llornkcor.com> // enhancements added by Phillip Kuhn #include <stdlib.h> #include <sys/types.h> #include <pwd.h> #include <unistd.h> #ifdef QT_QWS_OPIE #include <opie2/ocolorpopupmenu.h> #endif #include <qpe/resource.h> -#include <qdir.h> -#include <qevent.h> -#include <qdragobject.h> -#include <qobjectlist.h> -#include <qtoolbutton.h> -#include <qtoolbar.h> -#include <qpushbutton.h> -#include <qfontdialog.h> -#include <qglobal.h> -#include <qpainter.h> #include <qmenubar.h> -#include <qmessagebox.h> -#include <qaction.h> -#include <qapplication.h> -#include <qfontmetrics.h> -#include <qcombobox.h> -#include <qevent.h> -#include <qtabwidget.h> #include <qtabbar.h> #include <qpe/config.h> -#include <qstringlist.h> -#include <qpalette.h> #include <qfontdatabase.h> #include <qfile.h> #include <qspinbox.h> #include <qlayout.h> -#include <qvbox.h> #include <sys/wait.h> #include <stdio.h> #include <stdlib.h> #include <assert.h> #include "konsole.h" -#include "keytrans.h" #include "commandeditdialog.h" class EKNumTabBar : public QTabBar { public: EKNumTabBar(QWidget *parent = 0, const char *name = 0) : QTabBar(parent, name) {} // QList<QTab> *getTabList() { return(tabList()); } void numberTabs() { // Yes, it really is this messy. QTabWidget needs functions // that provide acces to tabs in a sequential way. int m=INT_MIN; for (int i=0; i<count(); i++) { QTab* left=0; QListIterator<QTab> it(*tabList()); int x=INT_MAX; for( QTab* t; (t=it.current()); ++it ) { int tx = t->rect().x(); if ( tx<x && tx>m ) { x = tx; left = t; } } if ( left ) { left->setText(QString::number(i+1)); m = left->rect().x(); } } } virtual QSize sizeHint() const { if (isHidden()) { return(QSize(0,0)); } else { QSize size = QTabBar::sizeHint(); int shrink = 5; diff --git a/core/apps/embeddedkonsole/playlistselection.cpp b/core/apps/embeddedkonsole/playlistselection.cpp index 4dd3126..fc5330f 100644 --- a/core/apps/embeddedkonsole/playlistselection.cpp +++ b/core/apps/embeddedkonsole/playlistselection.cpp @@ -1,75 +1,68 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ -#include <qpe/applnk.h> -#include <qpe/resource.h> -#include <qpainter.h> -#include <qimage.h> #include <qheader.h> -#include <qlistview.h> -#include <qlist.h> -#include <qpixmap.h> #include "playlistselection.h" #include <stdlib.h> PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) : QListView( parent, name ) { setAllColumnsShowFocus( TRUE ); addColumn( tr( "Command Selection" ) ); header()->hide(); setSorting( -1, FALSE ); } PlayListSelection::~PlayListSelection() { } void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { if ( event->state() == QMouseEvent::LeftButton ) { QListViewItem *currentItem = selectedItem(); QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); if ( currentItem && currentItem->itemAbove() == itemUnder ) moveSelectedUp(); else if ( currentItem && currentItem->itemBelow() == itemUnder ) moveSelectedDown(); } } const QString *PlayListSelection::current() { PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); if ( item ) return item->file(); return NULL; } void PlayListSelection::addToSelection( QListViewItem *lnk ) { PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk->text(0) ) ); QListViewItem *current = selectedItem(); if ( current ) diff --git a/core/apps/embeddedkonsole/session.cpp b/core/apps/embeddedkonsole/session.cpp index 17acb8c..043b8db 100644 --- a/core/apps/embeddedkonsole/session.cpp +++ b/core/apps/embeddedkonsole/session.cpp @@ -1,57 +1,56 @@ /* -------------------------------------------------------------------------- */ /* */ /* Ported Konsole to Qt/Embedded */ /* */ /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ /* */ /* -------------------------------------------------------------------------- */ #include "session.h" -#include <qpushbutton.h> // #include <kdebug.h> #include <stdlib.h> #define HERE fprintf(stderr,"%s(%d): here\n",__FILE__,__LINE__) /*! \class TESession Sessions are combinations of TEPTy and Emulations. The stuff in here does not belong to the terminal emulation framework, but to main.C. It serves it's duty by providing a single reference to TEPTy/Emulation pairs. In fact, it is only there to demonstrate one of the abilities of the framework - multible sessions. */ TESession::TESession(QMainWindow* main, TEWidget* _te, const char* _pgm, QStrList & _args, const char *_term) : schema_no(0), font_no(3), pgm(_pgm), args(_args) { te = _te; term = _term; // sh = new TEPty(); sh = new MyPty(); em = new TEmuVt102(te); sh->setSize(te->Lines(),te->Columns()); // not absolutely nessesary QObject::connect( sh,SIGNAL(block_in(const char*,int)), em,SLOT(onRcvBlock(const char*,int)) ); QObject::connect( em,SIGNAL(ImageSizeChanged(int,int)), sh,SLOT(setSize(int,int))); // 'main' should do those connects itself, somehow. // These aren't KTMW's slots, but konsole's.(David) /* QObject::connect( em,SIGNAL(ImageSizeChanged(int,int)), main,SLOT(notifySize(int,int))); */ QObject::connect( em,SIGNAL(sndBlock(const char*,int)), sh,SLOT(send_bytes(const char*,int)) ); QObject::connect( em,SIGNAL(changeColumns(int)), main,SLOT(changeColumns(int)) ); QObject::connect( em,SIGNAL(changeTitle(int, const QString&)), this,SLOT(changeTitle(int, const QString&)) ); diff --git a/core/apps/helpbrowser/helpbrowser.cpp b/core/apps/helpbrowser/helpbrowser.cpp index 6f84ae2..8fb0161 100644 --- a/core/apps/helpbrowser/helpbrowser.cpp +++ b/core/apps/helpbrowser/helpbrowser.cpp @@ -1,101 +1,79 @@ /********************************************************************** ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** ** This file is part of the Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #define QTOPIA_INTERNAL_LANGLIST #include "helpbrowser.h" #include <qpe/qpeapplication.h> #include <qpe/resource.h> -#include <qpe/mimetype.h> -#include <qpe/applnk.h> -#include <qpe/global.h> - -#include <qstatusbar.h> -#include <qdragobject.h> -#include <qpixmap.h> -#include <qpopupmenu.h> + #include <qmenubar.h> #include <qtoolbar.h> #include <qpe/qcopenvelope_qws.h> -#include <qtoolbutton.h> -#include <qiconset.h> -#include <qfile.h> -#include <qtextstream.h> -#include <qstylesheet.h> -#include <qmessagebox.h> -#include <qfiledialog.h> -#include <qevent.h> -#include <qlineedit.h> -#include <qobjectlist.h> #include <qfileinfo.h> -#include <qfile.h> -#include <qdatastream.h> -#include <qprinter.h> -#include <qsimplerichtext.h> -#include <qpaintdevicemetrics.h> #include <qaction.h> #include <cctype> #include "magictextbrowser.h" HelpBrowser::HelpBrowser( QWidget* parent, const char *name, WFlags f ) : QMainWindow( parent, name, f ), selectedURL() { init( "index.html" ); } void HelpBrowser::init( const QString& _home ) { setIcon( Resource::loadPixmap( "HelpBrowser" ) ); setBackgroundMode( PaletteButton ); browser = new MagicTextBrowser( this ); browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); connect( browser, SIGNAL( textChanged() ), this, SLOT( textChanged() ) ); setCentralWidget( browser ); setToolBarsMovable( FALSE ); if ( !_home.isEmpty() ) browser->setSource( _home ); QToolBar* toolbar = new QToolBar( this ); toolbar->setHorizontalStretchable( TRUE ); QMenuBar *menu = new QMenuBar( toolbar ); toolbar = new QToolBar( this ); // addToolBar( toolbar, "Toolbar"); QPopupMenu* go = new QPopupMenu( this ); backAction = new QAction( tr( "Backward" ), Resource::loadIconSet( "back" ), QString::null, 0, this, 0 ); connect( backAction, SIGNAL( activated() ), browser, SLOT( backward() ) ); connect( browser, SIGNAL( backwardAvailable( bool ) ), backAction, SLOT( setEnabled( bool ) ) ); backAction->addTo( go ); backAction->addTo( toolbar ); backAction->setEnabled( FALSE ); forwardAction = new QAction( tr( "Forward" ), Resource::loadIconSet( "forward" ), QString::null, 0, this, 0 ); diff --git a/core/apps/helpbrowser/magictextbrowser.cpp b/core/apps/helpbrowser/magictextbrowser.cpp index 8ce0325..80495c9 100644 --- a/core/apps/helpbrowser/magictextbrowser.cpp +++ b/core/apps/helpbrowser/magictextbrowser.cpp @@ -1,52 +1,50 @@ #include <qfile.h> -#include <qstring.h> #include <qdragobject.h> -#include <qregexp.h> /* need to get Global::helpPath() */ #define QTOPIA_INTERNAL_LANGLIST #include <qtopia/global.h> #include <qtopia/mimetype.h> #include <qtopia/applnk.h> #include "magictextbrowser.h" MagicTextBrowser::MagicTextBrowser(QWidget* parent) : QTextBrowser(parent){ } void MagicTextBrowser::setSource( const QString& source ) { QTextBrowser::setSource(source); if ( magicQpe(source,"applications") || magicQpe(source,"games") || magicQpe(source,"settings") || magicQpe(source, "1Pim") ) // No tr return; if ( magicOpe(source, "applets") || magicOpe(source, "input") ) return; // Just those are magic (for now). Could do CGI here, // or in Qtopia's mime source factory. } bool MagicTextBrowser::magicQpe(const QString& source, const QString& name) { if ( name+".html" == source || "help/"+name+".html" == source) { QString fn = mimeSourceFactory()->makeAbsolute( source, context() ); const QMimeSource* m = mimeSourceFactory()->data( fn, context() ); if ( m ) { QString txt; if ( QTextDrag::decode(m,txt) ) { QRegExp re("<qtopia-"+name+">.*</qtopia-"+name+">"); int start,len; if ( (start=re.match(txt,0,&len))>=0 ) { QString generated = generateQpe(name); txt.replace(start,len,generated); setText(txt); return true; } } } } return false; } bool MagicTextBrowser::magicOpe( const QString& source, const QString& name ) { if ( name+".html" != source && "help/"+name+".html" != source) return false; diff --git a/core/apps/oapp/oappplugin.cpp b/core/apps/oapp/oappplugin.cpp index 934594f..82cc59b 100644 --- a/core/apps/oapp/oappplugin.cpp +++ b/core/apps/oapp/oappplugin.cpp @@ -1,43 +1,40 @@ -#include "oappinterface.h" #include "oappplugin.h" -#include <qlist.h> #include <qwidget.h> -#include <qpe/quuid.h> OAppPlugin::OAppPlugin(OAppPos pos) { m_position = pos; }; OAppPlugin::OAppPlugin(QWidget *widget, OAppPos pos) { m_widgets.append( widget ); m_position = pos; }; OAppPlugin::~OAppPlugin() { }; QList<QWidget> OAppPlugin::widgets() { return m_widgets; }; OAppPos OAppPlugin::position() const { return m_position; } QRESULT OAppPlugin::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { *iface = 0; if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_OAppInterface ) *iface = this; if ( *iface ) (*iface)->addRef(); return QS_OK; } diff --git a/core/apps/qcop/main.cpp b/core/apps/qcop/main.cpp index 73db0f6..9306cbf 100644 --- a/core/apps/qcop/main.cpp +++ b/core/apps/qcop/main.cpp @@ -1,73 +1,71 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <qpe/qcopenvelope_qws.h> #include <qapplication.h> -#include <qstringlist.h> -#include <qdatastream.h> #include <qtimer.h> #include <stdlib.h> #include <stdio.h> static void usage() { fprintf( stderr, "Usage: qcop channel command [parameters]\n" ); } static void syntax( const QString &where, const QString &what ) { fprintf( stderr, "Syntax error in %s: %s\n", where.latin1(), what.latin1() ); exit(1); } int main( int argc, char *argv[] ) { QApplication app( argc, argv ); if ( argc < 3 ) { usage(); exit(1); } QString channel = argv[1]; QString command = argv[2]; command.stripWhiteSpace(); int paren = command.find( "(" ); if ( paren <= 0 ) syntax( "command", command ); QString params = command.mid( paren + 1 ); if ( params[params.length()-1] != ')' ) syntax( "command", command ); params.truncate( params.length()-1 ); QCopEnvelope env(channel.latin1(), command.latin1()); int argIdx = 3; QStringList paramList = QStringList::split( ",", params ); QStringList::Iterator it; for ( it = paramList.begin(); it != paramList.end(); ++it ) { QString arg = argv[argIdx]; if ( *it == "QString" ) { env << arg; diff --git a/core/apps/taboapp/main.cpp b/core/apps/taboapp/main.cpp index 4b9451e..b2703ff 100644 --- a/core/apps/taboapp/main.cpp +++ b/core/apps/taboapp/main.cpp @@ -1,51 +1,50 @@ #include <qdir.h> -#include <qpe/global.h> #include <qpe/qpeapplication.h> #include <qpe/qlibrary.h> #include <oappinterface.h> #include <oappplugin.h> #include <opie2/otabwidget.h> int main( int argc, char **argv ) { QPEApplication a( argc, argv ); OTabWidget *tabwidget = new OTabWidget(0, "tab widget"); QString path = QPEApplication::qpeDir() + "/plugins/app"; QDir dir( path, "lib*.so" ); QStringList list = dir.entryList(); QStringList::Iterator it; QInterfacePtr<OAppInterface> iface; for ( it = list.begin(); it != list.end(); ++it ) { QLibrary *lib = new QLibrary( path + "/" + *it ); qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); if ( lib->queryInterface( IID_OAppInterface, (QUnknownInterface**)&iface ) == QS_OK ) { qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() ); QList<QWidget> list = iface->widgets(); QWidget *widget; for ( widget = list.first(); widget != 0; widget = list.next() ) tabwidget->addTab(widget, QString(*it), QString(*it)); QString lang = getenv( "LANG" ); if (lang.isNull()) lang = "en"; QTranslator *trans = new QTranslator(qApp); QString type = (*it).left( (*it).find(".") ); if (type.left(3) == "lib") type = type.mid(3); type = type.right( type.find("lib") ); QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; if ( trans->load( tfn )) qApp->installTranslator( trans ); else delete trans; } } diff --git a/core/apps/textedit/filePermissions.cpp b/core/apps/textedit/filePermissions.cpp index f1c78a1..db353a9 100644 --- a/core/apps/textedit/filePermissions.cpp +++ b/core/apps/textedit/filePermissions.cpp @@ -1,72 +1,68 @@ /**************************************************************************** ** copyright 2002 ljp ljp@llornkcor.com ** Created: Sat Feb 23 19:44:40 2002 L.J. Potter ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ****************************************************************************/ #include "filePermissions.h" -#include <qfile.h> #include <qfileinfo.h> #include <qcheckbox.h> #include <qlabel.h> #include <qlineedit.h> -#include <qlayout.h> -#include <qvariant.h> -#include <qtooltip.h> #include <qmessagebox.h> #include <unistd.h> #include <sys/stat.h> #include <stdlib.h> #include <sys/types.h> #include <pwd.h> #include <grp.h> filePermissions::filePermissions( QWidget* parent, const char* name, bool modal, WFlags fl, const QString &fileName ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( tr("File Permissions") ); // qDebug("FilePermissions "+fileName); resize( 236, 210 ); setMaximumSize( QSize( 236, 210 ) ); setCaption( tr( "Set File Permissions" ) ); TextLabel1 = new QLabel( this, "TextLabel1" ); TextLabel1->setGeometry( QRect( 25, 5, 175, 20 ) ); TextLabel1->setText( tr( "Set file permissions for:" ) ); LineEdit1 = new QLineEdit( this, "LineEdit1" ); LineEdit1->setGeometry( QRect( 10, 25, 218, 22 ) ); LineEdit1->setReadOnly(true); TextLabel4 = new QLabel( this, "TextLabel4" ); TextLabel4->setGeometry( QRect( 5, 85, 50, 15 ) ); TextLabel4->setText( tr( "owner" ) ); TextLabel4_2 = new QLabel( this, "TextLabel4_2" ); TextLabel4_2->setGeometry( QRect( 5, 105, 50, 15 ) ); TextLabel4_2->setText( tr( "group" ) ); TextLabel4_3 = new QLabel( this, "TextLabel4_3" ); TextLabel4_3->setGeometry( QRect( 5, 125, 50, 15 ) ); TextLabel4_3->setText( tr( "others" ) ); CheckBox1 = new QCheckBox( this, "CheckBox1" ); CheckBox1->setGeometry( QRect( 75, 85, 20, 16 ) ); connect(CheckBox1, SIGNAL(released()),this,SLOT(ownReadCheck())); CheckBox1_2 = new QCheckBox( this, "CheckBox1_2" ); CheckBox1_2->setGeometry( QRect( 135, 85, 20, 16 ) ); connect(CheckBox1_2, SIGNAL(released()),this,SLOT(ownWriteCheck())); CheckBox1_3 = new QCheckBox( this, "CheckBox1_3" ); diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 8e106bf..55725cc 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp @@ -1,99 +1,81 @@ /********************************************************************** // textedit.cpp ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Opie Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** **********************************************************************/ // changes added by L. J. Potter Sun 02-17-2002 21:31:31 #include "textedit.h" #include "filePermissions.h" #include <opie2/ofileselector.h> #include <opie2/ofiledialog.h> #include <opie2/ofontselector.h> -#include <qpe/fontdatabase.h> -#include <qpe/global.h> -#include <qpe/fileselector.h> -#include <qpe/applnk.h> #include <qpe/resource.h> #include <qpe/config.h> #include <qpe/qpeapplication.h> #include <qmenubar.h> #include <qtoolbar.h> -#include <qpe/qcopenvelope_qws.h> -#include <qpoint.h> #include <qtextstream.h> -#include <qdatetime.h> #include <qclipboard.h> -#include <qstringlist.h> #include <qaction.h> -#include <qcolordialog.h> -#include <qfileinfo.h> #include <qlineedit.h> #include <qmessagebox.h> -#include <qobjectlist.h> -#include <qpopupmenu.h> -#include <qspinbox.h> -#include <qtoolbutton.h> -#include <qwidgetstack.h> -#include <qcheckbox.h> -#include <qcombo.h> #include <qlayout.h> -#include <qapplication.h> #include <qtimer.h> #include <qdir.h> #include <unistd.h> #include <sys/stat.h> #include <stdlib.h> //getenv using Opie::OFileDialog; using Opie::OFileSelector; using Opie::OFontSelector; #if QT_VERSION < 300 class QpeEditor : public QMultiLineEdit { public: QpeEditor( QWidget *parent, const char * name = 0 ) : QMultiLineEdit( parent, name ) { clearTableFlags(); setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar ); } void find( const QString &txt, bool caseSensitive, bool backwards ); protected: bool markIt; int line1, line2, col1, col2; void mousePressEvent( QMouseEvent * ); void mouseReleaseEvent( QMouseEvent * ); //public slots: /* signals: void notFound(); void searchWrapped(); */ private: }; void QpeEditor::mousePressEvent( QMouseEvent *e ) { switch(e->button()) { case RightButton: { //rediculous workaround for qt popup menu //and the hold right click mechanism this->setSelection( line1, col1, line2, col2); QMultiLineEdit::mousePressEvent( e ); |