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