author | chicken <chicken> | 2004-03-01 20:00:34 (UTC) |
---|---|---|
committer | chicken <chicken> | 2004-03-01 20:00:34 (UTC) |
commit | 6bab4a28785c4ab5b0f0707c8c8db953e399cac8 (patch) (side-by-side diff) | |
tree | 126dd6c09cc82b3d41ea70410803daac5cde5b60 | |
parent | 4ffae5ecb25f6d640c69f53f02755b6ec58d4c98 (diff) | |
download | opie-6bab4a28785c4ab5b0f0707c8c8db953e399cac8.zip opie-6bab4a28785c4ab5b0f0707c8c8db953e399cac8.tar.gz opie-6bab4a28785c4ab5b0f0707c8c8db953e399cac8.tar.bz2 |
fix includes
24 files changed, 2 insertions, 99 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katedocument.cpp b/noncore/apps/tinykate/libkate/document/katedocument.cpp index 6807544..f05e21a 100644 --- a/noncore/apps/tinykate/libkate/document/katedocument.cpp +++ b/noncore/apps/tinykate/libkate/document/katedocument.cpp @@ -1,164 +1,162 @@ /*************************************************************************** katedocument.cpp - description ------------------- begin : Mon Jan 15 2001 copyright : (C) 2001 by Christoph "Crossfire" Cullmann (C) 2002 by Joseph Wenninger email : crossfire@babylon2k.de jowenn@kde.org ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ /* Copyright (C) 1998, 1999 Jochen Wilhelmy digisnap@cs.tu-berlin.de This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 "katedocument.h" #include <qfileinfo.h> #include <qdatetime.h> #include <kmessagebox.h> -#include <klocale.h> #include <qpe/config.h> #include <qstring.h> #include <sys/time.h> #include <unistd.h> #include <stdio.h> #include <qtimer.h> #include <qobject.h> #include <qapplication.h> #include <qclipboard.h> #include <qfont.h> #include <qpainter.h> #include <qfile.h> #include <qtextstream.h> #include <qtextcodec.h> #include <kglobal.h> -#include <klocale.h> //#include <kcharsets.h> #include <kdebug.h> //#include <kinstance.h> #include <kglobalsettings.h> //#include <kaction.h> //#include <kstdaction.h> #include "../view/kateview.h" #include "katebuffer.h" #include "katetextline.h" #include "katecmd.h" KateAction::KateAction(Action a, PointStruc &cursor, int len, const QString &text) : action(a), cursor(cursor), len(len), text(text) { } KateActionGroup::KateActionGroup(PointStruc &aStart, int type) : start(aStart), action(0L), undoType(type) { } KateActionGroup::~KateActionGroup() { KateAction *current, *next; current = action; while (current) { next = current->next; delete current; current = next; } } void KateActionGroup::insertAction(KateAction *a) { a->next = action; action = a; } const char * KateActionGroup::typeName(int type) { // return a short text description of the given undo group type suitable for a menu // not the lack of i18n's, the caller is expected to handle translation switch (type) { case ugPaste : return "Paste Text"; case ugDelBlock : return "Selection Overwrite"; case ugIndent : return "Indent"; case ugUnindent : return "Unindent"; case ugComment : return "Comment"; case ugUncomment : return "Uncomment"; case ugReplace : return "Text Replace"; case ugSpell : return "Spell Check"; case ugInsChar : return "Typing"; case ugDelChar : return "Delete Text"; case ugInsLine : return "New Line"; case ugDelLine : return "Delete Line"; } return ""; } const int KateDocument::maxAttribs = 32; QStringList KateDocument::searchForList = QStringList(); QStringList KateDocument::replaceWithList = QStringList(); uint KateDocument::uniqueID = 0; QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0; KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView, QWidget *parentWidget, const char *widgetName, QObject *, const char *) : Kate::Document (), myFont(KGlobalSettings::generalFont()), myFontBold(KGlobalSettings::generalFont()), myFontItalic(KGlobalSettings::generalFont()), myFontBI(KGlobalSettings::generalFont()), myFontMetrics (myFont), myFontMetricsBold (myFontBold), myFontMetricsItalic (myFontItalic), myFontMetricsBI (myFontBI), hlManager(HlManager::self ()) { d(this)->hlSetByUser = false; PreHighlightedTill=0; RequestPreHighlightTill=0; m_bSingleViewMode=bSingleViewMode; m_bBrowserView = bBrowserView; m_url = QString::null; // NOTE: QFont::CharSet doesn't provide all the charsets KDE supports // (esp. it doesn't distinguish between UTF-8 and iso10646-1) myEncoding = QString::fromLatin1(QTextCodec::codecForLocale()->name()); maxLength = -1; setFont (KGlobalSettings::generalFont()); diff --git a/noncore/apps/tinykate/libkate/kateconfig.cpp b/noncore/apps/tinykate/libkate/kateconfig.cpp index 06ac49f..96f91fb 100644 --- a/noncore/apps/tinykate/libkate/kateconfig.cpp +++ b/noncore/apps/tinykate/libkate/kateconfig.cpp @@ -1,119 +1,117 @@ /********************************************************************** ** 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 <qdir.h> -#include <qfile.h> -#include <qfileinfo.h> #include <qmessagebox.h> #if QT_VERSION <= 230 && defined(QT_NO_CODECS) #include <qtextcodec.h> #endif #include <qtextstream.h> #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include <stdlib.h> #include <unistd.h> #define QTOPIA_INTERNAL_LANGLIST #include "kateconfig.h" #include <qpe/global.h> /*! \internal */ QString KateConfig::configFilename(const QString& name, Domain d) { switch (d) { case File: return name; case User: { QDir dir = (QString(getenv("HOME")) + "/Settings"); if ( !dir.exists() ) mkdir(dir.path().local8Bit(),0700); return dir.path() + "/" + name + ".conf"; } } return name; } /*! \class KateConfig config.h \brief The KateConfig class provides for saving application cofniguration state. You should keep a KateConfig in existence only while you do not want others to be able to change the state. There is no locking currently, but there may be in the future. */ /*! \enum KateConfig::KateConfigGroup \internal */ /*! \enum KateConfig::Domain \value File \value User See KateConfig for details. */ /*! Constructs a config that will load or create a configuration with the given \a name in the given \a domain. You must call setGroup() before doing much else with the KateConfig. In the default Domain, \e User, the configuration is user-specific. \a name should not contain "/" in this case, and in general should be the name of the C++ class that is primarily responsible for maintaining the configuration. In the File Domain, \a name is an absolute filename. */ KateConfig::KateConfig( const QString &name, Domain domain ) : filename( configFilename(name,domain) ) { qWarning("KateConfig constructor\n"); git = groups.end(); read(); QStringList l = Global::languageList(); lang = l[0]; glang = l[1]; } // Sharp ROM compatibility KateConfig::KateConfig ( const QString &name, bool what ) : filename( configFilename(name,what ? User : File) ) { git = groups.end(); read(); QStringList l = Global::languageList(); lang = l[0]; glang = l[1]; } /*! Writes any changes to disk and destroys the in-memory object. diff --git a/noncore/apps/tinykate/libkate/view/kateview.cpp b/noncore/apps/tinykate/libkate/view/kateview.cpp index 794fbdb..423634b 100644 --- a/noncore/apps/tinykate/libkate/view/kateview.cpp +++ b/noncore/apps/tinykate/libkate/view/kateview.cpp @@ -1,180 +1,173 @@ /*************************************************************************** kateview.cpp - description ------------------- begin : Mon Jan 15 2001 copyright : (C) 2001 by Christoph "Crossfire" Cullmann (C) 2002 by Joseph Wenninger email : crossfire@babylon2k.de jowenn@kde.org ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ /* Copyright (C) 1998, 1999 Jochen Wilhelmy digisnap@cs.tu-berlin.de This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 "kateview.h" #include "../document/katedocument.h" #include "../document/katecmd.h" #include "../document/katehighlight.h" -#include "kateviewdialog.h" #include "../document/katedialogs.h" +#include "kateviewdialog.h" #include <kateconfig.h> -#include <qfocusdata.h> -#include <kdebug.h> #include <kapplication.h> #include <qscrollbar.h> -#include <qiodevice.h> #include <qpopupmenu.h> #include <kpopupmenu.h> #include <qkeycode.h> #include <qintdict.h> #include <qfont.h> #include <qpainter.h> #include <qpixmap.h> #include <qfileinfo.h> #include <qfile.h> #include <qevent.h> #include <qdir.h> #include <qvbox.h> #include <qprintdialog.h> #include <qpaintdevicemetrics.h> -#include <qiodevice.h> #include <qbuffer.h> -#include <qfocusdata.h> #include <klocale.h> #include <kglobal.h> -#include <kdebug.h> #include <kmessagebox.h> #include <qregexp.h> #include <kdialogbase.h> #include <klineeditdlg.h> #include <qapplication.h> #include <kfiledialog.h> #include <kiconloader.h> #include "../document/katetextline.h" -#include "kateviewdialog.h" #include "kateundohistory.h" #include <qlayout.h> #include <qpe/qpeapplication.h> KateViewInternal::KateViewInternal(KateView *view, KateDocument *doc) : QWidget(view) { waitForPreHighlight=-1; myView = view; myDoc = doc; iconBorderWidth = 16; iconBorderHeight = 800; QWidget::setCursor(ibeamCursor); setBackgroundMode(NoBackground); setFocusPolicy(StrongFocus); xScroll = new QScrollBar(QScrollBar::Horizontal,myView); yScroll = new QScrollBar(QScrollBar::Vertical,myView); connect(xScroll,SIGNAL(valueChanged(int)),SLOT(changeXPos(int))); connect(yScroll,SIGNAL(valueChanged(int)),SLOT(changeYPos(int))); connect(yScroll,SIGNAL(valueChanged(int)),myView,SIGNAL(scrollValueChanged(int))); connect( doc, SIGNAL (preHighlightChanged(long)),this,SLOT(slotPreHighlightUpdate(long))); xPos = 0; yPos = 0; scrollTimer = 0; cursor.x = 0; cursor.y = 0; cursorOn = false; cursorTimer = 0; cXPos = 0; cOldXPos = 0; startLine = 0; endLine = -1; exposeCursor = false; updateState = 0; numLines = 0; lineRanges = 0L; newXPos = -1; newYPos = -1; drawBuffer = new QPixmap (); drawBuffer->setOptimization (QPixmap::BestOptim); bm.sXPos = 0; bm.eXPos = -1; } KateViewInternal::~KateViewInternal() { delete [] lineRanges; delete drawBuffer; } void KateViewInternal::slotPreHighlightUpdate(long line) { //kdDebug()<<QString("slotPreHighlightUpdate - Wait for: %1, line: %2").arg(waitForPreHighlight).arg(line)<<endl; if (waitForPreHighlight!=-1) { if (line>=waitForPreHighlight) { waitForPreHighlight=-1; repaint(); } } } void KateViewInternal::doCursorCommand(VConfig &c, int cmdNum) { switch (cmdNum) { case KateView::cmLeft: cursorLeft(c); break; case KateView::cmRight: cursorRight(c); break; case KateView::cmWordLeft: wordLeft(c); break; case KateView::cmWordRight: wordRight(c); break; case KateView::cmHome: home(c); break; case KateView::cmEnd: end(c); diff --git a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp index bd5b74f..a85fb87 100644 --- a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp +++ b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp @@ -1,140 +1,138 @@ /*************************************************************************** kateviewdialog.cpp - description ------------------- copyright : (C) 2001 by The Kate Team (C) 2002 by Joseph Wenninger email : kwrite-devel@kde.org jowenn@kde.org ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ // Dialogs #include <stdio.h> #include <stdlib.h> #include <qgrid.h> #include <qlabel.h> #include <qlayout.h> #include <qlistbox.h> -#include <qspinbox.h> -#include <qcombobox.h> #include <qgroupbox.h> #include <qlineedit.h> #include <qcheckbox.h> #include <qcollection.h> #include <qpushbutton.h> #include <qobjectlist.h> #include <qradiobutton.h> #include <qwhatsthis.h> #include <qstringlist.h> #include <klocale.h> #include <kcolorbtn.h> -#include <qcombobox.h> #include <kglobal.h> #include <qvbox.h> #include <qspinbox.h> +#include <qcombobox.h> #include <kfontdialog.h> #include "../document/katedocument.h" #include "kateviewdialog.h" #include <opie2/ofontselector.h> SearchDialog::SearchDialog( QWidget *parent, QStringList &searchFor, QStringList &replaceWith, int flags ) : KDialogBase( parent, 0L, true, i18n( "Find Text" ), Ok | Cancel, Ok ) , m_replace( 0L ) { QWidget *page = new QWidget( this ); setMainWidget( page ); QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); m_search = new QComboBox( true, page ); m_search->insertStringList( searchFor ); m_search->setMinimumWidth( m_search->sizeHint().width() ); m_search->lineEdit()->selectAll(); QLabel *label = new QLabel( m_search, i18n( "&Text To Find:" ), page ); m_optRegExp = new QCheckBox( i18n( "Regular Expression" ), page ); topLayout->addWidget( label ); topLayout->addWidget( m_search ); topLayout->addWidget( m_optRegExp ); if( flags & KateView::sfReplace ) { // make it a replace dialog setCaption( i18n( "Replace Text" ) ); m_replace = new QComboBox( true, page ); m_replace->insertStringList( replaceWith ); m_replace->setMinimumWidth( m_search->sizeHint().width() ); label = new QLabel( m_replace, i18n( "&Replace With:" ), page ); //m_optPlaceholders = new QCheckBox( i18n( "&Use Placeholders" ), page ); topLayout->addWidget( label ); topLayout->addWidget( m_replace ); //topLayout->addWidget( m_optPlaceholders ); } QGroupBox *group = new QGroupBox( i18n( "Options" ), page ); topLayout->addWidget( group, 10 ); QGridLayout *gbox = new QGridLayout( group, 5, 2, spacingHint() ); gbox->addRowSpacing( 0, fontMetrics().lineSpacing() ); gbox->setRowStretch( 4, 10 ); m_opt1 = new QCheckBox( i18n( "C&ase Sensitive" ), group ); gbox->addWidget( m_opt1, 1, 0 ); m_opt2 = new QCheckBox(i18n("&Whole Words Only" ), group ); gbox->addWidget( m_opt2, 2, 0 ); m_opt3 = new QCheckBox(i18n("&From Beginning" ), group ); gbox->addWidget( m_opt3, 3, 0 ); m_opt4 = new QCheckBox(i18n("Find &Backwards" ), group ); gbox->addWidget( m_opt4, 1, 1 ); m_opt5 = new QCheckBox(i18n("&Selected Text" ), group ); gbox->addWidget( m_opt5, 2, 1 ); m_opt1->setChecked( flags & KateView::sfCaseSensitive ); m_opt2->setChecked( flags & KateView::sfWholeWords ); m_opt3->setChecked( flags & KateView::sfFromBeginning ); m_optRegExp->setChecked( flags & KateView::sfRegularExpression ); m_opt4->setChecked( flags & KateView::sfBackward ); m_opt5->setChecked( flags & KateView::sfSelected ); if( m_replace ) { m_opt6 = new QCheckBox( i18n( "&Prompt On Replace" ), group ); m_opt6->setChecked( flags & KateView::sfPrompt ); gbox->addWidget( m_opt6, 3, 1 ); } m_search->setFocus(); } QString SearchDialog::getSearchFor() { return m_search->currentText(); } QString SearchDialog::getReplaceWith() { return m_replace->currentText(); } int SearchDialog::getFlags() { int flags = 0; if( m_opt1->isChecked() ) flags |= KateView::sfCaseSensitive; if( m_opt2->isChecked() ) flags |= KateView::sfWholeWords; if( m_opt3->isChecked() ) flags |= KateView::sfFromBeginning; diff --git a/noncore/apps/tinykate/tinykate.cpp b/noncore/apps/tinykate/tinykate.cpp index bbf80ce..19a0127 100644 --- a/noncore/apps/tinykate/tinykate.cpp +++ b/noncore/apps/tinykate/tinykate.cpp @@ -1,128 +1,123 @@ /*************************************************************************** tinykate.cpp Tiny KATE mainwindow ------------------- begin : November 2002 copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org> ***************************************************************************/ /*************************************************************************** * * * This program is free softwaSre; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation. * * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * * * ***************************************************************************/ -#include <qwidget.h> #include <qaction.h> -#include <qlayout.h> #include <qtoolbutton.h> #include <qmenubar.h> #include <qpe/resource.h> -#include <qpe/global.h> #include <qpe/qpeapplication.h> #include <opie2/ofiledialog.h> #include "tinykate.h" #include <katedocument.h> -#include <katehighlight.h> -#include <kateview.h> #include <kglobal.h> TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : QMainWindow( parent, name, f ) { shutDown=false; nextUnnamed=0; currentView=0; viewCount=0; setCaption(tr("TinyKATE")); KGlobal::setAppName("TinyKATE"); QMenuBar *mb = new QMenuBar( this ); mb->setMargin( 0 ); tabwidget=new OTabWidget(this); setCentralWidget(tabwidget); connect(tabwidget,SIGNAL(currentChanged( QWidget *)),this,SLOT(slotCurrentChanged(QWidget *))); //FILE ACTIONS QPopupMenu *popup = new QPopupMenu( this ); // Action for creating a new document QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); a->addTo( popup ); connect(a, SIGNAL(activated()), this, SLOT(slotNew())); // Action for opening an exisiting document a = new QAction( tr( "Open" ),Resource::loadPixmap( "fileopen" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotOpen())); // Action for saving document a = new QAction( tr( "Save" ), Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotSave())); // Action for saving document to a new name a = new QAction( tr( "Save As" ),Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); // Action for closing the currently active document a = new QAction( tr( "Close" ), Resource::loadPixmap( "quit_icon" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotClose())); mb->insertItem(tr("File"),popup); //EDIT ACTIONS // Action for cutting text editCut = new QToolButton( 0 ); editCut->setAutoRaise( true ); editCut->setIconSet( Resource::loadPixmap( "cut" ) ); // Action for Copying text editCopy = new QToolButton( 0 ); editCopy->setAutoRaise( true ); editCopy->setIconSet( Resource::loadPixmap( "copy" ) ); // Action for pasting text editPaste = new QToolButton( 0 ); editPaste->setAutoRaise( true ); editPaste->setIconSet( Resource::loadPixmap( "paste" ) ); // Action for finding / replacing text editFindReplace = new QToolButton( 0 ); editFindReplace->setAutoRaise( true ); editFindReplace->setIconSet( Resource::loadPixmap("find") ); // Action for undo editUndo = new QToolButton( 0 ); editUndo->setAutoRaise( true ); editUndo->setIconSet( Resource::loadPixmap( "undo" ) ); // Action for redo editRedo = new QToolButton( 0 ); editRedo->setAutoRaise( true ); editRedo->setIconSet( Resource::loadPixmap( "redo" ) ); //VIEW ACITONS popup = new QPopupMenu( this ); viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 ); viewIncFontSizes->addTo( popup ); viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 ); viewDecFontSizes->addTo( popup ); mb->insertItem(tr("View"),popup); popup = new QPopupMenu( this ); mb->insertItem(tr("Utils"),popup); diff --git a/noncore/apps/zsafe/category.cpp b/noncore/apps/zsafe/category.cpp index ce1d614..15448f0 100644 --- a/noncore/apps/zsafe/category.cpp +++ b/noncore/apps/zsafe/category.cpp @@ -1,63 +1,62 @@ /* C implementation of RC2 encryption algorithm, as described in RFC2268 */ /* By Matthew Palmer <mjp16@uow.edu.au> */ /* $Id$ */ #include "category.h" -#include <qlistview.h> Category::Category() { } Category::~Category() { } QString Category::getIconName() { return iconName; } QString Category::getCategoryName() { return categoryName; } QListViewItem * Category::getListItem() { return listItem; } QPixmap Category::getIcon() { return icon; } void Category::setIconName(QString name) { iconName = name; } void Category::setCategoryName(QString name) { categoryName = name; } void Category::setListItem(QListViewItem *item) { listItem = item; } void Category::setIcon(QPixmap item) { icon = item; } void Category::initListItem() { if (listItem) { listItem->setText (0, categoryName); listItem->setPixmap (0, icon); } } diff --git a/noncore/apps/zsafe/main.cpp b/noncore/apps/zsafe/main.cpp index 7ff549b..4fe319b 100644 --- a/noncore/apps/zsafe/main.cpp +++ b/noncore/apps/zsafe/main.cpp @@ -1,112 +1,111 @@ /* ** Author: Carsten Schneider <CarstenSchneider@t-online.de> ** ** $Id$ ** ** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html */ #include "zsafe.h" #ifdef DESKTOP #include <qapplication.h> #else #include <qpe/qpeapplication.h> #endif #include <stdio.h> #include <signal.h> -#include "qsettings.h" ZSafe *zs; #ifdef DESKTOP QApplication *appl; #else QPEApplication *appl; #endif int DeskW; int DeskH; void suspend (int signum) { printf ("Suspend signal %d received\n", signum); } void resume (int signum) { printf ("Resume signal %d received\n", signum); zs->resume(signum); } int main( int argc, char ** argv ) { #ifndef WIN32 // install signal handler signal (SIGSTOP, suspend); #endif #ifdef DESKTOP QApplication a( argc, argv ); #else QPEApplication a( argc, argv ); #endif appl = &a; #ifdef DESKTOP if (argc >= 3) { #ifndef WIN32 DeskW = atoi(argv[1]); DeskH = atoi(argv[2]); #else int w, h; sscanf (argv[1], "%d", &w); sscanf (argv[2], "%d", &h); DeskW = w; DeskH = h; #endif } else { DeskW = 600; DeskH = 400; } #else DeskW = a.desktop()->width(); DeskH = a.desktop()->height(); char buf[128]; sprintf (buf, "Width: %d Height: %d\n", DeskW, DeskH); qWarning (buf); #ifdef JPATCH_HDE // nothings #else if (DeskW > 240) { DeskW -= 20; DeskH += 25; sprintf (buf, "Changed width: %d Height: %d\n", DeskW, DeskH); qWarning (buf); } #endif #endif ZSafe mw; zs = &mw; #ifndef WIN32 signal (SIGCONT, resume); #endif #ifdef DESKTOP a.setMainWidget(&mw); mw.show(); #else // a.showMainWidget( &mw ); a.showMainDocumentWidget( &mw ); #endif int ret = a.exec(); return ret; } diff --git a/noncore/apps/zsafe/qsettings.cpp b/noncore/apps/zsafe/qsettings.cpp index 62a9947..ee55339 100755 --- a/noncore/apps/zsafe/qsettings.cpp +++ b/noncore/apps/zsafe/qsettings.cpp @@ -1,102 +1,101 @@ /*
** $Id$
*/
#include "qsettings.h"
-#include <qstringlist.h>
#include <stdio.h>
#include <qfile.h>
#include <qtextstream.h>
QSettings::QSettings(const QString &_fn)
{
// read the prefs from the file
fn = _fn;
QFile f(_fn);
if ( f.open(IO_ReadOnly) ) { // file opened successfully
QTextStream t( &f ); // use a text stream
QString s;
while ( !t.eof() ) { // until end of file...
s = t.readLine(); // line of text excluding '\n'
char buf[256];
sprintf (buf, "%s", (const char *) s);
int pos = s.find (" = ");
QString key = s.left (pos);
QString val = s.right (s.length() - pos - 3);
writeEntry (key, val);
sprintf (buf, "%s|%s", (const char *)key, (const char *)val);
}
f.close();
}
}
QSettings::~QSettings()
{
// write out the prefs to the file
QAsciiDictIterator <QString> it( prefs ); // iterator for dict
QFile f(fn);
f.open(IO_WriteOnly);
QTextStream ts( &f );
while ( it.current() )
{
QString *key = new QString(it.currentKey());
char buf[256];
sprintf (buf, "%s", (const char *) *( it.current()));
QString *val = new QString(buf);
sprintf (buf, "%s %s", (const char *)*key, (const char *)*val);
ts << *key << " = " << *val << endl;
++it;
}
f.close();
prefs.clear();
}
void QSettings::insertSearchPath (System sys, const QString &str)
{
fn = str;
}
QString QSettings::readEntry (const QString &key, const QString &def)
{
QString *s = prefs.find((const char *)key);
if (!s)
return def;
else
return *s;
}
int QSettings::readNumEntry (const QString &key, int def)
{
QString *s = prefs[key];
if (!s) return def;
return s->toInt();
}
bool QSettings::readBoolEntry (const QString &key, bool def)
{
QString *s = prefs[key];
if (!s) return def;
if (*s == "1")
return true;
else
return false;
}
bool QSettings::writeEntry (const QString &key, int val)
{
char buf[64];
sprintf (buf, "%d", val);
QString *v = new QString(buf);
prefs.replace ((const char *)key, v);
return true;
}
diff --git a/noncore/apps/zsafe/scqtfiledlg.cpp b/noncore/apps/zsafe/scqtfiledlg.cpp index d6cea64..dd72fdf 100644 --- a/noncore/apps/zsafe/scqtfiledlg.cpp +++ b/noncore/apps/zsafe/scqtfiledlg.cpp @@ -1,118 +1,113 @@ /**************************************************************************** ** Form implementation generated from reading ui file 'scqtfiledlg.ui' ** ** Created: Sun Jun 8 15:51:12 2003 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ #include "scqtfiledlg.h" #include <qcombobox.h> -#include <qheader.h> #include <qlineedit.h> #include <qlistview.h> -#include <qpushbutton.h> #include <qtoolbutton.h> #include <qlayout.h> -#include <qvariant.h> #include <qtooltip.h> #include <qwhatsthis.h> -#include <qimage.h> -#include <qpixmap.h> static const char* const image0_data[] = { "24 16 3 1", ". c None", "# c #000040", "a c #808080", "........................", "........................", ".................####...", ".................####...", ".......##........#aa#...", "......###........#aa#...", ".....####........#aa#...", "....##############aa#...", "...###aaaaaaaaaaaaaa#...", "..####aaaaaaaaaaaaaa#...", "...###aaaaaaaaaaaaaa#...", "....#################...", ".....####...............", "......###...............", ".......##...............", "........................"}; static const char* const image1_data[] = { "24 16 4 1", ". c None", "a c #008080", "b c #808080", "# c #ff0000", "........................", "........................", "...####..........####...", "...#####........#####...", "....######.....#####a...", ".....######...#####ba...", ".....aa###########bba...", "....aaaaa#######aabba...", "...aaabbb######bbbbba...", "..aaaabb########bbbba...", "...aaa############bba...", "....a######aaa#####aa...", "....######.....######...", "...#####a........####...", "...####aa.........###...", "........................"}; static const char* const image2_data[] = { "17 15 4 1", "# c #000000", ". c #dcdcdc", "a c #ffff00", "b c #ffffff", ".................", "............#....", ".................", "............#....", ".........#.....#.", "....####..#.#.#..", "...#abab#..#.#...", "..##########..#.#", "..#babababab##...", "..#ababababa#.#..", "..#babababab#..#.", "..#ababababa#....", "..#babababab#....", "..#ababababa#....", "..###########...."}; /* * Constructs a ScQtFileDlg which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ ScQtFileDlg::ScQtFileDlg( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { QPixmap image0( ( const char** ) image0_data ); QPixmap image1( ( const char** ) image1_data ); QPixmap image2( ( const char** ) image2_data ); if ( !name ) setName( "ScQtFileDlg" ); resize( 196, 279 ); if (!name) setCaption( tr( "FileDlg" ) ); else setCaption(name); ScQtFileDlgLayout = new QVBoxLayout( this ); ScQtFileDlgLayout->setSpacing( 6 ); ScQtFileDlgLayout->setMargin( 11 ); Layout5 = new QVBoxLayout; Layout5->setSpacing( 6 ); Layout5->setMargin( 0 ); diff --git a/noncore/apps/zsafe/scqtfileedit.cpp b/noncore/apps/zsafe/scqtfileedit.cpp index 7a3d906..08fc2b5 100644 --- a/noncore/apps/zsafe/scqtfileedit.cpp +++ b/noncore/apps/zsafe/scqtfileedit.cpp @@ -1,121 +1,117 @@ /*************************************************************************** scqtfileedit.cpp - description ------------------- begin : Mon Sep 3 2001 copyright : (C) 2001 by Werner Schulte email : sc@schulte-ac.de ***************************************************************************/ /* $Id$ */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include <stdio.h> #include <stdlib.h> -#include "qdir.h" -#include "qdialog.h" -#include "qpixmap.h" -#include "qlistview.h" #include "qlineedit.h" #include "qtoolbutton.h" #include "scqtfileedit.h" #include <qpe/qpeapplication.h> // #define DEBUGFILEEDIT /* XPM */ static const char* const file_xpm[]={ "16 16 5 1", ". c #7f7f7f", "# c None", "c c #000000", "b c #bfbfbf", "a c #ffffff", "################", "..........######", ".aaaaaaaab.#####", ".aaaaaaaaba.####", ".aaaaaaaacccc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".bbbbbbbbbbbc###", "ccccccccccccc###"}; /* XPM */ static const char * const link_file_xpm[]={ "16 16 10 1", "h c #808080", "g c #a0a0a0", "d c #c3c3c3", ". c #7f7f7f", "c c #000000", "b c #bfbfbf", "f c #303030", "e c #585858", "a c #ffffff", "# c None", "################", "..........######", ".aaaaaaaab.#####", ".aaaaaaaaba.####", ".aaaaaaaacccc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaadc###", ".aaaaaaaaaadc###", ".aaaacccccccc###", ".aaaacaaaaaac###", ".aaaacaeaeaac###", ".aaaacaefcfac###", ".aaaacaagchac###", ".ddddcaaahaac###", "ccccccccccccc###"}; /* XPM */ static const char * const closed_xpm[]={ "16 16 6 1", ". c None", "b c #ffff00", "d c #000000", "* c #999999", "a c #cccccc", "c c #ffffff", "................", "................", "..*****.........", ".*ababa*........", "*abababa******..", "*cccccccccccc*d.", "*cbababababab*d.", "*cabababababa*d.", "*cbababababab*d.", "*cabababababa*d.", "*cbababababab*d.", "*cabababababa*d.", "*cbababababab*d.", "**************d.", ".dddddddddddddd.", "................"}; /* XPM */ static const char* const cdtoparent_xpm[]={ "15 13 3 1", ". c None", "* c #000000", "a c #ffff99", diff --git a/noncore/apps/zsafe/zlistview.cpp b/noncore/apps/zsafe/zlistview.cpp index 23bbc4e..ba02a15 100644 --- a/noncore/apps/zsafe/zlistview.cpp +++ b/noncore/apps/zsafe/zlistview.cpp @@ -1,38 +1,36 @@ /* ** $Id$ */ #include "zlistview.h" -#include <qlistview.h> -#include <qevent.h> #include <stdio.h> #include "zsafe.h" ZListView::ZListView (ZSafe *zsafe, const char *id) : QListView(zsafe, id) { zs = zsafe; } ZListView::~ZListView() { } void ZListView::keyPressEvent ( QKeyEvent *e ) { /* char buf[64]; sprintf (buf, "key: %d\n", e->key()); qWarning (buf); */ switch (e->key()) { case 32: // middle cursor key pressed zs->showInfo (zs->selectedItem); break; default: QListView::keyPressEvent( e ); } } diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index f43a206..a3e805e 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp @@ -1,178 +1,177 @@ /**************************************************************************** ** ** Created: Sat Apr 6 17:57:45 2002 ** ** Author: Carsten Schneider <CarstenSchneider@t-online.de> ** ** $Id$ ** ** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html ** ** Compile Flags: ** Zaurus arm : -DNO_OPIE ** Zaurus Opie arm: none ** Linux Desktop : -DDESKTOP ** Windows Desktop: -DDESKTOP -DWIN32 ** ** for japanese version additional use: -DJPATCH_HDE ** ****************************************************************************/ #include "zsafe.h" #include "newdialog.h" #include "searchdialog.h" #include "categorydialog.h" #include "passworddialog.h" #include "infoform.h" #include "zlistview.h" #include "shadedlistitem.h" #ifndef DESKTOP #ifndef NO_OPIE #include <opie2/ofiledialog.h> using Opie::OFileDialog; using Opie::OFileSelector; #else #include "scqtfileedit.h" #endif #endif #include <qclipboard.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdlib.h> #ifndef WIN32 #include <unistd.h> #endif #include <string.h> #include <errno.h> #include <qmenubar.h> #include <qpopupmenu.h> #ifdef DESKTOP #include <qfiledialog.h> #ifndef WIN32 #include <qsettings.h> #else #include "qsettings.h" #endif #include <qapplication.h> #else #include <qfile.h> #include <qpe/fileselector.h> #include <qpe/global.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/config.h> #endif #include <qtimer.h> #include <qlayout.h> #include <qmessagebox.h> #include <qfile.h> #include <qtextstream.h> #include <qheader.h> #include <qlistview.h> #include <qtoolbutton.h> -#include <qlayout.h> #include <qvariant.h> #include <qtooltip.h> #include <qwhatsthis.h> #include <qimage.h> #include <qpixmap.h> #include <qlineedit.h> #include <qmultilineedit.h> #include <qregexp.h> #include <qdir.h> #include <qtextbrowser.h> #include <qlabel.h> #include <qcombobox.h> #include "krc2.h" #include "wait.h" extern int DeskW, DeskH; #ifdef DESKTOP extern QApplication *appl; #else extern QPEApplication *appl; #endif #ifdef JPATCH_HDE #define tr(arg) arg #endif #ifdef DESKTOP #ifndef WIN32 const QString APP_KEY="/.zsafe/"; #else const QString APP_KEY=""; #endif #else const QString APP_KEY=""; #endif // include xmp images #include "pics/zsafe/copy.xpm" #include "pics/zsafe/cut.xpm" #include "pics/zsafe/edit.xpm" #include "pics/zsafe/editdelete.xpm" #include "pics/zsafe/find.xpm" #include "pics/zsafe/folder_open.xpm" #include "pics/zsafe/help_icon.xpm" #include "pics/zsafe/new.xpm" #include "pics/zsafe/paste.xpm" #include "pics/zsafe/quit_icon.xpm" #include "pics/zsafe/save.xpm" #include "pics/zsafe/trash.xpm" #include "pics/zsafe/expand.xpm" #include "pics/zsafe/export.xpm" #include "pics/zsafe/import.xpm" #include "pics/zsafe/zsafe.xpm" static const char* const bank_cards_data[] = { "14 14 16 1", ". c None", "# c #000000", "b c #0000de", "a c #0000e6", "j c #41de83", "k c #4acecd", "h c #4aced5", "g c #5a40cd", "d c #5a44d5", "l c #9440d5", "m c #b4ce4a", "n c #cd4883", "e c #d5ae10", "f c #de3ce6", "i c #e640e6", "c c #ffffff", "..............", ".###########..", ".#ababababa#..", ".#babbbabbb#..", ".#ccccccccc#..", ".#cdcefcghc#..", ".#ccccccccc#..", ".#cicjkclic#..", ".#ccccccccc#..", ".#cmchlcnec#..", ".#ccccccccc#..", ".###########..", "..............", ".............."}; static const char* const passwords_data[] = { "16 16 20 1", ". c None", "# c #000000", "r c #000083", diff --git a/noncore/comm/keypebble/krfbbuffer.cpp b/noncore/comm/keypebble/krfbbuffer.cpp index f1cb929..92918d4 100644 --- a/noncore/comm/keypebble/krfbbuffer.cpp +++ b/noncore/comm/keypebble/krfbbuffer.cpp @@ -1,106 +1,103 @@ #include <assert.h> -#include <qpixmap.h> -#include <qbrush.h> #include <qimage.h> #include <qpainter.h> #include <qapplication.h> #include "krfbdecoder.h" #include "krfbbuffer.h" #include "krfbconnection.h" -#include "krfbserver.h" #include "krfbserverinfo.h" // // Endian stuff // #ifndef KDE_USE_FINAL const int endianTest = 1; #endif #define Swap16IfLE(s) \ (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s)) #define Swap32IfLE(l) \ (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \ (((l) & 0x00ff0000) >> 8) | \ (((l) & 0x0000ff00) << 8) | \ (((l) & 0x000000ff) << 24)) : (l)) KRFBBuffer::KRFBBuffer( KRFBDecoder *decoder, QObject *parent, const char *name ) : QObject( parent, name ) { assert( decoder ); this->decoder = decoder; pix = new QPixmap(); } KRFBBuffer::~KRFBBuffer() { delete pix; } void KRFBBuffer::resize( int w, int h ) { qWarning( "Resizing buffer" ); pix->resize( w, h ); QPalette pal = qApp->palette(); pix->fill( pal.active().base() ); emit sizeChanged( w, h ); } void KRFBBuffer::soundBell() { emit bell(); } void KRFBBuffer::mouseEvent( QMouseEvent *e ) { decoder->sendMouseEvent( e ); } void KRFBBuffer::keyPressEvent( QKeyEvent *e ) { qWarning( "Buffer got a key" ); decoder->sendKeyPressEvent( e ); } void KRFBBuffer::keyReleaseEvent( QKeyEvent *e ) { decoder->sendKeyReleaseEvent( e ); } void KRFBBuffer::copyRect( int srcX, int srcY, int destX, int destY, int w, int h ) { // qWarning( "Got copy rect" ); bitBlt( pix, destX, destY, pix, srcX, srcY, w, h, CopyROP ); emit updated( destX, destY, w, h ); } void KRFBBuffer::drawRawRectChunk( void *data, int x, int y, int w, int h ) { QImage img( w, h, 32 ); int scaleFactor=decoder->con->options()->scaleFactor; int redMax = Swap16IfLE( decoder->format->redMax ); int greenMax = Swap16IfLE( decoder->format->greenMax ); int blueMax = Swap16IfLE( decoder->format->blueMax ); QPainter p( pix ); if ( decoder->format->bpp == 8 ) { uchar *d = (unsigned char *) data; uint r,g,b; for ( int j = 0; j < h; j++) { for ( int i = 0; i < w ; i++ ) { r = d[ j * w + i ]; diff --git a/noncore/comm/keypebble/krfbcanvas.cpp b/noncore/comm/keypebble/krfbcanvas.cpp index bc71c90..75cba68 100644 --- a/noncore/comm/keypebble/krfbcanvas.cpp +++ b/noncore/comm/keypebble/krfbcanvas.cpp @@ -1,112 +1,103 @@ #include "krfbconnection.h" #include "krfbcanvas.h" -#include "krfbserver.h" #include "krfbbuffer.h" -#include <qpe/config.h> #include <qpe/qpeapplication.h> -#include <qapplication.h> #include <qclipboard.h> -#include <qaction.h> -#include <qpixmap.h> -#include <qpoint.h> -#include <qapplication.h> -#include <qmainwindow.h> -#include <qiconset.h> KRFBCanvas::KRFBCanvas( QWidget *parent, const char *name ) : QScrollView( parent, name ) { connection_ = new KRFBConnection(); connect( connection_, SIGNAL( loggedIn() ), this, SLOT( loggedIn() ) ); loggedIn_ = false; //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold); viewport()->setFocusPolicy( QWidget::StrongFocus ); viewport()->setFocus(); nextRightClick=0; nextDoubleClick=0; } KRFBCanvas::~KRFBCanvas() { } void KRFBCanvas::openConnection(KRFBServer server) { QCString host = server.hostname.latin1(); password=server.password; connection_->connectTo( server); } void KRFBCanvas::openURL( const QUrl &url ) { if ( loggedIn_ ) { qWarning( "openURL invoked when logged in\n" ); return; } QCString host = url.host().latin1(); int display = url.port(); // connection_->connectTo( host, display ); } void KRFBCanvas::closeConnection() { loggedIn_ = false; connection_->disconnect(); viewport()->setMouseTracking( false ); viewport()->setBackgroundMode( PaletteDark ); setBackgroundMode( PaletteDark ); update(); } void KRFBCanvas::bell() { if ( connection_->options()->deIconify ) { topLevelWidget()->raise(); topLevelWidget()->show(); } } void KRFBCanvas::loggedIn() { qWarning( "Ok, we're logged in" ); // // Get ready for action // loggedIn_ = true; viewport()->setMouseTracking( true ); viewport()->setBackgroundMode( NoBackground ); setBackgroundMode( NoBackground ); // Start using the buffer connect( connection_->buffer(), SIGNAL( sizeChanged( int, int ) ), this, SLOT( resizeContents(int,int) ) ); connect( connection_->buffer(), SIGNAL( updated( int, int, int, int ) ), this, SLOT( viewportUpdate(int,int,int,int) ) ); connect( connection_->buffer(), SIGNAL( bell() ), this, SLOT( bell() ) ); connect( qApp->clipboard(), SIGNAL( dataChanged() ), this, SLOT( clipboardChanged() ) ); } void KRFBCanvas::viewportPaintEvent( QPaintEvent *e ) { QRect r = e->rect(); if ( loggedIn_ ) { QPixmap p; diff --git a/noncore/comm/keypebble/krfbconnection.cpp b/noncore/comm/keypebble/krfbconnection.cpp index 389c836..e6c33c6 100644 --- a/noncore/comm/keypebble/krfbconnection.cpp +++ b/noncore/comm/keypebble/krfbconnection.cpp @@ -1,104 +1,103 @@ #include <assert.h> #include <qsocket.h> #include <qtimer.h> #include <string.h> #include "krfbconnection.h" #include "krfblogin.h" -#include "krfbserver.h" #include "krfbdecoder.h" #include "krfbbuffer.h" KRFBConnection::KRFBConnection( QObject *parent ) : QObject( parent, "KRFBConnection" ) { portBase_ = 5900; currentState_ = Disconnected; sock = 0; minData_ = 0; options_ = new KRFBServer(); updater = 0; decoder_ = 0; buffer_ = 0; } KRFBConnection::~KRFBConnection() { if ( ( currentState_ != Disconnected ) && ( currentState_ != Disconnecting ) && sock ) { disconnectDone(); } delete options_; } void KRFBConnection::connectTo( KRFBServer server) { if ( currentState_ != Disconnected ) disconnect(); (*options_)=server; sock = new QSocket( this, "rfbSocket" ); CHECK_PTR( sock ); // Connect to something to notice connection or error connect( sock, SIGNAL( error( int ) ), SLOT( gotSocketError( int ) ) ); connect( sock, SIGNAL( connected() ), SLOT( gotSocketConnection() ) ); qWarning( "Connecting..." ); currentState_ = Connecting; sock->connectToHost( options_->hostname.latin1(), portBase_ + options_->display ); } void KRFBConnection::disconnect() { qWarning( "Disconnecting from server" ); if ( ( currentState_ != Disconnected ) && ( currentState_ != Disconnecting ) && sock ) { currentState_ = Disconnecting; connect( sock, SIGNAL( delayedCloseFinished() ), SLOT( disconnectDone() ) ); sock->close(); if ( sock->state() != QSocket::Closing ) disconnectDone(); } } void KRFBConnection::disconnectDone() { currentState_ = Disconnected; delete sock; sock = 0; minData_ = 0; delete updater; delete decoder_; delete buffer_; emit disconnected(); } void KRFBConnection::gotSocketConnection() { currentState_ = LoggingIn; qWarning( "Connected, logging in..." ); static QString statusMsg = tr( "Connected" ); emit statusChanged( statusMsg ); // Do some login stuff login = new KRFBLogin( this ); } void KRFBConnection::gotRFBConnection() { qWarning( "Logged into server" ); currentState_ = Connected; emit connected(); // Create the decoder and start doing stuff decoder_ = new KRFBDecoder( this ); CHECK_PTR( decoder_ ); diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp index c43aed5..2c9ad71 100644 --- a/noncore/comm/keypebble/krfbdecoder.cpp +++ b/noncore/comm/keypebble/krfbdecoder.cpp @@ -1,109 +1,103 @@ #include "krfbconnection.h" -#include "krfbserver.h" #include "krfbserverinfo.h" #include "krfbdecoder.h" #include "krfbbuffer.h" -#include <qpe/qpeapplication.h> #include <qpixmap.h> -#include <qsocket.h> -#include <qevent.h> -#include <qstring.h> -#include <qclipboard.h> #include <assert.h> // // Endian stuff // #ifndef KDE_USE_FINAL const int endianTest = 1; #endif #define Swap16IfLE(s) \ (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s)) #define Swap32IfLE(l) \ (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \ (((l) & 0x00ff0000) >> 8) | \ (((l) & 0x0000ff00) << 8) | \ (((l) & 0x000000ff) << 24)) : (l)) // // The lengths of the messages we need to wait for // const int ServerInitLength = 24; const int UpdateHeaderLength = 4; const int RectHeaderLength = 12; const int RectChunkSize = 4; const int CopyRectPosLength = 4; const int ServerCutLenLength = 7; // // Client -> Server Message Identifiers // static CARD8 SetPixelFormatId = 0; //static CARD8 FixColourMapEntriesId = 1; // Not used static CARD8 SetEncodingsId = 2; static CARD8 UpdateRequestId = 3; static CARD8 KeyEventId = 4; static CARD8 PointerEventId = 5; static CARD8 ClientCutTextId = 6; // // Server -> Client Message Identifiers // static CARD8 UpdateId = 0; static CARD8 BellId = 2; static CARD8 ServerCutId = 3; // // Encoding identifiers // static CARD32 RawEncoding = Swap32IfLE( 0 ); static CARD32 CopyRectEncoding = Swap32IfLE(1 ); static CARD32 RreEncoding = Swap32IfLE( 2 ); static CARD32 CorreEncoding = Swap32IfLE( 4 ); static CARD32 HexTileEncoding = Swap32IfLE( 5 ); static struct { int keysym; int keycode; } keyMap[] = { { 0xff08, Qt::Key_Backspace }, { 0xff09, Qt::Key_Tab }, { 0xff0d, Qt::Key_Return }, { 0xff1b, Qt::Key_Escape }, { 0xff63, Qt::Key_Insert }, { 0xffff, Qt::Key_Delete }, { 0xff50, Qt::Key_Home }, { 0xff57, Qt::Key_End }, { 0xff55, Qt::Key_Prior }, { 0xff56, Qt::Key_Next }, { 0xff51, Qt::Key_Left }, { 0xff52, Qt::Key_Up }, { 0xff53, Qt::Key_Right }, { 0xff54, Qt::Key_Down }, { 0xffbe, Qt::Key_F1 }, { 0xffbf, Qt::Key_F2 }, { 0xffc0, Qt::Key_F3 }, { 0xffc1, Qt::Key_F4 }, { 0xffc2, Qt::Key_F5 }, { 0xffc3, Qt::Key_F6 }, { 0xffc4, Qt::Key_F7 }, { 0xffc5, Qt::Key_F8 }, { 0xffc6, Qt::Key_F9 }, { 0xffc7, Qt::Key_F10 }, { 0xffc8, Qt::Key_F11 }, { 0xffc9, Qt::Key_F12 }, { 0xffe1, Qt::Key_Shift }, { 0xffe2, Qt::Key_Shift }, { 0xffe3, Qt::Key_Control }, { 0xffe4, Qt::Key_Control }, { 0xffe7, Qt::Key_Meta }, { 0xffe8, Qt::Key_Meta }, { 0xffe9, Qt::Key_Alt }, { 0xffea, Qt::Key_Alt }, { 0, 0 } }; diff --git a/noncore/comm/keypebble/krfblogin.cpp b/noncore/comm/keypebble/krfblogin.cpp index 0d2a205..0b4a757 100644 --- a/noncore/comm/keypebble/krfblogin.cpp +++ b/noncore/comm/keypebble/krfblogin.cpp @@ -1,107 +1,106 @@ #include <assert.h> extern "C" { #include "vncauth.h" } #include "krfblogin.h" #include "krfbconnection.h" #include <qtimer.h> -#include <qregexp.h> // The length of the various messages (used to decide how many bytes to // wait for). const int ServerVersionLength = 12; const int ClientVersionLength = 12; const int AuthSchemeLength = 4; const int FailureReasonSizeLength = 4; const int ChallengeLength = 16; const int AuthResultLength = 4; // Authentication results enum AuthResult { AuthOk, AuthFailed, AuthTooMany }; typedef unsigned char CARD8; typedef unsigned short CARD16; typedef unsigned long CARD32; const int endianTest = 1; // Endian stuff #define Swap16IfLE(s) \ (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s)) #define Swap32IfLE(l) \ (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \ (((l) & 0x00ff0000) >> 8) | \ (((l) & 0x0000ff00) << 8) | \ (((l) & 0x000000ff) << 24)) : (l)) KRFBLogin::KRFBLogin( KRFBConnection *con ) : QObject( con, "RFB login manager" ) { assert( con ); this->con = con; currentState = AwaitingServerVersion; connect( this, SIGNAL( error( const QString & ) ), con, SIGNAL( error( const QString & ) ) ); qWarning( "Waiting for server version..." ); static QString statusMsg = tr( "Waiting for server version..." ); emit status( statusMsg ); // Kick off the state machine connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerVersion() ) ); con->waitForData( ServerVersionLength ); } KRFBLogin::~KRFBLogin() { } KRFBLogin::State KRFBLogin::state() const { return currentState; } void KRFBLogin::gotServerVersion() { qWarning( "Got server version" ); disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotServerVersion() ) ); // Read the server's version message char serverVersion[ ServerVersionLength + 1 ]; con->read( serverVersion, ServerVersionLength ); serverVersion[ ServerVersionLength ] = '\0'; QCString rfbString( serverVersion, ServerVersionLength + 1 ); versionString = rfbString; QRegExp regexp( "RFB [0-9][0-9][0-9]\\.[0-9][0-9][0-9]\n" ); if ( rfbString.find( regexp ) == -1 ) { static QString msg = tr( "Error: Invalid server version, %1" ).arg( rfbString ); qWarning( msg ); emit error( msg ); currentState = Error; return; } // Calculate the actual version number serverMajor = (serverVersion[4] - '0') * 100 + (serverVersion[5] - '0') * 10 + (serverVersion[6] - '0'); serverMinor = (serverVersion[8] - '0') * 100 + (serverVersion[9] - '0') * 10 diff --git a/noncore/comm/keypebble/krfbserver.cpp b/noncore/comm/keypebble/krfbserver.cpp index b47534e..fda81a1 100644 --- a/noncore/comm/keypebble/krfbserver.cpp +++ b/noncore/comm/keypebble/krfbserver.cpp @@ -1,41 +1,40 @@ -#include <qpe/config.h> #include <qpe/qpeapplication.h> #include "krfbserver.h" KRFBServer::KRFBServer() { QString name; QString hostname; QString password; display=0; scaleFactor=1; hexTile=0; corre=0; rre=0; copyrect=1; colors256=1; shared=0; readOnly=0; deIconify=0; updateRate=0; } KRFBServer::~KRFBServer() { } int KRFBServer::encodings() { // Initially one because we always support raw encoding int count = 1; count += hexTile ? 1 : 0; count += corre ? 1 : 0; count += rre ? 1 : 0; count += copyrect ? 1 : 0; return count; } diff --git a/noncore/comm/keypebble/kvnc.cpp b/noncore/comm/keypebble/kvnc.cpp index 2fa8d1f..c678edf 100644 --- a/noncore/comm/keypebble/kvnc.cpp +++ b/noncore/comm/keypebble/kvnc.cpp @@ -1,123 +1,110 @@ -#include <qiconset.h> -#include <qdialog.h> -#include <qpixmap.h> -#include <qdom.h> #include <qaction.h> -#include <qmenubar.h> -#include <qstatusbar.h> #include <qpopupmenu.h> #include <qpushbutton.h> -#include <qpe/qpetoolbar.h> -#include <qtimer.h> #include <qmessagebox.h> -#include <qspinbox.h> #include <qlistbox.h> -#include <qlineedit.h> #include <qpe/qpeapplication.h> -#include <qpe/global.h> -#include <qpe/qpetoolbar.h> #include <qpe/resource.h> #include <assert.h> #include "kvnc.h" #include "krfbcanvas.h" #include "krfbconnection.h" #include "kvncconndlg.h" -#include "krfbserver.h" static int u_id = 1; static int get_unique_id() { return u_id++; } /* XPM */ static char * menu_xpm[] = { "12 12 5 1", " c None", ". c #000000", "+ c #FFFDAD", "@ c #FFFF00", "# c #E5E100", " ", " ", " ......... ", " .+++++++. ", " .+@@@@#. ", " .+@@@#. ", " .+@@#. ", " .+@#. ", " .+#. ", " .+. ", " .. ", " "}; const int StatusTextId = 0; KVNC::KVNC( QWidget *parent, const char *name, WFlags f) : QMainWindow( 0, name ,WStyle_ContextHelp) { setCaption( tr("VNC Viewer") ); fullscreen = false; stack = new QWidgetStack( this ); setCentralWidget( stack ); bookmarkSelector=new KVNCBookmarkDlg(); stack->addWidget(bookmarkSelector,get_unique_id()); stack->raiseWidget( bookmarkSelector ); canvas = new KRFBCanvas( stack, "canvas" ); stack->addWidget(canvas,get_unique_id()); setCentralWidget( stack ); connect( bookmarkSelector->bookmarkList, SIGNAL(clicked(QListBoxItem *)), this, SLOT(openConnection(QListBoxItem *)) ); connect( canvas->connection(), SIGNAL(statusChanged(const QString &)), this, SLOT(statusMessage(const QString &)) ); connect( canvas->connection(), SIGNAL(error(const QString &)), this, SLOT(error(const QString &)) ); connect( canvas->connection(), SIGNAL(connected()), this, SLOT(connected()) ); connect( canvas->connection(), SIGNAL(loggedIn()), this, SLOT(loggedIn()) ); connect( canvas->connection(), SIGNAL(disconnected()), this, SLOT(disconnected()) ); setupActions(); cornerButton = new QPushButton( this ); cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); connect( cornerButton, SIGNAL(pressed()), this, SLOT(showMenu()) ); canvas->setCornerWidget( cornerButton ); stack->raiseWidget( bookmarkSelector ); bar= new QToolBar( this ); setToolBarsMovable( false ); setRightJustification(false); QAction *n = new QAction( tr( "New Connection" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); connect( n, SIGNAL( activated() ), this, SLOT( newConnection() ) ); n->addTo( bar ); QAction *o = new QAction( tr( "Open Bookmark" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); connect( o, SIGNAL( activated() ), this, SLOT( openConnection() ) ); o->addTo( bar ); QAction *d = new QAction( tr( "Delete Bookmark" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); connect( d, SIGNAL( activated() ), this, SLOT( deleteBookmark() ) ); d->addTo( bar ); } KVNC::~KVNC() { } diff --git a/noncore/comm/keypebble/kvncbookmarkdlg.cpp b/noncore/comm/keypebble/kvncbookmarkdlg.cpp index 8556d49..ef2fa12 100644 --- a/noncore/comm/keypebble/kvncbookmarkdlg.cpp +++ b/noncore/comm/keypebble/kvncbookmarkdlg.cpp @@ -1,114 +1,100 @@ -#include <qframe.h> -#include <qvbox.h> -#include <qcheckbox.h> -#include <qspinbox.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qwhatsthis.h> -#include <qfile.h> #include <qdir.h> -#include <qstring.h> -#include <qapplication.h> -#include <qlineedit.h> #include <qtextstream.h> -#include <qpushbutton.h> #include <qlistbox.h> -#include <qpe/config.h> #include <qpe/global.h> -#include "krfbserver.h" #include "kvncbookmarkdlg.h" KVNCBookmarkDlg::KVNCBookmarkDlg( QWidget * parent, const char * name, WFlags f ) : KVNCBookmarkDlgBase( parent, name,f) { readBookmarks(); refresh(); } KVNCBookmarkDlg::~KVNCBookmarkDlg() { } void KVNCBookmarkDlg::addBookmark(KRFBServer * server) { if (server) { servers.append(server); bookmarkList->insertItem(server->name); writeBookmarks(); refresh(); } } void KVNCBookmarkDlg::deleteBookmark(QString name) { KRFBServer * server=0; for ( server=servers.first(); server != 0; server=servers.next() ) { if (server->name==name) { servers.remove(servers.at()); writeBookmarks(); refresh(); return; } } } KRFBServer *KVNCBookmarkDlg::getServer(QString name) { KRFBServer * server=0; for ( server=servers.first(); server != 0; server=servers.next() ) { if (server->name==name) return server; } return 0; } /* Note that the degree of protection offered by the encryption here is only sufficient to avoid the most casual observation of the configuration files. People with access to the files can write down the contents and decrypt it using this source code. Conceivably, and at some burden to the user, this encryption could be improved. */ QString KVNCBookmarkDlg::encipher(const QString& plain) { // mainly, we make it long QString cipher; int mix=28730492; for (int i=0; i<(int)plain.length(); i++) { int u = plain[i].unicode(); int c = u ^ mix; QString x = QString::number(c,36); cipher.append(QChar('a'+x.length())); cipher.append(x); mix *= u; } return cipher; } QString KVNCBookmarkDlg::decipher(const QString& cipher) { QString plain; int mix=28730492; for (int i=0; i<(int)cipher.length();) { int l = cipher[i].unicode()-'a'; QString x = cipher.mid(i+1,l); i+=l+1; int u = x.toInt(0,36) ^ mix; plain.append(QChar(u)); mix *= u; } return plain; } void KVNCBookmarkDlg::readBookmarks(void) { QFile f(QDir::homeDirPath() + QString("/Applications/keypebble/bookmarks")); QStringList entry; QString key, val; KRFBServer * server=0; diff --git a/noncore/comm/keypebble/kvncconndlg.cpp b/noncore/comm/keypebble/kvncconndlg.cpp index cd55bb0..420c816 100644 --- a/noncore/comm/keypebble/kvncconndlg.cpp +++ b/noncore/comm/keypebble/kvncconndlg.cpp @@ -1,94 +1,86 @@ -#include <qframe.h> -#include <qvbox.h> #include <qcheckbox.h> #include <qcombobox.h> #include <qspinbox.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qwhatsthis.h> -#include <qapplication.h> #include <qlineedit.h> -#include <qpushbutton.h> -#include "krfbserver.h" #include "kvncconndlg.h" KVNCConnDlg::KVNCConnDlg( KRFBServer *options, QWidget *parent, char *name, bool modal ) : KVNCConnDlgBase( parent, name, modal, WStyle_ContextHelp ) { this->options=options; tmpOptions=*options; serverHostname->setText(options->hostname); serverDisplay->setValue(options->display); serverPassword->setText(options->password); serverBookmark->setText(options->name); hex->setChecked( options->hexTile ); corre->setChecked( options->corre ); rre->setChecked( options->rre ); copyRect->setChecked( options->copyrect ); for (int i=0; i < scaleFactor->count(); ++i) { if (scaleFactor->text(i).toInt()==tmpOptions.scaleFactor) { scaleFactor->setCurrentItem(i); } } // TODO hex->setEnabled( false ); corre->setEnabled( false ); rre->setEnabled( false ); // /TODO deIconify->setChecked( options->deIconify ); bit->setChecked( options->colors256 ); shared->setChecked( options->shared ); timeBox->setValue( options->updateRate ); serverPassword->setEchoMode(QLineEdit::Password); connect(togglePassword, SIGNAL( stateChanged(int) ), this, SLOT( showPassword(int) ) ); } KVNCConnDlg::~KVNCConnDlg() { } void KVNCConnDlg::accept() { save(); QDialog::accept(); } void KVNCConnDlg::save() { tmpOptions.hexTile = hex->isChecked(); tmpOptions.corre = corre->isChecked(); tmpOptions.rre = rre->isChecked(); tmpOptions.copyrect = copyRect->isChecked(); tmpOptions.deIconify = deIconify->isChecked(); tmpOptions.colors256 = bit->isChecked(); tmpOptions.shared = shared->isChecked(); tmpOptions.hostname = serverHostname->text(); tmpOptions.password = serverPassword->text(); tmpOptions.display = serverDisplay->value(); tmpOptions.name = serverBookmark->text(); tmpOptions.scaleFactor = scaleFactor->currentText().toInt(); if (!serverBookmark->text().isEmpty()) { if ( options) { *options=tmpOptions; } } } void KVNCConnDlg::showPassword(int show) { if (show) serverPassword->setEchoMode(QLineEdit::Normal); else serverPassword->setEchoMode(QLineEdit::Password); } diff --git a/noncore/comm/keypebble/main.cpp b/noncore/comm/keypebble/main.cpp index 11f67fc..fc34099 100644 --- a/noncore/comm/keypebble/main.cpp +++ b/noncore/comm/keypebble/main.cpp @@ -1,10 +1,9 @@ -#include <qpe/qpeapplication.h> #include "kvnc.h" #include <opie/oapplicationfactory.h> OPIE_EXPORT_APP( OApplicationFactory<KVNC> ) diff --git a/noncore/comm/mobilemsg/mobilemsg.cpp b/noncore/comm/mobilemsg/mobilemsg.cpp index 707872e..9a4db35 100644 --- a/noncore/comm/mobilemsg/mobilemsg.cpp +++ b/noncore/comm/mobilemsg/mobilemsg.cpp @@ -1,38 +1,33 @@ #include "mobilemsg.h" -#include <qpushbutton.h> -#include <qpe/qpeapplication.h> -#include <qlistbox.h> -#include <qpushbutton.h> -#include <qlayout.h> /* * Constructs a MobileMsg which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ MobileMsg::MobileMsg( QWidget* parent, const char* name, WFlags fl ) : MobileMsgBase( parent, name, fl ) { //connect(add, SIGNAL(clicked()), this, SLOT(goodBye())); //connect(remove, SIGNAL(clicked()), this, SLOT(goodBye())); //connect(props, SIGNAL(clicked()), this, SLOT(goodBye())); //connect(settings, SIGNAL(selectionChanged()), this, SLOT(goodBye()) ); } /* * Destroys the object and frees any allocated resources */ MobileMsg::~MobileMsg() { // no need to delete child widgets, Qt does it all for us } /* * A simple slot... not very interesting. */ void MobileMsg::goodBye() { close(); } diff --git a/noncore/decorations/liquid/liquid.cpp b/noncore/decorations/liquid/liquid.cpp index ef2ac3c..0bd4b1d 100644 --- a/noncore/decorations/liquid/liquid.cpp +++ b/noncore/decorations/liquid/liquid.cpp @@ -1,101 +1,99 @@ #include "liquid.h" #include <qapplication.h> -#include <qpainter.h> -#include <qpalette.h> #include <qdrawutil.h> LiquidDecoInterface::LiquidDecoInterface ( ) { } LiquidDecoInterface::~LiquidDecoInterface ( ) { } QString LiquidDecoInterface::name ( ) const { return qApp-> translate ( "Decoration", "Liquid" ); } QPixmap LiquidDecoInterface::icon ( ) const { return QPixmap ( ); } void LiquidDecoInterface::drawArea( Area a, QPainter *p, const WindowData *wd ) const { QRect r = wd-> rect; int th = metric ( TitleHeight, wd ); switch ( a ) { case WindowDecorationInterface::Border: { const QColorGroup &cg = wd-> palette. active ( ); qDrawWinPanel ( p, r. x ( ) - metric ( LeftBorder, wd ), r. y ( ) - th - metric ( TopBorder, wd ), r. width ( ) + metric ( LeftBorder, wd ) + metric ( RightBorder, wd ), r. height ( ) + th + metric ( TopBorder,wd) + metric ( BottomBorder, wd ), cg, false, &cg. brush ( QColorGroup::Background )); break; } case WindowDecorationInterface::Title: { const QColorGroup &cg = wd-> palette. active ( ); QBrush titleBrush; QPen titleLines1, titleLines2; titleBrush = cg. brush (( wd-> flags & WindowData::Active ) ? QColorGroup::Highlight : QColorGroup::Background ); titleLines1 = titleBrush. color ( ). dark ( 105 ); titleLines2 = titleBrush. color ( ). dark ( 103 ); p-> fillRect ( r. x ( ), r. y ( ) - th, r. width ( ), th, titleBrush ); for ( int i = r.y()-th; i < r.y(); i += 4 ) { p-> setPen ( titleLines1 ); p-> drawLine ( r. left ( ), i, r. right ( ), i ); p-> setPen ( titleLines2 ); p-> drawLine ( r. left ( ), i+1, r. right ( ), i+1 ); } break; } case WindowDecorationInterface::TitleText: { QColor textcol = wd-> palette. active ( ). color (( wd-> flags & WindowData::Active ) ? QColorGroup::HighlightedText : QColorGroup::Text ); QColor shadecol = ( qGray ( textcol. rgb ( ) ) > 128 ) ? textcol. dark ( 230 ) : textcol.light( 300 ); if ( textcol == shadecol ) { if ( qGray ( shadecol. rgb ( ) ) < 128 ) shadecol = QColor ( 225, 225, 225 ); else shadecol = QColor ( 30, 30, 30 ); } QColor fillcol = wd-> palette. active ( ). color (( wd-> flags & WindowData::Active ) ? QColorGroup::Highlight : QColorGroup::Background ); QColor bordercol = fillcol. dark ( 110 ); fillcol = fillcol. light ( 110 ); QRect tr ( r.x ( ) + 3 + metric ( HelpWidth, wd ), r. top ( ) - th, r. width ( ) - metric ( OKWidth, wd ) - metric ( CloseWidth, wd ), th ); QFont f = p-> font ( ); f. setWeight ( QFont::Bold ); p-> setFont ( f ); QRect br = p-> boundingRect ( tr, QPainter::AlignCenter, wd-> caption ); int trh2 = tr. height ( ) / 2; int align = QPainter::AlignCenter; if ( br. width ( ) + 2 * trh2 > tr. width ( ) ) { br. setLeft ( tr. left ( ) + trh2 ); br. setWidth ( tr. width ( ) - 2 * trh2 ); align = QPainter::AlignLeft | QPainter::AlignVCenter; } p-> setBrush ( fillcol ); p-> setPen ( bordercol /*Qt::NoPen*/ ); p-> drawChord ( br. left ( ) - trh2, tr. top ( ), 2 * trh2, tr. height ( ), 90*16, 180*16 ); p-> drawChord ( br. right ( ) + 1 - trh2, tr. top ( ), 2 * trh2, tr. height ( ), 90*16, -180*16 ); p-> fillRect ( br.left() - 1, tr. top ( ), br. width ( ) + 2, tr. height ( ), fillcol); |