summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libqtaux/ocolorbutton.cpp2
-rw-r--r--libqtaux/ocolorpopupmenu.cpp2
-rw-r--r--library/datebookmonth.cpp28
-rw-r--r--library/fileselector.cpp16
-rw-r--r--library/finddialog.cpp12
-rw-r--r--library/findwidget_p.cpp4
-rw-r--r--library/ir.cpp4
-rw-r--r--library/network.cpp4
-rw-r--r--library/qcopenvelope_qws.cpp4
-rw-r--r--library/qpeapplication.cpp12
-rw-r--r--library/qpedialog.cpp4
-rw-r--r--library/storage.cpp4
-rw-r--r--library/timestring.cpp2
-rw-r--r--library/tzselect.cpp8
-rw-r--r--noncore/applets/memoryapplet/swapfile.cpp4
-rw-r--r--noncore/applets/notesapplet/notes.cpp8
-rw-r--r--noncore/applets/wirelessapplet/wireless.cpp8
-rw-r--r--noncore/applets/zkbapplet/zkbwidget.cpp4
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp4
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp28
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp10
-rw-r--r--noncore/apps/advancedfm/output.cpp18
-rw-r--r--noncore/apps/checkbook/checkbook.cpp18
-rw-r--r--noncore/apps/checkbook/listedit.cpp6
-rw-r--r--noncore/apps/checkbook/mainwindow.cpp2
-rw-r--r--noncore/apps/checkbook/password.cpp2
-rw-r--r--noncore/apps/checkbook/transaction.cpp14
-rw-r--r--noncore/apps/confedit/mainwindow.cpp4
-rw-r--r--noncore/apps/odict/odict.cpp2
-rw-r--r--noncore/apps/opie-bartender/bartender.cpp6
-rw-r--r--noncore/apps/opie-bartender/searchresults.cpp2
-rw-r--r--noncore/apps/opie-console/btconfigwidget.cpp4
-rw-r--r--noncore/apps/opie-console/dialdialog.cpp2
-rw-r--r--noncore/apps/opie-console/emulation_handler.cpp8
-rw-r--r--noncore/apps/opie-console/emulation_layer.cpp24
-rw-r--r--noncore/apps/opie-console/function_keyboard.cpp10
-rw-r--r--noncore/apps/opie-console/io_bt.cpp4
-rw-r--r--noncore/apps/opie-console/io_irda.cpp4
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp8
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp6
-rw-r--r--noncore/apps/opie-console/session.cpp4
-rw-r--r--noncore/apps/opie-console/sz_transfer.cpp18
-rw-r--r--noncore/apps/opie-console/test/senderui.cpp2
-rw-r--r--noncore/apps/opie-console/transferdialog.cpp12
-rw-r--r--noncore/apps/opie-reader/QTReaderApp.cpp24
-rw-r--r--noncore/apps/opie-reader/fileBrowser.cpp8
-rw-r--r--noncore/apps/opie-sheet/mainwindow.cpp12
-rw-r--r--noncore/apps/opie-sheet/sheet.cpp4
-rw-r--r--noncore/apps/opie-write/mainwindow.cpp24
-rw-r--r--noncore/apps/opie-write/qtextedit.cpp4
-rwxr-xr-xnoncore/apps/qashmoney/accountdisplay.cpp22
-rwxr-xr-xnoncore/apps/qashmoney/budgetdisplay.cpp20
-rwxr-xr-xnoncore/apps/qashmoney/calculator.cpp24
-rwxr-xr-xnoncore/apps/qashmoney/datepicker.cpp6
-rwxr-xr-xnoncore/apps/qashmoney/memorydialog.cpp6
-rwxr-xr-xnoncore/apps/qashmoney/newaccount.cpp8
-rwxr-xr-xnoncore/apps/qashmoney/newtransaction.cpp8
-rwxr-xr-xnoncore/apps/qashmoney/preferencedialogs.cpp20
-rwxr-xr-xnoncore/apps/qashmoney/qashmoney.cpp20
-rwxr-xr-xnoncore/apps/qashmoney/transactiondisplay.cpp18
-rwxr-xr-xnoncore/apps/qashmoney/transferdialog.cpp2
-rw-r--r--noncore/apps/tableviewer/tableviewer.cpp8
-rw-r--r--noncore/apps/tableviewer/ui/commonwidgets.cpp2
-rw-r--r--noncore/apps/tableviewer/ui/tvbrowseview.cpp4
-rw-r--r--noncore/apps/tableviewer/ui/tvfilterview.cpp2
-rw-r--r--noncore/apps/tableviewer/ui/tvlistview.cpp4
-rw-r--r--noncore/apps/tinykate/libkate/document/katedialogs.cpp6
-rw-r--r--noncore/apps/tinykate/libkate/document/katedocument.cpp2
-rw-r--r--noncore/apps/tinykate/libkate/view/kateviewdialog.cpp6
-rw-r--r--noncore/apps/tinykate/tinykate.cpp2
-rw-r--r--noncore/apps/zsafe/scqtfiledlg.cpp12
-rw-r--r--noncore/apps/zsafe/zsafe.cpp20
-rw-r--r--noncore/comm/keypebble/krfbcanvas.cpp4
-rw-r--r--noncore/comm/keypebble/krfbconnection.cpp6
-rw-r--r--noncore/comm/keypebble/krfblogin.cpp4
-rw-r--r--noncore/comm/keypebble/kvnc.cpp12
-rw-r--r--noncore/games/bounce/game.cpp12
-rw-r--r--noncore/games/buzzword/buzzword.cpp2
-rw-r--r--noncore/games/kpacman/kpacman.cpp4
-rw-r--r--noncore/games/oyatzee/oyatzee.cpp4
-rw-r--r--noncore/multimedia/camera/gui/mainwindow.cpp4
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp88
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/threadutil.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp4
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp14
-rw-r--r--noncore/multimedia/opierec/qtrec.cpp30
-rw-r--r--noncore/multimedia/powerchord/powerchordbase.cpp14
-rw-r--r--noncore/multimedia/showimg/ImageFileSelector.cpp14
-rw-r--r--noncore/multimedia/showimg/showimg.cpp4
-rw-r--r--noncore/net/linphone/qlinphone.cpp2
-rw-r--r--noncore/net/mail/accountview.cpp8
-rw-r--r--noncore/net/mail/composemail.cpp2
-rw-r--r--noncore/net/mail/editaccounts.cpp18
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.cpp8
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp2
-rw-r--r--noncore/net/mail/mainwindow.cpp16
-rw-r--r--noncore/net/mail/viewmail.cpp6
-rw-r--r--noncore/net/opieftp/opieftp.cpp46
-rw-r--r--noncore/net/opieirc/ircchanneltab.cpp2
-rw-r--r--noncore/net/opieirc/ircsession.cpp2
-rw-r--r--noncore/net/opieirc/mainwindow.cpp4
-rw-r--r--noncore/net/opietooth/lib/startdunconnection.cpp8
-rw-r--r--noncore/net/opietooth/lib/startpanconnection.cpp16
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp32
-rw-r--r--noncore/net/opietooth/manager/obexdialog.cpp2
-rw-r--r--noncore/net/opietooth/manager/pppdialog.cpp6
-rw-r--r--noncore/net/opietooth/manager/scandialog.cpp4
-rw-r--r--noncore/settings/appearance2/appearance.cpp24
-rw-r--r--noncore/settings/appearance2/sample.cpp4
-rw-r--r--noncore/settings/aqpkg/inputdlg.cpp4
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp8
-rw-r--r--noncore/settings/aqpkg/ipkg.cpp10
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp26
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp4
-rw-r--r--noncore/settings/backup/backuprestore.cpp4
-rw-r--r--noncore/settings/netsystemtime/mainwindow.cpp14
-rw-r--r--noncore/settings/netsystemtime/settingstabwidget.cpp4
-rw-r--r--noncore/settings/netsystemtime/timetabwidget.cpp2
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp4
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp14
-rw-r--r--noncore/settings/networksettings/ppp/edit.cpp8
-rw-r--r--noncore/settings/networksettings/ppp/general.cpp4
-rw-r--r--noncore/settings/networksettings/ppp/kpppwidget.cpp12
-rw-r--r--noncore/settings/networksettings/ppp/pppdargs.cpp4
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp2.cpp2
-rw-r--r--noncore/settings/packagemanager/filterdlg.cpp2
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp8
-rw-r--r--noncore/settings/packagemanager/oipkg.cpp16
-rw-r--r--noncore/settings/sound/soundsettings.cpp20
-rw-r--r--noncore/settings/sysinfo/benchmarkinfo.cpp2
-rw-r--r--noncore/settings/sysinfo/modulesinfo.cpp4
-rw-r--r--noncore/settings/sysinfo/processinfo.cpp4
-rw-r--r--noncore/settings/tabmanager/tabmanager.cpp4
-rw-r--r--noncore/settings/usermanager/usermanager.cpp2
-rw-r--r--noncore/styles/liquid/liquidset.cpp6
-rw-r--r--noncore/todayplugins/fortune/fortunepluginwidget.cpp4
-rw-r--r--noncore/todayplugins/stockticker/stockticker/helpwindow.cpp16
-rw-r--r--noncore/todayplugins/stockticker/stockticker/inputDialog.cpp2
-rw-r--r--noncore/todayplugins/weather/weatherpluginwidget.cpp2
-rw-r--r--noncore/tools/calc2/calc.cpp4
-rw-r--r--noncore/tools/calculator/calculatorimpl.cpp2
-rw-r--r--noncore/tools/clock/clock.cpp8
-rw-r--r--noncore/tools/formatter/formatter.cpp6
-rw-r--r--noncore/tools/remote/buttondialog.cpp4
-rw-r--r--noncore/tools/remote/recorddialog.cpp6
-rw-r--r--noncore/tools/remote/topgroup.cpp2
-rw-r--r--noncore/tools/remote/topgroupconf.cpp4
-rw-r--r--noncore/unsupported/filebrowser/filebrowser.cpp12
-rw-r--r--noncore/unsupported/gsmtool/gsmtool.cpp4
-rw-r--r--noncore/unsupported/mail2/bend/bend.cpp4
-rw-r--r--noncore/unsupported/mail2/composer.cpp8
-rw-r--r--noncore/unsupported/mail2/folderwidget.cpp24
-rw-r--r--noncore/unsupported/mail2/libmail/imaphandler.cpp6
-rw-r--r--noncore/unsupported/mail2/listviewplus.cpp4
-rw-r--r--noncore/unsupported/mail2/mailtable.cpp12
-rw-r--r--noncore/unsupported/mail2/mainwindow.cpp14
-rw-r--r--noncore/unsupported/mail2/searchdiag.cpp14
-rw-r--r--noncore/unsupported/mail2/viewmail.cpp4
-rw-r--r--noncore/unsupported/mailit/addatt.cpp4
-rw-r--r--noncore/unsupported/mailit/emailclient.cpp32
-rw-r--r--noncore/unsupported/mailit/emailhandler.cpp22
-rw-r--r--noncore/unsupported/mailit/mailitwindow.cpp36
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp8
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.cpp8
-rw-r--r--noncore/unsupported/oipkg/packagelistview.cpp8
-rw-r--r--noncore/unsupported/oipkg/pksettings.cpp2
-rw-r--r--noncore/unsupported/qpdf/qbusybar.cpp2
-rw-r--r--noncore/unsupported/qpdf/qpdf.cpp30
-rw-r--r--x11/libqpe-x11/qpe/qpeapplication.cpp8
-rw-r--r--x11/libqpe-x11/qt/qcopchannel_qws.cpp4
174 files changed, 812 insertions, 816 deletions
diff --git a/libqtaux/ocolorbutton.cpp b/libqtaux/ocolorbutton.cpp
index fd3f963..9e41d93 100644
--- a/libqtaux/ocolorbutton.cpp
+++ b/libqtaux/ocolorbutton.cpp
@@ -1,126 +1,126 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) Robert Griebl <sandman@handhelds.org> 3 Copyright (C) Robert Griebl <sandman@handhelds.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "ocolorpopupmenu.h" 30#include "ocolorpopupmenu.h"
31#include "ocolorbutton.h" 31#include "ocolorbutton.h"
32 32
33/* OPIE */ 33/* OPIE */
34 34
35/* QT */ 35/* QT */
36#include <qimage.h> 36#include <qimage.h>
37 37
38using namespace Opie; 38using namespace Opie;
39 39
40struct OColorButtonPrivate 40struct OColorButtonPrivate
41{ 41{
42 QPopupMenu *m_menu; 42 QPopupMenu *m_menu;
43 QColor m_color; 43 QColor m_color;
44}; 44};
45 45
46/** 46/**
47 * This concstructs a Color Button with @param color as the start color 47 * This concstructs a Color Button with @param color as the start color
48 * It'll use a OColorPopupMenu internally 48 * It'll use a OColorPopupMenu internally
49 * 49 *
50 * @param parent The parent of the Color Button 50 * @param parent The parent of the Color Button
51 * @param color The color from where to start on 51 * @param color The color from where to start on
52 * @param name @see QObject 52 * @param name @see QObject
53 */ 53 */
54OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name ) 54OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name )
55 : QPushButton ( parent, name ) 55 : QPushButton ( parent, name )
56{ 56{
57 d = new OColorButtonPrivate; 57 d = new OColorButtonPrivate;
58 58
59 d-> m_menu = new OColorPopupMenu ( color, 0, 0 ); 59 d-> m_menu = new OColorPopupMenu ( color, 0, 0 );
60 setPopup ( d-> m_menu ); 60 setPopup ( d-> m_menu );
61 //setPopupDelay ( 0 ); 61 //setPopupDelay ( 0 );
62 connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & ))); 62 connect ( d-> m_menu, SIGNAL( colorSelected(const QColor&)), this, SLOT( updateColor(const QColor&)));
63 63
64 updateColor ( color ); 64 updateColor ( color );
65 65
66 QSize s = sizeHint ( ) + QSize ( 12, 0 ); 66 QSize s = sizeHint ( ) + QSize ( 12, 0 );
67 setMinimumSize ( s ); 67 setMinimumSize ( s );
68 setMaximumSize ( s. width ( ) * 2, s. height ( )); 68 setMaximumSize ( s. width ( ) * 2, s. height ( ));
69} 69}
70 70
71/** 71/**
72 * This destructs the object 72 * This destructs the object
73 */ 73 */
74OColorButton::~OColorButton ( ) 74OColorButton::~OColorButton ( )
75{ 75{
76 delete d; 76 delete d;
77} 77}
78 78
79/** 79/**
80 * @return Returns the current color of the button 80 * @return Returns the current color of the button
81 */ 81 */
82QColor OColorButton::color ( ) const 82QColor OColorButton::color ( ) const
83{ 83{
84 return d-> m_color; 84 return d-> m_color;
85} 85}
86 86
87/** 87/**
88 * This method sets the color of the button 88 * This method sets the color of the button
89 * @param c The color to be set. 89 * @param c The color to be set.
90 */ 90 */
91void OColorButton::setColor ( const QColor &c ) 91void OColorButton::setColor ( const QColor &c )
92{ 92{
93 updateColor ( c ); 93 updateColor ( c );
94} 94}
95 95
96/** 96/**
97 * @internal 97 * @internal
98 */ 98 */
99void OColorButton::updateColor ( const QColor &c ) 99void OColorButton::updateColor ( const QColor &c )
100{ 100{
101 d-> m_color = c; 101 d-> m_color = c;
102 102
103 QImage img ( 16, 16, 32 ); 103 QImage img ( 16, 16, 32 );
104 img. fill ( 0 ); 104 img. fill ( 0 );
105 105
106 int r, g, b; 106 int r, g, b;
107 c. rgb ( &r, &g, &b ); 107 c. rgb ( &r, &g, &b );
108 108
109 int w = img. width ( ); 109 int w = img. width ( );
110 int h = img. height ( ); 110 int h = img. height ( );
111 111
112 int dx = w * 20 / 100; // 15% 112 int dx = w * 20 / 100; // 15%
113 int dy = h * 20 / 100; 113 int dy = h * 20 / 100;
114 114
115 for ( int y = 0; y < h; y++ ) 115 for ( int y = 0; y < h; y++ )
116 { 116 {
117 for ( int x = 0; x < w; x++ ) 117 for ( int x = 0; x < w; x++ )
118 { 118 {
119 double alpha = 1.0; 119 double alpha = 1.0;
120 120
121 if ( x < dx ) 121 if ( x < dx )
122 alpha *= ( double ( x + 1 ) / dx ); 122 alpha *= ( double ( x + 1 ) / dx );
123 else if ( x >= w - dx ) 123 else if ( x >= w - dx )
124 alpha *= ( double ( w - x ) / dx ); 124 alpha *= ( double ( w - x ) / dx );
125 if ( y < dy ) 125 if ( y < dy )
126 alpha *= ( double ( y + 1 ) / dy ); 126 alpha *= ( double ( y + 1 ) / dy );
diff --git a/libqtaux/ocolorpopupmenu.cpp b/libqtaux/ocolorpopupmenu.cpp
index c5b2b88..4da2a0e 100644
--- a/libqtaux/ocolorpopupmenu.cpp
+++ b/libqtaux/ocolorpopupmenu.cpp
@@ -94,82 +94,82 @@ void OColorPanelButton::mouseReleaseEvent( QMouseEvent* )
94 emit selected( m_color ); 94 emit selected( m_color );
95} 95}
96 96
97OColorPopupMenu::OColorPopupMenu( const QColor& color, QWidget* parent, const char* name ) 97OColorPopupMenu::OColorPopupMenu( const QColor& color, QWidget* parent, const char* name )
98 : QPopupMenu( parent, name ) 98 : QPopupMenu( parent, name )
99{ 99{
100 m_color = color; 100 m_color = color;
101 101
102 colorPanel = new QWidget( this ); 102 colorPanel = new QWidget( this );
103 103
104 colorLayout = new QGridLayout(colorPanel, 5, 6); 104 colorLayout = new QGridLayout(colorPanel, 5, 6);
105 105
106 addColor(QColor(255, 255, 255), 0, 1); 106 addColor(QColor(255, 255, 255), 0, 1);
107 addColor(QColor(192, 192, 192), 0, 2); 107 addColor(QColor(192, 192, 192), 0, 2);
108 addColor(QColor(128, 128, 128), 0, 3); 108 addColor(QColor(128, 128, 128), 0, 3);
109 addColor(QColor(64, 64, 64), 0, 4); 109 addColor(QColor(64, 64, 64), 0, 4);
110 addColor(QColor(0, 0, 0), 0, 5); 110 addColor(QColor(0, 0, 0), 0, 5);
111 111
112 addColor(QColor(255, 0, 0), 1, 0); 112 addColor(QColor(255, 0, 0), 1, 0);
113 addColor(QColor(255, 128, 0), 1, 1); 113 addColor(QColor(255, 128, 0), 1, 1);
114 addColor(QColor(255, 255, 0), 1, 2); 114 addColor(QColor(255, 255, 0), 1, 2);
115 addColor(QColor(128, 255, 0), 1, 3); 115 addColor(QColor(128, 255, 0), 1, 3);
116 addColor(QColor(0, 255, 0), 1, 4); 116 addColor(QColor(0, 255, 0), 1, 4);
117 addColor(QColor(0, 255, 128), 1, 5); 117 addColor(QColor(0, 255, 128), 1, 5);
118 118
119 addColor(QColor(128, 0, 0), 2, 0); 119 addColor(QColor(128, 0, 0), 2, 0);
120 addColor(QColor(128, 64, 0), 2, 1); 120 addColor(QColor(128, 64, 0), 2, 1);
121 addColor(QColor(128, 128, 0), 2, 2); 121 addColor(QColor(128, 128, 0), 2, 2);
122 addColor(QColor(64, 128, 0), 2, 3); 122 addColor(QColor(64, 128, 0), 2, 3);
123 addColor(QColor(0, 128, 0), 2, 4); 123 addColor(QColor(0, 128, 0), 2, 4);
124 addColor(QColor(0, 128, 64), 2, 5); 124 addColor(QColor(0, 128, 64), 2, 5);
125 125
126 addColor(QColor(0, 255, 255), 3, 0); 126 addColor(QColor(0, 255, 255), 3, 0);
127 addColor(QColor(0, 128, 255), 3, 1); 127 addColor(QColor(0, 128, 255), 3, 1);
128 addColor(QColor(0, 0, 255), 3, 2); 128 addColor(QColor(0, 0, 255), 3, 2);
129 addColor(QColor(128, 0, 255), 3, 3); 129 addColor(QColor(128, 0, 255), 3, 3);
130 addColor(QColor(255, 0, 255), 3, 4); 130 addColor(QColor(255, 0, 255), 3, 4);
131 addColor(QColor(255, 0, 128), 3, 5); 131 addColor(QColor(255, 0, 128), 3, 5);
132 132
133 addColor(QColor(0, 128, 128), 4, 0); 133 addColor(QColor(0, 128, 128), 4, 0);
134 addColor(QColor(0, 64, 128), 4, 1); 134 addColor(QColor(0, 64, 128), 4, 1);
135 addColor(QColor(0, 0, 128), 4, 2); 135 addColor(QColor(0, 0, 128), 4, 2);
136 addColor(QColor(64, 0, 128), 4, 3); 136 addColor(QColor(64, 0, 128), 4, 3);
137 addColor(QColor(128, 0, 128), 4, 4); 137 addColor(QColor(128, 0, 128), 4, 4);
138 addColor(QColor(128, 0, 64), 4, 5); 138 addColor(QColor(128, 0, 64), 4, 5);
139 139
140 insertItem( colorPanel ); 140 insertItem( colorPanel );
141 insertSeparator(); 141 insertSeparator();
142 insertItem(tr("More"),this,SLOT( moreColorClicked())); 142 insertItem(tr("More"),this,SLOT( moreColorClicked()));
143 /* 143 /*
144 QAction* chooseColorAction = new QAction( tr( "More" ), tr( "More..." ), 0, colorPanel, "More" ); 144 QAction* chooseColorAction = new QAction( tr( "More" ), tr( "More..." ), 0, colorPanel, "More" );
145 connect( chooseColorAction, SIGNAL( activated() ), this, SLOT( moreColorClicked() ) ); 145 connect( chooseColorAction, SIGNAL( activated() ), this, SLOT( moreColorClicked() ) );
146 chooseColorAction->addTo( this ); 146 chooseColorAction->addTo( this );
147 */ 147 */
148 activateItemAt( 0 ); 148 activateItemAt( 0 );
149} 149}
150 150
151OColorPopupMenu::~OColorPopupMenu() 151OColorPopupMenu::~OColorPopupMenu()
152{ 152{
153} 153}
154 154
155void OColorPopupMenu::addColor( const QColor& color, int row, int col ) 155void OColorPopupMenu::addColor( const QColor& color, int row, int col )
156{ 156{
157 OColorPanelButton* panelButton = new OColorPanelButton( color, colorPanel ); 157 OColorPanelButton* panelButton = new OColorPanelButton( color, colorPanel );
158 connect( panelButton, SIGNAL( selected( const QColor& ) ), this, SLOT( buttonSelected( const QColor& ) ) ); 158 connect( panelButton, SIGNAL( selected(const QColor&) ), this, SLOT( buttonSelected(const QColor&) ) );
159 colorLayout->addWidget( panelButton, row, col ); 159 colorLayout->addWidget( panelButton, row, col );
160} 160}
161 161
162void OColorPopupMenu::buttonSelected( const QColor& color ) 162void OColorPopupMenu::buttonSelected( const QColor& color )
163{ 163{
164 m_color = color; 164 m_color = color;
165 emit colorSelected( color ); 165 emit colorSelected( color );
166 hide(); 166 hide();
167} 167}
168 168
169void OColorPopupMenu::moreColorClicked() 169void OColorPopupMenu::moreColorClicked()
170{ 170{
171 QColor color = QColorDialog::getColor( m_color ); 171 QColor color = QColorDialog::getColor( m_color );
172 m_color = color; 172 m_color = color;
173 emit colorSelected( color ); 173 emit colorSelected( color );
174 hide(); 174 hide();
175} 175}
diff --git a/library/datebookmonth.cpp b/library/datebookmonth.cpp
index 76e022f..421559e 100644
--- a/library/datebookmonth.cpp
+++ b/library/datebookmonth.cpp
@@ -8,250 +8,250 @@
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#include "config.h" 20#include "config.h"
21#include "datebookmonth.h" 21#include "datebookmonth.h"
22#include "datebookdb.h" 22#include "datebookdb.h"
23#include "resource.h" 23#include "resource.h"
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25 25
26#include <qtoolbutton.h> 26#include <qtoolbutton.h>
27#include <qspinbox.h> 27#include <qspinbox.h>
28#include <qcombobox.h> 28#include <qcombobox.h>
29#include <qvaluestack.h> 29#include <qvaluestack.h>
30#include <qwhatsthis.h> 30#include <qwhatsthis.h>
31 31
32 32
33DateBookMonthHeader::DateBookMonthHeader( QWidget *parent, const char *name ) 33DateBookMonthHeader::DateBookMonthHeader( QWidget *parent, const char *name )
34 : QHBox( parent, name ) 34 : QHBox( parent, name )
35{ 35{
36 setBackgroundMode( PaletteButton ); 36 setBackgroundMode( PaletteButton );
37 37
38 begin = new QToolButton( this ); 38 begin = new QToolButton( this );
39 begin->setFocusPolicy(NoFocus); 39 begin->setFocusPolicy(NoFocus);
40 begin->setPixmap( Resource::loadPixmap( "start" ) ); 40 begin->setPixmap( Resource::loadPixmap( "start" ) );
41 begin->setAutoRaise( TRUE ); 41 begin->setAutoRaise( TRUE );
42 begin->setFixedSize( begin->sizeHint() ); 42 begin->setFixedSize( begin->sizeHint() );
43 QWhatsThis::add( begin, tr("Show January in the selected year") ); 43 QWhatsThis::add( begin, tr("Show January in the selected year") );
44 44
45 back = new QToolButton( this ); 45 back = new QToolButton( this );
46 back->setFocusPolicy(NoFocus); 46 back->setFocusPolicy(NoFocus);
47 back->setPixmap( Resource::loadPixmap( "back" ) ); 47 back->setPixmap( Resource::loadPixmap( "back" ) );
48 back->setAutoRaise( TRUE ); 48 back->setAutoRaise( TRUE );
49 back->setFixedSize( back->sizeHint() ); 49 back->setFixedSize( back->sizeHint() );
50 QWhatsThis::add( back, tr("Show the previous month") ); 50 QWhatsThis::add( back, tr("Show the previous month") );
51 51
52 month = new QComboBox( FALSE, this ); 52 month = new QComboBox( FALSE, this );
53 for ( int i = 0; i < 12; ++i ) 53 for ( int i = 0; i < 12; ++i )
54 month->insertItem( Calendar::nameOfMonth( i + 1 ) ); 54 month->insertItem( Calendar::nameOfMonth( i + 1 ) );
55 55
56 year = new QSpinBox( 1752, 8000, 1, this ); 56 year = new QSpinBox( 1752, 8000, 1, this );
57 57
58 next = new QToolButton( this ); 58 next = new QToolButton( this );
59 next->setFocusPolicy(NoFocus); 59 next->setFocusPolicy(NoFocus);
60 next->setPixmap( Resource::loadPixmap( "forward" ) ); 60 next->setPixmap( Resource::loadPixmap( "forward" ) );
61 next->setAutoRaise( TRUE ); 61 next->setAutoRaise( TRUE );
62 next->setFixedSize( next->sizeHint() ); 62 next->setFixedSize( next->sizeHint() );
63 QWhatsThis::add( next, tr("Show the next month") ); 63 QWhatsThis::add( next, tr("Show the next month") );
64 64
65 end = new QToolButton( this ); 65 end = new QToolButton( this );
66 end->setFocusPolicy(NoFocus); 66 end->setFocusPolicy(NoFocus);
67 end->setPixmap( Resource::loadPixmap( "finish" ) ); 67 end->setPixmap( Resource::loadPixmap( "finish" ) );
68 end->setAutoRaise( TRUE ); 68 end->setAutoRaise( TRUE );
69 end->setFixedSize( end->sizeHint() ); 69 end->setFixedSize( end->sizeHint() );
70 QWhatsThis::add( end, tr("Show December in the selected year") ); 70 QWhatsThis::add( end, tr("Show December in the selected year") );
71 71
72 connect( month, SIGNAL( activated( int ) ), 72 connect( month, SIGNAL( activated(int) ),
73 this, SLOT( updateDate() ) ); 73 this, SLOT( updateDate() ) );
74 connect( year, SIGNAL( valueChanged( int ) ), 74 connect( year, SIGNAL( valueChanged(int) ),
75 this, SLOT( updateDate() ) ); 75 this, SLOT( updateDate() ) );
76 connect( begin, SIGNAL( clicked() ), 76 connect( begin, SIGNAL( clicked() ),
77 this, SLOT( firstMonth() ) ); 77 this, SLOT( firstMonth() ) );
78 connect( end, SIGNAL( clicked() ), 78 connect( end, SIGNAL( clicked() ),
79 this, SLOT( lastMonth() ) ); 79 this, SLOT( lastMonth() ) );
80 connect( back, SIGNAL( clicked() ), 80 connect( back, SIGNAL( clicked() ),
81 this, SLOT( monthBack() ) ); 81 this, SLOT( monthBack() ) );
82 connect( next, SIGNAL( clicked() ), 82 connect( next, SIGNAL( clicked() ),
83 this, SLOT( monthForward() ) ); 83 this, SLOT( monthForward() ) );
84 back->setAutoRepeat( TRUE ); 84 back->setAutoRepeat( TRUE );
85 next->setAutoRepeat( TRUE ); 85 next->setAutoRepeat( TRUE );
86} 86}
87 87
88 88
89DateBookMonthHeader::~DateBookMonthHeader() 89DateBookMonthHeader::~DateBookMonthHeader()
90{ 90{
91 91
92} 92}
93 93
94void DateBookMonthHeader::updateDate() 94void DateBookMonthHeader::updateDate()
95{ 95{
96 emit dateChanged( year->value(), month->currentItem() + 1 ); 96 emit dateChanged( year->value(), month->currentItem() + 1 );
97} 97}
98 98
99void DateBookMonthHeader::firstMonth() 99void DateBookMonthHeader::firstMonth()
100{ 100{
101 emit dateChanged( year->value(), 1 ); 101 emit dateChanged( year->value(), 1 );
102 month->setCurrentItem( 0 ); 102 month->setCurrentItem( 0 );
103} 103}
104 104
105void DateBookMonthHeader::lastMonth() 105void DateBookMonthHeader::lastMonth()
106{ 106{
107 emit dateChanged( year->value(), 12 ); 107 emit dateChanged( year->value(), 12 );
108 month->setCurrentItem( 11 ); 108 month->setCurrentItem( 11 );
109} 109}
110 110
111void DateBookMonthHeader::monthBack() 111void DateBookMonthHeader::monthBack()
112{ 112{
113 if ( month->currentItem() > 0 ) { 113 if ( month->currentItem() > 0 ) {
114 emit dateChanged( year->value(), month->currentItem() ); 114 emit dateChanged( year->value(), month->currentItem() );
115 month->setCurrentItem( month->currentItem() - 1 ); 115 month->setCurrentItem( month->currentItem() - 1 );
116 } else { 116 } else {
117 emit dateChanged( year->value() - 1, 12 ); 117 emit dateChanged( year->value() - 1, 12 );
118 // we have a signal set to a changed value in year so we only need to change 118 // we have a signal set to a changed value in year so we only need to change
119 // year to get the result... 119 // year to get the result...
120 month->setCurrentItem( 11 ); 120 month->setCurrentItem( 11 );
121 year->setValue( year->value() - 1 ); 121 year->setValue( year->value() - 1 );
122 } 122 }
123} 123}
124 124
125void DateBookMonthHeader::monthForward() 125void DateBookMonthHeader::monthForward()
126{ 126{
127 if ( month->currentItem() < 11 ) { 127 if ( month->currentItem() < 11 ) {
128 emit dateChanged( year->value(), month->currentItem() + 2 ); 128 emit dateChanged( year->value(), month->currentItem() + 2 );
129 month->setCurrentItem( month->currentItem() + 1 ); 129 month->setCurrentItem( month->currentItem() + 1 );
130 } else { 130 } else {
131 // we have a signal set to a changed value in year so we only need to change 131 // we have a signal set to a changed value in year so we only need to change
132 // year to get the result... 132 // year to get the result...
133 month->setCurrentItem( 0 ); 133 month->setCurrentItem( 0 );
134 year->setValue( year->value() + 1 ); 134 year->setValue( year->value() + 1 );
135 } 135 }
136} 136}
137 137
138void DateBookMonthHeader::setDate( int y, int m ) 138void DateBookMonthHeader::setDate( int y, int m )
139{ 139{
140 year->setValue( y ); 140 year->setValue( y );
141 month->setCurrentItem( m - 1 ); 141 month->setCurrentItem( m - 1 );
142} 142}
143 143
144//--------------------------------------------------------------------------- 144//---------------------------------------------------------------------------
145 145
146class DateBookMonthTablePrivate 146class DateBookMonthTablePrivate
147{ 147{
148public: 148public:
149 DateBookMonthTablePrivate() {}; 149 DateBookMonthTablePrivate() {};
150 ~DateBookMonthTablePrivate() { mMonthEvents.clear(); }; 150 ~DateBookMonthTablePrivate() { mMonthEvents.clear(); };
151 151
152 QValueList<EffectiveEvent> mMonthEvents; 152 QValueList<EffectiveEvent> mMonthEvents;
153 bool onMonday; 153 bool onMonday;
154}; 154};
155 155
156DateBookMonthTable::DateBookMonthTable( QWidget *parent, const char *name, 156DateBookMonthTable::DateBookMonthTable( QWidget *parent, const char *name,
157 DateBookDB *newDb ) 157 DateBookDB *newDb )
158 : QTable( 6, 7, parent, name ), 158 : QTable( 6, 7, parent, name ),
159 db( newDb ) 159 db( newDb )
160{ 160{
161 d = new DateBookMonthTablePrivate(); 161 d = new DateBookMonthTablePrivate();
162 selYear = -1; 162 selYear = -1;
163 selMonth = -1; 163 selMonth = -1;
164 selDay = -1; 164 selDay = -1;
165 165
166 /* init these as well make valgrind happy and be consistent with Qtopia1.6 -zecke */ 166 /* init these as well make valgrind happy and be consistent with Qtopia1.6 -zecke */
167 year = -1; 167 year = -1;
168 month = -1; 168 month = -1;
169 day = -1; 169 day = -1;
170 170
171 Config cfg( "qpe" ); 171 Config cfg( "qpe" );
172 cfg.setGroup( "Time" ); 172 cfg.setGroup( "Time" );
173 d->onMonday = cfg.readBoolEntry( "MONDAY" ); 173 d->onMonday = cfg.readBoolEntry( "MONDAY" );
174 174
175 horizontalHeader()->setResizeEnabled( FALSE ); 175 horizontalHeader()->setResizeEnabled( FALSE );
176 // we have to do this here... or suffer the consequences later... 176 // we have to do this here... or suffer the consequences later...
177 for ( int i = 0; i < 7; i++ ){ 177 for ( int i = 0; i < 7; i++ ){
178 horizontalHeader()->resizeSection( i, 30 ); 178 horizontalHeader()->resizeSection( i, 30 );
179 setColumnStretchable( i, TRUE ); 179 setColumnStretchable( i, TRUE );
180 } 180 }
181 setupLabels(); 181 setupLabels();
182 182
183 verticalHeader()->hide(); 183 verticalHeader()->hide();
184 setLeftMargin( 0 ); 184 setLeftMargin( 0 );
185 for ( int i = 0; i < 6; ++i ) 185 for ( int i = 0; i < 6; ++i )
186 setRowStretchable( i, TRUE ); 186 setRowStretchable( i, TRUE );
187 187
188 setSelectionMode( NoSelection ); 188 setSelectionMode( NoSelection );
189 189
190 connect( this, SIGNAL( clicked( int, int, int, const QPoint & ) ), 190 connect( this, SIGNAL( clicked(int,int,int,const QPoint&) ),
191 this, SLOT( dayClicked( int, int ) ) ); 191 this, SLOT( dayClicked(int,int) ) );
192 connect( this, SIGNAL( currentChanged( int, int ) ), 192 connect( this, SIGNAL( currentChanged(int,int) ),
193 this, SLOT( dragDay( int, int ) ) ); 193 this, SLOT( dragDay(int,int) ) );
194 setVScrollBarMode( AlwaysOff ); 194 setVScrollBarMode( AlwaysOff );
195 setHScrollBarMode( AlwaysOff ); 195 setHScrollBarMode( AlwaysOff );
196} 196}
197 197
198DateBookMonthTable::~DateBookMonthTable() 198DateBookMonthTable::~DateBookMonthTable()
199{ 199{
200 monthsEvents.clear(); 200 monthsEvents.clear();
201 delete d; 201 delete d;
202} 202}
203 203
204void DateBookMonthTable::setDate(int y, int m, int d) 204void DateBookMonthTable::setDate(int y, int m, int d)
205{ 205{
206 if (month == m && year == y) { 206 if (month == m && year == y) {
207 if ( selYear == -1 ) 207 if ( selYear == -1 )
208 year = selYear; 208 year = selYear;
209 if ( selMonth == -1 ) 209 if ( selMonth == -1 )
210 month = selMonth; 210 month = selMonth;
211 int r1, c1, r2, c2; 211 int r1, c1, r2, c2;
212 findDay(selDay, r1, c1); 212 findDay(selDay, r1, c1);
213 selDay = day = d; 213 selDay = day = d;
214 findDay(selDay, r2, c2); 214 findDay(selDay, r2, c2);
215 setCurrentCell( r2, c2 ); 215 setCurrentCell( r2, c2 );
216 //updateCell(r1,c1); 216 //updateCell(r1,c1);
217 //updateCell(r2,c2); 217 //updateCell(r2,c2);
218 } else { 218 } else {
219 selYear = year = y; 219 selYear = year = y;
220 selMonth = month = m; 220 selMonth = month = m;
221 selDay = day = d; 221 selDay = day = d;
222 setupTable(); 222 setupTable();
223 } 223 }
224} 224}
225 225
226void DateBookMonthTable::redraw() 226void DateBookMonthTable::redraw()
227{ 227{
228 setupLabels(); 228 setupLabels();
229 setupTable(); 229 setupTable();
230} 230}
231 231
232void DateBookMonthTable::setWeekStart( bool onMonday ) 232void DateBookMonthTable::setWeekStart( bool onMonday )
233{ 233{
234 d->onMonday = onMonday; 234 d->onMonday = onMonday;
235 setupLabels(); 235 setupLabels();
236 setupTable(); 236 setupTable();
237} 237}
238 238
239void DateBookMonthTable::setupTable() 239void DateBookMonthTable::setupTable()
240{ 240{
241 QValueList<Calendar::Day> days = Calendar::daysOfMonth( year, month, d->onMonday ); 241 QValueList<Calendar::Day> days = Calendar::daysOfMonth( year, month, d->onMonday );
242 QValueList<Calendar::Day>::Iterator it = days.begin(); 242 QValueList<Calendar::Day>::Iterator it = days.begin();
243 int row = 0, col = 0; 243 int row = 0, col = 0;
244 int crow = 0; 244 int crow = 0;
245 int ccol = 0; 245 int ccol = 0;
246 for ( ; it != days.end(); ++it ) { 246 for ( ; it != days.end(); ++it ) {
247 DayItemMonth *i = (DayItemMonth *)item( row, col ); 247 DayItemMonth *i = (DayItemMonth *)item( row, col );
248 if ( !i ) { 248 if ( !i ) {
249 i = new DayItemMonth( this, QTableItem::Never, "" ); 249 i = new DayItemMonth( this, QTableItem::Never, "" );
250 setItem( row, col, i ); 250 setItem( row, col, i );
251 } 251 }
252 Calendar::Day calDay = *it; 252 Calendar::Day calDay = *it;
253 i->clearEffEvents(); 253 i->clearEffEvents();
254 i->setDay( calDay.date ); 254 i->setDay( calDay.date );
255 i->setType( calDay.type ); 255 i->setType( calDay.type );
256 if ( i->day() == day && calDay.type == Calendar::Day::ThisMonth ) { 256 if ( i->day() == day && calDay.type == Calendar::Day::ThisMonth ) {
257 crow = row; 257 crow = row;
@@ -333,132 +333,132 @@ void DateBookMonthTable::getEvents()
333 return; 333 return;
334 334
335 QDate dtStart( year, month, 1 ); 335 QDate dtStart( year, month, 1 );
336 d->mMonthEvents = db->getEffectiveEvents( dtStart, 336 d->mMonthEvents = db->getEffectiveEvents( dtStart,
337 QDate( year, month, 337 QDate( year, month,
338 dtStart.daysInMonth() ) ); 338 dtStart.daysInMonth() ) );
339 QValueListIterator<EffectiveEvent> it = d->mMonthEvents.begin(); 339 QValueListIterator<EffectiveEvent> it = d->mMonthEvents.begin();
340 // now that the events are sorted, basically go through the list, make 340 // now that the events are sorted, basically go through the list, make
341 // a small list for every day and set it for each item... 341 // a small list for every day and set it for each item...
342 // clear all the items... 342 // clear all the items...
343 while ( it != d->mMonthEvents.end() ) { 343 while ( it != d->mMonthEvents.end() ) {
344 QValueList<EffectiveEvent> dayEvent; 344 QValueList<EffectiveEvent> dayEvent;
345 EffectiveEvent e = *it; 345 EffectiveEvent e = *it;
346 ++it; 346 ++it;
347 dayEvent.append( e ); 347 dayEvent.append( e );
348 while ( it != d->mMonthEvents.end() 348 while ( it != d->mMonthEvents.end()
349 && e.date() == (*it).date() ) { 349 && e.date() == (*it).date() ) {
350 dayEvent.append( *it ); 350 dayEvent.append( *it );
351 ++it; 351 ++it;
352 } 352 }
353 int row, col; 353 int row, col;
354 findDay( e.date().day(), row, col ); 354 findDay( e.date().day(), row, col );
355 DayItemMonth* w = static_cast<DayItemMonth*>( item( row, col ) ); 355 DayItemMonth* w = static_cast<DayItemMonth*>( item( row, col ) );
356 w->setEvents( dayEvent ); 356 w->setEvents( dayEvent );
357 updateCell( row, col ); 357 updateCell( row, col );
358 dayEvent.clear(); 358 dayEvent.clear();
359 } 359 }
360} 360}
361 361
362 362
363void DateBookMonthTable::setupLabels() 363void DateBookMonthTable::setupLabels()
364{ 364{
365 for ( int i = 0; i < 7; ++i ) { 365 for ( int i = 0; i < 7; ++i ) {
366 // horizontalHeader()->resizeSection( i, 30 ); 366 // horizontalHeader()->resizeSection( i, 30 );
367 // setColumnStretchable( i, TRUE ); 367 // setColumnStretchable( i, TRUE );
368 if ( d->onMonday ) 368 if ( d->onMonday )
369 horizontalHeader()->setLabel( i, Calendar::nameOfDay( i + 1 ) ); 369 horizontalHeader()->setLabel( i, Calendar::nameOfDay( i + 1 ) );
370 else { 370 else {
371 if ( i == 0 ) 371 if ( i == 0 )
372 horizontalHeader()->setLabel( i, Calendar::nameOfDay( 7 ) ); 372 horizontalHeader()->setLabel( i, Calendar::nameOfDay( 7 ) );
373 else 373 else
374 horizontalHeader()->setLabel( i, Calendar::nameOfDay( i ) ); 374 horizontalHeader()->setLabel( i, Calendar::nameOfDay( i ) );
375 } 375 }
376 } 376 }
377} 377}
378 378
379 379
380//--------------------------------------------------------------------------- 380//---------------------------------------------------------------------------
381 381
382DateBookMonth::DateBookMonth( QWidget *parent, const char *name, bool ac, 382DateBookMonth::DateBookMonth( QWidget *parent, const char *name, bool ac,
383 DateBookDB *data ) 383 DateBookDB *data )
384 : QVBox( parent, name ), 384 : QVBox( parent, name ),
385 autoClose( ac ) 385 autoClose( ac )
386{ 386{
387 setFocusPolicy(StrongFocus); 387 setFocusPolicy(StrongFocus);
388 year = QDate::currentDate().year(); 388 year = QDate::currentDate().year();
389 month = QDate::currentDate().month(); 389 month = QDate::currentDate().month();
390 day = QDate::currentDate().day(); 390 day = QDate::currentDate().day();
391 header = new DateBookMonthHeader( this, "DateBookMonthHeader" ); 391 header = new DateBookMonthHeader( this, "DateBookMonthHeader" );
392 table = new DateBookMonthTable( this, "DateBookMonthTable", data ); 392 table = new DateBookMonthTable( this, "DateBookMonthTable", data );
393 header->setDate( year, month ); 393 header->setDate( year, month );
394 table->setDate( year, month, QDate::currentDate().day() ); 394 table->setDate( year, month, QDate::currentDate().day() );
395 header->setFocusPolicy(NoFocus); 395 header->setFocusPolicy(NoFocus);
396 table->setFocusPolicy(NoFocus); 396 table->setFocusPolicy(NoFocus);
397 connect( header, SIGNAL( dateChanged( int, int ) ), 397 connect( header, SIGNAL( dateChanged(int,int) ),
398 this, SLOT( setDate( int, int ) ) ); 398 this, SLOT( setDate(int,int) ) );
399 connect( table, SIGNAL( dateClicked( int, int, int ) ), 399 connect( table, SIGNAL( dateClicked(int,int,int) ),
400 this, SLOT( finalDate(int, int, int) ) ); 400 this, SLOT( finalDate(int,int,int) ) );
401 connect( qApp, SIGNAL(weekChanged(bool)), this, 401 connect( qApp, SIGNAL(weekChanged(bool)), this,
402 SLOT(slotWeekChange(bool)) ); 402 SLOT(slotWeekChange(bool)) );
403 table->setFocus(); 403 table->setFocus();
404} 404}
405 405
406DateBookMonth::~DateBookMonth() 406DateBookMonth::~DateBookMonth()
407{ 407{
408 408
409} 409}
410 410
411void DateBookMonth::setDate( int y, int m ) 411void DateBookMonth::setDate( int y, int m )
412{ 412{
413 /* only change the date if this is a different date, 413 /* only change the date if this is a different date,
414 * other wise we may mistakenly overide the day */ 414 * other wise we may mistakenly overide the day */
415 if ( (y != year) || (m != month) ) { 415 if ( (y != year) || (m != month) ) {
416 year = y; 416 year = y;
417 month = m; 417 month = m;
418 QDate nd( y, m, 1 ); 418 QDate nd( y, m, 1 );
419 if ( nd.daysInMonth() < day ) 419 if ( nd.daysInMonth() < day )
420 day = nd.daysInMonth(); 420 day = nd.daysInMonth();
421 table->setDate( year, month, day ); 421 table->setDate( year, month, day );
422 } 422 }
423} 423}
424 424
425void DateBookMonth::setDate( int y, int m, int d ) 425void DateBookMonth::setDate( int y, int m, int d )
426{ 426{
427 header->setDate( y, m); 427 header->setDate( y, m);
428 table->setDate( y, m, d); 428 table->setDate( y, m, d);
429 year = y; 429 year = y;
430 month = m; 430 month = m;
431 day = d; 431 day = d;
432} 432}
433 433
434/* called when we wish to close or pass back the date */ 434/* called when we wish to close or pass back the date */
435void DateBookMonth::finalDate(int y, int m, int d) 435void DateBookMonth::finalDate(int y, int m, int d)
436{ 436{
437 setDate( y, m, d ); 437 setDate( y, m, d );
438 438
439 emit dateClicked(y, m, d); 439 emit dateClicked(y, m, d);
440 // emit dateClicked(QDate(y, m, d).toString()); 440 // emit dateClicked(QDate(y, m, d).toString());
441 441
442 if ( autoClose && parentWidget() ) 442 if ( autoClose && parentWidget() )
443 parentWidget()->close(); 443 parentWidget()->close();
444} 444}
445 445
446void DateBookMonth::setDate( QDate d) 446void DateBookMonth::setDate( QDate d)
447{ 447{
448 setDate(d.year(), d.month(), d.day()); 448 setDate(d.year(), d.month(), d.day());
449} 449}
450 450
451void DateBookMonth::redraw() 451void DateBookMonth::redraw()
452{ 452{
453 table->setDate( year, month, day ); 453 table->setDate( year, month, day );
454 table->redraw(); 454 table->redraw();
455} 455}
456 456
457QDate DateBookMonth::selectedDate() const 457QDate DateBookMonth::selectedDate() const
458{ 458{
459 if ( !table ) 459 if ( !table )
460 return QDate::currentDate(); 460 return QDate::currentDate();
461 int y, m, d; 461 int y, m, d;
462 table->getDate( y, m, d ); 462 table->getDate( y, m, d );
463 return QDate( y, m, d ); 463 return QDate( y, m, d );
464} 464}
@@ -635,128 +635,128 @@ void DayItemMonth::paint( QPainter *p, const QColorGroup &cg,
635 } 635 }
636 636
637 y += h; 637 y += h;
638 638
639 while(repeatLine.count() >= 2) { 639 while(repeatLine.count() >= 2) {
640 int x2 = repeatLine.pop(); 640 int x2 = repeatLine.pop();
641 int x1 = repeatLine.pop(); 641 int x1 = repeatLine.pop();
642 if (x2 < x1 + 2) 642 if (x2 < x1 + 2)
643 x2 = x1 + 2; 643 x2 = x1 + 2;
644 p->fillRect(x1, y, x2 - x1, h, colorRepeat); 644 p->fillRect(x1, y, x2 - x1, h, colorRepeat);
645 } 645 }
646 646
647 647
648 // Finally, draw the number. 648 // Finally, draw the number.
649 QFont f = p->font(); 649 QFont f = p->font();
650 f.setPointSize( ( f.pointSize() / 3 ) * 2 ); 650 f.setPointSize( ( f.pointSize() / 3 ) * 2 );
651 p->setFont( f ); 651 p->setFont( f );
652 QFontMetrics fm( f ); 652 QFontMetrics fm( f );
653 p->drawText( 1, 1 + fm.ascent(), QString::number( day() ) ); 653 p->drawText( 1, 1 + fm.ascent(), QString::number( day() ) );
654 654
655 p->restore(); 655 p->restore();
656} 656}
657 657
658 658
659 659
660void DayItemMonth::setType( Calendar::Day::Type t ) 660void DayItemMonth::setType( Calendar::Day::Type t )
661{ 661{
662 switch ( t ) { 662 switch ( t ) {
663 case Calendar::Day::PrevMonth: 663 case Calendar::Day::PrevMonth:
664 case Calendar::Day::NextMonth: 664 case Calendar::Day::NextMonth:
665 back = QBrush( QColor( 224, 224, 224 ) ); 665 back = QBrush( QColor( 224, 224, 224 ) );
666 forg = black; 666 forg = black;
667 break; 667 break;
668 case Calendar::Day::ThisMonth: 668 case Calendar::Day::ThisMonth:
669 back = QBrush( white ); 669 back = QBrush( white );
670 forg = black; 670 forg = black;
671 break; 671 break;
672 } 672 }
673 typ = t; 673 typ = t;
674} 674}
675 675
676 676
677 677
678DateButton::DateButton( bool longDate, QWidget *parent, const char * name ) 678DateButton::DateButton( bool longDate, QWidget *parent, const char * name )
679 :QPushButton( parent, name ) 679 :QPushButton( parent, name )
680{ 680{
681 longFormat = longDate; 681 longFormat = longDate;
682 df = DateFormat('/', DateFormat::MonthDayYear, DateFormat::MonthDayYear); 682 df = DateFormat('/', DateFormat::MonthDayYear, DateFormat::MonthDayYear);
683 setDate( QDate::currentDate() ); 683 setDate( QDate::currentDate() );
684 684
685 connect(this,SIGNAL(pressed()),this,SLOT(pickDate())); 685 connect(this,SIGNAL(pressed()),this,SLOT(pickDate()));
686 686
687 687
688} 688}
689 689
690 690
691void DateButton::pickDate() 691void DateButton::pickDate()
692{ 692{
693 static QPopupMenu *m1 = 0; 693 static QPopupMenu *m1 = 0;
694 static DateBookMonth *picker = 0; 694 static DateBookMonth *picker = 0;
695 if ( !m1 ) { 695 if ( !m1 ) {
696 m1 = new QPopupMenu( this ); 696 m1 = new QPopupMenu( this );
697 picker = new DateBookMonth( m1, 0, TRUE ); 697 picker = new DateBookMonth( m1, 0, TRUE );
698 m1->insertItem( picker ); 698 m1->insertItem( picker );
699 connect( picker, SIGNAL( dateClicked( int, int, int ) ), 699 connect( picker, SIGNAL( dateClicked(int,int,int) ),
700 this, SLOT( setDate( int, int, int ) ) ); 700 this, SLOT( setDate(int,int,int) ) );
701 connect( picker, SIGNAL( dateClicked( int, int, int ) ), 701 connect( picker, SIGNAL( dateClicked(int,int,int) ),
702 this, SIGNAL( dateSelected( int, int, int ) ) ); 702 this, SIGNAL( dateSelected(int,int,int) ) );
703 connect( m1, SIGNAL( aboutToHide() ), 703 connect( m1, SIGNAL( aboutToHide() ),
704 this, SLOT( gotHide() ) ); 704 this, SLOT( gotHide() ) );
705 } 705 }
706 picker->slotWeekChange( weekStartsMonday ); 706 picker->slotWeekChange( weekStartsMonday );
707 picker->setDate( currDate.year(), currDate.month(), currDate.day() ); 707 picker->setDate( currDate.year(), currDate.month(), currDate.day() );
708 m1->popup(mapToGlobal(QPoint(0,height()))); 708 m1->popup(mapToGlobal(QPoint(0,height())));
709 picker->setFocus(); 709 picker->setFocus();
710} 710}
711 711
712 712
713void DateButton::gotHide() 713void DateButton::gotHide()
714{ 714{
715 // we have to redo the button... 715 // we have to redo the button...
716 setDown( false ); 716 setDown( false );
717} 717}
718 718
719 719
720// void dateSelected( int year, int month, int day ); 720// void dateSelected( int year, int month, int day );
721 721
722void DateButton::setWeekStartsMonday( int b ) 722void DateButton::setWeekStartsMonday( int b )
723{ 723{
724 weekStartsMonday = b; 724 weekStartsMonday = b;
725} 725}
726 726
727void DateButton::setDate( int y, int m, int d ) 727void DateButton::setDate( int y, int m, int d )
728{ 728{
729 setDate( QDate( y,m,d) ); 729 setDate( QDate( y,m,d) );
730} 730}
731 731
732void DateButton::setDate( QDate d ) 732void DateButton::setDate( QDate d )
733{ 733{
734 currDate = d; 734 currDate = d;
735 setText( longFormat ? TimeString::longDateString( d, df ) : 735 setText( longFormat ? TimeString::longDateString( d, df ) :
736 TimeString::shortDate( d, df ) ); 736 TimeString::shortDate( d, df ) );
737 737
738} 738}
739 739
740void DateButton::setDateFormat( DateFormat f ) 740void DateButton::setDateFormat( DateFormat f )
741{ 741{
742 df = f; 742 df = f;
743 setDate( currDate ); 743 setDate( currDate );
744} 744}
745 745
746bool DateButton::customWhatsThis() const 746bool DateButton::customWhatsThis() const
747{ 747{
748 return TRUE; 748 return TRUE;
749} 749}
750 750
751 751
752// this class is only here for Sharp ROM compatibility 752// this class is only here for Sharp ROM compatibility
753// I have reverse engineered this class and it seems to 753// I have reverse engineered this class and it seems to
754// work (only qtmail seems to use it) - sandman 754// work (only qtmail seems to use it) - sandman
755// DO NOT USE IT IN NEW CODE !! 755// DO NOT USE IT IN NEW CODE !!
756 756
757DateBookMonthPopup::DateBookMonthPopup ( QWidget *w ) 757DateBookMonthPopup::DateBookMonthPopup ( QWidget *w )
758 : QPopupMenu ( w ) 758 : QPopupMenu ( w )
759{ 759{
760 m_dbm = new DateBookMonth( this, 0, TRUE ); 760 m_dbm = new DateBookMonth( this, 0, TRUE );
761 insertItem( m_dbm ); 761 insertItem( m_dbm );
762} 762}
diff --git a/library/fileselector.cpp b/library/fileselector.cpp
index 7c29aba..93fb429 100644
--- a/library/fileselector.cpp
+++ b/library/fileselector.cpp
@@ -247,157 +247,157 @@ public:
247 they wish to operate on. Please refer to the implementation of 247 they wish to operate on. Please refer to the implementation of
248 texteditor for an example of how to tie these classes together. 248 texteditor for an example of how to tie these classes together.
249 249
250 Use setNewVisible() depending on whether the application can be used 250 Use setNewVisible() depending on whether the application can be used
251 to create new files or not. Use setCloseVisible() depending on 251 to create new files or not. Use setCloseVisible() depending on
252 whether the user may leave the dialog without creating or selecting 252 whether the user may leave the dialog without creating or selecting
253 a document or not. The number of files in the view is available from 253 a document or not. The number of files in the view is available from
254 fileCount(). To force the view to be updated call reread(). 254 fileCount(). To force the view to be updated call reread().
255 255
256 If the user presses the 'New Document' button the newSelected() 256 If the user presses the 'New Document' button the newSelected()
257 signal is emitted. If the user selects an existing file the 257 signal is emitted. If the user selects an existing file the
258 fileSelected() signal is emitted. The selected file's \link 258 fileSelected() signal is emitted. The selected file's \link
259 doclnk.html DocLnk\endlink is available from the selected() 259 doclnk.html DocLnk\endlink is available from the selected()
260 function. If the file selector is no longer necessary the closeMe() 260 function. If the file selector is no longer necessary the closeMe()
261 signal is emitted. 261 signal is emitted.
262 262
263 \ingroup qtopiaemb 263 \ingroup qtopiaemb
264 \sa FileManager 264 \sa FileManager
265*/ 265*/
266 266
267/*! 267/*!
268 Constructs a FileSelector with mime filter \a f. 268 Constructs a FileSelector with mime filter \a f.
269 The standard Qt \a parent and \a name parameters are passed to the 269 The standard Qt \a parent and \a name parameters are passed to the
270 parent widget. 270 parent widget.
271 271
272 If \a newVisible is TRUE, the widget has a button to allow the user 272 If \a newVisible is TRUE, the widget has a button to allow the user
273 the create "new" documents; this is useful for applications that can 273 the create "new" documents; this is useful for applications that can
274 create and edit documents but not suitable for applications that 274 create and edit documents but not suitable for applications that
275 only provide viewing. 275 only provide viewing.
276 276
277 \a closeVisible is deprecated 277 \a closeVisible is deprecated
278 278
279 \sa DocLnkSet::DocLnkSet() 279 \sa DocLnkSet::DocLnkSet()
280*/ 280*/
281FileSelector::FileSelector( const QString &f, QWidget *parent, const char *name, bool newVisible, bool closeVisible ) 281FileSelector::FileSelector( const QString &f, QWidget *parent, const char *name, bool newVisible, bool closeVisible )
282 : QVBox( parent, name ), filter( f ) 282 : QVBox( parent, name ), filter( f )
283{ 283{
284 setMargin( 0 ); 284 setMargin( 0 );
285 setSpacing( 0 ); 285 setSpacing( 0 );
286 286
287 d = new FileSelectorPrivate(); 287 d = new FileSelectorPrivate();
288 d->newDocItem = 0; 288 d->newDocItem = 0;
289 d->showNew = newVisible; 289 d->showNew = newVisible;
290 d->catId = -2; // All files 290 d->catId = -2; // All files
291 291
292 d->toolbar = new QHBox( this ); 292 d->toolbar = new QHBox( this );
293 d->toolbar->setBackgroundMode( PaletteButton ); // same colour as toolbars 293 d->toolbar->setBackgroundMode( PaletteButton ); // same colour as toolbars
294 d->toolbar->setSpacing( 0 ); 294 d->toolbar->setSpacing( 0 );
295 d->toolbar->hide(); 295 d->toolbar->hide();
296 296
297 QWidget *spacer = new QWidget( d->toolbar ); 297 QWidget *spacer = new QWidget( d->toolbar );
298 spacer->setBackgroundMode( PaletteButton ); 298 spacer->setBackgroundMode( PaletteButton );
299 299
300 QToolButton *tb = new QToolButton( d->toolbar ); 300 QToolButton *tb = new QToolButton( d->toolbar );
301 tb->setPixmap( Resource::loadPixmap( "close" ) ); 301 tb->setPixmap( Resource::loadPixmap( "close" ) );
302 connect( tb, SIGNAL( clicked() ), this, SIGNAL( closeMe() ) ); 302 connect( tb, SIGNAL( clicked() ), this, SIGNAL( closeMe() ) );
303 buttonClose = tb; 303 buttonClose = tb;
304 tb->setFixedSize( 18, 20 ); // tb->sizeHint() ); 304 tb->setFixedSize( 18, 20 ); // tb->sizeHint() );
305 tb->setAutoRaise( TRUE ); 305 tb->setAutoRaise( TRUE );
306 QToolTip::add( tb, tr( "Close the File Selector" ) ); 306 QToolTip::add( tb, tr( "Close the File Selector" ) );
307 QPEMenuToolFocusManager::manager()->addWidget( tb ); 307 QPEMenuToolFocusManager::manager()->addWidget( tb );
308 308
309 view = new FileSelectorView( this, "fileview" ); 309 view = new FileSelectorView( this, "fileview" );
310 QPEApplication::setStylusOperation( view->viewport(), QPEApplication::RightOnHold ); 310 QPEApplication::setStylusOperation( view->viewport(), QPEApplication::RightOnHold );
311 connect( view, SIGNAL( mouseButtonClicked( int, QListViewItem *, const QPoint &, int ) ), 311 connect( view, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),
312 this, SLOT( fileClicked( int, QListViewItem *, const QPoint &, int ) ) ); 312 this, SLOT( fileClicked(int,QListViewItem*,const QPoint&,int) ) );
313 connect( view, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint &, int ) ), 313 connect( view, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
314 this, SLOT( filePressed( int, QListViewItem *, const QPoint &, int ) ) ); 314 this, SLOT( filePressed(int,QListViewItem*,const QPoint&,int) ) );
315 connect( view, SIGNAL( returnPressed( QListViewItem * ) ), 315 connect( view, SIGNAL( returnPressed(QListViewItem*) ),
316 this, SLOT( fileClicked( QListViewItem * ) ) ); 316 this, SLOT( fileClicked(QListViewItem*) ) );
317 317
318 QHBox *hb = new QHBox( this ); 318 QHBox *hb = new QHBox( this );
319 319
320 d->typeCombo = new TypeCombo( hb ); 320 d->typeCombo = new TypeCombo( hb );
321 connect( d->typeCombo, SIGNAL(selected(const QString&)), 321 connect( d->typeCombo, SIGNAL(selected(const QString&)),
322 this, SLOT(typeSelected(const QString&)) ); 322 this, SLOT(typeSelected(const QString&)) );
323 QWhatsThis::add( d->typeCombo, tr("Show documents of this type") ); 323 QWhatsThis::add( d->typeCombo, tr("Show documents of this type") );
324 324
325 Categories c; 325 Categories c;
326 c.load(categoryFileName()); 326 c.load(categoryFileName());
327 QArray<int> vl( 0 ); 327 QArray<int> vl( 0 );
328 d->catSelect = new CategorySelect( hb ); 328 d->catSelect = new CategorySelect( hb );
329 d->catSelect->setRemoveCategoryEdit( TRUE ); 329 d->catSelect->setRemoveCategoryEdit( TRUE );
330 d->catSelect->setCategories( vl, "Document View", tr("Document View") ); 330 d->catSelect->setCategories( vl, "Document View", tr("Document View") );
331 d->catSelect->setAllCategories( TRUE ); 331 d->catSelect->setAllCategories( TRUE );
332 connect( d->catSelect, SIGNAL(signalSelected(int)), this, SLOT(catSelected(int)) ); 332 connect( d->catSelect, SIGNAL(signalSelected(int)), this, SLOT(catSelected(int)) );
333 QWhatsThis::add( d->catSelect, tr("Show documents in this category") ); 333 QWhatsThis::add( d->catSelect, tr("Show documents in this category") );
334 334
335 setCloseVisible( closeVisible ); 335 setCloseVisible( closeVisible );
336 336
337 QCopChannel *channel = new QCopChannel( "QPE/Card", this ); 337 QCopChannel *channel = new QCopChannel( "QPE/Card", this );
338 connect( channel, SIGNAL(received(const QCString &, const QByteArray &)), 338 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
339 this, SLOT(cardMessage( const QCString &, const QByteArray &)) ); 339 this, SLOT(cardMessage(const QCString&,const QByteArray&)) );
340 340
341 reread(); 341 reread();
342 updateWhatsThis(); 342 updateWhatsThis();
343} 343}
344 344
345/*! 345/*!
346 Destroys the widget. 346 Destroys the widget.
347*/ 347*/
348FileSelector::~FileSelector() 348FileSelector::~FileSelector()
349{ 349{
350 delete d; 350 delete d;
351} 351}
352 352
353/*! 353/*!
354 Returns the number of files in the view. If this is zero, an editor 354 Returns the number of files in the view. If this is zero, an editor
355 application might bypass the selector and immediately start with 355 application might bypass the selector and immediately start with
356 a "new" document. 356 a "new" document.
357*/ 357*/
358int FileSelector::fileCount() 358int FileSelector::fileCount()
359{ 359{
360 return d->files.children().count();; 360 return d->files.children().count();;
361} 361}
362 362
363/*! 363/*!
364 Calling this function is the programmatic equivalent of the user 364 Calling this function is the programmatic equivalent of the user
365 pressing the "new" button. 365 pressing the "new" button.
366 366
367 \sa newSelected(), closeMe() 367 \sa newSelected(), closeMe()
368*/ 368*/
369void FileSelector::createNew() 369void FileSelector::createNew()
370{ 370{
371 DocLnk f; 371 DocLnk f;
372 emit newSelected( f ); 372 emit newSelected( f );
373 emit closeMe(); 373 emit closeMe();
374} 374}
375 375
376void FileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, int ) 376void FileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, int )
377{ 377{
378 if ( !i ) 378 if ( !i )
379 return; 379 return;
380 if ( button == Qt::LeftButton ) { 380 if ( button == Qt::LeftButton ) {
381 fileClicked( i ); 381 fileClicked( i );
382 } 382 }
383} 383}
384 384
385void FileSelector::filePressed( int button, QListViewItem *i, const QPoint &, int ) 385void FileSelector::filePressed( int button, QListViewItem *i, const QPoint &, int )
386{ 386{
387 if ( !i || i == d->newDocItem ) 387 if ( !i || i == d->newDocItem )
388 return; 388 return;
389 if ( button == Qt::RightButton ) { 389 if ( button == Qt::RightButton ) {
390 DocLnk l = ((FileSelectorItem *)i)->file(); 390 DocLnk l = ((FileSelectorItem *)i)->file();
391 LnkProperties prop( &l ); 391 LnkProperties prop( &l );
392 prop.showMaximized(); 392 prop.showMaximized();
393 prop.exec(); 393 prop.exec();
394 reread(); 394 reread();
395 } 395 }
396} 396}
397 397
398void FileSelector::fileClicked( QListViewItem *i ) 398void FileSelector::fileClicked( QListViewItem *i )
399{ 399{
400 if ( !i ) 400 if ( !i )
401 return; 401 return;
402 if ( i == d->newDocItem ) { 402 if ( i == d->newDocItem ) {
403 createNew(); 403 createNew();
diff --git a/library/finddialog.cpp b/library/finddialog.cpp
index 64487c9..9417179 100644
--- a/library/finddialog.cpp
+++ b/library/finddialog.cpp
@@ -1,84 +1,80 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the 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// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT 21// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT
22// have this class. 22// have this class.
23#define QTOPIA_INTERNAL_FD 23#define QTOPIA_INTERNAL_FD
24 24
25#include "finddialog.h" 25#include "finddialog.h"
26#include "findwidget_p.h" 26#include "findwidget_p.h"
27 27
28#include <qlayout.h> 28#include <qlayout.h>
29 29
30/*! 30/*!
31 \class FindDialog finddialog.h 31 \class FindDialog finddialog.h
32 \brief A simple FindDialog 32 \brief A simple FindDialog
33 33
34 A find dialog. FIXME!!!! 34 A find dialog. FIXME!!!!
35 35
36*/ 36*/
37FindDialog::FindDialog( const QString &appName, QWidget *parent, 37FindDialog::FindDialog( const QString &appName, QWidget *parent,
38 const char *name, bool modal ) 38 const char *name, bool modal )
39 : QDialog( parent, name, modal ) 39 : QDialog( parent, name, modal )
40{ 40{
41 setCaption( tr("Find") ); 41 setCaption( tr("Find") );
42 QVBoxLayout *vb; 42 QVBoxLayout *vb;
43 vb = new QVBoxLayout( this ); 43 vb = new QVBoxLayout( this );
44 fw = new FindWidget( appName, this, "Find Widget" ); 44 fw = new FindWidget( appName, this, "Find Widget" );
45 vb->addWidget( fw ); 45 vb->addWidget( fw );
46 QObject::connect( fw, SIGNAL(signalFindClicked(const QString&, 46 QObject::connect( fw, SIGNAL(signalFindClicked(const QString&,bool,bool,int)),
47 bool,bool,int)), 47 this, SIGNAL(signalFindClicked(const QString&,bool,bool,int)) );
48 this, SIGNAL(signalFindClicked(const QString&, 48 QObject::connect( fw, SIGNAL(signalFindClicked(const QString&,const QDate&,bool,bool,int)),
49 bool,bool,int)) ); 49 this, SIGNAL(signalFindClicked(const QString&,const QDate&,bool,bool,int)) );
50 QObject::connect( fw, SIGNAL(signalFindClicked(const QString&,const QDate&,
51 bool,bool,int)),
52 this, SIGNAL(signalFindClicked(const QString&,
53 const QDate&,bool,bool,int)) );
54 d = 0; 50 d = 0;
55} 51}
56 52
57FindDialog::~FindDialog() 53FindDialog::~FindDialog()
58{ 54{
59} 55}
60 56
61QString FindDialog::findText() const 57QString FindDialog::findText() const
62{ 58{
63 return fw->findText(); 59 return fw->findText();
64} 60}
65 61
66void FindDialog::setUseDate( bool show ) 62void FindDialog::setUseDate( bool show )
67{ 63{
68 fw->setUseDate( show ); 64 fw->setUseDate( show );
69} 65}
70 66
71void FindDialog::setDate( const QDate &dt ) 67void FindDialog::setDate( const QDate &dt )
72{ 68{
73 fw->setDate( dt ); 69 fw->setDate( dt );
74} 70}
75 71
76void FindDialog::slotNotFound() 72void FindDialog::slotNotFound()
77{ 73{
78 fw->slotNotFound(); 74 fw->slotNotFound();
79} 75}
80 76
81void FindDialog::slotWrapAround() 77void FindDialog::slotWrapAround()
82{ 78{
83 fw->slotWrapAround(); 79 fw->slotWrapAround();
84} 80}
diff --git a/library/findwidget_p.cpp b/library/findwidget_p.cpp
index e91d789..0591f07 100644
--- a/library/findwidget_p.cpp
+++ b/library/findwidget_p.cpp
@@ -1,114 +1,114 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the 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 "findwidget_p.h" 21#include "findwidget_p.h"
22 22
23#include <qpe/categoryselect.h> 23#include <qpe/categoryselect.h>
24#include <qpe/datebookmonth.h> 24#include <qpe/datebookmonth.h>
25 25
26#include <qcheckbox.h> 26#include <qcheckbox.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29 29
30FindWidget::FindWidget( const QString &appName, QWidget *parent, 30FindWidget::FindWidget( const QString &appName, QWidget *parent,
31 const char *name ) 31 const char *name )
32 : FindWidgetBase( parent, name ), 32 : FindWidgetBase( parent, name ),
33 mStrApp( appName ), 33 mStrApp( appName ),
34 mDate( QDate::currentDate() ) 34 mDate( QDate::currentDate() )
35{ 35{
36 setMaximumSize( sizeHint() ); 36 setMaximumSize( sizeHint() );
37 QArray<int> vl(0); 37 QArray<int> vl(0);
38 cmbCat->setCategories( vl, mStrApp ); 38 cmbCat->setCategories( vl, mStrApp );
39 cmbCat->setRemoveCategoryEdit( TRUE ); 39 cmbCat->setRemoveCategoryEdit( TRUE );
40 cmbCat->setAllCategories( TRUE ); 40 cmbCat->setAllCategories( TRUE );
41 // hide junk for the moment... 41 // hide junk for the moment...
42 lblStartDate->hide(); 42 lblStartDate->hide();
43 cmdStartDate->hide(); 43 cmdStartDate->hide();
44 QPopupMenu *m1 = new QPopupMenu( this ); 44 QPopupMenu *m1 = new QPopupMenu( this );
45 dtPicker = new DateBookMonth( m1, 0, TRUE ); 45 dtPicker = new DateBookMonth( m1, 0, TRUE );
46 dtPicker->setDate( mDate.year(), mDate.month(), mDate.day() ); 46 dtPicker->setDate( mDate.year(), mDate.month(), mDate.day() );
47 m1->insertItem( dtPicker ); 47 m1->insertItem( dtPicker );
48 cmdStartDate->setPopup( m1 ); 48 cmdStartDate->setPopup( m1 );
49 cmdStartDate->setText( TimeString::shortDate(mDate) ); 49 cmdStartDate->setText( TimeString::shortDate(mDate) );
50 QObject::connect( dtPicker, SIGNAL(dateClicked(int, int, int)), 50 QObject::connect( dtPicker, SIGNAL(dateClicked(int,int,int)),
51 this, SLOT(slotDateChanged(int, int, int)) ); 51 this, SLOT(slotDateChanged(int,int,int)) );
52 52
53 QObject::connect( cmdFind, SIGNAL(clicked()), 53 QObject::connect( cmdFind, SIGNAL(clicked()),
54 this, SLOT(slotFindClicked()) ); 54 this, SLOT(slotFindClicked()) );
55} 55}
56 56
57FindWidget::~FindWidget() 57FindWidget::~FindWidget()
58{ 58{
59} 59}
60 60
61QString FindWidget::findText() const 61QString FindWidget::findText() const
62{ 62{
63 return txtFind->text(); 63 return txtFind->text();
64} 64}
65 65
66void FindWidget::slotFindClicked() 66void FindWidget::slotFindClicked()
67{ 67{
68 lblStatus->setText( "" ); 68 lblStatus->setText( "" );
69 if ( cmdStartDate->isVisible() ) 69 if ( cmdStartDate->isVisible() )
70 emit signalFindClicked( findText(), 70 emit signalFindClicked( findText(),
71 mDate, 71 mDate,
72 chkCase->isChecked(), 72 chkCase->isChecked(),
73 chkBackwards->isChecked(), 73 chkBackwards->isChecked(),
74 cmbCat->currentCategory() ); 74 cmbCat->currentCategory() );
75 else 75 else
76 emit signalFindClicked( findText(), chkCase->isChecked(), 76 emit signalFindClicked( findText(), chkCase->isChecked(),
77 chkBackwards->isChecked(), 77 chkBackwards->isChecked(),
78 cmbCat->currentCategory() ); 78 cmbCat->currentCategory() );
79} 79}
80 80
81void FindWidget::setUseDate( bool show ) 81void FindWidget::setUseDate( bool show )
82{ 82{
83 if ( show ) { 83 if ( show ) {
84 lblStartDate->show(); 84 lblStartDate->show();
85 cmdStartDate->show(); 85 cmdStartDate->show();
86 } else { 86 } else {
87 lblStartDate->hide(); 87 lblStartDate->hide();
88 cmdStartDate->hide(); 88 cmdStartDate->hide();
89 } 89 }
90 chkBackwards->setDisabled( show ); 90 chkBackwards->setDisabled( show );
91} 91}
92 92
93void FindWidget::setDate( const QDate &dt ) 93void FindWidget::setDate( const QDate &dt )
94{ 94{
95 slotDateChanged( dt.year(), dt.month(), dt.day() ); 95 slotDateChanged( dt.year(), dt.month(), dt.day() );
96} 96}
97 97
98void FindWidget::slotNotFound() 98void FindWidget::slotNotFound()
99{ 99{
100 lblStatus->setText( tr("String Not Found.") ); 100 lblStatus->setText( tr("String Not Found.") );
101} 101}
102 102
103void FindWidget::slotWrapAround() 103void FindWidget::slotWrapAround()
104{ 104{
105 lblStatus->setText( tr("End reached, starting at %1", "Date using TimeString::shortDate") 105 lblStatus->setText( tr("End reached, starting at %1", "Date using TimeString::shortDate")
106 .arg(TimeString::shortDate( mDate ) ) ); 106 .arg(TimeString::shortDate( mDate ) ) );
107} 107}
108 108
109void FindWidget::slotDateChanged( int year, int month, int day ) 109void FindWidget::slotDateChanged( int year, int month, int day )
110{ 110{
111 mDate.setYMD( year, month, day ); 111 mDate.setYMD( year, month, day );
112 cmdStartDate->setText( TimeString::shortDate( mDate ) ); 112 cmdStartDate->setText( TimeString::shortDate( mDate ) );
113 dtPicker->setDate( year, month, day ); 113 dtPicker->setDate( year, month, day );
114} 114}
diff --git a/library/ir.cpp b/library/ir.cpp
index 32c0925..c581eb1 100644
--- a/library/ir.cpp
+++ b/library/ir.cpp
@@ -1,116 +1,116 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the 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 "ir.h" 21#include "ir.h"
22 22
23#include "qcopenvelope_qws.h" 23#include "qcopenvelope_qws.h"
24#include "applnk.h" 24#include "applnk.h"
25 25
26/*! 26/*!
27 \class Ir ir.h 27 \class Ir ir.h
28 \brief The Ir class implements basic support for sending objects over an 28 \brief The Ir class implements basic support for sending objects over an
29 infrared communication link. 29 infrared communication link.
30 30
31 Both \link doclnk.html DocLnk\endlink objects and files can be 31 Both \link doclnk.html DocLnk\endlink objects and files can be
32 sent to another device via the infrared link using the send() 32 sent to another device via the infrared link using the send()
33 function. When the send has completed the done() signal is 33 function. When the send has completed the done() signal is
34 emitted. 34 emitted.
35 35
36 The supported() function returns whether the device supports 36 The supported() function returns whether the device supports
37 infrared communication or not. 37 infrared communication or not.
38 38
39 \ingroup qtopiaemb 39 \ingroup qtopiaemb
40*/ 40*/
41 41
42/*! 42/*!
43 Constructs an Ir object. The \a parent and \a name classes are the 43 Constructs an Ir object. The \a parent and \a name classes are the
44 standard QObject parameters. 44 standard QObject parameters.
45*/ 45*/
46Ir::Ir( QObject *parent, const char *name ) 46Ir::Ir( QObject *parent, const char *name )
47 : QObject( parent, name ) 47 : QObject( parent, name )
48{ 48{
49#ifndef QT_NO_COP 49#ifndef QT_NO_COP
50 ch = new QCopChannel( "QPE/Obex" ); 50 ch = new QCopChannel( "QPE/Obex" );
51 connect( ch, SIGNAL(received(const QCString &, const QByteArray &)), 51 connect( ch, SIGNAL(received(const QCString&,const QByteArray&)),
52 this, SLOT(obexMessage( const QCString &, const QByteArray &)) ); 52 this, SLOT(obexMessage(const QCString&,const QByteArray&)) );
53#endif 53#endif
54} 54}
55 55
56/*! 56/*!
57 Returns TRUE if the system supports infrared communication; 57 Returns TRUE if the system supports infrared communication;
58 otherwise returns FALSE. 58 otherwise returns FALSE.
59*/ 59*/
60bool Ir::supported() 60bool Ir::supported()
61{ 61{
62#ifndef QT_NO_COP 62#ifndef QT_NO_COP
63 return QCopChannel::isRegistered( "QPE/Obex" ); 63 return QCopChannel::isRegistered( "QPE/Obex" );
64#endif 64#endif
65} 65}
66 66
67/*! 67/*!
68 Sends the object in file \a fn over the infrared link. The \a 68 Sends the object in file \a fn over the infrared link. The \a
69 description is used in the text shown to the user while sending 69 description is used in the text shown to the user while sending
70 is in progress. The optional \a mimetype parameter specifies the 70 is in progress. The optional \a mimetype parameter specifies the
71 mimetype of the object. If this parameter is not set, it is 71 mimetype of the object. If this parameter is not set, it is
72 determined by the the filename's suffix. 72 determined by the the filename's suffix.
73 73
74 \sa done() 74 \sa done()
75*/ 75*/
76void Ir::send( const QString &fn, const QString &description, const QString &mimetype) 76void Ir::send( const QString &fn, const QString &description, const QString &mimetype)
77{ 77{
78 if ( !filename.isEmpty() ) return; 78 if ( !filename.isEmpty() ) return;
79 filename = fn; 79 filename = fn;
80#ifndef QT_NO_COP 80#ifndef QT_NO_COP
81 QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)"); 81 QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)");
82 e << description << filename << mimetype; 82 e << description << filename << mimetype;
83#endif 83#endif
84} 84}
85 85
86/*! 86/*!
87 \overload 87 \overload
88 88
89 Uses the DocLnk::file() and DocLnk::type() of \a doc. 89 Uses the DocLnk::file() and DocLnk::type() of \a doc.
90 90
91 \sa done() 91 \sa done()
92*/ 92*/
93void Ir::send( const DocLnk &doc, const QString &description ) 93void Ir::send( const DocLnk &doc, const QString &description )
94{ 94{
95 send( doc.file(), description, doc.type() ); 95 send( doc.file(), description, doc.type() );
96} 96}
97 97
98/*! 98/*!
99 \fn Ir::done( Ir *ir ); 99 \fn Ir::done( Ir *ir );
100 100
101 This signal is emitted by \a ir, when the send comand has been processed. 101 This signal is emitted by \a ir, when the send comand has been processed.
102*/ 102*/
103 103
104/*!\internal 104/*!\internal
105 */ 105 */
106void Ir::obexMessage( const QCString &msg, const QByteArray &data) 106void Ir::obexMessage( const QCString &msg, const QByteArray &data)
107{ 107{
108 if ( msg == "done(QString)" ) { 108 if ( msg == "done(QString)" ) {
109 QString fn; 109 QString fn;
110 QDataStream stream( data, IO_ReadOnly ); 110 QDataStream stream( data, IO_ReadOnly );
111 stream >> fn; 111 stream >> fn;
112 if ( fn == filename ) 112 if ( fn == filename )
113 emit done( this ); 113 emit done( this );
114 } 114 }
115} 115}
116 116
diff --git a/library/network.cpp b/library/network.cpp
index 991e11a..df28857 100644
--- a/library/network.cpp
+++ b/library/network.cpp
@@ -100,130 +100,130 @@ void Network::writeProxySettings( Config &cfg )
100*/ 100*/
101void Network::stop() 101void Network::stop()
102{ 102{
103 QCopEnvelope e("QPE/Network", "stop()"); 103 QCopEnvelope e("QPE/Network", "stop()");
104} 104}
105 105
106static NetworkEmitter *emitter = 0; 106static NetworkEmitter *emitter = 0;
107 107
108/*! 108/*!
109 \internal 109 \internal
110*/ 110*/
111void Network::connectChoiceChange(QObject* receiver, const char* slot) 111void Network::connectChoiceChange(QObject* receiver, const char* slot)
112{ 112{
113 if ( !emitter ) 113 if ( !emitter )
114 emitter = new NetworkEmitter; 114 emitter = new NetworkEmitter;
115 QObject::connect(emitter,SIGNAL(changed()),receiver,slot); 115 QObject::connect(emitter,SIGNAL(changed()),receiver,slot);
116} 116}
117 117
118 #endif// QT_NO_COP 118 #endif// QT_NO_COP
119/*! 119/*!
120 \internal 120 \internal
121*/ 121*/
122QString Network::settingsDir() 122QString Network::settingsDir()
123{ 123{
124 return Global::applicationFileName("Network", "modules"); 124 return Global::applicationFileName("Network", "modules");
125} 125}
126 126
127#ifndef QT_NO_COP 127#ifndef QT_NO_COP
128/*! 128/*!
129 \internal 129 \internal
130*/ 130*/
131QStringList Network::choices(QListBox* lb, const QString& dir) 131QStringList Network::choices(QListBox* lb, const QString& dir)
132{ 132{
133 QStringList list; 133 QStringList list;
134 134
135 if ( lb ) 135 if ( lb )
136 lb->clear(); 136 lb->clear();
137 137
138 QString adir = dir.isEmpty() ? settingsDir() : dir; 138 QString adir = dir.isEmpty() ? settingsDir() : dir;
139 QDir settingsdir(adir); 139 QDir settingsdir(adir);
140 settingsdir.mkdir(adir); 140 settingsdir.mkdir(adir);
141 141
142 QStringList files = settingsdir.entryList("*.conf"); 142 QStringList files = settingsdir.entryList("*.conf");
143 for (QStringList::ConstIterator it=files.begin(); it!=files.end(); ++it ) { 143 for (QStringList::ConstIterator it=files.begin(); it!=files.end(); ++it ) {
144 QString filename = settingsdir.filePath(*it); 144 QString filename = settingsdir.filePath(*it);
145 Config cfg(filename, Config::File); 145 Config cfg(filename, Config::File);
146 cfg.setGroup("Info"); 146 cfg.setGroup("Info");
147 if ( lb ) 147 if ( lb )
148 lb->insertItem(Resource::loadPixmap("Network/" + cfg.readEntry("Type")), 148 lb->insertItem(Resource::loadPixmap("Network/" + cfg.readEntry("Type")),
149 cfg.readEntry("Name")); 149 cfg.readEntry("Name"));
150 list.append(filename); 150 list.append(filename);
151 } 151 }
152 152
153 return list; 153 return list;
154} 154}
155 155
156class NetworkServer : public QCopChannel { 156class NetworkServer : public QCopChannel {
157 Q_OBJECT 157 Q_OBJECT
158public: 158public:
159 NetworkServer(QObject* parent) : QCopChannel("QPE/Network",parent), wait(0) 159 NetworkServer(QObject* parent) : QCopChannel("QPE/Network",parent), wait(0)
160 { 160 {
161 up = FALSE; 161 up = FALSE;
162 examineNetworks( TRUE ); 162 examineNetworks( TRUE );
163 QCopChannel* card = new QCopChannel("QPE/Card",parent); 163 QCopChannel* card = new QCopChannel("QPE/Card",parent);
164 connect(card,SIGNAL(received(const QCString &, const QByteArray&)), 164 connect(card,SIGNAL(received(const QCString&,const QByteArray&)),
165 this,SLOT(cardMessage(const QCString &, const QByteArray&))); 165 this,SLOT(cardMessage(const QCString&,const QByteArray&)));
166 } 166 }
167 167
168 ~NetworkServer() 168 ~NetworkServer()
169 { 169 {
170 stop(); 170 stop();
171 } 171 }
172 172
173 bool networkOnline() const 173 bool networkOnline() const
174 { 174 {
175 return up; 175 return up;
176 } 176 }
177 177
178private: 178private:
179 void receive(const QCString &msg, const QByteArray& data) 179 void receive(const QCString &msg, const QByteArray& data)
180 { 180 {
181 if ( msg == "start(QString,QString)" ) { 181 if ( msg == "start(QString,QString)" ) {
182 QDataStream stream(data,IO_ReadOnly); 182 QDataStream stream(data,IO_ReadOnly);
183 QString file,password; 183 QString file,password;
184 stream >> file >> password; 184 stream >> file >> password;
185 if ( file.isEmpty() ) { 185 if ( file.isEmpty() ) {
186 QStringList l = Network::choices(); 186 QStringList l = Network::choices();
187 for (QStringList::ConstIterator i=l.begin(); i!=l.end(); ++i) { 187 for (QStringList::ConstIterator i=l.begin(); i!=l.end(); ++i) {
188 Config cfg(*i,Config::File); 188 Config cfg(*i,Config::File);
189 cfg.setGroup("Info"); 189 cfg.setGroup("Info");
190 QString type = cfg.readEntry("Type"); 190 QString type = cfg.readEntry("Type");
191 NetworkInterface* plugin = Network::loadPlugin(type); 191 NetworkInterface* plugin = Network::loadPlugin(type);
192 cfg.setGroup("Properties"); 192 cfg.setGroup("Properties");
193 if ( plugin && plugin->isAvailable(cfg) ) { 193 if ( plugin && plugin->isAvailable(cfg) ) {
194 file = *i; 194 file = *i;
195 break; 195 break;
196 } 196 }
197 } 197 }
198 if ( file.isEmpty() ) { 198 if ( file.isEmpty() ) {
199 QCopEnvelope("QPE/Network", "failed()"); 199 QCopEnvelope("QPE/Network", "failed()");
200 return; 200 return;
201 } 201 }
202 } 202 }
203 start(file,password); 203 start(file,password);
204 } else if ( msg == "stop()" ) { 204 } else if ( msg == "stop()" ) {
205 stop(); 205 stop();
206 } else if ( msg == "choicesChanged()" ) { 206 } else if ( msg == "choicesChanged()" ) {
207 examineNetworks(); 207 examineNetworks();
208 } 208 }
209 } 209 }
210 210
211private slots: 211private slots:
212 void cardMessage(const QCString &msg, const QByteArray&) 212 void cardMessage(const QCString &msg, const QByteArray&)
213 { 213 {
214 if ( msg == "stabChanged()" ) 214 if ( msg == "stabChanged()" )
215 examineNetworks(); 215 examineNetworks();
216 } 216 }
217 217
218private: 218private:
219 void examineNetworks( bool firstStart = FALSE ) 219 void examineNetworks( bool firstStart = FALSE )
220 { 220 {
221 QStringList l = Network::choices(); 221 QStringList l = Network::choices();
222 bool wasup = up; up=FALSE; 222 bool wasup = up; up=FALSE;
223 QStringList pavailable = available; 223 QStringList pavailable = available;
224 available.clear(); 224 available.clear();
225 for (QStringList::ConstIterator it=l.begin(); it!=l.end(); ++it) { 225 for (QStringList::ConstIterator it=l.begin(); it!=l.end(); ++it) {
226 Config cfg(*it,Config::File); 226 Config cfg(*it,Config::File);
227 cfg.setGroup("Info"); 227 cfg.setGroup("Info");
228 QString type = cfg.readEntry("Type"); 228 QString type = cfg.readEntry("Type");
229 NetworkInterface* plugin = Network::loadPlugin(type); 229 NetworkInterface* plugin = Network::loadPlugin(type);
diff --git a/library/qcopenvelope_qws.cpp b/library/qcopenvelope_qws.cpp
index 8f58787..63efb13 100644
--- a/library/qcopenvelope_qws.cpp
+++ b/library/qcopenvelope_qws.cpp
@@ -7,130 +7,130 @@
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#ifndef QT_NO_COP 21#ifndef QT_NO_COP
22#include "qcopenvelope_qws.h" 22#include "qcopenvelope_qws.h"
23#endif 23#endif
24#include <qbuffer.h> 24#include <qbuffer.h>
25#include <qfile.h> 25#include <qfile.h>
26#include <unistd.h> 26#include <unistd.h>
27#include <errno.h> 27#include <errno.h>
28#include <sys/file.h> 28#include <sys/file.h>
29#include <sys/types.h> 29#include <sys/types.h>
30#include <sys/stat.h> 30#include <sys/stat.h>
31#include <time.h> 31#include <time.h>
32 32
33#ifndef QT_NO_COP 33#ifndef QT_NO_COP
34 34
35/*! 35/*!
36 \class QCopEnvelope qcopenvelope_qws.h 36 \class QCopEnvelope qcopenvelope_qws.h
37 \brief The QCopEnvelope class encapsulates and sends QCop messages 37 \brief The QCopEnvelope class encapsulates and sends QCop messages
38 over QCopChannels. 38 over QCopChannels.
39 39
40 QCop messages allow applications to communicate with each other. 40 QCop messages allow applications to communicate with each other.
41 These messages are sent using QCopEnvelope, and received by connecting 41 These messages are sent using QCopEnvelope, and received by connecting
42 to a QCopChannel. 42 to a QCopChannel.
43 43
44 To send a message, use the following protocol: 44 To send a message, use the following protocol:
45 45
46 \code 46 \code
47 QCopEnvelope e(channelname, messagename); 47 QCopEnvelope e(channelname, messagename);
48 e << parameter1 << parameter2 << ...; 48 e << parameter1 << parameter2 << ...;
49 \endcode 49 \endcode
50 50
51 For messages without parameters, simply use: 51 For messages without parameters, simply use:
52 52
53 \code 53 \code
54 QCopEnvelope e(channelname, messagename); 54 QCopEnvelope e(channelname, messagename);
55 \endcode 55 \endcode
56 56
57 (Do not try to simplify this further as it may confuse some 57 (Do not try to simplify this further as it may confuse some
58 compilers.) 58 compilers.)
59 59
60 The \c{channelname} of channels within Qtopia all start with "QPE/". 60 The \c{channelname} of channels within Qtopia all start with "QPE/".
61 The \c{messagename} is a function identifier followed by a list of types 61 The \c{messagename} is a function identifier followed by a list of types
62 in parentheses. There is no whitespace in the message name. 62 in parentheses. There is no whitespace in the message name.
63 63
64 To receive a message, you will generally just use your application's 64 To receive a message, you will generally just use your application's
65 predefined QPE/Application/\e{appname} channel 65 predefined QPE/Application/\e{appname} channel
66 (see QPEApplication::appMessage()), but you can make another channel 66 (see QPEApplication::appMessage()), but you can make another channel
67 and connect it to a slot like this: 67 and connect it to a slot like this:
68 68
69 \code 69 \code
70 myChannel = new QCopChannel( "QPE/FooBar", this ); 70 myChannel = new QCopChannel( "QPE/FooBar", this );
71 connect( myChannel, SIGNAL(received(const QCString &, const QByteArray &)), 71 connect( myChannel, SIGNAL(received(const QCString&,const QByteArray&)),
72 this, SLOT(fooBarMessage( const QCString &, const QByteArray &)) ); 72 this, SLOT(fooBarMessage(const QCString&,const QByteArray&)) );
73 \endcode 73 \endcode
74 74
75 See also, the \link qcop.html list of Qtopia messages\endlink. 75 See also, the \link qcop.html list of Qtopia messages\endlink.
76*/ 76*/
77 77
78/*! 78/*!
79 Constructs a QCopEnvelope that will write \a message to \a channel. 79 Constructs a QCopEnvelope that will write \a message to \a channel.
80 If \a message has parameters, you must then use operator<<() to 80 If \a message has parameters, you must then use operator<<() to
81 add these parameters to the envelope. 81 add these parameters to the envelope.
82*/ 82*/
83QCopEnvelope::QCopEnvelope( const QCString& channel, const QCString& message ) : 83QCopEnvelope::QCopEnvelope( const QCString& channel, const QCString& message ) :
84 QDataStream(new QBuffer), 84 QDataStream(new QBuffer),
85 ch(channel), msg(message) 85 ch(channel), msg(message)
86{ 86{
87 device()->open(IO_WriteOnly); 87 device()->open(IO_WriteOnly);
88} 88}
89 89
90/*! 90/*!
91 Writes the message and then destroys the QCopEnvelope. 91 Writes the message and then destroys the QCopEnvelope.
92*/ 92*/
93QCopEnvelope::~QCopEnvelope() 93QCopEnvelope::~QCopEnvelope()
94{ 94{
95 QByteArray data = ((QBuffer*)device())->buffer(); 95 QByteArray data = ((QBuffer*)device())->buffer();
96 const int pref=16; 96 const int pref=16;
97 if ( qstrncmp(ch.data(),"QPE/Application/",pref)==0 ) { 97 if ( qstrncmp(ch.data(),"QPE/Application/",pref)==0 ) {
98 QString qcopfn("/tmp/qcop-msg-"); 98 QString qcopfn("/tmp/qcop-msg-");
99 qcopfn += ch.mid(pref); 99 qcopfn += ch.mid(pref);
100 QFile qcopfile(qcopfn); 100 QFile qcopfile(qcopfn);
101 101
102 if ( qcopfile.open(IO_WriteOnly | IO_Append) ) { 102 if ( qcopfile.open(IO_WriteOnly | IO_Append) ) {
103#ifndef Q_OS_WIN32 103#ifndef Q_OS_WIN32
104 if(flock(qcopfile.handle(), LOCK_EX)) { 104 if(flock(qcopfile.handle(), LOCK_EX)) {
105 /* some error occurred */ 105 /* some error occurred */
106 qWarning(QString("Failed to obtain file lock on %1 (%2)") 106 qWarning(QString("Failed to obtain file lock on %1 (%2)")
107 .arg(qcopfn).arg( errno )); 107 .arg(qcopfn).arg( errno ));
108 } 108 }
109#endif 109#endif
110 { 110 {
111 QDataStream ds(&qcopfile); 111 QDataStream ds(&qcopfile);
112 ds << ch << msg << data; 112 ds << ch << msg << data;
113 qcopfile.flush(); 113 qcopfile.flush();
114#ifndef Q_OS_WIN32 114#ifndef Q_OS_WIN32
115 flock(qcopfile.handle(), LOCK_UN); 115 flock(qcopfile.handle(), LOCK_UN);
116#endif 116#endif
117 qcopfile.close(); 117 qcopfile.close();
118 } 118 }
119 119
120 QByteArray b; 120 QByteArray b;
121 QDataStream stream(b, IO_WriteOnly); 121 QDataStream stream(b, IO_WriteOnly);
122 stream << QString(ch.mid(pref)); 122 stream << QString(ch.mid(pref));
123 QCopChannel::send("QPE/Server", "processQCop(QString)", b); 123 QCopChannel::send("QPE/Server", "processQCop(QString)", b);
124 delete device(); 124 delete device();
125 return; 125 return;
126 } else { 126 } else {
127 qWarning(QString("Failed to open file %1") 127 qWarning(QString("Failed to open file %1")
128 .arg(qcopfn)); 128 .arg(qcopfn));
129 } // endif open 129 } // endif open
130 } 130 }
131 else if (qstrncmp(ch.data(), "QPE/SOAP/", 9) == 0) { 131 else if (qstrncmp(ch.data(), "QPE/SOAP/", 9) == 0) {
132 // If this is a message that should go along the SOAP channel, we move the 132 // If this is a message that should go along the SOAP channel, we move the
133 // endpoint URL to the data section. 133 // endpoint URL to the data section.
134 QString endpoint = ch.mid(9); 134 QString endpoint = ch.mid(9);
135 135
136 ch = "QPE/SOAP"; 136 ch = "QPE/SOAP";
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 262221e..c339a78 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -567,253 +567,253 @@ void QPEApplication::processQCopFile()
567 567
568 The slot to which you connect this signal uses \a msg and \a data 568 The slot to which you connect this signal uses \a msg and \a data
569 in the following way: 569 in the following way:
570 570
571\code 571\code
572 void MyWidget::receive( const QCString& msg, const QByteArray& data ) 572 void MyWidget::receive( const QCString& msg, const QByteArray& data )
573 { 573 {
574 QDataStream stream( data, IO_ReadOnly ); 574 QDataStream stream( data, IO_ReadOnly );
575 if ( msg == "someMessage(int,int,int)" ) { 575 if ( msg == "someMessage(int,int,int)" ) {
576 int a,b,c; 576 int a,b,c;
577 stream >> a >> b >> c; 577 stream >> a >> b >> c;
578 ... 578 ...
579 } else if ( msg == "otherMessage(QString)" ) { 579 } else if ( msg == "otherMessage(QString)" ) {
580 ... 580 ...
581 } 581 }
582 } 582 }
583\endcode 583\endcode
584 584
585 \sa qcop.html 585 \sa qcop.html
586 Note that messages received here may be processed by qpe application 586 Note that messages received here may be processed by qpe application
587 and emitted as signals, such as flush() and reload(). 587 and emitted as signals, such as flush() and reload().
588*/ 588*/
589 589
590/*! 590/*!
591 Constructs a QPEApplication just as you would construct 591 Constructs a QPEApplication just as you would construct
592 a QApplication, passing \a argc, \a argv, and \a t. 592 a QApplication, passing \a argc, \a argv, and \a t.
593 593
594 For applications, \a t should be the default, GuiClient. Only 594 For applications, \a t should be the default, GuiClient. Only
595 the Qtopia server passes GuiServer. 595 the Qtopia server passes GuiServer.
596*/ 596*/
597QPEApplication::QPEApplication( int & argc, char **argv, Type t ) 597QPEApplication::QPEApplication( int & argc, char **argv, Type t )
598 : QApplication( hack(argc), argv, t ), pidChannel( 0 ) 598 : QApplication( hack(argc), argv, t ), pidChannel( 0 )
599{ 599{
600 QPixmapCache::setCacheLimit(256); // sensible default for smaller devices. 600 QPixmapCache::setCacheLimit(256); // sensible default for smaller devices.
601 601
602 d = new QPEApplicationData; 602 d = new QPEApplicationData;
603 d->loadTextCodecs(); 603 d->loadTextCodecs();
604 d->loadImageCodecs(); 604 d->loadImageCodecs();
605 int dw = desktop() ->width(); 605 int dw = desktop() ->width();
606 606
607 if ( dw < 200 ) { 607 if ( dw < 200 ) {
608 setFont( QFont( "vera", 8 ) ); 608 setFont( QFont( "vera", 8 ) );
609 AppLnk::setSmallIconSize( 10 ); 609 AppLnk::setSmallIconSize( 10 );
610 AppLnk::setBigIconSize( 28 ); 610 AppLnk::setBigIconSize( 28 );
611 } 611 }
612#if defined(OPIE_HIGH_RES_SMALL_PHY) 612#if defined(OPIE_HIGH_RES_SMALL_PHY)
613 else if ( dw > 600 ) { 613 else if ( dw > 600 ) {
614 setFont( QFont( "vera", 16 ) ); 614 setFont( QFont( "vera", 16 ) );
615 AppLnk::setSmallIconSize( 24 ); 615 AppLnk::setSmallIconSize( 24 );
616 AppLnk::setBigIconSize( 48 ); 616 AppLnk::setBigIconSize( 48 );
617 } 617 }
618#endif 618#endif
619 else if ( dw > 200 ) { 619 else if ( dw > 200 ) {
620 setFont( QFont( "vera", 10 ) ); 620 setFont( QFont( "vera", 10 ) );
621 AppLnk::setSmallIconSize( 14 ); 621 AppLnk::setSmallIconSize( 14 );
622 AppLnk::setBigIconSize( 32 ); 622 AppLnk::setBigIconSize( 32 );
623 } 623 }
624 624
625 QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); 625 QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory );
626 626
627 connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); 627 connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) );
628 628
629 629
630 sysChannel = new QCopChannel( "QPE/System", this ); 630 sysChannel = new QCopChannel( "QPE/System", this );
631 connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), 631 connect( sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
632 this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); 632 this, SLOT( systemMessage(const QCString&,const QByteArray&) ) );
633 633
634/* COde now in initapp */ 634/* COde now in initapp */
635#if 0 635#if 0
636#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 636#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
637 637
638 QString qcopfn( "/tmp/qcop-msg-" ); 638 QString qcopfn( "/tmp/qcop-msg-" );
639 qcopfn += QString( argv[ 0 ] ); // append command name 639 qcopfn += QString( argv[ 0 ] ); // append command name
640 640
641 QFile f( qcopfn ); 641 QFile f( qcopfn );
642 if ( f.open( IO_ReadOnly ) ) { 642 if ( f.open( IO_ReadOnly ) ) {
643 flock( f.handle(), LOCK_EX ); 643 flock( f.handle(), LOCK_EX );
644 } 644 }
645 645
646 646
647 647
648 QCString channel = QCString( argv[ 0 ] ); 648 QCString channel = QCString( argv[ 0 ] );
649 channel.replace( QRegExp( ".*/" ), "" ); 649 channel.replace( QRegExp( ".*/" ), "" );
650 d->appName = channel; 650 d->appName = channel;
651 channel = "QPE/Application/" + channel; 651 channel = "QPE/Application/" + channel;
652 pidChannel = new QCopChannel( channel, this ); 652 pidChannel = new QCopChannel( channel, this );
653 connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), 653 connect( pidChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
654 this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); 654 this, SLOT( pidMessage(const QCString&,const QByteArray&) ) );
655 655
656 if ( f.isOpen() ) { 656 if ( f.isOpen() ) {
657 d->keep_running = FALSE; 657 d->keep_running = FALSE;
658 QDataStream ds( &f ); 658 QDataStream ds( &f );
659 QCString channel, message; 659 QCString channel, message;
660 QByteArray data; 660 QByteArray data;
661 while ( !ds.atEnd() ) { 661 while ( !ds.atEnd() ) {
662 ds >> channel >> message >> data; 662 ds >> channel >> message >> data;
663 d->enqueueQCop( channel, message, data ); 663 d->enqueueQCop( channel, message, data );
664 } 664 }
665 665
666 flock( f.handle(), LOCK_UN ); 666 flock( f.handle(), LOCK_UN );
667 f.close(); 667 f.close();
668 f.remove(); 668 f.remove();
669 } 669 }
670 670
671 for ( int a = 0; a < argc; a++ ) { 671 for ( int a = 0; a < argc; a++ ) {
672 if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { 672 if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) {
673 argv[ a ] = argv[ a + 1 ]; 673 argv[ a ] = argv[ a + 1 ];
674 a++; 674 a++;
675 d->preloaded = TRUE; 675 d->preloaded = TRUE;
676 argc -= 1; 676 argc -= 1;
677 } 677 }
678 else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { 678 else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) {
679 argv[ a ] = argv[ a + 1 ]; 679 argv[ a ] = argv[ a + 1 ];
680 a++; 680 a++;
681 d->preloaded = TRUE; 681 d->preloaded = TRUE;
682 d->forceshow = TRUE; 682 d->forceshow = TRUE;
683 argc -= 1; 683 argc -= 1;
684 } 684 }
685 } 685 }
686 686
687 /* overide stored arguments */ 687 /* overide stored arguments */
688 setArgs( argc, argv ); 688 setArgs( argc, argv );
689 689
690#endif 690#endif
691#else 691#else
692 initApp( argc, argv ); 692 initApp( argc, argv );
693#endif 693#endif
694 // qwsSetDecoration( new QPEDecoration() ); 694 // qwsSetDecoration( new QPEDecoration() );
695 695
696#ifndef QT_NO_TRANSLATION 696#ifndef QT_NO_TRANSLATION
697 697
698 d->langs = Global::languageList(); 698 d->langs = Global::languageList();
699 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) { 699 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) {
700 QString lang = *it; 700 QString lang = *it;
701 701
702 installTranslation( lang + "/libopie.qm"); 702 installTranslation( lang + "/libopie.qm");
703 installTranslation( lang + "/libqpe.qm" ); 703 installTranslation( lang + "/libqpe.qm" );
704 installTranslation( lang + "/" + d->appName + ".qm" ); 704 installTranslation( lang + "/" + d->appName + ".qm" );
705 705
706 706
707 //###language/font hack; should look it up somewhere 707 //###language/font hack; should look it up somewhere
708#ifdef QWS 708#ifdef QWS
709 709
710 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { 710 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) {
711 QFont fn = FontManager::unicodeFont( FontManager::Proportional ); 711 QFont fn = FontManager::unicodeFont( FontManager::Proportional );
712 setFont( fn ); 712 setFont( fn );
713 } 713 }
714#endif 714#endif
715 } 715 }
716#endif 716#endif
717 717
718 applyStyle(); 718 applyStyle();
719 719
720 if ( type() == GuiServer ) { 720 if ( type() == GuiServer ) {
721 setVolume(); 721 setVolume();
722 } 722 }
723 723
724 installEventFilter( this ); 724 installEventFilter( this );
725 725
726 QPEMenuToolFocusManager::initialize(); 726 QPEMenuToolFocusManager::initialize();
727 727
728#ifdef QT_NO_QWS_CURSOR 728#ifdef QT_NO_QWS_CURSOR
729 // if we have no cursor, probably don't want tooltips 729 // if we have no cursor, probably don't want tooltips
730 QToolTip::setEnabled( FALSE ); 730 QToolTip::setEnabled( FALSE );
731#endif 731#endif
732} 732}
733 733
734 734
735#ifdef QTOPIA_INTERNAL_INITAPP 735#ifdef QTOPIA_INTERNAL_INITAPP
736void QPEApplication::initApp( int argc, char **argv ) 736void QPEApplication::initApp( int argc, char **argv )
737{ 737{
738 delete pidChannel; 738 delete pidChannel;
739 d->keep_running = TRUE; 739 d->keep_running = TRUE;
740 d->preloaded = FALSE; 740 d->preloaded = FALSE;
741 d->forceshow = FALSE; 741 d->forceshow = FALSE;
742 742
743 QCString channel = QCString(argv[0]); 743 QCString channel = QCString(argv[0]);
744 744
745 channel.replace(QRegExp(".*/"),""); 745 channel.replace(QRegExp(".*/"),"");
746 d->appName = channel; 746 d->appName = channel;
747 747
748 #if QT_VERSION > 235 748 #if QT_VERSION > 235
749 qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 749 qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6
750 #endif 750 #endif
751 751
752 channel = "QPE/Application/" + channel; 752 channel = "QPE/Application/" + channel;
753 pidChannel = new QCopChannel( channel, this); 753 pidChannel = new QCopChannel( channel, this);
754 connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), 754 connect( pidChannel, SIGNAL(received(const QCString&,const QByteArray&)),
755 this, SLOT(pidMessage(const QCString &, const QByteArray &))); 755 this, SLOT(pidMessage(const QCString&,const QByteArray&)));
756 756
757 757
758 758
759 processQCopFile(); 759 processQCopFile();
760 d->keep_running = d->qcopq.isEmpty(); 760 d->keep_running = d->qcopq.isEmpty();
761 761
762 for (int a=0; a<argc; a++) { 762 for (int a=0; a<argc; a++) {
763 if ( qstrcmp(argv[a],"-preload")==0 ) { 763 if ( qstrcmp(argv[a],"-preload")==0 ) {
764 argv[a] = argv[a+1]; 764 argv[a] = argv[a+1];
765 a++; 765 a++;
766 d->preloaded = TRUE; 766 d->preloaded = TRUE;
767 argc-=1; 767 argc-=1;
768 } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { 768 } else if ( qstrcmp(argv[a],"-preload-show")==0 ) {
769 argv[a] = argv[a+1]; 769 argv[a] = argv[a+1];
770 a++; 770 a++;
771 d->preloaded = TRUE; 771 d->preloaded = TRUE;
772 d->forceshow = TRUE; 772 d->forceshow = TRUE;
773 argc-=1; 773 argc-=1;
774 } 774 }
775 } 775 }
776 776
777 /* overide stored arguments */ 777 /* overide stored arguments */
778 setArgs(argc, argv); 778 setArgs(argc, argv);
779 779
780 /* install translation here */ 780 /* install translation here */
781 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) 781 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it )
782 installTranslation( (*it) + "/" + d->appName + ".qm" ); 782 installTranslation( (*it) + "/" + d->appName + ".qm" );
783} 783}
784#endif 784#endif
785 785
786 786
787static QPtrDict<void>* inputMethodDict = 0; 787static QPtrDict<void>* inputMethodDict = 0;
788static void createInputMethodDict() 788static void createInputMethodDict()
789{ 789{
790 if ( !inputMethodDict ) 790 if ( !inputMethodDict )
791 inputMethodDict = new QPtrDict<void>; 791 inputMethodDict = new QPtrDict<void>;
792} 792}
793 793
794/*! 794/*!
795 Returns the currently set hint to the system as to whether 795 Returns the currently set hint to the system as to whether
796 widget \a w has any use for text input methods. 796 widget \a w has any use for text input methods.
797 797
798 798
799 \sa setInputMethodHint() InputMethodHint 799 \sa setInputMethodHint() InputMethodHint
800*/ 800*/
801QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) 801QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w )
802{ 802{
803 if ( inputMethodDict && w ) 803 if ( inputMethodDict && w )
804 return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); 804 return ( InputMethodHint ) ( int ) inputMethodDict->find( w );
805 return Normal; 805 return Normal;
806} 806}
807 807
808/*! 808/*!
809 \enum QPEApplication::InputMethodHint 809 \enum QPEApplication::InputMethodHint
810 810
811 \value Normal the application sometimes needs text input (the default). 811 \value Normal the application sometimes needs text input (the default).
812 \value AlwaysOff the application never needs text input. 812 \value AlwaysOff the application never needs text input.
813 \value AlwaysOn the application always needs text input. 813 \value AlwaysOn the application always needs text input.
814*/ 814*/
815 815
816/*! 816/*!
817 Hints to the system that widget \a w has use for text input methods 817 Hints to the system that widget \a w has use for text input methods
818 as specified by \a mode. 818 as specified by \a mode.
819 819
diff --git a/library/qpedialog.cpp b/library/qpedialog.cpp
index ac42972..da461b7 100644
--- a/library/qpedialog.cpp
+++ b/library/qpedialog.cpp
@@ -1,74 +1,74 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the 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#define protected public 21#define protected public
22#include <qdialog.h> 22#include <qdialog.h>
23#undef protected 23#undef protected
24 24
25#include "qpedialog.h" 25#include "qpedialog.h"
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27 27
28 28
29/** 29/**
30 * \brief This is the only c'tor. 30 * \brief This is the only c'tor.
31 * 31 *
32 * The parent of this Listener is the Dialog you pass. This means once 32 * The parent of this Listener is the Dialog you pass. This means once
33 * the dialog is deleted this listener will be deleted too. 33 * the dialog is deleted this listener will be deleted too.
34 * This Listener listens on QPEApplication::appMessage signal and implements 34 * This Listener listens on QPEApplication::appMessage signal and implements
35 * accept() and reject(). 35 * accept() and reject().
36 * 36 *
37 * \code 37 * \code
38 *QDialog *dialog = new YourDialog(); 38 *QDialog *dialog = new YourDialog();
39 (void)new QPEDialogListener(dialog); 39 (void)new QPEDialogListener(dialog);
40 if( QPEApplication::execDialog(dialog) == QDialog::Accept ){ 40 if( QPEApplication::execDialog(dialog) == QDialog::Accept ){
41 // do some stuff 41 // do some stuff
42 } 42 }
43 delete dialog; 43 delete dialog;
44 44
45 * \endcode 45 * \endcode
46 * 46 *
47 * @param di The dialog to handle 47 * @param di The dialog to handle
48 */ 48 */
49QPEDialogListener::QPEDialogListener(QDialog *di ) : QObject(di) 49QPEDialogListener::QPEDialogListener(QDialog *di ) : QObject(di)
50{ 50{
51 dialog = di; 51 dialog = di;
52 connect(qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), 52 connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)),
53 this, SLOT(appMessage(const QCString&, const QByteArray&)) ); 53 this, SLOT(appMessage(const QCString&,const QByteArray&)) );
54} 54}
55 55
56 56
57/** 57/**
58 * d'tor 58 * d'tor
59 */ 59 */
60QPEDialogListener::~QPEDialogListener() {} 60QPEDialogListener::~QPEDialogListener() {}
61 61
62/** 62/**
63 * \internal 63 * \internal
64 */ 64 */
65void QPEDialogListener::appMessage( const QCString &msg, const QByteArray & ) 65void QPEDialogListener::appMessage( const QCString &msg, const QByteArray & )
66{ 66{
67 if (!dialog) 67 if (!dialog)
68 return; 68 return;
69 if (msg == "accept()") { 69 if (msg == "accept()") {
70 dialog->accept(); 70 dialog->accept();
71 } else if (msg == "reject()") { 71 } else if (msg == "reject()") {
72 dialog->reject(); 72 dialog->reject();
73 } 73 }
74} 74}
diff --git a/library/storage.cpp b/library/storage.cpp
index 0ea465b..fcee689 100644
--- a/library/storage.cpp
+++ b/library/storage.cpp
@@ -34,130 +34,130 @@
34#ifdef Q_OS_MACX 34#ifdef Q_OS_MACX
35# include <sys/param.h> 35# include <sys/param.h>
36# include <sys/ucred.h> 36# include <sys/ucred.h>
37# include <sys/mount.h> 37# include <sys/mount.h>
38# include <stdio.h> // For strerror() 38# include <stdio.h> // For strerror()
39# include <errno.h> 39# include <errno.h>
40#endif /* Q_OS_MACX */ 40#endif /* Q_OS_MACX */
41 41
42 42
43// Shouldn't be here ! (eilers) 43// Shouldn't be here ! (eilers)
44// #include <sys/vfs.h> 44// #include <sys/vfs.h>
45// #include <mntent.h> 45// #include <mntent.h>
46 46
47 47
48static bool isCF(const QString& m) 48static bool isCF(const QString& m)
49{ 49{
50 50
51#ifndef Q_OS_MACX 51#ifndef Q_OS_MACX
52 FILE* f = fopen("/var/run/stab", "r"); 52 FILE* f = fopen("/var/run/stab", "r");
53 if (!f) f = fopen("/var/state/pcmcia/stab", "r"); 53 if (!f) f = fopen("/var/state/pcmcia/stab", "r");
54 if (!f) f = fopen("/var/lib/pcmcia/stab", "r"); 54 if (!f) f = fopen("/var/lib/pcmcia/stab", "r");
55 if ( f ) 55 if ( f )
56 { 56 {
57 char line[1024]; 57 char line[1024];
58 char devtype[80]; 58 char devtype[80];
59 char devname[80]; 59 char devname[80];
60 while ( fgets( line, 1024, f ) ) 60 while ( fgets( line, 1024, f ) )
61 { 61 {
62 // 0 ide ide-cs 0 hda 3 0 62 // 0 ide ide-cs 0 hda 3 0
63 if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 ) 63 if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 )
64 { 64 {
65 if ( QString(devtype) == "ide" && m.find(devname)>0 ) 65 if ( QString(devtype) == "ide" && m.find(devname)>0 )
66 { 66 {
67 fclose(f); 67 fclose(f);
68 return TRUE; 68 return TRUE;
69 } 69 }
70 } 70 }
71 } 71 }
72 fclose(f); 72 fclose(f);
73 } 73 }
74#endif /* Q_OS_MACX */ 74#endif /* Q_OS_MACX */
75 return FALSE; 75 return FALSE;
76} 76}
77 77
78/*! \class StorageInfo storage.h 78/*! \class StorageInfo storage.h
79 \brief The StorageInfo class describes the disks mounted on the file system. 79 \brief The StorageInfo class describes the disks mounted on the file system.
80 80
81 This class provides access to the mount information for the Linux 81 This class provides access to the mount information for the Linux
82 filesystem. Each mount point is represented by the FileSystem class. 82 filesystem. Each mount point is represented by the FileSystem class.
83 To ensure this class has the most up to date size information, call 83 To ensure this class has the most up to date size information, call
84 the update() method. Note that this will automatically be signaled 84 the update() method. Note that this will automatically be signaled
85 by the operating system when a disk has been mounted or unmounted. 85 by the operating system when a disk has been mounted or unmounted.
86 86
87 \ingroup qtopiaemb 87 \ingroup qtopiaemb
88*/ 88*/
89 89
90/*! Constructor that determines the current mount points of the filesystem. 90/*! Constructor that determines the current mount points of the filesystem.
91 The standard \a parent parameters is passed on to QObject. 91 The standard \a parent parameters is passed on to QObject.
92 */ 92 */
93StorageInfo::StorageInfo( QObject *parent ) 93StorageInfo::StorageInfo( QObject *parent )
94 : QObject( parent ) 94 : QObject( parent )
95{ 95{
96 mFileSystems.setAutoDelete( TRUE ); 96 mFileSystems.setAutoDelete( TRUE );
97 channel = new QCopChannel( "QPE/Card", this ); 97 channel = new QCopChannel( "QPE/Card", this );
98 connect( channel, SIGNAL(received(const QCString &, const QByteArray &)), 98 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
99 this, SLOT(cardMessage( const QCString &, const QByteArray &)) ); 99 this, SLOT(cardMessage(const QCString&,const QByteArray&)) );
100 update(); 100 update();
101} 101}
102 102
103/*! Returns the longest matching FileSystem that starts with the 103/*! Returns the longest matching FileSystem that starts with the
104 same prefix as \a filename as its mount point. 104 same prefix as \a filename as its mount point.
105*/ 105*/
106const FileSystem *StorageInfo::fileSystemOf( const QString &filename ) 106const FileSystem *StorageInfo::fileSystemOf( const QString &filename )
107{ 107{
108 for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) 108 for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i)
109 { 109 {
110 if ( filename.startsWith( (*i)->path() ) ) 110 if ( filename.startsWith( (*i)->path() ) )
111 return (*i); 111 return (*i);
112 } 112 }
113 return 0; 113 return 0;
114} 114}
115 115
116 116
117void StorageInfo::cardMessage( const QCString& msg, const QByteArray& ) 117void StorageInfo::cardMessage( const QCString& msg, const QByteArray& )
118{ 118{
119 if ( msg == "mtabChanged()" ) 119 if ( msg == "mtabChanged()" )
120 update(); 120 update();
121} 121}
122 122
123 123
124/*! Updates the mount and free space available information for each mount 124/*! Updates the mount and free space available information for each mount
125 point. This method is automatically called when a disk is mounted or 125 point. This method is automatically called when a disk is mounted or
126 unmounted. 126 unmounted.
127*/ 127*/
128// cause of the lack of a d pointer we need 128// cause of the lack of a d pointer we need
129// to store informations in a config file :( 129// to store informations in a config file :(
130void StorageInfo::update() 130void StorageInfo::update()
131{ 131{
132 //qDebug("StorageInfo::updating"); 132 //qDebug("StorageInfo::updating");
133#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 133#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
134 struct mntent *me; 134 struct mntent *me;
135 FILE *mntfp = setmntent( "/etc/mtab", "r" ); 135 FILE *mntfp = setmntent( "/etc/mtab", "r" );
136 136
137 QStringList curdisks; 137 QStringList curdisks;
138 QStringList curopts; 138 QStringList curopts;
139 QStringList curfs; 139 QStringList curfs;
140 bool rebuild = FALSE; 140 bool rebuild = FALSE;
141 int n=0; 141 int n=0;
142 if ( mntfp ) 142 if ( mntfp )
143 { 143 {
144 while ( (me = getmntent( mntfp )) != 0 ) 144 while ( (me = getmntent( mntfp )) != 0 )
145 { 145 {
146 QString fs = me->mnt_fsname; 146 QString fs = me->mnt_fsname;
147 if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" 147 if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd"
148 || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" 148 || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd"
149 || fs.left( 14 ) == "/dev/mmc/part1" 149 || fs.left( 14 ) == "/dev/mmc/part1"
150 || fs.left(5)=="tmpfs" || fs.left(9)=="/dev/root" ) 150 || fs.left(5)=="tmpfs" || fs.left(9)=="/dev/root" )
151 { 151 {
152 n++; 152 n++;
153 curdisks.append(fs); 153 curdisks.append(fs);
154 curopts.append( me->mnt_opts ); 154 curopts.append( me->mnt_opts );
155 //qDebug("-->fs %s opts %s", fs.latin1(), me->mnt_opts ); 155 //qDebug("-->fs %s opts %s", fs.latin1(), me->mnt_opts );
156 curfs.append( me->mnt_dir ); 156 curfs.append( me->mnt_dir );
157 bool found = FALSE; 157 bool found = FALSE;
158 for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) 158 for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i)
159 { 159 {
160 if ( (*i)->disk() == fs ) 160 if ( (*i)->disk() == fs )
161 { 161 {
162 found = TRUE; 162 found = TRUE;
163 break; 163 break;
diff --git a/library/timestring.cpp b/library/timestring.cpp
index 2fd0191..91c29ae 100644
--- a/library/timestring.cpp
+++ b/library/timestring.cpp
@@ -1,120 +1,120 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the 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 "timestring.h" 21#include "timestring.h"
22#include <qobject.h> 22#include <qobject.h>
23#include <qpe/qpeapplication.h> //for qApp 23#include <qpe/qpeapplication.h> //for qApp
24#include "config.h" 24#include "config.h"
25 25
26 26
27class TimeStringFormatKeeper : public QObject 27class TimeStringFormatKeeper : public QObject
28{ 28{
29 Q_OBJECT 29 Q_OBJECT
30public: 30public:
31 static DateFormat currentFormat() 31 static DateFormat currentFormat()
32 { 32 {
33 if ( !self ) 33 if ( !self )
34 self = new TimeStringFormatKeeper; 34 self = new TimeStringFormatKeeper;
35 return self->format; 35 return self->format;
36 } 36 }
37private slots: 37private slots:
38 void formatChanged( DateFormat f ) 38 void formatChanged( DateFormat f )
39 { 39 {
40 format = f; 40 format = f;
41 } 41 }
42private: 42private:
43 static TimeStringFormatKeeper *self; 43 static TimeStringFormatKeeper *self;
44 DateFormat format; 44 DateFormat format;
45 45
46 TimeStringFormatKeeper() 46 TimeStringFormatKeeper()
47 : QObject( qApp ) 47 : QObject( qApp )
48 { 48 {
49 Config config("qpe"); 49 Config config("qpe");
50 config.setGroup( "Date" ); 50 config.setGroup( "Date" );
51 format = DateFormat(QChar(config.readEntry("Separator", "/")[0]), 51 format = DateFormat(QChar(config.readEntry("Separator", "/")[0]),
52 (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear), 52 (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear),
53 (DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear)); 53 (DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear));
54 54
55 connect( qApp, SIGNAL( dateFormatChanged(DateFormat) ), 55 connect( qApp, SIGNAL( dateFormatChanged(DateFormat) ),
56 this, SLOT( formatChanged( DateFormat ) ) ); 56 this, SLOT( formatChanged(DateFormat) ) );
57 } 57 }
58}; 58};
59 59
60TimeStringFormatKeeper *TimeStringFormatKeeper::self = 0; 60TimeStringFormatKeeper *TimeStringFormatKeeper::self = 0;
61 61
62QString DateFormat::toNumberString() const 62QString DateFormat::toNumberString() const
63{ 63{
64 QString buf = ""; 64 QString buf = "";
65 // for each part of the order 65 // for each part of the order
66 for (int i = 0; i < 3; i++) { 66 for (int i = 0; i < 3; i++) {
67 // switch on the relavent 3 bits. 67 // switch on the relavent 3 bits.
68 switch((_shortOrder >> (i * 3)) & 0x0007) { 68 switch((_shortOrder >> (i * 3)) & 0x0007) {
69 case 0x0001: 69 case 0x0001:
70 buf += QObject::tr( "D" , "Shortcut for Day"); 70 buf += QObject::tr( "D" , "Shortcut for Day");
71 break; 71 break;
72 case 0x0002: 72 case 0x0002:
73 buf += QObject::tr( "M", "Shortcur for Month" ); 73 buf += QObject::tr( "M", "Shortcur for Month" );
74 break; 74 break;
75 case 0x0004: 75 case 0x0004:
76 buf += QObject::tr( "Y" ); 76 buf += QObject::tr( "Y" );
77 break; 77 break;
78 } 78 }
79 if (i < 2) 79 if (i < 2)
80 buf += _shortSeparator; 80 buf += _shortSeparator;
81 } 81 }
82 return buf; 82 return buf;
83} 83}
84 84
85QString DateFormat::toWordString() const 85QString DateFormat::toWordString() const
86{ 86{
87 QString buf = ""; 87 QString buf = "";
88 // for each part of the order 88 // for each part of the order
89 for (int i = 0; i < 3; i++) { 89 for (int i = 0; i < 3; i++) {
90 // switch on the relavent 3 bits. 90 // switch on the relavent 3 bits.
91 switch((_longOrder >> (i * 3)) & 0x0007) { 91 switch((_longOrder >> (i * 3)) & 0x0007) {
92 case 0x0001: 92 case 0x0001:
93 buf += QObject::tr( "day" ); 93 buf += QObject::tr( "day" );
94 if (i < 2) { 94 if (i < 2) {
95 if ((_shortOrder << ((i+1) * 3)) & 0x0007) 95 if ((_shortOrder << ((i+1) * 3)) & 0x0007)
96 buf += ", "; 96 buf += ", ";
97 else 97 else
98 buf += " "; 98 buf += " ";
99 } 99 }
100 break; 100 break;
101 case 0x0002: 101 case 0x0002:
102 buf += QObject::tr( "month" ); 102 buf += QObject::tr( "month" );
103 if (i < 2) 103 if (i < 2)
104 buf += " "; 104 buf += " ";
105 break; 105 break;
106 case 0x0004: 106 case 0x0004:
107 buf += QObject::tr( "year" ); 107 buf += QObject::tr( "year" );
108 if (i < 2) 108 if (i < 2)
109 buf += ", "; 109 buf += ", ";
110 break; 110 break;
111 } 111 }
112 } 112 }
113 return buf; 113 return buf;
114} 114}
115 115
116QString DateFormat::numberDate(const QDate &d, int v) const 116QString DateFormat::numberDate(const QDate &d, int v) const
117{ 117{
118 QString buf = ""; 118 QString buf = "";
119 119
120 int pad = 2; 120 int pad = 2;
diff --git a/library/tzselect.cpp b/library/tzselect.cpp
index f28100b..848dfb7 100644
--- a/library/tzselect.cpp
+++ b/library/tzselect.cpp
@@ -16,130 +16,130 @@
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#define QTOPIA_INTERNAL_TZSELECT_INC_LOCAL 21#define QTOPIA_INTERNAL_TZSELECT_INC_LOCAL
22 22
23#include "tzselect.h" 23#include "tzselect.h"
24#include "resource.h" 24#include "resource.h"
25#include "config.h" 25#include "config.h"
26#include <qtoolbutton.h> 26#include <qtoolbutton.h>
27#include <qfile.h> 27#include <qfile.h>
28#include <stdlib.h> 28#include <stdlib.h>
29 29
30#include <qcopchannel_qws.h> 30#include <qcopchannel_qws.h>
31#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
32#include <qmessagebox.h> 32#include <qmessagebox.h>
33 33
34/*! 34/*!
35 \class TimeZoneSelector 35 \class TimeZoneSelector
36 36
37 \brief The TimeZoneSelector widget allows users to configure their time zone information. 37 \brief The TimeZoneSelector widget allows users to configure their time zone information.
38 38
39 \ingroup qtopiaemb 39 \ingroup qtopiaemb
40*/ 40*/
41 41
42class TimeZoneSelectorPrivate 42class TimeZoneSelectorPrivate
43{ 43{
44public: 44public:
45 TimeZoneSelectorPrivate() : includeLocal(FALSE) {} 45 TimeZoneSelectorPrivate() : includeLocal(FALSE) {}
46 bool includeLocal; 46 bool includeLocal;
47}; 47};
48 48
49TZCombo::TZCombo( QWidget *p, const char* n ) 49TZCombo::TZCombo( QWidget *p, const char* n )
50 : QComboBox( p, n ) 50 : QComboBox( p, n )
51{ 51{
52 updateZones(); 52 updateZones();
53 // check to see if TZ is set, if it is set the current item to that 53 // check to see if TZ is set, if it is set the current item to that
54 QString tz = getenv("TZ"); 54 QString tz = getenv("TZ");
55 if (parent()->inherits("TimeZoneSelector")) { 55 if (parent()->inherits("TimeZoneSelector")) {
56 if ( ((TimeZoneSelector *)parent())->localIncluded() ) { 56 if ( ((TimeZoneSelector *)parent())->localIncluded() ) {
57 // overide to the 'local' type. 57 // overide to the 'local' type.
58 tz = "None"; 58 tz = "None";
59 } 59 }
60 } 60 }
61 if ( !tz.isNull() ) { 61 if ( !tz.isNull() ) {
62 int n = 0, 62 int n = 0,
63 index = 0; 63 index = 0;
64 for ( QStringList::Iterator it=identifiers.begin(); 64 for ( QStringList::Iterator it=identifiers.begin();
65 it!=identifiers.end(); ++it) { 65 it!=identifiers.end(); ++it) {
66 if ( *it == tz ) 66 if ( *it == tz )
67 index = n; 67 index = n;
68 n++; 68 n++;
69 } 69 }
70 setCurrentItem(index); 70 setCurrentItem(index);
71 } else { 71 } else {
72 setCurrentItem(0); 72 setCurrentItem(0);
73 } 73 }
74 74
75 75
76 76
77 // listen on QPE/System 77 // listen on QPE/System
78#if !defined(QT_NO_COP) 78#if !defined(QT_NO_COP)
79 QCopChannel *channel = new QCopChannel( "QPE/System", this ); 79 QCopChannel *channel = new QCopChannel( "QPE/System", this );
80 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 80 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
81 this, SLOT(handleSystemChannel(const QCString&, const QByteArray&)) ); 81 this, SLOT(handleSystemChannel(const QCString&,const QByteArray&)) );
82#endif 82#endif
83 83
84 84
85} 85}
86 86
87TZCombo::~TZCombo() 87TZCombo::~TZCombo()
88{ 88{
89} 89}
90 90
91void TZCombo::updateZones() 91void TZCombo::updateZones()
92{ 92{
93 QString cur = currentText(); 93 QString cur = currentText();
94 clear(); 94 clear();
95 identifiers.clear(); 95 identifiers.clear();
96 int curix=0; 96 int curix=0;
97 QString tz = getenv("TZ"); 97 QString tz = getenv("TZ");
98 bool tzFound = FALSE; 98 bool tzFound = FALSE;
99 Config cfg("CityTime"); 99 Config cfg("CityTime");
100 cfg.setGroup("TimeZones"); 100 cfg.setGroup("TimeZones");
101 int listIndex = 0; 101 int listIndex = 0;
102 if (parent()->inherits("TimeZoneSelector")) { 102 if (parent()->inherits("TimeZoneSelector")) {
103 if ( ((TimeZoneSelector *)parent())->localIncluded() ) { 103 if ( ((TimeZoneSelector *)parent())->localIncluded() ) {
104 // overide to the 'local' type. 104 // overide to the 'local' type.
105 identifiers.append( "None" ); 105 identifiers.append( "None" );
106 insertItem( tr("None") ); 106 insertItem( tr("None") );
107 if ( cur == tr("None")) 107 if ( cur == tr("None"))
108 curix = 0; 108 curix = 0;
109 listIndex++; 109 listIndex++;
110 } 110 }
111 } 111 }
112 int cfgIndex = 0; 112 int cfgIndex = 0;
113 while (1) { 113 while (1) {
114 QString zn = cfg.readEntry("Zone"+QString::number(cfgIndex), QString::null); 114 QString zn = cfg.readEntry("Zone"+QString::number(cfgIndex), QString::null);
115 if ( zn.isNull() ) 115 if ( zn.isNull() )
116 break; 116 break;
117 if ( zn == tz ) 117 if ( zn == tz )
118 tzFound = TRUE; 118 tzFound = TRUE;
119 QString nm = cfg.readEntry("ZoneName"+QString::number(cfgIndex)); 119 QString nm = cfg.readEntry("ZoneName"+QString::number(cfgIndex));
120 identifiers.append(zn); 120 identifiers.append(zn);
121 insertItem(nm); 121 insertItem(nm);
122 if ( nm == cur ) 122 if ( nm == cur )
123 curix = listIndex; 123 curix = listIndex;
124 ++cfgIndex; 124 ++cfgIndex;
125 ++listIndex; 125 ++listIndex;
126 } 126 }
127 if ( !listIndex ) { 127 if ( !listIndex ) {
128 QStringList list = timezoneDefaults(); 128 QStringList list = timezoneDefaults();
129 for ( QStringList::Iterator it = list.begin(); it!=list.end(); ++it ) { 129 for ( QStringList::Iterator it = list.begin(); it!=list.end(); ++it ) {
130 QString zn = *it; 130 QString zn = *it;
131 QString nm = *++it; 131 QString nm = *++it;
132 if ( zn == tz ) 132 if ( zn == tz )
133 tzFound = TRUE; 133 tzFound = TRUE;
134 if ( nm == cur ) 134 if ( nm == cur )
135 curix = listIndex; 135 curix = listIndex;
136 identifiers.append(zn); 136 identifiers.append(zn);
137 insertItem(nm); 137 insertItem(nm);
138 ++listIndex; 138 ++listIndex;
139 } 139 }
140 } 140 }
141 for (QStringList::Iterator it=extras.begin(); it!=extras.end(); ++it) { 141 for (QStringList::Iterator it=extras.begin(); it!=extras.end(); ++it) {
142 insertItem(*it); 142 insertItem(*it);
143 identifiers.append(*it); 143 identifiers.append(*it);
144 if ( *it == cur ) 144 if ( *it == cur )
145 curix = listIndex; 145 curix = listIndex;
@@ -157,130 +157,130 @@ void TZCombo::updateZones()
157 setCurrentItem(curix); 157 setCurrentItem(curix);
158} 158}
159 159
160 160
161void TZCombo::keyPressEvent( QKeyEvent *e ) 161void TZCombo::keyPressEvent( QKeyEvent *e )
162{ 162{
163 // ### should popup() in Qt 3.0 (it's virtual there) 163 // ### should popup() in Qt 3.0 (it's virtual there)
164// updateZones(); 164// updateZones();
165 QComboBox::keyPressEvent(e); 165 QComboBox::keyPressEvent(e);
166} 166}
167 167
168void TZCombo::mousePressEvent(QMouseEvent*e) 168void TZCombo::mousePressEvent(QMouseEvent*e)
169{ 169{
170 // ### should popup() in Qt 3.0 (it's virtual there) 170 // ### should popup() in Qt 3.0 (it's virtual there)
171// updateZones(); 171// updateZones();
172 QComboBox::mousePressEvent(e); 172 QComboBox::mousePressEvent(e);
173} 173}
174 174
175QString TZCombo::currZone() const 175QString TZCombo::currZone() const
176{ 176{
177 return identifiers[currentItem()]; 177 return identifiers[currentItem()];
178} 178}
179 179
180void TZCombo::setCurrZone( const QString& id ) 180void TZCombo::setCurrZone( const QString& id )
181{ 181{
182 for (int i=0; i< count(); i++) { 182 for (int i=0; i< count(); i++) {
183 if ( identifiers[i] == id ) { 183 if ( identifiers[i] == id ) {
184 setCurrentItem(i); 184 setCurrentItem(i);
185 return; 185 return;
186} 186}
187 } 187 }
188 insertItem(id); 188 insertItem(id);
189 setCurrentItem( count() - 1); 189 setCurrentItem( count() - 1);
190 identifiers.append(id); 190 identifiers.append(id);
191 extras.append(id); 191 extras.append(id);
192} 192}
193 193
194 194
195 195
196void TZCombo::handleSystemChannel(const QCString&msg, const QByteArray&) 196void TZCombo::handleSystemChannel(const QCString&msg, const QByteArray&)
197{ 197{
198 if ( msg == "timeZoneListChange()" ) { 198 if ( msg == "timeZoneListChange()" ) {
199 updateZones(); 199 updateZones();
200 } 200 }
201} 201}
202 202
203/*! 203/*!
204 Creates a new TimeZoneSelector with parent \a p and name \a n. The combobox will be 204 Creates a new TimeZoneSelector with parent \a p and name \a n. The combobox will be
205 populated with the available timezones. 205 populated with the available timezones.
206*/ 206*/
207 207
208TimeZoneSelector::TimeZoneSelector(QWidget* p, const char* n) : 208TimeZoneSelector::TimeZoneSelector(QWidget* p, const char* n) :
209 QHBox(p,n) 209 QHBox(p,n)
210{ 210{
211 d = new TimeZoneSelectorPrivate(); 211 d = new TimeZoneSelectorPrivate();
212 // build the combobox before we do any updates... 212 // build the combobox before we do any updates...
213 cmbTz = new TZCombo( this, "timezone combo" ); 213 cmbTz = new TZCombo( this, "timezone combo" );
214 214
215 cmdTz = new QToolButton( this, "timezone button" ); 215 cmdTz = new QToolButton( this, "timezone button" );
216 cmdTz->setIconSet( Resource::loadIconSet( "citytime_icon" ) ); 216 cmdTz->setIconSet( Resource::loadIconSet( "citytime_icon" ) );
217 cmdTz->setMaximumSize( cmdTz->sizeHint() ); 217 cmdTz->setMaximumSize( cmdTz->sizeHint() );
218 218
219 // set up a connection to catch a newly selected item and throw our 219 // set up a connection to catch a newly selected item and throw our
220 // signal 220 // signal
221 QObject::connect( cmbTz, SIGNAL( activated( int ) ), 221 QObject::connect( cmbTz, SIGNAL( activated(int) ),
222 this, SLOT( slotTzActive( int ) ) ); 222 this, SLOT( slotTzActive(int) ) );
223 QObject::connect( cmdTz, SIGNAL( clicked() ), 223 QObject::connect( cmdTz, SIGNAL( clicked() ),
224 this, SLOT( slotExecute() ) ); 224 this, SLOT( slotExecute() ) );
225} 225}
226 226
227/*! 227/*!
228 Destroys a TimeZoneSelector. 228 Destroys a TimeZoneSelector.
229*/ 229*/
230TimeZoneSelector::~TimeZoneSelector() 230TimeZoneSelector::~TimeZoneSelector()
231{ 231{
232} 232}
233 233
234void TimeZoneSelector::setLocalIncluded(bool b) 234void TimeZoneSelector::setLocalIncluded(bool b)
235{ 235{
236 d->includeLocal = b; 236 d->includeLocal = b;
237 cmbTz->updateZones(); 237 cmbTz->updateZones();
238} 238}
239 239
240bool TimeZoneSelector::localIncluded() const 240bool TimeZoneSelector::localIncluded() const
241{ 241{
242 return d->includeLocal; 242 return d->includeLocal;
243} 243}
244 244
245/*! 245/*!
246 Returns the currently selected timezone as a string in location format, e.g. 246 Returns the currently selected timezone as a string in location format, e.g.
247 \code Australia/Brisbane \endcode 247 \code Australia/Brisbane \endcode
248*/ 248*/
249QString TimeZoneSelector::currentZone() const 249QString TimeZoneSelector::currentZone() const
250{ 250{
251 return cmbTz->currZone(); 251 return cmbTz->currZone();
252} 252}
253 253
254/*! 254/*!
255 Sets the current timezone to \a id. 255 Sets the current timezone to \a id.
256*/ 256*/
257void TimeZoneSelector::setCurrentZone( const QString& id ) 257void TimeZoneSelector::setCurrentZone( const QString& id )
258{ 258{
259 cmbTz->setCurrZone( id ); 259 cmbTz->setCurrZone( id );
260} 260}
261/*! \fn void TimeZoneSelector::signalNewTz( const QString& id ) 261/*! \fn void TimeZoneSelector::signalNewTz( const QString& id )
262 This signal is emitted when a timezone has been selected by the user. The id 262 This signal is emitted when a timezone has been selected by the user. The id
263 is a \l QString in location format, eg \code Australia/Brisbane \endcode 263 is a \l QString in location format, eg \code Australia/Brisbane \endcode
264*/ 264*/
265 265
266 266
267void TimeZoneSelector::slotTzActive( int ) 267void TimeZoneSelector::slotTzActive( int )
268{ 268{
269 emit signalNewTz( cmbTz->currZone() ); 269 emit signalNewTz( cmbTz->currZone() );
270} 270}
271 271
272void TimeZoneSelector::slotExecute( void ) 272void TimeZoneSelector::slotExecute( void )
273{ 273{
274 // execute the world time application... 274 // execute the world time application...
275 if (QFile::exists(QPEApplication::qpeDir()+"bin/citytime")) 275 if (QFile::exists(QPEApplication::qpeDir()+"bin/citytime"))
276 Global::execute( "citytime" ); 276 Global::execute( "citytime" );
277 else 277 else
278 QMessageBox::warning(this,tr("citytime executable not found"), 278 QMessageBox::warning(this,tr("citytime executable not found"),
279 tr("In order to choose the time zones,\nplease install citytime.")); 279 tr("In order to choose the time zones,\nplease install citytime."));
280} 280}
281 281
282QStringList timezoneDefaults( void ) 282QStringList timezoneDefaults( void )
283{ 283{
284 QStringList tzs; 284 QStringList tzs;
285 // load up the list just like the file format (citytime.cpp) 285 // load up the list just like the file format (citytime.cpp)
286 tzs.append( "America/New_York" ); 286 tzs.append( "America/New_York" );
diff --git a/noncore/applets/memoryapplet/swapfile.cpp b/noncore/applets/memoryapplet/swapfile.cpp
index 04da8bb..9416db3 100644
--- a/noncore/applets/memoryapplet/swapfile.cpp
+++ b/noncore/applets/memoryapplet/swapfile.cpp
@@ -49,131 +49,131 @@
49#include <sys/types.h> 49#include <sys/types.h>
50 50
51Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f ) 51Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f )
52 : QWidget( parent, name, f ) 52 : QWidget( parent, name, f )
53{ 53{
54 // are we running as root? 54 // are we running as root?
55 isRoot = geteuid() == 0; 55 isRoot = geteuid() == 0;
56 56
57 QVBoxLayout* vb = new QVBoxLayout(this, 5); 57 QVBoxLayout* vb = new QVBoxLayout(this, 5);
58 58
59 QHButtonGroup* cfsdRBG = new QHButtonGroup(tr("Swapfile location"), this); 59 QHButtonGroup* cfsdRBG = new QHButtonGroup(tr("Swapfile location"), this);
60 cfsdRBG->setRadioButtonExclusive(true); 60 cfsdRBG->setRadioButtonExclusive(true);
61 vb->addWidget(cfsdRBG); 61 vb->addWidget(cfsdRBG);
62 62
63 ramRB = new QRadioButton(tr("RAM"), cfsdRBG); 63 ramRB = new QRadioButton(tr("RAM"), cfsdRBG);
64 cfRB = new QRadioButton(tr("CF Card"), cfsdRBG); 64 cfRB = new QRadioButton(tr("CF Card"), cfsdRBG);
65 sdRB = new QRadioButton(tr("SD Card"), cfsdRBG); 65 sdRB = new QRadioButton(tr("SD Card"), cfsdRBG);
66 66
67 QHBox *hb1 = new QHBox(this); 67 QHBox *hb1 = new QHBox(this);
68 hb1->setSpacing(5); 68 hb1->setSpacing(5);
69 69
70 swapPath1 = new QLineEdit(hb1); 70 swapPath1 = new QLineEdit(hb1);
71 swapPath1->setEnabled(false); 71 swapPath1->setEnabled(false);
72 72
73 QPushButton* swapOn = new QPushButton(tr(" On "), hb1); 73 QPushButton* swapOn = new QPushButton(tr(" On "), hb1);
74 QPushButton* swapOff = new QPushButton(tr(" Off "), hb1); 74 QPushButton* swapOff = new QPushButton(tr(" Off "), hb1);
75 vb->addWidget(hb1); 75 vb->addWidget(hb1);
76 76
77 QVGroupBox* box1 = new QVGroupBox(tr("Manage Swapfile"), this); 77 QVGroupBox* box1 = new QVGroupBox(tr("Manage Swapfile"), this);
78 vb->addWidget(box1); 78 vb->addWidget(box1);
79 79
80 QHBox *hb2 = new QHBox(box1); 80 QHBox *hb2 = new QHBox(box1);
81 hb2->setSpacing(5); 81 hb2->setSpacing(5);
82 QPushButton* mkSwap = new QPushButton(tr("Generate"), hb2); 82 QPushButton* mkSwap = new QPushButton(tr("Generate"), hb2);
83 QPushButton* rmSwap = new QPushButton(tr("Remove"), hb2); 83 QPushButton* rmSwap = new QPushButton(tr("Remove"), hb2);
84 84
85 QHBox *hb3 = new QHBox(box1); 85 QHBox *hb3 = new QHBox(box1);
86 hb3->setSpacing(5); 86 hb3->setSpacing(5);
87 swapSize = new QComboBox(hb3); 87 swapSize = new QComboBox(hb3);
88 swapSize->insertStringList(QStringList::split(",", tr("2 Mb,4 Mb,6 Mb,8 Mb"))); 88 swapSize->insertStringList(QStringList::split(",", tr("2 Mb,4 Mb,6 Mb,8 Mb")));
89 89
90 mkswapProgress = new QProgressBar(3, hb3); 90 mkswapProgress = new QProgressBar(3, hb3);
91 mkswapProgress->setCenterIndicator(true); 91 mkswapProgress->setCenterIndicator(true);
92 92
93 QHBox *hb4 = new QHBox(this); 93 QHBox *hb4 = new QHBox(this);
94 hb4->setSpacing(5); 94 hb4->setSpacing(5);
95 95
96 swapStatusIcon = new QLabel(hb4); 96 swapStatusIcon = new QLabel(hb4);
97 swapStatus = new QLabel(tr(""), hb4); 97 swapStatus = new QLabel(tr(""), hb4);
98 hb4->setStretchFactor(swapStatus, 99); 98 hb4->setStretchFactor(swapStatus, 99);
99 vb->addWidget(hb4); 99 vb->addWidget(hb4);
100 100
101 connect(swapOn, SIGNAL(clicked()), this, SLOT(swapon())); 101 connect(swapOn, SIGNAL(clicked()), this, SLOT(swapon()));
102 connect(swapOff, SIGNAL(clicked()), this, SLOT(swapoff())); 102 connect(swapOff, SIGNAL(clicked()), this, SLOT(swapoff()));
103 connect(cfRB, SIGNAL(clicked()), this, SLOT(cfsdchecked())); 103 connect(cfRB, SIGNAL(clicked()), this, SLOT(cfsdchecked()));
104 connect(sdRB, SIGNAL(clicked()), this, SLOT(cfsdchecked())); 104 connect(sdRB, SIGNAL(clicked()), this, SLOT(cfsdchecked()));
105 connect(ramRB, SIGNAL(clicked()), this, SLOT(cfsdchecked())); 105 connect(ramRB, SIGNAL(clicked()), this, SLOT(cfsdchecked()));
106 connect(mkSwap, SIGNAL(clicked()), this, SLOT(makeswapfile())); 106 connect(mkSwap, SIGNAL(clicked()), this, SLOT(makeswapfile()));
107 connect(rmSwap, SIGNAL(clicked()), this, SLOT(removeswapfile())); 107 connect(rmSwap, SIGNAL(clicked()), this, SLOT(removeswapfile()));
108 108
109 cfRB->setEnabled(FALSE); 109 cfRB->setEnabled(FALSE);
110 sdRB->setEnabled(FALSE); 110 sdRB->setEnabled(FALSE);
111 111
112 QCopChannel *pcmciaChannel = new QCopChannel("QPE/Card", this); 112 QCopChannel *pcmciaChannel = new QCopChannel("QPE/Card", this);
113 connect(pcmciaChannel, SIGNAL(received(const QCString &, const QByteArray &)), this, SLOT(cardnotify(const QCString &, const QByteArray &))); 113 connect(pcmciaChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(cardnotify(const QCString&,const QByteArray&)));
114 QCopChannel *sdChannel = new QCopChannel("QPE/Card", this); 114 QCopChannel *sdChannel = new QCopChannel("QPE/Card", this);
115 connect(sdChannel, SIGNAL(received(const QCString &, const QByteArray &)), this, SLOT(cardnotify(const QCString &, const QByteArray &))); 115 connect(sdChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(cardnotify(const QCString&,const QByteArray&)));
116 116
117 cardInPcmcia0 = FALSE; 117 cardInPcmcia0 = FALSE;
118 cardInPcmcia1 = FALSE; 118 cardInPcmcia1 = FALSE;
119 cardInSd = FALSE; 119 cardInSd = FALSE;
120 120
121 Swapfile::status(); 121 Swapfile::status();
122 Swapfile::getStatusPcmcia(); 122 Swapfile::getStatusPcmcia();
123 Swapfile::getStatusSd(); 123 Swapfile::getStatusSd();
124} 124}
125 125
126int Swapfile::exec(const QString& arg) 126int Swapfile::exec(const QString& arg)
127{ 127{
128 return system((!isRoot ? "sudo " : "") + arg); 128 return system((!isRoot ? "sudo " : "") + arg);
129} 129}
130 130
131 131
132Swapfile::~Swapfile() 132Swapfile::~Swapfile()
133{ 133{
134} 134}
135 135
136void Swapfile::cardnotify(const QCString & msg, const QByteArray &) 136void Swapfile::cardnotify(const QCString & msg, const QByteArray &)
137{ 137{
138 if (msg == "stabChanged()") 138 if (msg == "stabChanged()")
139 { 139 {
140 getStatusPcmcia(); 140 getStatusPcmcia();
141 } 141 }
142 else if (msg == "mtabChanged()") 142 else if (msg == "mtabChanged()")
143 { 143 {
144 getStatusSd(); 144 getStatusSd();
145 } 145 }
146} 146}
147 147
148void Swapfile::getStatusPcmcia() 148void Swapfile::getStatusPcmcia()
149{ 149{
150 150
151 bool cardWas0 = cardInPcmcia0;// remember last state 151 bool cardWas0 = cardInPcmcia0;// remember last state
152 bool cardWas1 = cardInPcmcia1; 152 bool cardWas1 = cardInPcmcia1;
153 153
154 QString fileName; 154 QString fileName;
155 155
156 // one of these 3 files should exist 156 // one of these 3 files should exist
157 if (QFile::exists("/var/run/stab")) { 157 if (QFile::exists("/var/run/stab")) {
158 fileName = "/var/run/stab"; 158 fileName = "/var/run/stab";
159 } else if (QFile::exists("/var/state/pcmcia/stab")) { 159 } else if (QFile::exists("/var/state/pcmcia/stab")) {
160 fileName = "/var/state/pcmcia/stab"; 160 fileName = "/var/state/pcmcia/stab";
161 } else { 161 } else {
162 fileName = "/var/lib/pcmcia/stab"; 162 fileName = "/var/lib/pcmcia/stab";
163 } 163 }
164 164
165 QFile f(fileName); 165 QFile f(fileName);
166 166
167 if (f.open(IO_ReadOnly)) { 167 if (f.open(IO_ReadOnly)) {
168 QStringList list; 168 QStringList list;
169 QTextStream stream(&f); 169 QTextStream stream(&f);
170 QString streamIn; 170 QString streamIn;
171 streamIn = stream.read(); 171 streamIn = stream.read();
172 list = QStringList::split("\n", streamIn); 172 list = QStringList::split("\n", streamIn);
173 for (QStringList::Iterator line = list.begin(); line != list.end(); 173 for (QStringList::Iterator line = list.begin(); line != list.end();
174 line++) { 174 line++) {
175 if ((*line).startsWith("Socket 0:")) { 175 if ((*line).startsWith("Socket 0:")) {
176 if ((*line).startsWith("Socket 0: empty") && cardInPcmcia0) { 176 if ((*line).startsWith("Socket 0: empty") && cardInPcmcia0) {
177 cardInPcmcia0 = FALSE; 177 cardInPcmcia0 = FALSE;
178 } else if (!(*line).startsWith("Socket 0: empty") 178 } else if (!(*line).startsWith("Socket 0: empty")
179 && !cardInPcmcia0) { 179 && !cardInPcmcia0) {
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp
index 1142028..9b5e475 100644
--- a/noncore/applets/notesapplet/notes.cpp
+++ b/noncore/applets/notesapplet/notes.cpp
@@ -66,224 +66,224 @@ static char * notes_xpm[] = {
66" .@. ", 66" .@. ",
67" . .+ ", 67" . .+ ",
68" ..#.@. ", 68" ..#.@. ",
69" ..###.+.. ", 69" ..###.+.. ",
70" ..###$...##.. ", 70" ..###$...##.. ",
71"..###$$$%+$$##&.", 71"..###$$$%+$$##&.",
72".*=####$-###&=&.", 72".*=####$-###&=&.",
73".=**=###==&=&=..", 73".=**=###==&=&=..",
74" ..=**=#&=&=.. ", 74" ..=**=#&=&=.. ",
75" ..=*=&=.. ", 75" ..=*=&=.. ",
76" ..=.. ", 76" ..=.. ",
77" . "}; 77" . "};
78 78
79 79
80NotesControl::NotesControl( QWidget *, const char * ) 80NotesControl::NotesControl( QWidget *, const char * )
81 : QVBox( 0, "NotesControl",/* WDestructiveClose | */WStyle_StaysOnTop ) 81 : QVBox( 0, "NotesControl",/* WDestructiveClose | */WStyle_StaysOnTop )
82// : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) 82// : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup )
83{ 83{
84 QDir d( QDir::homeDirPath()+"/notes"); 84 QDir d( QDir::homeDirPath()+"/notes");
85 if( !d.exists()) { 85 if( !d.exists()) {
86 qDebug("make dir"); 86 qDebug("make dir");
87 if(!d.mkdir( QDir::homeDirPath()+"/notes", true)) 87 if(!d.mkdir( QDir::homeDirPath()+"/notes", true))
88 qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed"); 88 qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed");
89 } 89 }
90 Config cfg("Notes"); 90 Config cfg("Notes");
91 cfg.setGroup("Options"); 91 cfg.setGroup("Options");
92 showMax = cfg.readBoolEntry("ShowMax", false); 92 showMax = cfg.readBoolEntry("ShowMax", false);
93 93
94 setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); 94 setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
95 loaded=false; 95 loaded=false;
96 edited=false; 96 edited=false;
97 doPopulate=true; 97 doPopulate=true;
98 isNew=false; 98 isNew=false;
99 QVBox *vbox = new QVBox( this, "Vlayout" ); 99 QVBox *vbox = new QVBox( this, "Vlayout" );
100 QHBox *hbox = new QHBox( this, "HLayout" ); 100 QHBox *hbox = new QHBox( this, "HLayout" );
101 101
102 view = new QMultiLineEdit(vbox, "OpieNotesView"); 102 view = new QMultiLineEdit(vbox, "OpieNotesView");
103 103
104 box = new QListBox(vbox, "OpieNotesBox"); 104 box = new QListBox(vbox, "OpieNotesBox");
105 105
106 QPEApplication::setStylusOperation( box->viewport(),QPEApplication::RightOnHold); 106 QPEApplication::setStylusOperation( box->viewport(),QPEApplication::RightOnHold);
107 107
108 box->setFixedHeight(50); 108 box->setFixedHeight(50);
109 109
110 vbox->setMargin( 6 ); 110 vbox->setMargin( 6 );
111 vbox->setSpacing( 3 ); 111 vbox->setSpacing( 3 );
112 112
113 113
114 114
115 setFocusPolicy(QWidget::StrongFocus); 115 setFocusPolicy(QWidget::StrongFocus);
116 116
117 newButton= new QPushButton( hbox, "newButton" ); 117 newButton= new QPushButton( hbox, "newButton" );
118 newButton->setText(tr("New")); 118 newButton->setText(tr("New"));
119 119
120 120
121 saveButton= new QPushButton( hbox, "saveButton" ); 121 saveButton= new QPushButton( hbox, "saveButton" );
122 saveButton->setText(tr("Save")); 122 saveButton->setText(tr("Save"));
123 123
124 124
125 deleteButton= new QPushButton( hbox, "deleteButton" ); 125 deleteButton= new QPushButton( hbox, "deleteButton" );
126 deleteButton->setText(tr("Delete")); 126 deleteButton->setText(tr("Delete"));
127 127
128 128
129 129
130 connect( box, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint&)), 130 connect( box, SIGNAL( mouseButtonPressed(int,QListBoxItem*,const QPoint&)),
131 this,SLOT( boxPressed(int, QListBoxItem *, const QPoint&)) ); 131 this,SLOT( boxPressed(int,QListBoxItem*,const QPoint&)) );
132 132
133 connect(box, SIGNAL(highlighted(const QString&)), this, SLOT(slotBoxSelected(const QString &))); 133 connect(box, SIGNAL(highlighted(const QString&)), this, SLOT(slotBoxSelected(const QString&)));
134 134
135 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showMenu() ) ); 135 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showMenu() ) );
136 136
137 connect(view,SIGNAL( textChanged() ), this, SLOT(slotViewEdited() ) ); 137 connect(view,SIGNAL( textChanged() ), this, SLOT(slotViewEdited() ) );
138 138
139 connect(newButton, SIGNAL(clicked()), this, SLOT(slotNewButton())); 139 connect(newButton, SIGNAL(clicked()), this, SLOT(slotNewButton()));
140 connect(saveButton, SIGNAL(clicked()), this, SLOT(slotSaveButton())); 140 connect(saveButton, SIGNAL(clicked()), this, SLOT(slotSaveButton()));
141 connect(deleteButton, SIGNAL(clicked()), this, SLOT(slotDeleteButtonClicked())); 141 connect(deleteButton, SIGNAL(clicked()), this, SLOT(slotDeleteButtonClicked()));
142 142
143 populateBox(); 143 populateBox();
144 load(); 144 load();
145 setCaption("Notes"); 145 setCaption("Notes");
146 // parent->setFocus(); 146 // parent->setFocus();
147} 147}
148 148
149void NotesControl::slotSaveButton() { 149void NotesControl::slotSaveButton() {
150 slotNewButton(); 150 slotNewButton();
151 populateBox(); 151 populateBox();
152} 152}
153 153
154void NotesControl::slotDeleteButtonClicked() { 154void NotesControl::slotDeleteButtonClicked() {
155 switch ( QMessageBox::warning(this,tr("Delete?") 155 switch ( QMessageBox::warning(this,tr("Delete?")
156 ,tr("Do you really want to<BR><B> delete</B> this note ?") 156 ,tr("Do you really want to<BR><B> delete</B> this note ?")
157 ,tr("Yes"),tr("No"),0,1,1) ) { 157 ,tr("Yes"),tr("No"),0,1,1) ) {
158 case 0: 158 case 0:
159 slotDeleteButton(); 159 slotDeleteButton();
160 break; 160 break;
161 }; 161 };
162} 162}
163 163
164void NotesControl::slotDeleteButton() { 164void NotesControl::slotDeleteButton() {
165 165
166 QString selectedText = box->currentText(); 166 QString selectedText = box->currentText();
167 qDebug("deleting "+selectedText); 167 qDebug("deleting "+selectedText);
168 168
169 if( !selectedText.isEmpty()) { 169 if( !selectedText.isEmpty()) {
170 170
171 Config cfg("Notes"); 171 Config cfg("Notes");
172 cfg.setGroup("Docs"); 172 cfg.setGroup("Docs");
173 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 173 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
174 QString entryName, entryName2;; 174 QString entryName, entryName2;;
175 for ( int i = 0; i < noOfFiles; i++ ) { 175 for ( int i = 0; i < noOfFiles; i++ ) {
176 entryName.sprintf( "File%i", i + 1 ); 176 entryName.sprintf( "File%i", i + 1 );
177 if(selectedText == cfg.readEntry( entryName )) { 177 if(selectedText == cfg.readEntry( entryName )) {
178 qDebug("removing %s, %d", selectedText.latin1(), i); 178 qDebug("removing %s, %d", selectedText.latin1(), i);
179 for ( int j = i; j < noOfFiles; j++ ) { 179 for ( int j = i; j < noOfFiles; j++ ) {
180 entryName.sprintf( "File%i", i + 1 ); 180 entryName.sprintf( "File%i", i + 1 );
181 entryName2.sprintf( "File%i", i + 2 ); 181 entryName2.sprintf( "File%i", i + 2 );
182 QString temp = cfg.readEntry(entryName2); 182 QString temp = cfg.readEntry(entryName2);
183 qDebug("move "+temp); 183 qDebug("move "+temp);
184 cfg.writeEntry(entryName, temp); 184 cfg.writeEntry(entryName, temp);
185 i++; 185 i++;
186 } 186 }
187 cfg.writeEntry("NumberOfFiles", noOfFiles-1 ); 187 cfg.writeEntry("NumberOfFiles", noOfFiles-1 );
188 entryName.sprintf( "File%i", noOfFiles ); 188 entryName.sprintf( "File%i", noOfFiles );
189 cfg.removeEntry(entryName); 189 cfg.removeEntry(entryName);
190 cfg.write(); 190 cfg.write();
191 DocLnk nf(selectedText); 191 DocLnk nf(selectedText);
192 nf.removeFiles(); 192 nf.removeFiles();
193 QString fi=QPEApplication::documentDir()+"/text/plain/"+selectedText+".desktop"; 193 QString fi=QPEApplication::documentDir()+"/text/plain/"+selectedText+".desktop";
194 qDebug(fi); 194 qDebug(fi);
195 195
196 QFile f( fi); 196 QFile f( fi);
197 if( !f.remove()) qDebug(".desktop file not removed"); 197 if( !f.remove()) qDebug(".desktop file not removed");
198 198
199 } 199 }
200 } 200 }
201 view->clear(); 201 view->clear();
202 202
203 populateBox(); 203 populateBox();
204 } 204 }
205} 205}
206 206
207void NotesControl::slotNewButton() { 207void NotesControl::slotNewButton() {
208 if(edited) save(); 208 if(edited) save();
209 view->clear(); 209 view->clear();
210 view->setFocus(); 210 view->setFocus();
211 edited=false; 211 edited=false;
212 isNew=false; 212 isNew=false;
213} 213}
214 214
215void NotesControl::slotBeamButton() { 215void NotesControl::slotBeamButton() {
216 Ir ir; 216 Ir ir;
217 if(!ir.supported()){ 217 if(!ir.supported()){
218 } else { 218 } else {
219 this->hide(); 219 this->hide();
220 QString selectedText = box->currentText(); 220 QString selectedText = box->currentText();
221 if( !selectedText.isEmpty()) { 221 if( !selectedText.isEmpty()) {
222 QString file = QDir::homeDirPath()+"/"+selectedText; 222 QString file = QDir::homeDirPath()+"/"+selectedText;
223 QFile f(file); 223 QFile f(file);
224 Ir *irFile = new Ir(this, "IR"); 224 Ir *irFile = new Ir(this, "IR");
225 connect( irFile, SIGNAL(done(Ir*)), this, SLOT( slotBeamFinished( Ir * ))); 225 connect( irFile, SIGNAL(done(Ir*)), this, SLOT( slotBeamFinished(Ir*)));
226 irFile->send( file, "Note", "text/plain" ); 226 irFile->send( file, "Note", "text/plain" );
227 } 227 }
228 } 228 }
229} 229}
230 230
231void NotesControl::slotBeamFinished(Ir *) { 231void NotesControl::slotBeamFinished(Ir *) {
232 this->show(); 232 this->show();
233} 233}
234 234
235void NotesControl::boxPressed(int mouse, QListBoxItem *, const QPoint&) { 235void NotesControl::boxPressed(int mouse, QListBoxItem *, const QPoint&) {
236 switch (mouse) { 236 switch (mouse) {
237 case 1:{ 237 case 1:{
238 } 238 }
239 break; 239 break;
240 case 2: 240 case 2:
241 menuTimer.start( 500, TRUE ); 241 menuTimer.start( 500, TRUE );
242 break; 242 break;
243 }; 243 };
244} 244}
245 245
246void NotesControl::slotBoxSelected(const QString &itemString) { 246void NotesControl::slotBoxSelected(const QString &itemString) {
247 if(edited) { 247 if(edited) {
248 save(); 248 save();
249 } 249 }
250 loaded=false; 250 loaded=false;
251 edited=false; 251 edited=false;
252 load(itemString); 252 load(itemString);
253} 253}
254 254
255 255
256void NotesControl::showMenu() { 256void NotesControl::showMenu() {
257 QPopupMenu *m = new QPopupMenu(0); 257 QPopupMenu *m = new QPopupMenu(0);
258 m->insertItem( tr( "Beam Out" ), this, SLOT( slotBeamButton() )); 258 m->insertItem( tr( "Beam Out" ), this, SLOT( slotBeamButton() ));
259 m->insertItem( tr( "Search For..." ), this, SLOT( slotSearch() )); 259 m->insertItem( tr( "Search For..." ), this, SLOT( slotSearch() ));
260 m->insertItem( tr( "Toggle Maximized" ), this, SLOT( slotShowMax() )); 260 m->insertItem( tr( "Toggle Maximized" ), this, SLOT( slotShowMax() ));
261 m->insertSeparator(); 261 m->insertSeparator();
262 m->insertItem( tr( "Delete" ), this, SLOT( slotDeleteButton() )); 262 m->insertItem( tr( "Delete" ), this, SLOT( slotDeleteButton() ));
263 m->setFocus(); 263 m->setFocus();
264 m->exec( QCursor::pos() ); 264 m->exec( QCursor::pos() );
265 265
266 if(m) delete m; 266 if(m) delete m;
267} 267}
268 268
269void NotesControl::focusOutEvent ( QFocusEvent * e) { 269void NotesControl::focusOutEvent ( QFocusEvent * e) {
270 if( e->reason() == QFocusEvent::Popup) 270 if( e->reason() == QFocusEvent::Popup)
271 save(); 271 save();
272 else { 272 else {
273 if(!loaded) { 273 if(!loaded) {
274 populateBox(); 274 populateBox();
275 load(); 275 load();
276 } 276 }
277 } 277 }
278 QWidget::focusOutEvent(e); 278 QWidget::focusOutEvent(e);
279} 279}
280 280
281void NotesControl::save() { 281void NotesControl::save() {
282 Config cfg("Notes"); 282 Config cfg("Notes");
283 cfg.setGroup("Docs"); 283 cfg.setGroup("Docs");
284 if( edited) { 284 if( edited) {
285// qDebug("is edited"); 285// qDebug("is edited");
286 QString rt = view->text(); 286 QString rt = view->text();
287 if( rt.length()>1) { 287 if( rt.length()>1) {
288 QString pt = rt.simplifyWhiteSpace(); 288 QString pt = rt.simplifyWhiteSpace();
289 int i = pt.find( ' ', pt.find( ' ' )+2 ); 289 int i = pt.find( ' ', pt.find( ' ' )+2 );
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp
index 9ce6618..6ef2e44 100644
--- a/noncore/applets/wirelessapplet/wireless.cpp
+++ b/noncore/applets/wirelessapplet/wireless.cpp
@@ -60,139 +60,139 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
60 QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" ); 60 QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" );
61 61
62 /* status label */ 62 /* status label */
63 63
64 statusLabel = new QLabel( this, "statuslabel" ); 64 statusLabel = new QLabel( this, "statuslabel" );
65 QString text( "Wireless Status:<br>" 65 QString text( "Wireless Status:<br>"
66 "*** Unknown ***<br>" 66 "*** Unknown ***<br>"
67 "Card not inserted ?<br>" 67 "Card not inserted ?<br>"
68 "Or Sharp ROM ?<br>" 68 "Or Sharp ROM ?<br>"
69 "CELL: 00:00:00:00:00:00" ); 69 "CELL: 00:00:00:00:00:00" );
70 /* QString text( "Station: Unknown<br>" 70 /* QString text( "Station: Unknown<br>"
71 "ESSID: Unknown<br>" 71 "ESSID: Unknown<br>"
72 "MODE: Unknown<br>" 72 "MODE: Unknown<br>"
73 "FREQ: Unknown<br>" 73 "FREQ: Unknown<br>"
74 "CELL: AA:BB:CC:DD:EE:FF" ); */ 74 "CELL: AA:BB:CC:DD:EE:FF" ); */
75 statusLabel->setText( text ); 75 statusLabel->setText( text );
76 statusLabel->setFixedSize( statusLabel->sizeHint() ); 76 statusLabel->setFixedSize( statusLabel->sizeHint() );
77 grid->addWidget( statusLabel, 0, 0 ); 77 grid->addWidget( statusLabel, 0, 0 );
78 78
79 /* visualization group box */ 79 /* visualization group box */
80 80
81 QButtonGroup* group = new QButtonGroup( 1, Qt::Horizontal, "Visualization", this ); 81 QButtonGroup* group = new QButtonGroup( 1, Qt::Horizontal, "Visualization", this );
82 QRadioButton* r1 = new QRadioButton( "Color Bars", group ); 82 QRadioButton* r1 = new QRadioButton( "Color Bars", group );
83 QRadioButton* r2 = new QRadioButton( "Antenna", group ); 83 QRadioButton* r2 = new QRadioButton( "Antenna", group );
84 r1->setFocusPolicy( QWidget::NoFocus ); 84 r1->setFocusPolicy( QWidget::NoFocus );
85 r2->setFocusPolicy( QWidget::NoFocus ); 85 r2->setFocusPolicy( QWidget::NoFocus );
86 group->setFocusPolicy( QWidget::NoFocus ); 86 group->setFocusPolicy( QWidget::NoFocus );
87 group->setButton( displayStyle ); 87 group->setButton( displayStyle );
88 grid->addWidget( group, 0, 1 ); 88 grid->addWidget( group, 0, 1 );
89 89
90 /* quality graph */ 90 /* quality graph */
91 91
92 mgraph = new MGraph( this ); 92 mgraph = new MGraph( this );
93 mgraph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 93 mgraph->setFrameStyle( QFrame::Panel | QFrame::Sunken );
94 mgraph->setMin( 0 ); 94 mgraph->setMin( 0 );
95 mgraph->setMax( 92 ); 95 mgraph->setMax( 92 );
96 grid->addWidget( mgraph, 1, 0 ); 96 grid->addWidget( mgraph, 1, 0 );
97 mgraph->setFocusPolicy( QWidget::NoFocus ); 97 mgraph->setFocusPolicy( QWidget::NoFocus );
98 98
99 /* advanced configuration Button */ 99 /* advanced configuration Button */
100 100
101 QPushButton* advanced = new QPushButton( "Advanced...", this ); 101 QPushButton* advanced = new QPushButton( "Advanced...", this );
102 advanced->setFocusPolicy( QWidget::NoFocus ); 102 advanced->setFocusPolicy( QWidget::NoFocus );
103 grid->addWidget( advanced, 2, 0, Qt::AlignCenter ); 103 grid->addWidget( advanced, 2, 0, Qt::AlignCenter );
104 connect( advanced, SIGNAL( clicked() ), 104 connect( advanced, SIGNAL( clicked() ),
105 this, SLOT( advancedConfigClicked() ) ); 105 this, SLOT( advancedConfigClicked() ) );
106 106
107 /* update Frequency Label */ 107 /* update Frequency Label */
108 108
109 updateLabel = new QLabel( this ); 109 updateLabel = new QLabel( this );
110 text.sprintf( "Update every %d s", updateFrequency ); 110 text.sprintf( "Update every %d s", updateFrequency );
111 updateLabel->setText( text ); 111 updateLabel->setText( text );
112 grid->addWidget( updateLabel, 2, 1 ); 112 grid->addWidget( updateLabel, 2, 1 );
113 113
114 /* update Frequency Slider */ 114 /* update Frequency Slider */
115 115
116 QSlider* updateSlider = new QSlider( QSlider::Horizontal, this ); 116 QSlider* updateSlider = new QSlider( QSlider::Horizontal, this );
117 updateSlider->setRange( 0, 9 ); 117 updateSlider->setRange( 0, 9 );
118 updateSlider->setValue( updateFrequency ); 118 updateSlider->setValue( updateFrequency );
119 updateSlider->setTickmarks( QSlider::Both ); 119 updateSlider->setTickmarks( QSlider::Both );
120 updateSlider->setTickInterval( 1 ); 120 updateSlider->setTickInterval( 1 );
121 updateSlider->setSteps( 1, 1 ); 121 updateSlider->setSteps( 1, 1 );
122 updateSlider->setFocusPolicy( QWidget::NoFocus ); 122 updateSlider->setFocusPolicy( QWidget::NoFocus );
123 grid->addWidget( updateSlider, 1, 1 ); 123 grid->addWidget( updateSlider, 1, 1 );
124 connect( updateSlider, SIGNAL( valueChanged( int ) ), 124 connect( updateSlider, SIGNAL( valueChanged(int) ),
125 this, SLOT( updateDelayChange( int ) ) ); 125 this, SLOT( updateDelayChange(int) ) );
126 126
127 setFixedSize( sizeHint() ); 127 setFixedSize( sizeHint() );
128 setFocusPolicy( QWidget::NoFocus ); 128 setFocusPolicy( QWidget::NoFocus );
129 129
130 applet->displayStyleChange( displayStyle ); 130 applet->displayStyleChange( displayStyle );
131 applet->updateDelayChange( updateFrequency ); 131 applet->updateDelayChange( updateFrequency );
132 132
133 connect( group, SIGNAL( clicked( int ) ), 133 connect( group, SIGNAL( clicked(int) ),
134 this, SLOT( displayStyleChange( int ) ) ); 134 this, SLOT( displayStyleChange(int) ) );
135 135
136 applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); 136 applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE );
137} 137}
138 138
139void WirelessControl::advancedConfigClicked() 139void WirelessControl::advancedConfigClicked()
140{ 140{
141 AdvancedConfig * a = new AdvancedConfig( this, "dialog", TRUE ); 141 AdvancedConfig * a = new AdvancedConfig( this, "dialog", TRUE );
142 int result = a->exec(); 142 int result = a->exec();
143 a->hide(); 143 a->hide();
144 delete a; 144 delete a;
145 if ( result == QDialog::Accepted ) 145 if ( result == QDialog::Accepted )
146 { 146 {
147 readConfig(); 147 readConfig();
148 applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); 148 applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE );
149 } 149 }
150} 150}
151 151
152void WirelessControl::updateDelayChange( int delay ) 152void WirelessControl::updateDelayChange( int delay )
153{ 153{
154 QString text; 154 QString text;
155 text.sprintf( "Update every %d s", delay ); 155 text.sprintf( "Update every %d s", delay );
156 updateLabel->setText( text ); 156 updateLabel->setText( text );
157 applet->updateDelayChange( delay ); 157 applet->updateDelayChange( delay );
158 writeConfigEntry( "UpdateFrequency", delay ); 158 writeConfigEntry( "UpdateFrequency", delay );
159} 159}
160 160
161void WirelessControl::displayStyleChange( int style ) 161void WirelessControl::displayStyleChange( int style )
162{ 162{
163 applet->displayStyleChange( style ); 163 applet->displayStyleChange( style );
164 writeConfigEntry( "DisplayStyle", style ); 164 writeConfigEntry( "DisplayStyle", style );
165} 165}
166 166
167void WirelessControl::show ( bool ) 167void WirelessControl::show ( bool )
168{ 168{
169 QPoint curPos = applet->mapToGlobal( QPoint ( 0, 0 ) ); 169 QPoint curPos = applet->mapToGlobal( QPoint ( 0, 0 ) );
170 170
171 int w = sizeHint().width(); 171 int w = sizeHint().width();
172 int x = curPos.x() - ( w / 2 ); 172 int x = curPos.x() - ( w / 2 );
173 173
174 if ( ( x + w ) > QPEApplication::desktop() ->width() ) 174 if ( ( x + w ) > QPEApplication::desktop() ->width() )
175 x = QPEApplication::desktop ( ) -> width ( ) - w; 175 x = QPEApplication::desktop ( ) -> width ( ) - w;
176 176
177 move( x, curPos.y () - sizeHint().height () ); 177 move( x, curPos.y () - sizeHint().height () );
178 QFrame::show(); 178 QFrame::show();
179} 179}
180 180
181void WirelessControl::readConfig() 181void WirelessControl::readConfig()
182{ 182{
183 Config cfg( "qpe" ); 183 Config cfg( "qpe" );
184 cfg.setGroup( "Wireless" ); 184 cfg.setGroup( "Wireless" );
185 185
186 updateFrequency = cfg.readNumEntry( "UpdateFrequency", 2 ); 186 updateFrequency = cfg.readNumEntry( "UpdateFrequency", 2 );
187 displayStyle = cfg.readNumEntry( "DisplayStyle", STYLE_ANTENNA ); 187 displayStyle = cfg.readNumEntry( "DisplayStyle", STYLE_ANTENNA );
188 rocESSID = cfg.readBoolEntry( "renew_dhcp_on_essid_change", false ); 188 rocESSID = cfg.readBoolEntry( "renew_dhcp_on_essid_change", false );
189 rocFREQ = cfg.readBoolEntry( "renew_dhcp_on_freq_change", false ); 189 rocFREQ = cfg.readBoolEntry( "renew_dhcp_on_freq_change", false );
190 rocAP = cfg.readBoolEntry( "renew_dhcp_on_ap_change", false ); 190 rocAP = cfg.readBoolEntry( "renew_dhcp_on_ap_change", false );
191 rocMODE = cfg.readBoolEntry( "renew_dhcp_on_mode_change", false ); 191 rocMODE = cfg.readBoolEntry( "renew_dhcp_on_mode_change", false );
192} 192}
193 193
194void WirelessControl::writeConfigEntry( const char *entry, int val ) 194void WirelessControl::writeConfigEntry( const char *entry, int val )
195{ 195{
196 Config cfg( "qpe" ); 196 Config cfg( "qpe" );
197 cfg.setGroup( "Wireless" ); 197 cfg.setGroup( "Wireless" );
198 cfg.writeEntry( entry, val ); 198 cfg.writeEntry( entry, val );
diff --git a/noncore/applets/zkbapplet/zkbwidget.cpp b/noncore/applets/zkbapplet/zkbwidget.cpp
index 0b5ab78..0083e9b 100644
--- a/noncore/applets/zkbapplet/zkbwidget.cpp
+++ b/noncore/applets/zkbapplet/zkbwidget.cpp
@@ -1,86 +1,86 @@
1#include <opie2/otaskbarapplet.h> 1#include <opie2/otaskbarapplet.h>
2#include <qpe/qcopenvelope_qws.h> 2#include <qpe/qcopenvelope_qws.h>
3#include <qpe/applnk.h> 3#include <qpe/applnk.h>
4#include <qpe/qpeapplication.h> 4#include <qpe/qpeapplication.h>
5#include <qpe/resource.h> 5#include <qpe/resource.h>
6#include <stdio.h> 6#include <stdio.h>
7#include <unistd.h> 7#include <unistd.h>
8#include "zkbwidget.h" 8#include "zkbwidget.h"
9#include "zkbcfg.h" 9#include "zkbcfg.h"
10 10
11ZkbWidget::ZkbWidget(QWidget* parent):QLabel(parent),keymap(0), 11ZkbWidget::ZkbWidget(QWidget* parent):QLabel(parent),keymap(0),
12 disabled(Resource::loadPixmap("zkb-disabled")) { 12 disabled(Resource::loadPixmap("zkb-disabled")) {
13 13
14 labels = new QPopupMenu(); 14 labels = new QPopupMenu();
15 connect(labels, SIGNAL(activated(int)), this, 15 connect(labels, SIGNAL(activated(int)), this,
16 SLOT(labelChanged(int))); 16 SLOT(labelChanged(int)));
17 17
18 loadKeymap(); 18 loadKeymap();
19 19
20 channel = new QCopChannel("QPE/zkb", this); 20 channel = new QCopChannel("QPE/zkb", this);
21 connect(channel, SIGNAL(received(const QCString&, const QByteArray&)), 21 connect(channel, SIGNAL(received(const QCString&,const QByteArray&)),
22 this, SLOT(signalReceived(const QCString&, const QByteArray&))); 22 this, SLOT(signalReceived(const QCString&,const QByteArray&)));
23 setFixedWidth ( AppLnk::smallIconSize() ); 23 setFixedWidth ( AppLnk::smallIconSize() );
24 setFixedHeight ( AppLnk::smallIconSize() ); 24 setFixedHeight ( AppLnk::smallIconSize() );
25} 25}
26 26
27ZkbWidget::~ZkbWidget() { 27ZkbWidget::~ZkbWidget() {
28} 28}
29 29
30int ZkbWidget::position() 30int ZkbWidget::position()
31{ 31{
32 return 8; 32 return 8;
33} 33}
34 34
35bool ZkbWidget::loadKeymap() { 35bool ZkbWidget::loadKeymap() {
36 ZkbConfig c(QPEApplication::qpeDir()+"/share/zkb"); 36 ZkbConfig c(QPEApplication::qpeDir()+"/share/zkb");
37 QFontMetrics fm(font()); 37 QFontMetrics fm(font());
38 38
39 if (keymap != 0) { 39 if (keymap != 0) {
40 delete keymap; 40 delete keymap;
41 keymap = 0; 41 keymap = 0;
42 } 42 }
43 43
44 Keymap* km = new Keymap(); 44 Keymap* km = new Keymap();
45 45
46 if (!c.load("zkb.xml", *km, "")) { 46 if (!c.load("zkb.xml", *km, "")) {
47 delete km; 47 delete km;
48 setPixmap(disabled); 48 setPixmap(disabled);
49 return false; 49 return false;
50 } 50 }
51 51
52 connect(km, SIGNAL(stateChanged(const QString&)), 52 connect(km, SIGNAL(stateChanged(const QString&)),
53 this, SLOT(stateChanged(const QString&))); 53 this, SLOT(stateChanged(const QString&)));
54 54
55 qwsServer->setKeyboardFilter(km); 55 qwsServer->setKeyboardFilter(km);
56 56
57 Keymap* oldkm = keymap; 57 Keymap* oldkm = keymap;
58 keymap = km; 58 keymap = km;
59 59
60 if (oldkm != 0) { 60 if (oldkm != 0) {
61 delete oldkm; 61 delete oldkm;
62 } 62 }
63 63
64 setText(keymap->getCurrentLabel()); 64 setText(keymap->getCurrentLabel());
65 65
66 labels->clear(); 66 labels->clear();
67 QStringList l = keymap->listLabels(); 67 QStringList l = keymap->listLabels();
68 labels->insertItem(disabled, 0, 0); 68 labels->insertItem(disabled, 0, 0);
69 int n = 1; 69 int n = 1;
70 w = 0; 70 w = 0;
71 for(QStringList::Iterator it = l.begin(); it != l.end(); 71 for(QStringList::Iterator it = l.begin(); it != l.end();
72 ++it, n++) { 72 ++it, n++) {
73 73
74 // printf("label: %s\n", (const char*) (*it).utf8()); 74 // printf("label: %s\n", (const char*) (*it).utf8());
75 75
76 labels->insertItem(*it, n, n); 76 labels->insertItem(*it, n, n);
77 int lw = fm.width(*it); 77 int lw = fm.width(*it);
78 if (lw > w) { 78 if (lw > w) {
79 w = lw; 79 w = lw;
80 } 80 }
81 } 81 }
82 82
83 if (w == 0) { 83 if (w == 0) {
84 hide(); 84 hide();
85 } else { 85 } else {
86 show(); 86 show();
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index c44d387..2ba3dca 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,117 +1,117 @@
1/*************************************************************************** 1/***************************************************************************
2 AdvancedFm.cpp 2 AdvancedFm.cpp
3 ------------------- 3 -------------------
4 ** Created: Sat Mar 9 23:33:09 2002 4 ** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#define DEVELOPERS_VERSION 12#define DEVELOPERS_VERSION
13#include "advancedfm.h" 13#include "advancedfm.h"
14 14
15#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
16#include <qpe/config.h> 16#include <qpe/config.h>
17#include <qpe/mimetype.h> 17#include <qpe/mimetype.h>
18#include <qpe/applnk.h> 18#include <qpe/applnk.h>
19#include <qpe/resource.h> 19#include <qpe/resource.h>
20#include <qpe/menubutton.h> 20#include <qpe/menubutton.h>
21 21
22#include <qcombobox.h> 22#include <qcombobox.h>
23#include <qpopupmenu.h> 23#include <qpopupmenu.h>
24#include <qlistview.h> 24#include <qlistview.h>
25#include <qmessagebox.h> 25#include <qmessagebox.h>
26#include <qlineedit.h> 26#include <qlineedit.h>
27 27
28 28
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <time.h> 30#include <time.h>
31#include <dirent.h> 31#include <dirent.h>
32#include <fcntl.h> 32#include <fcntl.h>
33#include <sys/vfs.h> 33#include <sys/vfs.h>
34#include <mntent.h> 34#include <mntent.h>
35 35
36#ifdef NOQUICKLAUNCH 36#ifdef NOQUICKLAUNCH
37AdvancedFm::AdvancedFm( ) 37AdvancedFm::AdvancedFm( )
38#else 38#else
39AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) 39AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags )
40#endif 40#endif
41 : QMainWindow( ) { 41 : QMainWindow( ) {
42 init(); 42 init();
43 renameBox = 0; 43 renameBox = 0;
44 44
45 unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 45 unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
46 46
47 initConnections(); 47 initConnections();
48 whichTab=1; 48 whichTab=1;
49 rePopulate(); 49 rePopulate();
50 currentPathCombo->setFocus(); 50 currentPathCombo->setFocus();
51 channel = new QCopChannel( "QPE/Application/advancedfm", this ); 51 channel = new QCopChannel( "QPE/Application/advancedfm", this );
52 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 52 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
53 this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); 53 this, SLOT( qcopReceive(const QCString&,const QByteArray&)) );
54} 54}
55 55
56AdvancedFm::~AdvancedFm() { 56AdvancedFm::~AdvancedFm() {
57} 57}
58 58
59 59
60void AdvancedFm::cleanUp() { 60void AdvancedFm::cleanUp() {
61 QString sfile=QDir::homeDirPath(); 61 QString sfile=QDir::homeDirPath();
62 if(sfile.right(1) != "/") 62 if(sfile.right(1) != "/")
63 sfile+="/._temp"; 63 sfile+="/._temp";
64 else 64 else
65 sfile+="._temp"; 65 sfile+="._temp";
66 QFile file( sfile); 66 QFile file( sfile);
67 if(file.exists()) 67 if(file.exists())
68 file.remove(); 68 file.remove();
69} 69}
70 70
71void AdvancedFm::tabChanged(QWidget *) { 71void AdvancedFm::tabChanged(QWidget *) {
72// qWarning("tab changed"); 72// qWarning("tab changed");
73 QString path = CurrentDir()->canonicalPath(); 73 QString path = CurrentDir()->canonicalPath();
74 currentPathCombo->lineEdit()->setText( path ); 74 currentPathCombo->lineEdit()->setText( path );
75 75
76 if(whichTab == 1) { 76 if(whichTab == 1) {
77 viewMenu->setItemChecked(viewMenu->idAt(0), true); 77 viewMenu->setItemChecked(viewMenu->idAt(0), true);
78 viewMenu->setItemChecked(viewMenu->idAt(1), false); 78 viewMenu->setItemChecked(viewMenu->idAt(1), false);
79 } else { 79 } else {
80 viewMenu->setItemChecked(viewMenu->idAt(0), false); 80 viewMenu->setItemChecked(viewMenu->idAt(0), false);
81 viewMenu->setItemChecked(viewMenu->idAt(1), true); 81 viewMenu->setItemChecked(viewMenu->idAt(1), true);
82 } 82 }
83 83
84 QString fs= getFileSystemType( (const QString &) path); 84 QString fs= getFileSystemType( (const QString &) path);
85 85
86 setCaption(tr("AdvancedFm :: ")+fs+" :: " 86 setCaption(tr("AdvancedFm :: ")+fs+" :: "
87 +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); 87 +checkDiskSpace( (const QString &) path )+ tr(" kB free") );
88 chdir( path.latin1()); 88 chdir( path.latin1());
89} 89}
90 90
91 91
92void AdvancedFm::populateView() { 92void AdvancedFm::populateView() {
93 93
94// qWarning("PopulateView"); 94// qWarning("PopulateView");
95 QPixmap pm; 95 QPixmap pm;
96 QListView *thisView = CurrentView(); 96 QListView *thisView = CurrentView();
97 QDir *thisDir = CurrentDir(); 97 QDir *thisDir = CurrentDir();
98 QString path = thisDir->canonicalPath(); 98 QString path = thisDir->canonicalPath();
99 99
100//qWarning("path is "+path); 100//qWarning("path is "+path);
101 thisView->clear(); 101 thisView->clear();
102 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 102 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
103 thisDir->setMatchAllDirs(TRUE); 103 thisDir->setMatchAllDirs(TRUE);
104 thisDir->setNameFilter(filterStr); 104 thisDir->setNameFilter(filterStr);
105 QString fileL, fileS, fileDate; 105 QString fileL, fileS, fileDate;
106 QString fs= getFileSystemType((const QString &) path); 106 QString fs= getFileSystemType((const QString &) path);
107 setCaption(tr("AdvancedFm :: ")+fs+" :: " 107 setCaption(tr("AdvancedFm :: ")+fs+" :: "
108 +checkDiskSpace((const QString &) path)+ tr(" kB free") ); 108 +checkDiskSpace((const QString &) path)+ tr(" kB free") );
109 bool isDir=FALSE; 109 bool isDir=FALSE;
110 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 110 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
111 QFileInfoListIterator it(*list); 111 QFileInfoListIterator it(*list);
112 QFileInfo *fi; 112 QFileInfo *fi;
113 while ( (fi=it.current()) ) { 113 while ( (fi=it.current()) ) {
114 if (fi->isSymLink() ) { 114 if (fi->isSymLink() ) {
115 QString symLink=fi->readLink(); 115 QString symLink=fi->readLink();
116 QFileInfo sym( symLink); 116 QFileInfo sym( symLink);
117 fileS.sprintf( "%10i", sym.size() ); 117 fileS.sprintf( "%10i", sym.size() );
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index 763ae34..f791c77 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -192,95 +192,95 @@ void AdvancedFm::init() {
192 192
193 // OFileDialog fileDialog; 193 // OFileDialog fileDialog;
194 // fileDialog; 194 // fileDialog;
195 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy 195 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy
196 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); 196 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow");
197 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); 197 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/");
198 198
199 QListView *fileTree; 199 QListView *fileTree;
200 fileTree = new QListView( tab_3, "tree" ); 200 fileTree = new QListView( tab_3, "tree" );
201 201
202 202
203 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); 203 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 );
204 204
205 TabWidget->insertTab( tab_3, tr( "Remote" ) ); 205 TabWidget->insertTab( tab_3, tr( "Remote" ) );
206 */ 206 */
207 207
208 /////////////// 208 ///////////////
209 209
210 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) 210 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
211 zaurusDevice=TRUE; 211 zaurusDevice=TRUE;
212 else 212 else
213 zaurusDevice=FALSE; 213 zaurusDevice=FALSE;
214 214
215 215
216 if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { 216 if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) {
217 qDebug("not have sd"); 217 qDebug("not have sd");
218 sdButton->hide(); 218 sdButton->hide();
219 } 219 }
220 if( !StorageInfo::hasCf() ) { 220 if( !StorageInfo::hasCf() ) {
221 qDebug("not have cf"); 221 qDebug("not have cf");
222 cfButton->hide(); 222 cfButton->hide();
223 } 223 }
224 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 224 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
225 currentDir.setPath( QDir::currentDirPath()); 225 currentDir.setPath( QDir::currentDirPath());
226 226
227 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 227 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
228 currentRemoteDir.setPath( QDir::currentDirPath()); 228 currentRemoteDir.setPath( QDir::currentDirPath());
229 229
230 // b = TRUE; 230 // b = TRUE;
231 231
232 filterStr="*"; 232 filterStr="*";
233 b=FALSE; 233 b=FALSE;
234 showMenuHidden(); 234 showMenuHidden();
235 TabWidget->setCurrentWidget(0); 235 TabWidget->setCurrentWidget(0);
236 236
237} 237}
238 238
239void AdvancedFm::initConnections() 239void AdvancedFm::initConnections()
240{ 240{
241 241
242 connect( qApp,SIGNAL( aboutToQuit()), 242 connect( qApp,SIGNAL( aboutToQuit()),
243 this, SLOT( cleanUp()) ); 243 this, SLOT( cleanUp()) );
244 connect( qpeDirButton ,SIGNAL(released()), 244 connect( qpeDirButton ,SIGNAL(released()),
245 this,SLOT( QPEButtonPushed()) ); 245 this,SLOT( QPEButtonPushed()) );
246 connect( cfButton ,SIGNAL(released()), 246 connect( cfButton ,SIGNAL(released()),
247 this,SLOT( CFButtonPushed()) ); 247 this,SLOT( CFButtonPushed()) );
248 connect( sdButton ,SIGNAL(released()), 248 connect( sdButton ,SIGNAL(released()),
249 this,SLOT( SDButtonPushed()) ); 249 this,SLOT( SDButtonPushed()) );
250 connect( cdUpButton ,SIGNAL(released()), 250 connect( cdUpButton ,SIGNAL(released()),
251 this,SLOT( upDir()) ); 251 this,SLOT( upDir()) );
252 connect( docButton,SIGNAL(released()), 252 connect( docButton,SIGNAL(released()),
253 this,SLOT( docButtonPushed()) ); 253 this,SLOT( docButtonPushed()) );
254 connect( homeButton,SIGNAL(released()), 254 connect( homeButton,SIGNAL(released()),
255 this,SLOT( homeButtonPushed()) ); 255 this,SLOT( homeButtonPushed()) );
256 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 256 connect( currentPathCombo, SIGNAL( activated(const QString&) ),
257 this, SLOT( currentPathComboActivated( const QString & ) ) ); 257 this, SLOT( currentPathComboActivated(const QString&) ) );
258 258
259 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 259 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
260 this,SLOT(currentPathComboChanged())); 260 this,SLOT(currentPathComboChanged()));
261 261
262 connect( Local_View, SIGNAL( clicked( QListViewItem*)), 262 connect( Local_View, SIGNAL( clicked(QListViewItem*)),
263 this,SLOT( ListClicked(QListViewItem *)) ); 263 this,SLOT( ListClicked(QListViewItem*)) );
264 264
265 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 265 connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
266 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 266 this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) );
267 267
268 connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); 268 connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) );
269 269
270 connect( Remote_View, SIGNAL( clicked( QListViewItem*)), 270 connect( Remote_View, SIGNAL( clicked(QListViewItem*)),
271 this,SLOT( ListClicked(QListViewItem *)) ); 271 this,SLOT( ListClicked(QListViewItem*)) );
272 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 272 connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
273 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 273 this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) );
274 274
275 connect( TabWidget,SIGNAL(currentChanged(QWidget *)), 275 connect( TabWidget,SIGNAL(currentChanged(QWidget*)),
276 this,SLOT(tabChanged(QWidget*))); 276 this,SLOT(tabChanged(QWidget*)));
277 277
278 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); 278 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) );
279 279
280 connect( menuButton, SIGNAL( selected(const QString &)), SLOT(gotoCustomDir(const QString&))); 280 connect( menuButton, SIGNAL( selected(const QString&)), SLOT(gotoCustomDir(const QString&)));
281// connect( menuButton, SIGNAL( selected( int)), SLOT( dirMenuSelected(int))); 281// connect( menuButton, SIGNAL( selected(int)), SLOT( dirMenuSelected(int)));
282 connect( viewMenu, SIGNAL( activated(int )), this, SLOT(slotSwitchMenu(int ))); 282 connect( viewMenu, SIGNAL( activated(int)), this, SLOT(slotSwitchMenu(int)));
283// connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); 283// connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int)));
284 284
285} 285}
286 286
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 9ad1146..9e740d0 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -620,154 +620,154 @@ void AdvancedFm::fileStatus() {
620 command << "-c"; 620 command << "-c";
621 command << "stat -l "+ curFile; 621 command << "stat -l "+ curFile;
622 622
623 Output *outDlg; 623 Output *outDlg;
624 outDlg = new Output( command, this, tr("AdvancedFm Output"), true); 624 outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
625 QPEApplication::execDialog( outDlg ); 625 QPEApplication::execDialog( outDlg );
626 qApp->processEvents(); 626 qApp->processEvents();
627} 627}
628 628
629 629
630void AdvancedFm::mkDir() { 630void AdvancedFm::mkDir() {
631 makeDir(); 631 makeDir();
632} 632}
633 633
634void AdvancedFm::rn() { 634void AdvancedFm::rn() {
635 renameIt(); 635 renameIt();
636} 636}
637 637
638void AdvancedFm::del() { 638void AdvancedFm::del() {
639 doDelete(); 639 doDelete();
640} 640}
641 641
642void AdvancedFm::mkSym() { 642void AdvancedFm::mkSym() {
643 QString cmd; 643 QString cmd;
644 QStringList curFileList = getPath(); 644 QStringList curFileList = getPath();
645 if( curFileList.count() > 0) { 645 if( curFileList.count() > 0) {
646 QDir *thisDir = CurrentDir(); 646 QDir *thisDir = CurrentDir();
647 QDir * thatDir = OtherDir(); 647 QDir * thatDir = OtherDir();
648 648
649 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 649 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
650 650
651 QString destName = thatDir->canonicalPath()+"/"+(*it); 651 QString destName = thatDir->canonicalPath()+"/"+(*it);
652 if(destName.right(1) == "/") { 652 if(destName.right(1) == "/") {
653 destName = destName.left( destName.length() -1); 653 destName = destName.left( destName.length() -1);
654 } 654 }
655 655
656 QString curFile = thisDir->canonicalPath()+"/"+(*it); 656 QString curFile = thisDir->canonicalPath()+"/"+(*it);
657 657
658 if( curFile.right(1) == "/") { 658 if( curFile.right(1) == "/") {
659 curFile = curFile.left( curFile.length() -1); 659 curFile = curFile.left( curFile.length() -1);
660 } 660 }
661 661
662 cmd = "ln -s "+curFile+" "+destName; 662 cmd = "ln -s "+curFile+" "+destName;
663// qDebug(cmd); 663// qDebug(cmd);
664 startProcess( (const QString)cmd ); 664 startProcess( (const QString)cmd );
665 } 665 }
666 rePopulate(); 666 rePopulate();
667 setOtherTabCurrent(); 667 setOtherTabCurrent();
668 } 668 }
669} 669}
670 670
671void AdvancedFm::doBeam() { 671void AdvancedFm::doBeam() {
672 Ir ir; 672 Ir ir;
673 if(!ir.supported()) { 673 if(!ir.supported()) {
674 } else { 674 } else {
675 QStringList curFileList = getPath(); 675 QStringList curFileList = getPath();
676 if( curFileList.count() > 0) { 676 if( curFileList.count() > 0) {
677 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 677 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
678 QString curFile = (*it); 678 QString curFile = (*it);
679 QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; 679 QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile;
680 if( curFilePath.right(1) == "/") { 680 if( curFilePath.right(1) == "/") {
681 curFilePath = curFilePath.left( curFilePath.length() -1); 681 curFilePath = curFilePath.left( curFilePath.length() -1);
682 } 682 }
683 Ir *file = new Ir(this, "IR"); 683 Ir *file = new Ir(this, "IR");
684 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); 684 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*)));
685 file->send( curFilePath, curFile ); 685 file->send( curFilePath, curFile );
686 } 686 }
687 } 687 }
688 } 688 }
689} 689}
690 690
691void AdvancedFm::fileBeamFinished( Ir *) { 691void AdvancedFm::fileBeamFinished( Ir *) {
692 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); 692 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
693} 693}
694 694
695void AdvancedFm::selectAll() { 695void AdvancedFm::selectAll() {
696 QListView *thisView = CurrentView(); 696 QListView *thisView = CurrentView();
697 thisView->selectAll(true); 697 thisView->selectAll(true);
698 thisView->setSelected( thisView->firstChild(),false); 698 thisView->setSelected( thisView->firstChild(),false);
699} 699}
700 700
701void AdvancedFm::startProcess(const QString & cmd) { 701void AdvancedFm::startProcess(const QString & cmd) {
702 QStringList command; 702 QStringList command;
703 OProcess *process; 703 OProcess *process;
704 process = new OProcess(); 704 process = new OProcess();
705 connect(process, SIGNAL(processExited(OProcess *)), 705 connect(process, SIGNAL(processExited(OProcess*)),
706 this, SLOT( processEnded(OProcess *))); 706 this, SLOT( processEnded(OProcess*)));
707 707
708 connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)), 708 connect(process, SIGNAL( receivedStderr(OProcess*,char*,int)),
709 this, SLOT( oprocessStderr(OProcess *, char *, int))); 709 this, SLOT( oprocessStderr(OProcess*,char*,int)));
710 710
711 command << "/bin/sh"; 711 command << "/bin/sh";
712 command << "-c"; 712 command << "-c";
713 command << cmd.latin1(); 713 command << cmd.latin1();
714 *process << command; 714 *process << command;
715 if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) 715 if(!process->start(OProcess::NotifyOnExit, OProcess::All) )
716 qDebug("could not start process"); 716 qDebug("could not start process");
717} 717}
718 718
719void AdvancedFm::processEnded(OProcess *) { 719void AdvancedFm::processEnded(OProcess *) {
720 rePopulate(); 720 rePopulate();
721} 721}
722 722
723void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { 723void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
724// qWarning("received stderrt %d bytes", buflen); 724// qWarning("received stderrt %d bytes", buflen);
725 725
726 QString lineStr = buffer; 726 QString lineStr = buffer;
727 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); 727 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
728} 728}
729 729
730bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { 730bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
731 if ( o->inherits( "QLineEdit" ) ) { 731 if ( o->inherits( "QLineEdit" ) ) {
732 if ( e->type() == QEvent::KeyPress ) { 732 if ( e->type() == QEvent::KeyPress ) {
733 QKeyEvent *ke = (QKeyEvent*)e; 733 QKeyEvent *ke = (QKeyEvent*)e;
734 if ( ke->key() == Key_Return || 734 if ( ke->key() == Key_Return ||
735 ke->key() == Key_Enter ) { 735 ke->key() == Key_Enter ) {
736 okRename(); 736 okRename();
737 return true; 737 return true;
738 } 738 }
739 else if ( ke->key() == Key_Escape ) { 739 else if ( ke->key() == Key_Escape ) {
740 cancelRename(); 740 cancelRename();
741 return true; 741 return true;
742 } 742 }
743 } 743 }
744 else if ( e->type() == QEvent::FocusOut ) { 744 else if ( e->type() == QEvent::FocusOut ) {
745 cancelRename(); 745 cancelRename();
746 return true; 746 return true;
747 } 747 }
748 } 748 }
749 if ( o->inherits( "QListView" ) ) { 749 if ( o->inherits( "QListView" ) ) {
750 if ( e->type() == QEvent::FocusIn ) { 750 if ( e->type() == QEvent::FocusIn ) {
751 if( o == Local_View) { //keep track of which view 751 if( o == Local_View) { //keep track of which view
752 whichTab=1; 752 whichTab=1;
753 } 753 }
754 else { 754 else {
755 whichTab=2; 755 whichTab=2;
756 } 756 }
757 } 757 }
758 OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection 758 OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection
759 } 759 }
760 760
761 return QWidget::eventFilter( o, e ); 761 return QWidget::eventFilter( o, e );
762} 762}
763 763
764 764
765void AdvancedFm::cancelRename() { 765void AdvancedFm::cancelRename() {
766// qDebug("cancel rename"); 766// qDebug("cancel rename");
767 QListView * view; 767 QListView * view;
768 view = CurrentView(); 768 view = CurrentView();
769 769
770 bool resetFocus = view->viewport()->focusProxy() == renameBox; 770 bool resetFocus = view->viewport()->focusProxy() == renameBox;
771 delete renameBox; 771 delete renameBox;
772 renameBox = 0; 772 renameBox = 0;
773 if ( resetFocus ) { 773 if ( resetFocus ) {
diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp
index 7dc2416..0bba1d8 100644
--- a/noncore/apps/advancedfm/output.cpp
+++ b/noncore/apps/advancedfm/output.cpp
@@ -80,197 +80,197 @@ static char * filesave_xpm[] = {
80"u c #949494", 80"u c #949494",
81"v c #E6E6E6", 81"v c #E6E6E6",
82"w c #424242", 82"w c #424242",
83"x c #515151", 83"x c #515151",
84"y c #535353", 84"y c #535353",
85"z c #3E3E3E", 85"z c #3E3E3E",
86"A c #D4D4D4", 86"A c #D4D4D4",
87"B c #0C0C0C", 87"B c #0C0C0C",
88"C c #353535", 88"C c #353535",
89"D c #474747", 89"D c #474747",
90"E c #ECECEC", 90"E c #ECECEC",
91"F c #919191", 91"F c #919191",
92"G c #7D7D7D", 92"G c #7D7D7D",
93"H c #000000", 93"H c #000000",
94"I c #404040", 94"I c #404040",
95"J c #858585", 95"J c #858585",
96"K c #323232", 96"K c #323232",
97"L c #D0D0D0", 97"L c #D0D0D0",
98"M c #1C1C1C", 98"M c #1C1C1C",
99" ...+ ", 99" ...+ ",
100" @#$%&..+ ", 100" @#$%&..+ ",
101" .*=-;;>,..+ ", 101" .*=-;;>,..+ ",
102" ')!~;;;;;;{]..", 102" ')!~;;;;;;{]..",
103" ^/(-;;;;;;;_:<", 103" ^/(-;;;;;;;_:<",
104" [}|;;;;;;;{12$", 104" [}|;;;;;;;{12$",
105" #34-55;;;;678$+", 105" #34-55;;;;678$+",
106" 90ab=c;dd;e1fg ", 106" 90ab=c;dd;e1fg ",
107" [ahij((kbl0mn$ ", 107" [ahij((kbl0mn$ ",
108" op^q^^7r&]s/$+ ", 108" op^q^^7r&]s/$+ ",
109"@btu;vbwxy]zAB ", 109"@btu;vbwxy]zAB ",
110"CzDEvEv;;DssF$ ", 110"CzDEvEv;;DssF$ ",
111"G.H{E{E{IxsJ$+ ", 111"G.H{E{E{IxsJ$+ ",
112" +...vEKxzLM ", 112" +...vEKxzLM ",
113" +...z]n$ ", 113" +...z]n$ ",
114" +... "}; 114" +... "};
115 115
116Output::Output( const QStringList commands, QWidget* parent, const char* name, bool modal, WFlags fl) 116Output::Output( const QStringList commands, QWidget* parent, const char* name, bool modal, WFlags fl)
117 : QDialog( parent, name, modal, fl ) 117 : QDialog( parent, name, modal, fl )
118{ 118{
119 QStringList cmmds; 119 QStringList cmmds;
120// cmmds=QStringList::split( " ", commands, false); 120// cmmds=QStringList::split( " ", commands, false);
121 cmmds=commands; 121 cmmds=commands;
122// qDebug("count %d", cmmds.count()); 122// qDebug("count %d", cmmds.count());
123 if ( !name ) 123 if ( !name )
124 setName( tr("Output")); 124 setName( tr("Output"));
125 resize( 196, 269 ); 125 resize( 196, 269 );
126 setCaption( name ); 126 setCaption( name );
127 127
128 OutputLayout = new QGridLayout( this ); 128 OutputLayout = new QGridLayout( this );
129 OutputLayout->setSpacing( 2); 129 OutputLayout->setSpacing( 2);
130 OutputLayout->setMargin( 2); 130 OutputLayout->setMargin( 2);
131 131
132 QPushButton *docButton; 132 QPushButton *docButton;
133 docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton"); 133 docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton");
134 docButton->setFixedSize( QSize( 20, 20 ) ); 134 docButton->setFixedSize( QSize( 20, 20 ) );
135 connect( docButton,SIGNAL(released()),this,SLOT( saveOutput() )); 135 connect( docButton,SIGNAL(released()),this,SLOT( saveOutput() ));
136 // docButton->setFlat(TRUE); 136 // docButton->setFlat(TRUE);
137 OutputLayout->addMultiCellWidget( docButton, 0,0,3,3 ); 137 OutputLayout->addMultiCellWidget( docButton, 0,0,3,3 );
138 138
139 OutputEdit = new QMultiLineEdit( this, "OutputEdit" ); 139 OutputEdit = new QMultiLineEdit( this, "OutputEdit" );
140 OutputLayout->addMultiCellWidget( OutputEdit, 1,1,0,3 ); 140 OutputLayout->addMultiCellWidget( OutputEdit, 1,1,0,3 );
141 141
142 proc = new OProcess(); 142 proc = new OProcess();
143 143
144 connect(proc, SIGNAL(processExited(OProcess *)), 144 connect(proc, SIGNAL(processExited(OProcess*)),
145 this, SLOT( processFinished())); 145 this, SLOT( processFinished()));
146 146
147 connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)), 147 connect(proc, SIGNAL(receivedStdout(OProcess*,char*,int)),
148 this, SLOT(commandStdout(OProcess *, char *, int))); 148 this, SLOT(commandStdout(OProcess*,char*,int)));
149 149
150 connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), 150 connect(proc, SIGNAL(receivedStderr(OProcess*,char*,int)),
151 this, SLOT(commandStderr(OProcess *, char *, int))); 151 this, SLOT(commandStderr(OProcess*,char*,int)));
152 152
153// connect( , SIGNAL(received(const QByteArray &)), 153// connect( , SIGNAL(received(const QByteArray&)),
154// this, SLOT(commandStdin(const QByteArray &))); 154// this, SLOT(commandStdin(const QByteArray&)));
155 155
156// * proc << commands.latin1(); 156// * proc << commands.latin1();
157 for ( QStringList::Iterator it = cmmds.begin(); it != cmmds.end(); ++it ) { 157 for ( QStringList::Iterator it = cmmds.begin(); it != cmmds.end(); ++it ) {
158 qDebug( "%s", (*it).latin1() ); 158 qDebug( "%s", (*it).latin1() );
159 * proc << (*it).latin1(); 159 * proc << (*it).latin1();
160 } 160 }
161 161
162 if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) { 162 if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) {
163 163
164 OutputEdit->append(tr("Process could not start") ); 164 OutputEdit->append(tr("Process could not start") );
165 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 165 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
166 perror("Error: "); 166 perror("Error: ");
167 QString errorMsg=tr("Error\n")+(QString)strerror(errno); 167 QString errorMsg=tr("Error\n")+(QString)strerror(errno);
168 OutputEdit->append( errorMsg); 168 OutputEdit->append( errorMsg);
169 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 169 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
170 } 170 }
171} 171}
172 172
173Output::~Output() { 173Output::~Output() {
174} 174}
175 175
176void Output::saveOutput() { 176void Output::saveOutput() {
177 177
178 InputDialog *fileDlg; 178 InputDialog *fileDlg;
179 fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0); 179 fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0);
180 fileDlg->exec(); 180 fileDlg->exec();
181 if( fileDlg->result() == 1 ) { 181 if( fileDlg->result() == 1 ) {
182 QString filename = QPEApplication::documentDir(); 182 QString filename = QPEApplication::documentDir();
183 if(filename.right(1).find('/') == -1) 183 if(filename.right(1).find('/') == -1)
184 filename+="/"; 184 filename+="/";
185 QString name = fileDlg->LineEdit1->text(); 185 QString name = fileDlg->LineEdit1->text();
186 filename+="text/plain/"+name; 186 filename+="text/plain/"+name;
187 qDebug(filename); 187 qDebug(filename);
188 188
189 QFile f(filename); 189 QFile f(filename);
190 f.open( IO_WriteOnly); 190 f.open( IO_WriteOnly);
191 if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) { 191 if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) {
192 DocLnk lnk; 192 DocLnk lnk;
193 lnk.setName(name); //sets file name 193 lnk.setName(name); //sets file name
194 lnk.setFile(filename); //sets File property 194 lnk.setFile(filename); //sets File property
195 lnk.setType("text/plain"); 195 lnk.setType("text/plain");
196 if(!lnk.writeLink()) { 196 if(!lnk.writeLink()) {
197 qDebug("Writing doclink did not work"); 197 qDebug("Writing doclink did not work");
198 } 198 }
199 } else 199 } else
200 qWarning("Could not write file"); 200 qWarning("Could not write file");
201 f.close(); 201 f.close();
202 } 202 }
203} 203}
204 204
205void Output::commandStdout(OProcess*, char *buffer, int buflen) { 205void Output::commandStdout(OProcess*, char *buffer, int buflen) {
206 qWarning("received stdout %d bytes", buflen); 206 qWarning("received stdout %d bytes", buflen);
207 207
208// QByteArray data(buflen); 208// QByteArray data(buflen);
209// data.fill(*buffer, buflen); 209// data.fill(*buffer, buflen);
210// for (uint i = 0; i < data.count(); i++ ) { 210// for (uint i = 0; i < data.count(); i++ ) {
211// printf("%c", buffer[i] ); 211// printf("%c", buffer[i] );
212// } 212// }
213// printf("\n"); 213// printf("\n");
214 214
215 QString lineStr = buffer; 215 QString lineStr = buffer;
216 lineStr=lineStr.left(lineStr.length()-1); 216 lineStr=lineStr.left(lineStr.length()-1);
217 OutputEdit->append(lineStr); 217 OutputEdit->append(lineStr);
218 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 218 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
219} 219}
220 220
221 221
222void Output::commandStdin( const QByteArray &data) { 222void Output::commandStdin( const QByteArray &data) {
223 qWarning("received stdin %d bytes", data.size()); 223 qWarning("received stdin %d bytes", data.size());
224 // recieved data from the io layer goes to sz 224 // recieved data from the io layer goes to sz
225 proc->writeStdin(data.data(), data.size()); 225 proc->writeStdin(data.data(), data.size());
226} 226}
227 227
228void Output::commandStderr(OProcess*, char *buffer, int buflen) { 228void Output::commandStderr(OProcess*, char *buffer, int buflen) {
229 qWarning("received stderrt %d bytes", buflen); 229 qWarning("received stderrt %d bytes", buflen);
230 230
231 QString lineStr = buffer; 231 QString lineStr = buffer;
232// lineStr=lineStr.left(lineStr.length()-1); 232// lineStr=lineStr.left(lineStr.length()-1);
233 OutputEdit->append(lineStr); 233 OutputEdit->append(lineStr);
234 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 234 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
235} 235}
236 236
237void Output::processFinished() { 237void Output::processFinished() {
238 238
239 delete proc; 239 delete proc;
240 OutputEdit->append( tr("\nFinished\n") ); 240 OutputEdit->append( tr("\nFinished\n") );
241 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 241 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
242// close(); 242// close();
243// disconnect( layer(), SIGNAL(received(const QByteArray &)), 243// disconnect( layer(), SIGNAL(received(const QByteArray&)),
244// this, SLOT(commandStdin(const QByteArray &))); 244// this, SLOT(commandStdin(const QByteArray&)));
245} 245}
246 246
247//============================== 247//==============================
248 248
249InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 249InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
250 : QDialog( parent, name, modal, fl ) 250 : QDialog( parent, name, modal, fl )
251{ 251{
252 if ( !name ) 252 if ( !name )
253 setName( "InputDialog" ); 253 setName( "InputDialog" );
254 resize( 234, 50 ); 254 resize( 234, 50 );
255 setMaximumSize( QSize( 240, 50 ) ); 255 setMaximumSize( QSize( 240, 50 ) );
256 setCaption( tr(name ) ); 256 setCaption( tr(name ) );
257 257
258 LineEdit1 = new QLineEdit( this, "LineEdit1" ); 258 LineEdit1 = new QLineEdit( this, "LineEdit1" );
259 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); 259 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) );
260 LineEdit1->setFocus(); 260 LineEdit1->setFocus();
261 LineEdit1->setFocus(); 261 LineEdit1->setFocus();
262 connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(returned() )); 262 connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(returned() ));
263} 263}
264 264
265InputDialog::~InputDialog() { 265InputDialog::~InputDialog() {
266 inputText = LineEdit1->text(); 266 inputText = LineEdit1->text();
267} 267}
268 268
269void InputDialog::setInputText(const QString &string) { 269void InputDialog::setInputText(const QString &string) {
270 LineEdit1->setText( string); 270 LineEdit1->setText( string);
271} 271}
272 272
273void InputDialog::returned() { 273void InputDialog::returned() {
274 inputText = LineEdit1->text(); 274 inputText = LineEdit1->text();
275 this->accept(); 275 this->accept();
276} 276}
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp
index 26b2533..1b933f2 100644
--- a/noncore/apps/checkbook/checkbook.cpp
+++ b/noncore/apps/checkbook/checkbook.cpp
@@ -32,277 +32,277 @@
32#include "traninfo.h" 32#include "traninfo.h"
33#include "graph.h" 33#include "graph.h"
34#include "graphinfo.h" 34#include "graphinfo.h"
35#include "password.h" 35#include "password.h"
36#include "cfg.h" 36#include "cfg.h"
37 37
38#include <qpe/qpeapplication.h> 38#include <qpe/qpeapplication.h>
39#include <qpe/qpemessagebox.h> 39#include <qpe/qpemessagebox.h>
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41 41
42#include <qcheckbox.h> 42#include <qcheckbox.h>
43#include <qcombobox.h> 43#include <qcombobox.h>
44#include <qlabel.h> 44#include <qlabel.h>
45#include <qlayout.h> 45#include <qlayout.h>
46#include <qlineedit.h> 46#include <qlineedit.h>
47#include <qmultilineedit.h> 47#include <qmultilineedit.h>
48#include <qpushbutton.h> 48#include <qpushbutton.h>
49#include <qwhatsthis.h> 49#include <qwhatsthis.h>
50#include <qpopupmenu.h> 50#include <qpopupmenu.h>
51 51
52#define COL_ID 0 52#define COL_ID 0
53#define COL_SORTDATE 1 53#define COL_SORTDATE 1
54#define COL_NUM 2 54#define COL_NUM 2
55#define COL_DATE 3 55#define COL_DATE 3
56#define COL_DESC 4 56#define COL_DESC 4
57#define COL_AMOUNT 5 57#define COL_AMOUNT 5
58#define COL_BAL 6 58#define COL_BAL 6
59 59
60// --- Checkbook -------------------------------------------------------------- 60// --- Checkbook --------------------------------------------------------------
61Checkbook::Checkbook( QWidget *parent, CBInfo *i, Cfg *cfg ) 61Checkbook::Checkbook( QWidget *parent, CBInfo *i, Cfg *cfg )
62 : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) 62 : QDialog( parent, 0, TRUE, WStyle_ContextHelp )
63{ 63{
64 info = i; 64 info = i;
65 _pCfg=cfg; 65 _pCfg=cfg;
66 66
67 // Title bar 67 // Title bar
68 if ( info->name() != "" ) 68 if ( info->name() != "" )
69 { 69 {
70 QString tempstr = info->name(); 70 QString tempstr = info->name();
71 tempstr.append( " - " ); 71 tempstr.append( " - " );
72 tempstr.append( tr( "Checkbook" ) ); 72 tempstr.append( tr( "Checkbook" ) );
73 setCaption( tempstr ); 73 setCaption( tempstr );
74 } 74 }
75 else 75 else
76 { 76 {
77 setCaption( tr( "New checkbook" ) ); 77 setCaption( tr( "New checkbook" ) );
78 } 78 }
79 79
80 80
81 // Setup layout to make everything pretty 81 // Setup layout to make everything pretty
82 QVBoxLayout *layout = new QVBoxLayout( this ); 82 QVBoxLayout *layout = new QVBoxLayout( this );
83 layout->setMargin( 2 ); 83 layout->setMargin( 2 );
84 layout->setSpacing( 4 ); 84 layout->setSpacing( 4 );
85 85
86 // Setup tabs for all info 86 // Setup tabs for all info
87 mainWidget = new OTabWidget( this ); 87 mainWidget = new OTabWidget( this );
88 layout->addWidget( mainWidget ); 88 layout->addWidget( mainWidget );
89 mainWidget->addTab( initInfo(), "checkbook/infotab", tr( "Info" ) ); 89 mainWidget->addTab( initInfo(), "checkbook/infotab", tr( "Info" ) );
90 mainWidget->addTab( initTransactions(), "checkbook/trantab", tr( "Transactions" ) ); 90 mainWidget->addTab( initTransactions(), "checkbook/trantab", tr( "Transactions" ) );
91 mainWidget->addTab( initCharts(), "checkbook/charttab", tr( "Charts" ) ); 91 mainWidget->addTab( initCharts(), "checkbook/charttab", tr( "Charts" ) );
92 if( _pCfg->isShowLastTab() ) 92 if( _pCfg->isShowLastTab() )
93 mainWidget->setCurrentTab( info->getLastTab() ); 93 mainWidget->setCurrentTab( info->getLastTab() );
94 else 94 else
95 mainWidget->setCurrentTab( tr( "Info" ) ); 95 mainWidget->setCurrentTab( tr( "Info" ) );
96 connect( mainWidget, SIGNAL( currentChanged(QWidget *) ), this, SLOT( slotTab(QWidget *) ) ); 96 connect( mainWidget, SIGNAL( currentChanged(QWidget*) ), this, SLOT( slotTab(QWidget*) ) );
97 97
98 // Load checkbook information 98 // Load checkbook information
99 loadCheckbook(); 99 loadCheckbook();
100} 100}
101 101
102Checkbook::~Checkbook() 102Checkbook::~Checkbook()
103{ 103{
104} 104}
105 105
106// --- initInfo --------------------------------------------------------------- 106// --- initInfo ---------------------------------------------------------------
107QWidget *Checkbook::initInfo() 107QWidget *Checkbook::initInfo()
108{ 108{
109 QWidget *control = new QWidget( mainWidget, tr("Info") ); 109 QWidget *control = new QWidget( mainWidget, tr("Info") );
110 110
111 QVBoxLayout *vb = new QVBoxLayout( control ); 111 QVBoxLayout *vb = new QVBoxLayout( control );
112 112
113 QScrollView *sv = new QScrollView( control ); 113 QScrollView *sv = new QScrollView( control );
114 vb->addWidget( sv, 0, 0 ); 114 vb->addWidget( sv, 0, 0 );
115 sv->setResizePolicy( QScrollView::AutoOneFit ); 115 sv->setResizePolicy( QScrollView::AutoOneFit );
116 sv->setFrameStyle( QFrame::NoFrame ); 116 sv->setFrameStyle( QFrame::NoFrame );
117 117
118 QWidget *container = new QWidget( sv->viewport() ); 118 QWidget *container = new QWidget( sv->viewport() );
119 sv->addChild( container ); 119 sv->addChild( container );
120 120
121 QGridLayout *layout = new QGridLayout( container ); 121 QGridLayout *layout = new QGridLayout( container );
122 layout->setSpacing( 2 ); 122 layout->setSpacing( 2 );
123 layout->setMargin( 4 ); 123 layout->setMargin( 4 );
124 124
125 // Password protection 125 // Password protection
126 passwordCB = new QCheckBox( tr( "Password protect" ), container ); 126 passwordCB = new QCheckBox( tr( "Password protect" ), container );
127 QWhatsThis::add( passwordCB, tr( "Click here to enable/disable password protection of this checkbook." ) ); 127 QWhatsThis::add( passwordCB, tr( "Click here to enable/disable password protection of this checkbook." ) );
128 connect( passwordCB, SIGNAL( clicked() ), this, SLOT( slotPasswordClicked() ) ); 128 connect( passwordCB, SIGNAL( clicked() ), this, SLOT( slotPasswordClicked() ) );
129 layout->addMultiCellWidget( passwordCB, 0, 0, 0, 1 ); 129 layout->addMultiCellWidget( passwordCB, 0, 0, 0, 1 );
130 130
131 // Account name 131 // Account name
132 QLabel *label = new QLabel( tr( "Name:" ), container ); 132 QLabel *label = new QLabel( tr( "Name:" ), container );
133 QWhatsThis::add( label, tr( "Enter name of checkbook here." ) ); 133 QWhatsThis::add( label, tr( "Enter name of checkbook here." ) );
134 layout->addWidget( label, 1, 0 ); 134 layout->addWidget( label, 1, 0 );
135 nameEdit = new QLineEdit( container ); 135 nameEdit = new QLineEdit( container );
136 QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) ); 136 QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) );
137 connect( nameEdit, SIGNAL( textChanged( const QString & ) ), 137 connect( nameEdit, SIGNAL( textChanged(const QString&) ),
138 this, SLOT( slotNameChanged( const QString & ) ) ); 138 this, SLOT( slotNameChanged(const QString&) ) );
139 layout->addWidget( nameEdit, 1, 1 ); 139 layout->addWidget( nameEdit, 1, 1 );
140 140
141 // Type of account 141 // Type of account
142 label = new QLabel( tr( "Type:" ), container ); 142 label = new QLabel( tr( "Type:" ), container );
143 QWhatsThis::add( label, tr( "Select type of checkbook here." ) ); 143 QWhatsThis::add( label, tr( "Select type of checkbook here." ) );
144 layout->addWidget( label, 2, 0 ); 144 layout->addWidget( label, 2, 0 );
145 typeList = new QComboBox( container ); 145 typeList = new QComboBox( container );
146 QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) ); 146 QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) );
147 typeList->insertStringList( _pCfg->getAccountTypes() ); 147 typeList->insertStringList( _pCfg->getAccountTypes() );
148 layout->addWidget( typeList, 2, 1 ); 148 layout->addWidget( typeList, 2, 1 );
149 149
150 // Bank/institution name 150 // Bank/institution name
151 label = new QLabel( tr( "Bank:" ), container ); 151 label = new QLabel( tr( "Bank:" ), container );
152 QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) ); 152 QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) );
153 layout->addWidget( label, 3, 0 ); 153 layout->addWidget( label, 3, 0 );
154 bankEdit = new QLineEdit( container ); 154 bankEdit = new QLineEdit( container );
155 QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) ); 155 QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) );
156 layout->addWidget( bankEdit, 3, 1 ); 156 layout->addWidget( bankEdit, 3, 1 );
157 157
158 // Account number 158 // Account number
159 label = new QLabel( tr( "Account number:" ), container ); 159 label = new QLabel( tr( "Account number:" ), container );
160 QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) ); 160 QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) );
161 layout->addWidget( label, 4, 0 ); 161 layout->addWidget( label, 4, 0 );
162 acctNumEdit = new QLineEdit( container ); 162 acctNumEdit = new QLineEdit( container );
163 QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) ); 163 QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) );
164 layout->addWidget( acctNumEdit, 4, 1 ); 164 layout->addWidget( acctNumEdit, 4, 1 );
165 165
166 // PIN number 166 // PIN number
167 label = new QLabel( tr( "PIN number:" ), container ); 167 label = new QLabel( tr( "PIN number:" ), container );
168 QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) ); 168 QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) );
169 layout->addWidget( label, 5, 0 ); 169 layout->addWidget( label, 5, 0 );
170 pinNumEdit = new QLineEdit( container ); 170 pinNumEdit = new QLineEdit( container );
171 QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) ); 171 QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) );
172 layout->addWidget( pinNumEdit, 5, 1 ); 172 layout->addWidget( pinNumEdit, 5, 1 );
173 173
174 // Starting balance 174 // Starting balance
175 label = new QLabel( tr( "Starting balance:" ), container ); 175 label = new QLabel( tr( "Starting balance:" ), container );
176 QWhatsThis::add( label, tr( "Enter the initial balance for this checkbook here." ) ); 176 QWhatsThis::add( label, tr( "Enter the initial balance for this checkbook here." ) );
177 layout->addWidget( label, 6, 0 ); 177 layout->addWidget( label, 6, 0 );
178 balanceEdit = new QLineEdit( container ); 178 balanceEdit = new QLineEdit( container );
179 QWhatsThis::add( balanceEdit, tr( "Enter the initial balance for this checkbook here." ) ); 179 QWhatsThis::add( balanceEdit, tr( "Enter the initial balance for this checkbook here." ) );
180 connect( balanceEdit, SIGNAL( textChanged( const QString & ) ), 180 connect( balanceEdit, SIGNAL( textChanged(const QString&) ),
181 this, SLOT( slotStartingBalanceChanged( const QString & ) ) ); 181 this, SLOT( slotStartingBalanceChanged(const QString&) ) );
182 layout->addWidget( balanceEdit, 6, 1 ); 182 layout->addWidget( balanceEdit, 6, 1 );
183 183
184 // Notes 184 // Notes
185 label = new QLabel( tr( "Notes:" ), container ); 185 label = new QLabel( tr( "Notes:" ), container );
186 QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) ); 186 QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) );
187 layout->addWidget( label, 7, 0 ); 187 layout->addWidget( label, 7, 0 );
188 notesEdit = new QMultiLineEdit( container ); 188 notesEdit = new QMultiLineEdit( container );
189 QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) ); 189 QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) );
190 notesEdit->setMinimumHeight( 25 ); 190 notesEdit->setMinimumHeight( 25 );
191 notesEdit->setMaximumHeight( 65 ); 191 notesEdit->setMaximumHeight( 65 );
192 layout->addMultiCellWidget( notesEdit, 8, 8, 0, 1 ); 192 layout->addMultiCellWidget( notesEdit, 8, 8, 0, 1 );
193 193
194 return control; 194 return control;
195} 195}
196 196
197 197
198// --- initTransactions ------------------------------------------------------- 198// --- initTransactions -------------------------------------------------------
199QWidget *Checkbook::initTransactions() 199QWidget *Checkbook::initTransactions()
200{ 200{
201 QWidget *control = new QWidget( mainWidget, tr("Transactions") ); 201 QWidget *control = new QWidget( mainWidget, tr("Transactions") );
202 202
203 QGridLayout *layout = new QGridLayout( control ); 203 QGridLayout *layout = new QGridLayout( control );
204 layout->setSpacing( 2 ); 204 layout->setSpacing( 2 );
205 layout->setMargin( 4 ); 205 layout->setMargin( 4 );
206 206
207 // Sort selector 207 // Sort selector
208 QLabel *label = new QLabel( tr( "Sort by:" ), control ); 208 QLabel *label = new QLabel( tr( "Sort by:" ), control );
209 QWhatsThis::add( label, tr( "Select checkbook sorting here." ) ); 209 QWhatsThis::add( label, tr( "Select checkbook sorting here." ) );
210 layout->addMultiCellWidget( label, 0, 0, 0, 1 ); 210 layout->addMultiCellWidget( label, 0, 0, 0, 1 );
211 _cbSortType=new QComboBox( control ); 211 _cbSortType=new QComboBox( control );
212 _cbSortType->insertItem( tr("Entry Order") ); 212 _cbSortType->insertItem( tr("Entry Order") );
213 _cbSortType->insertItem( tr("Date") ); 213 _cbSortType->insertItem( tr("Date") );
214 _cbSortType->insertItem( tr("Number") ); 214 _cbSortType->insertItem( tr("Number") );
215 layout->addMultiCellWidget( _cbSortType, 0, 0, 1, 2 ); 215 layout->addMultiCellWidget( _cbSortType, 0, 0, 1, 2 );
216 connect( _cbSortType, SIGNAL( activated(const QString &) ), this, SLOT( slotSortChanged( const QString & ) ) ); 216 connect( _cbSortType, SIGNAL( activated(const QString&) ), this, SLOT( slotSortChanged(const QString&) ) );
217 217
218 // Table 218 // Table
219 tranTable = new QListView( control ); 219 tranTable = new QListView( control );
220 QFont fnt(QPEApplication::font()); 220 QFont fnt(QPEApplication::font());
221 fnt.setPointSize( fnt.pointSize()-1 ); 221 fnt.setPointSize( fnt.pointSize()-1 );
222 tranTable->setFont( fnt ); 222 tranTable->setFont( fnt );
223 QWhatsThis::add( tranTable, tr( "This is a listing of all transactions entered for this checkbook.\n\nTo sort entries by a specific field, click on the column name." ) ); 223 QWhatsThis::add( tranTable, tr( "This is a listing of all transactions entered for this checkbook.\n\nTo sort entries by a specific field, click on the column name." ) );
224 tranTable->addColumn( tr( "Id" ) ); 224 tranTable->addColumn( tr( "Id" ) );
225 tranTable->setColumnWidthMode( COL_ID, QListView::Manual ); 225 tranTable->setColumnWidthMode( COL_ID, QListView::Manual );
226 tranTable->setColumnWidth( COL_ID, 0); 226 tranTable->setColumnWidth( COL_ID, 0);
227 tranTable->addColumn( tr( "SortDate" ) ); 227 tranTable->addColumn( tr( "SortDate" ) );
228 tranTable->setColumnWidthMode( COL_SORTDATE, QListView::Manual ); 228 tranTable->setColumnWidthMode( COL_SORTDATE, QListView::Manual );
229 tranTable->setColumnWidth( COL_SORTDATE, 0); 229 tranTable->setColumnWidth( COL_SORTDATE, 0);
230 tranTable->addColumn( tr( "Num" ) ); 230 tranTable->addColumn( tr( "Num" ) );
231 tranTable->addColumn( tr( "Date" ) ); 231 tranTable->addColumn( tr( "Date" ) );
232 //tranTable->addColumn( tr( "Cleared" ) ); 232 //tranTable->addColumn( tr( "Cleared" ) );
233 tranTable->addColumn( tr( "Description" ) ); 233 tranTable->addColumn( tr( "Description" ) );
234 int column = tranTable->addColumn( tr( "Amount" ) ); 234 int column = tranTable->addColumn( tr( "Amount" ) );
235 tranTable->setColumnAlignment( column, Qt::AlignRight ); 235 tranTable->setColumnAlignment( column, Qt::AlignRight );
236 column=tranTable->addColumn( tr("Balance") ); 236 column=tranTable->addColumn( tr("Balance") );
237 tranTable->setColumnAlignment( column, Qt::AlignRight ); 237 tranTable->setColumnAlignment( column, Qt::AlignRight );
238 tranTable->setAllColumnsShowFocus( TRUE ); 238 tranTable->setAllColumnsShowFocus( TRUE );
239 tranTable->setSorting( -1 ); 239 tranTable->setSorting( -1 );
240 layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 ); 240 layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 );
241 QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold ); 241 QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold );
242 connect( tranTable, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), 242 connect( tranTable, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ),
243 this, SLOT( slotMenuTran(QListViewItem *, const QPoint &) ) ); 243 this, SLOT( slotMenuTran(QListViewItem*,const QPoint&) ) );
244 connect( tranTable, SIGNAL( doubleClicked( QListViewItem * ) ), 244 connect( tranTable, SIGNAL( doubleClicked(QListViewItem*) ),
245 this, SLOT( slotEditTran() ) ); 245 this, SLOT( slotEditTran() ) );
246 _sortCol=COL_ID; 246 _sortCol=COL_ID;
247 247
248 // Buttons 248 // Buttons
249 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control ); 249 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control );
250 QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); 250 QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) );
251 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) ); 251 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) );
252 layout->addWidget( btn, 2, 0 ); 252 layout->addWidget( btn, 2, 0 );
253 253
254 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control ); 254 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control );
255 QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); 255 QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) );
256 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) ); 256 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) );
257 layout->addWidget( btn, 2, 1 ); 257 layout->addWidget( btn, 2, 1 );
258 258
259 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), control ); 259 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), control );
260 QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); 260 QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) );
261 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) ); 261 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) );
262 layout->addWidget( btn, 2, 2 ); 262 layout->addWidget( btn, 2, 2 );
263 263
264 return( control ); 264 return( control );
265} 265}
266 266
267 267
268// --- initCharts ------------------------------------------------------------- 268// --- initCharts -------------------------------------------------------------
269QWidget *Checkbook::initCharts() 269QWidget *Checkbook::initCharts()
270{ 270{
271 graphInfo = 0x0; 271 graphInfo = 0x0;
272 272
273 QWidget *control = new QWidget( mainWidget, tr("Charts") ); 273 QWidget *control = new QWidget( mainWidget, tr("Charts") );
274 274
275 QGridLayout *layout = new QGridLayout( control ); 275 QGridLayout *layout = new QGridLayout( control );
276 layout->setSpacing( 2 ); 276 layout->setSpacing( 2 );
277 layout->setMargin( 4 ); 277 layout->setMargin( 4 );
278 278
279 graphWidget = new Graph( control ); 279 graphWidget = new Graph( control );
280 QWhatsThis::add( graphWidget, tr( "Select the desired chart below and then click on the Draw button." ) ); 280 QWhatsThis::add( graphWidget, tr( "Select the desired chart below and then click on the Draw button." ) );
281 layout->addMultiCellWidget( graphWidget, 0, 0, 0, 2 ); 281 layout->addMultiCellWidget( graphWidget, 0, 0, 0, 2 );
282 282
283 graphList = new QComboBox( control ); 283 graphList = new QComboBox( control );
284 QWhatsThis::add( graphList, tr( "Click here to select the desired chart type." ) ); 284 QWhatsThis::add( graphList, tr( "Click here to select the desired chart type." ) );
285 graphList->insertItem( tr( "Account balance" ) ); 285 graphList->insertItem( tr( "Account balance" ) );
286 graphList->insertItem( tr( "Withdrawals by category" ) ); 286 graphList->insertItem( tr( "Withdrawals by category" ) );
287 graphList->insertItem( tr( "Deposits by category" ) ); 287 graphList->insertItem( tr( "Deposits by category" ) );
288 288
289 layout->addMultiCellWidget( graphList, 1, 1, 0, 1 ); 289 layout->addMultiCellWidget( graphList, 1, 1, 0, 1 );
290 290
291 QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control ); 291 QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control );
292 QWhatsThis::add( btn, tr( "Click here to draw the selected chart." ) ); 292 QWhatsThis::add( btn, tr( "Click here to draw the selected chart." ) );
293 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) ); 293 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) );
294 layout->addWidget( btn, 1, 2 ); 294 layout->addWidget( btn, 1, 2 );
295 295
296 return control; 296 return control;
297} 297}
298 298
299// --- loadCheckbook ---------------------------------------------------------- 299// --- loadCheckbook ----------------------------------------------------------
300void Checkbook::loadCheckbook() 300void Checkbook::loadCheckbook()
301{ 301{
302 if ( !info ) 302 if ( !info )
303 { 303 {
304 return; 304 return;
305 } 305 }
306 306
307 tranList = info->transactions(); 307 tranList = info->transactions();
308 308
diff --git a/noncore/apps/checkbook/listedit.cpp b/noncore/apps/checkbook/listedit.cpp
index 37f05f0..d00e305 100644
--- a/noncore/apps/checkbook/listedit.cpp
+++ b/noncore/apps/checkbook/listedit.cpp
@@ -1,136 +1,136 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "listedit.h" 29#include "listedit.h"
30#include <qlayout.h> 30#include <qlayout.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qlistview.h> 32#include <qlistview.h>
33#include <qwidgetstack.h> 33#include <qwidgetstack.h>
34#include <qcombobox.h> 34#include <qcombobox.h>
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qpe/resource.h> 36#include <qpe/resource.h>
37 37
38 38
39// --- ListEdit --------------------------------------------------------------- 39// --- ListEdit ---------------------------------------------------------------
40ListEdit::ListEdit( QWidget *parent, const char *sName ) 40ListEdit::ListEdit( QWidget *parent, const char *sName )
41 : QWidget(parent, sName), TableDef(sName) 41 : QWidget(parent, sName), TableDef(sName)
42{ 42{
43 // get font height 43 // get font height
44 int fh = fontMetrics().height(); 44 int fh = fontMetrics().height();
45 45
46 // create layout 46 // create layout
47 QGridLayout *layout=new QGridLayout(this); 47 QGridLayout *layout=new QGridLayout(this);
48 layout->setSpacing( 2 ); 48 layout->setSpacing( 2 );
49 layout->setMargin( 4 ); 49 layout->setMargin( 4 );
50 50
51 // type table 51 // type table
52 _typeTable = new QListView( this ); 52 _typeTable = new QListView( this );
53 ColumnDef *def=first(); 53 ColumnDef *def=first();
54 while( def ) { 54 while( def ) {
55 _typeTable->addColumn( def->getName() ); 55 _typeTable->addColumn( def->getName() );
56 def=next(); 56 def=next();
57 } 57 }
58 connect( _typeTable, SIGNAL( clicked(QListViewItem *, const QPoint &, int) ), this, SLOT( slotClick(QListViewItem *, const QPoint &, int ) ) ); 58 connect( _typeTable, SIGNAL( clicked(QListViewItem*,const QPoint&,int) ), this, SLOT( slotClick(QListViewItem*,const QPoint&,int) ) );
59 layout->addMultiCellWidget(_typeTable, 0,4,0,4); 59 layout->addMultiCellWidget(_typeTable, 0,4,0,4);
60 _currentItem=NULL; 60 _currentItem=NULL;
61 61
62 // edit field 62 // edit field
63 _stack=new QWidgetStack( this ); 63 _stack=new QWidgetStack( this );
64 _stack->setMaximumHeight(fh+5); 64 _stack->setMaximumHeight(fh+5);
65 layout->addMultiCellWidget(_stack, 5,5,0,2); 65 layout->addMultiCellWidget(_stack, 5,5,0,2);
66 _typeEdit = new QLineEdit( _stack ); 66 _typeEdit = new QLineEdit( _stack );
67 _stack->raiseWidget(_typeEdit ); 67 _stack->raiseWidget(_typeEdit );
68 connect( _typeEdit, SIGNAL( textChanged(const QString &) ), this, SLOT( slotEditChanged(const QString &) ) ); 68 connect( _typeEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotEditChanged(const QString&) ) );
69 69
70 // combo box 70 // combo box
71 _box=new QComboBox( _stack ); 71 _box=new QComboBox( _stack );
72 connect( _box, SIGNAL( activated(const QString &) ), this, SLOT( slotActivated(const QString &) ) ); 72 connect( _box, SIGNAL( activated(const QString&) ), this, SLOT( slotActivated(const QString&) ) );
73 73
74 74
75 // add button 75 // add button
76 QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/add" ), tr( "Add" ), this ); 76 QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/add" ), tr( "Add" ), this );
77 connect( btn, SIGNAL( clicked() ), this, SLOT( slotAdd() ) ); 77 connect( btn, SIGNAL( clicked() ), this, SLOT( slotAdd() ) );
78 layout->addWidget( btn, 5, 3 ); 78 layout->addWidget( btn, 5, 3 );
79 79
80 // delete button 80 // delete button
81 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); 81 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this );
82 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDel() ) ); 82 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDel() ) );
83 layout->addWidget( btn, 5, 4 ); 83 layout->addWidget( btn, 5, 4 );
84} 84}
85 85
86// --- ~ListEdit -------------------------------------------------------------- 86// --- ~ListEdit --------------------------------------------------------------
87ListEdit::~ListEdit() 87ListEdit::~ListEdit()
88{ 88{
89} 89}
90 90
91 91
92// --- slotEditTypeChanged ---------------------------------------------------- 92// --- slotEditTypeChanged ----------------------------------------------------
93void ListEdit::slotEditChanged(const QString &str) 93void ListEdit::slotEditChanged(const QString &str)
94{ 94{
95 if( !_currentItem || _currentColumn<0 ) return; 95 if( !_currentItem || _currentColumn<0 ) return;
96 _currentItem->setText(_currentColumn, str); 96 _currentItem->setText(_currentColumn, str);
97} 97}
98 98
99// --- slotAddType ------------------------------------------------------------ 99// --- slotAddType ------------------------------------------------------------
100void ListEdit::slotAdd() 100void ListEdit::slotAdd()
101{ 101{
102 // construct new row 102 // construct new row
103 QString args[8]; 103 QString args[8];
104 ColumnDef *pCol=this->first(); 104 ColumnDef *pCol=this->first();
105 int i=0; 105 int i=0;
106 while( pCol && i<8 ) { 106 while( pCol && i<8 ) {
107 args[i++]=pCol->getNewValue(); 107 args[i++]=pCol->getNewValue();
108 pCol=this->next(); 108 pCol=this->next();
109 } 109 }
110 _currentItem=new QListViewItem(_typeTable, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7] ); 110 _currentItem=new QListViewItem(_typeTable, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7] );
111 111
112 // fix uniques 112 // fix uniques
113 fixTypes(); 113 fixTypes();
114 114
115 // display col 0 of new value 115 // display col 0 of new value
116 QPoint pnt; 116 QPoint pnt;
117 slotClick(_currentItem, pnt, 0); 117 slotClick(_currentItem, pnt, 0);
118 _typeTable->setSelected( _currentItem, true ); 118 _typeTable->setSelected( _currentItem, true );
119 119
120 // make it selected 120 // make it selected
121 _typeEdit->setCursorPosition(0); 121 _typeEdit->setCursorPosition(0);
122 _typeEdit->setSelection(0, _typeEdit->text().length() ); 122 _typeEdit->setSelection(0, _typeEdit->text().length() );
123} 123}
124 124
125// --- slotDel ------------------------------------------------------------- 125// --- slotDel -------------------------------------------------------------
126void ListEdit::slotDel() 126void ListEdit::slotDel()
127{ 127{
128 if( !_currentItem ) return; 128 if( !_currentItem ) return;
129 delete _currentItem; 129 delete _currentItem;
130 _currentItem=NULL; 130 _currentItem=NULL;
131 _typeEdit->setText(""); 131 _typeEdit->setText("");
132 _stack->raiseWidget(_typeEdit); 132 _stack->raiseWidget(_typeEdit);
133} 133}
134 134
135 135
136// --- fixTypes ---------------------------------------------------------------- 136// --- fixTypes ----------------------------------------------------------------
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp
index d0fac3b..254ce6a 100644
--- a/noncore/apps/checkbook/mainwindow.cpp
+++ b/noncore/apps/checkbook/mainwindow.cpp
@@ -111,129 +111,129 @@ MainWindow::MainWindow( QWidget* parent, const char* name, WFlags /*fl*/ )
111 for ( QStringList::Iterator it = cblist.begin(); it != cblist.end(); it++ ) 111 for ( QStringList::Iterator it = cblist.begin(); it != cblist.end(); it++ )
112 { 112 {
113 filename = cbDir; 113 filename = cbDir;
114 filename.append( (*it) ); 114 filename.append( (*it) );
115 115
116 cb = new CBInfo( (*it).remove( (*it).find('.'), (*it).length() ), filename ); 116 cb = new CBInfo( (*it).remove( (*it).find('.'), (*it).length() ), filename );
117 checkbooks->inSort( cb ); 117 checkbooks->inSort( cb );
118 } 118 }
119 } 119 }
120 120
121 // Build Checkbook selection list control 121 // Build Checkbook selection list control
122 cbList = 0x0; 122 cbList = 0x0;
123 buildList(); 123 buildList();
124 124
125 // open last book? 125 // open last book?
126 if( _cfg.isOpenLastBook() ) { 126 if( _cfg.isOpenLastBook() ) {
127 this->show(); 127 this->show();
128 this->showMaximized(); 128 this->showMaximized();
129 QListViewItem *itm=cbList->firstChild(); 129 QListViewItem *itm=cbList->firstChild();
130 while( itm ) { 130 while( itm ) {
131 if( itm->text(posName)==_cfg.getLastBook() ) { 131 if( itm->text(posName)==_cfg.getLastBook() ) {
132 openBook( itm ); 132 openBook( itm );
133 break; 133 break;
134 } 134 }
135 itm=itm->nextSibling(); 135 itm=itm->nextSibling();
136 } 136 }
137 } 137 }
138} 138}
139 139
140 140
141// --- ~MainWindow ------------------------------------------------------------ 141// --- ~MainWindow ------------------------------------------------------------
142MainWindow::~MainWindow() 142MainWindow::~MainWindow()
143{ 143{
144 writeConfig(); 144 writeConfig();
145} 145}
146 146
147 147
148// --- buildList -------------------------------------------------------------- 148// --- buildList --------------------------------------------------------------
149void MainWindow::buildList() 149void MainWindow::buildList()
150{ 150{
151 if ( cbList ) 151 if ( cbList )
152 delete cbList; 152 delete cbList;
153 153
154 cbList = new QListView( this ); 154 cbList = new QListView( this );
155 QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) ); 155 QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) );
156 156
157 if ( _cfg.getShowLocks() ) 157 if ( _cfg.getShowLocks() )
158 { 158 {
159 cbList->addColumn( Resource::loadIconSet( "locked" ), "", 24 ); 159 cbList->addColumn( Resource::loadIconSet( "locked" ), "", 24 );
160 posName = 1; 160 posName = 1;
161 } 161 }
162 else 162 else
163 { 163 {
164 posName = 0; 164 posName = 0;
165 } 165 }
166 cbList->addColumn( tr( "Checkbook Name" ) ); 166 cbList->addColumn( tr( "Checkbook Name" ) );
167 if ( _cfg.getShowBalances() ) 167 if ( _cfg.getShowBalances() )
168 { 168 {
169 int colnum = cbList->addColumn( tr( "Balance" ) ); 169 int colnum = cbList->addColumn( tr( "Balance" ) );
170 cbList->setColumnAlignment( colnum, Qt::AlignRight ); 170 cbList->setColumnAlignment( colnum, Qt::AlignRight );
171 } 171 }
172 cbList->setAllColumnsShowFocus( TRUE ); 172 cbList->setAllColumnsShowFocus( TRUE );
173 cbList->setSorting( posName ); 173 cbList->setSorting( posName );
174 QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold ); 174 QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold );
175 connect( cbList, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), 175 connect( cbList, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ),
176 this, SLOT( slotEdit() ) ); 176 this, SLOT( slotEdit() ) );
177 setCentralWidget( cbList ); 177 setCentralWidget( cbList );
178 178
179 for ( CBInfo *cb = checkbooks->first(); cb; cb = checkbooks->next() ) 179 for ( CBInfo *cb = checkbooks->first(); cb; cb = checkbooks->next() )
180 { 180 {
181 addCheckbook( cb ); 181 addCheckbook( cb );
182 } 182 }
183} 183}
184 184
185void MainWindow::addCheckbook( CBInfo *cb ) 185void MainWindow::addCheckbook( CBInfo *cb )
186{ 186{
187 QListViewItem *lvi = new QListViewItem( cbList ); 187 QListViewItem *lvi = new QListViewItem( cbList );
188 if ( _cfg.getShowLocks() && !cb->password().isNull() ) 188 if ( _cfg.getShowLocks() && !cb->password().isNull() )
189 { 189 {
190 lvi->setPixmap( 0, lockIcon ); 190 lvi->setPixmap( 0, lockIcon );
191 } 191 }
192 lvi->setText( posName, cb->name() ); 192 lvi->setText( posName, cb->name() );
193 if ( _cfg.getShowBalances() ) 193 if ( _cfg.getShowBalances() )
194 { 194 {
195 QString balance; 195 QString balance;
196 balance.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() ); 196 balance.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() );
197 lvi->setText( posName + 1, balance ); 197 lvi->setText( posName + 1, balance );
198 } 198 }
199} 199}
200 200
201void MainWindow::buildFilename( const QString &name ) 201void MainWindow::buildFilename( const QString &name )
202{ 202{
203 tempFilename = cbDir; 203 tempFilename = cbDir;
204 tempFilename.append( name ); 204 tempFilename.append( name );
205 tempFilename.append( ".qcb" ); 205 tempFilename.append( ".qcb" );
206} 206}
207 207
208void MainWindow::slotNew() 208void MainWindow::slotNew()
209{ 209{
210 CBInfo *cb = new CBInfo(); 210 CBInfo *cb = new CBInfo();
211 211
212 Checkbook *currcb = new Checkbook( this, cb, &_cfg ); 212 Checkbook *currcb = new Checkbook( this, cb, &_cfg );
213 if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted ) 213 if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted )
214 { 214 {
215 // Save new checkbook 215 // Save new checkbook
216 buildFilename( cb->name() ); 216 buildFilename( cb->name() );
217 _cfg.setLastBook( cb->name() ); 217 _cfg.setLastBook( cb->name() );
218 cb->setFilename( tempFilename ); 218 cb->setFilename( tempFilename );
219 cb->write(); 219 cb->write();
220 220
221 // Add to listbox 221 // Add to listbox
222 checkbooks->inSort( cb ); 222 checkbooks->inSort( cb );
223 addCheckbook( cb ); 223 addCheckbook( cb );
224 } 224 }
225 delete currcb; 225 delete currcb;
226} 226}
227 227
228// --- slotEdit --------------------------------------------------------------- 228// --- slotEdit ---------------------------------------------------------------
229void MainWindow::slotEdit() 229void MainWindow::slotEdit()
230{ 230{
231 // get name and open it 231 // get name and open it
232 QListViewItem *curritem = cbList->currentItem(); 232 QListViewItem *curritem = cbList->currentItem();
233 if ( !curritem ) 233 if ( !curritem )
234 return; 234 return;
235 openBook( curritem ); 235 openBook( curritem );
236} 236}
237 237
238 238
239// --- openBook --------------------------------------------------------------- 239// --- openBook ---------------------------------------------------------------
diff --git a/noncore/apps/checkbook/password.cpp b/noncore/apps/checkbook/password.cpp
index f381271..89a6bc6 100644
--- a/noncore/apps/checkbook/password.cpp
+++ b/noncore/apps/checkbook/password.cpp
@@ -14,84 +14,84 @@
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "password.h" 29#include "password.h"
30 30
31#include <qlabel.h> 31#include <qlabel.h>
32#include <qlayout.h> 32#include <qlayout.h>
33#include <qlineedit.h> 33#include <qlineedit.h>
34#include <qpushbutton.h> 34#include <qpushbutton.h>
35 35
36static const char* const showhideimage_data[] = { 36static const char* const showhideimage_data[] = {
37"16 16 2 1", 37"16 16 2 1",
38". c None", 38". c None",
39"# c #000000", 39"# c #000000",
40"................", 40"................",
41"...#...###...##.", 41"...#...###...##.",
42"..#.#..#..#.##..", 42"..#.#..#..#.##..",
43"..###..###.##...", 43"..###..###.##...",
44".#...#.#..##....", 44".#...#.#..##....",
45".#...#.#.##.....", 45".#...#.#.##.....",
46"........##.#..#.", 46"........##.#..#.",
47"..##...##...##..", 47"..##...##...##..",
48".#..#.###...##..", 48".#..#.###...##..",
49".#...##..#.#..#.", 49".#...##..#.#..#.",
50".#..##..........", 50".#..##..........",
51".#.##.#..#.#..#.", 51".#.##.#..#.#..#.",
52"..##...##...##..", 52"..##...##...##..",
53".##....##...##..", 53".##....##...##..",
54".#....#..#.#..#.", 54".#....#..#.#..#.",
55"................"}; 55"................"};
56 56
57Password::Password( QWidget *parent, const char *caption, const char *prompt ) 57Password::Password( QWidget *parent, const char *caption, const char *prompt )
58 : QDialog( parent, 0x0, TRUE, 0x0 ) 58 : QDialog( parent, 0x0, TRUE, 0x0 )
59{ 59{
60 setCaption( caption ); 60 setCaption( caption );
61 61
62 QGridLayout *layout = new QGridLayout( this ); 62 QGridLayout *layout = new QGridLayout( this );
63 layout->setSpacing( 2 ); 63 layout->setSpacing( 2 );
64 layout->setMargin( 4 ); 64 layout->setMargin( 4 );
65 65
66 QLabel *label = new QLabel( prompt, this ); 66 QLabel *label = new QLabel( prompt, this );
67 label->setAlignment( AlignLeft | AlignTop | WordBreak ); 67 label->setAlignment( AlignLeft | AlignTop | WordBreak );
68 layout->addMultiCellWidget( label, 0, 0, 0, 1 ); 68 layout->addMultiCellWidget( label, 0, 0, 0, 1 );
69 69
70 pw = new QLineEdit( this ); 70 pw = new QLineEdit( this );
71 pw->setEchoMode( QLineEdit::Password ); 71 pw->setEchoMode( QLineEdit::Password );
72 layout->addWidget( pw, 1, 0 ); 72 layout->addWidget( pw, 1, 0 );
73 73
74 QPixmap *pic = new QPixmap( ( const char** ) showhideimage_data ); 74 QPixmap *pic = new QPixmap( ( const char** ) showhideimage_data );
75 QPushButton *btn = new QPushButton( ( QIconSet ) *pic, QString::null, this ); 75 QPushButton *btn = new QPushButton( ( QIconSet ) *pic, QString::null, this );
76 btn->setMaximumSize( pic->width() + 10, pic->height() + 10 ); 76 btn->setMaximumSize( pic->width() + 10, pic->height() + 10 );
77 btn->setToggleButton( TRUE ); 77 btn->setToggleButton( TRUE );
78 connect( btn, SIGNAL( toggled( bool ) ), this, SLOT( slotTogglePassword( bool ) ) ); 78 connect( btn, SIGNAL( toggled(bool) ), this, SLOT( slotTogglePassword(bool) ) );
79 layout->addWidget( btn, 1, 1 ); 79 layout->addWidget( btn, 1, 1 );
80 80
81 password == ""; 81 password == "";
82} 82}
83 83
84Password::~Password() 84Password::~Password()
85{ 85{
86} 86}
87 87
88void Password::accept() 88void Password::accept()
89{ 89{
90 password = pw->text(); 90 password = pw->text();
91 QDialog::accept(); 91 QDialog::accept();
92} 92}
93 93
94void Password::slotTogglePassword( bool showPW ) 94void Password::slotTogglePassword( bool showPW )
95{ 95{
96 showPW ? pw->setEchoMode( QLineEdit::Normal ) : pw->setEchoMode( QLineEdit::Password ); 96 showPW ? pw->setEchoMode( QLineEdit::Normal ) : pw->setEchoMode( QLineEdit::Password );
97} 97}
diff --git a/noncore/apps/checkbook/transaction.cpp b/noncore/apps/checkbook/transaction.cpp
index a72a48b..1b08b24 100644
--- a/noncore/apps/checkbook/transaction.cpp
+++ b/noncore/apps/checkbook/transaction.cpp
@@ -38,203 +38,203 @@
38#include <qlabel.h> 38#include <qlabel.h>
39#include <qlayout.h> 39#include <qlayout.h>
40#include <qlineedit.h> 40#include <qlineedit.h>
41#include <qmultilineedit.h> 41#include <qmultilineedit.h>
42#include <qradiobutton.h> 42#include <qradiobutton.h>
43#include <qwhatsthis.h> 43#include <qwhatsthis.h>
44 44
45Transaction::Transaction( QWidget *parent, bool bNew, const QString &acctname, 45Transaction::Transaction( QWidget *parent, bool bNew, const QString &acctname,
46 TranInfo *info, Cfg *pCfg ) 46 TranInfo *info, Cfg *pCfg )
47 : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) 47 : QDialog( parent, 0, TRUE, WStyle_ContextHelp )
48{ 48{
49 QString tempstr = tr( "Transaction for " ); 49 QString tempstr = tr( "Transaction for " );
50 tempstr.append( acctname ); 50 tempstr.append( acctname );
51 setCaption( tempstr ); 51 setCaption( tempstr );
52 52
53 _bNew=bNew; 53 _bNew=bNew;
54 tran = info; 54 tran = info;
55 _pCfg=pCfg; 55 _pCfg=pCfg;
56 56
57 QVBoxLayout *vb = new QVBoxLayout( this ); 57 QVBoxLayout *vb = new QVBoxLayout( this );
58 58
59 QScrollView *sv = new QScrollView( this ); 59 QScrollView *sv = new QScrollView( this );
60 vb->addWidget( sv, 0, 0 ); 60 vb->addWidget( sv, 0, 0 );
61 sv->setResizePolicy( QScrollView::AutoOneFit ); 61 sv->setResizePolicy( QScrollView::AutoOneFit );
62 sv->setFrameStyle( QFrame::NoFrame ); 62 sv->setFrameStyle( QFrame::NoFrame );
63 63
64 QWidget *container = new QWidget( sv->viewport() ); 64 QWidget *container = new QWidget( sv->viewport() );
65 sv->addChild( container ); 65 sv->addChild( container );
66 66
67 QGridLayout *layout = new QGridLayout( container ); 67 QGridLayout *layout = new QGridLayout( container );
68 layout->setSpacing( 2 ); 68 layout->setSpacing( 2 );
69 layout->setMargin( 4 ); 69 layout->setMargin( 4 );
70 70
71 // Withdrawal/Deposit 71 // Withdrawal/Deposit
72 QButtonGroup *btngrp = new QButtonGroup( container ); 72 QButtonGroup *btngrp = new QButtonGroup( container );
73 btngrp->setColumnLayout(0, Qt::Vertical ); 73 btngrp->setColumnLayout(0, Qt::Vertical );
74 btngrp->layout()->setSpacing( 0 ); 74 btngrp->layout()->setSpacing( 0 );
75 btngrp->layout()->setMargin( 0 ); 75 btngrp->layout()->setMargin( 0 );
76 btngrp->setMaximumWidth( 220 ); 76 btngrp->setMaximumWidth( 220 );
77 QGridLayout *layout2 = new QGridLayout( btngrp->layout() ); 77 QGridLayout *layout2 = new QGridLayout( btngrp->layout() );
78 layout2->setSpacing( 2 ); 78 layout2->setSpacing( 2 );
79 layout2->setMargin( 2 ); 79 layout2->setMargin( 2 );
80 withBtn = new QRadioButton( tr( "Withdrawal" ), btngrp ); 80 withBtn = new QRadioButton( tr( "Withdrawal" ), btngrp );
81 QWhatsThis::add( withBtn, tr( "Select whether the transaction is a withdrawal or deposit here." ) ); 81 QWhatsThis::add( withBtn, tr( "Select whether the transaction is a withdrawal or deposit here." ) );
82 layout2->addWidget( withBtn, 0, 0 ); 82 layout2->addWidget( withBtn, 0, 0 );
83 connect( withBtn, SIGNAL( clicked() ), this, SLOT( slotWithdrawalClicked() ) ); 83 connect( withBtn, SIGNAL( clicked() ), this, SLOT( slotWithdrawalClicked() ) );
84 depBtn = new QRadioButton( tr( "Deposit" ), btngrp ); 84 depBtn = new QRadioButton( tr( "Deposit" ), btngrp );
85 QWhatsThis::add( depBtn, tr( "Select whether the transaction is a withdrawal or deposit here." ) ); 85 QWhatsThis::add( depBtn, tr( "Select whether the transaction is a withdrawal or deposit here." ) );
86 layout2->addWidget( depBtn, 0, 1 ); 86 layout2->addWidget( depBtn, 0, 1 );
87 btngrp->setMaximumSize( 320, withBtn->height() ); 87 btngrp->setMaximumSize( 320, withBtn->height() );
88 connect( depBtn, SIGNAL( clicked() ), this, SLOT( slotDepositClicked() ) ); 88 connect( depBtn, SIGNAL( clicked() ), this, SLOT( slotDepositClicked() ) );
89 layout->addMultiCellWidget( btngrp, 0, 0, 0, 3 ); 89 layout->addMultiCellWidget( btngrp, 0, 0, 0, 3 );
90 90
91 // Date 91 // Date
92 QLabel *label = new QLabel( tr( "Date:" ), container ); 92 QLabel *label = new QLabel( tr( "Date:" ), container );
93 QWhatsThis::add( label, tr( "Select date of transaction here." ) ); 93 QWhatsThis::add( label, tr( "Select date of transaction here." ) );
94 layout->addWidget( label, 1, 0 ); 94 layout->addWidget( label, 1, 0 );
95 dateBtn = new QPushButton( TimeString::shortDate( QDate::currentDate() ), 95 dateBtn = new QPushButton( TimeString::shortDate( QDate::currentDate() ),
96 container ); 96 container );
97 QWhatsThis::add( dateBtn, tr( "Select date of transaction here." ) ); 97 QWhatsThis::add( dateBtn, tr( "Select date of transaction here." ) );
98 QPopupMenu *m1 = new QPopupMenu( container ); 98 QPopupMenu *m1 = new QPopupMenu( container );
99 datePicker = new DateBookMonth( m1, 0, TRUE ); 99 datePicker = new DateBookMonth( m1, 0, TRUE );
100 m1->insertItem( datePicker ); 100 m1->insertItem( datePicker );
101 dateBtn->setPopup( m1 ); 101 dateBtn->setPopup( m1 );
102 connect( datePicker, SIGNAL( dateClicked( int, int, int ) ), 102 connect( datePicker, SIGNAL( dateClicked(int,int,int) ),
103 this, SLOT( slotDateChanged( int, int, int ) ) ); 103 this, SLOT( slotDateChanged(int,int,int) ) );
104 layout->addWidget( dateBtn, 1, 1 ); 104 layout->addWidget( dateBtn, 1, 1 );
105 105
106 // Check number 106 // Check number
107 label = new QLabel( tr( "Number:" ), container ); 107 label = new QLabel( tr( "Number:" ), container );
108 QWhatsThis::add( label, tr( "Enter check number here." ) ); 108 QWhatsThis::add( label, tr( "Enter check number here." ) );
109 layout->addWidget( label, 1, 2 ); 109 layout->addWidget( label, 1, 2 );
110 numEdit = new QLineEdit( container ); 110 numEdit = new QLineEdit( container );
111 QWhatsThis::add( numEdit, tr( "Enter check number here." ) ); 111 QWhatsThis::add( numEdit, tr( "Enter check number here." ) );
112 numEdit->setMaximumWidth( 40 ); 112 numEdit->setMaximumWidth( 40 );
113 layout->addWidget( numEdit, 1, 3 ); 113 layout->addWidget( numEdit, 1, 3 );
114 114
115 // Description 115 // Description
116 label = new QLabel( tr( "Description:" ), container ); 116 label = new QLabel( tr( "Description:" ), container );
117 QWhatsThis::add( label, tr( "Enter description of transaction here." ) ); 117 QWhatsThis::add( label, tr( "Enter description of transaction here." ) );
118 layout->addWidget( label, 2, 0 ); 118 layout->addWidget( label, 2, 0 );
119 _cbDesc=new QComboBox( true, container ); 119 _cbDesc=new QComboBox( true, container );
120 _cbDesc->insertStringList( _pCfg->getPayees() ); 120 _cbDesc->insertStringList( _pCfg->getPayees() );
121 QWhatsThis::add( _cbDesc, tr( "Enter description of transaction here." ) ); 121 QWhatsThis::add( _cbDesc, tr( "Enter description of transaction here." ) );
122 layout->addMultiCellWidget( _cbDesc, 2, 2, 1, 3 ); 122 layout->addMultiCellWidget( _cbDesc, 2, 2, 1, 3 );
123 connect( _cbDesc, SIGNAL( activated(const QString &) ), this, SLOT( slotActivated(const QString &) ) ); 123 connect( _cbDesc, SIGNAL( activated(const QString&) ), this, SLOT( slotActivated(const QString&) ) );
124 124
125 125
126 // Category 126 // Category
127 label = new QLabel( tr( "Category:" ), container ); 127 label = new QLabel( tr( "Category:" ), container );
128 QWhatsThis::add( label, tr( "Select transaction category here." ) ); 128 QWhatsThis::add( label, tr( "Select transaction category here." ) );
129 layout->addWidget( label, 3, 0 ); 129 layout->addWidget( label, 3, 0 );
130 catList = new QComboBox( container ); 130 catList = new QComboBox( container );
131 QWhatsThis::add( catList, tr( "Select transaction category here." ) ); 131 QWhatsThis::add( catList, tr( "Select transaction category here." ) );
132 layout->addMultiCellWidget( catList, 3, 3, 1, 3 ); 132 layout->addMultiCellWidget( catList, 3, 3, 1, 3 );
133 133
134 // Type 134 // Type
135 label = new QLabel( tr( "Type:" ), container ); 135 label = new QLabel( tr( "Type:" ), container );
136 QWhatsThis::add( label, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) ); 136 QWhatsThis::add( label, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) );
137 layout->addWidget( label, 4, 0 ); 137 layout->addWidget( label, 4, 0 );
138 typeList = new QComboBox( container ); 138 typeList = new QComboBox( container );
139 QWhatsThis::add( typeList, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) ); 139 QWhatsThis::add( typeList, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) );
140 layout->addMultiCellWidget( typeList, 4, 4, 1, 3 ); 140 layout->addMultiCellWidget( typeList, 4, 4, 1, 3 );
141 141
142 142
143 // Amount 143 // Amount
144 label = new QLabel( tr( "Amount:" ), container ); 144 label = new QLabel( tr( "Amount:" ), container );
145 QWhatsThis::add( label, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) ); 145 QWhatsThis::add( label, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) );
146 layout->addWidget( label, 5, 0 ); 146 layout->addWidget( label, 5, 0 );
147 amtEdit = new QLineEdit( container ); 147 amtEdit = new QLineEdit( container );
148 QWhatsThis::add( amtEdit, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) ); 148 QWhatsThis::add( amtEdit, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) );
149 layout->addMultiCellWidget( amtEdit, 5, 5, 1, 3 ); 149 layout->addMultiCellWidget( amtEdit, 5, 5, 1, 3 );
150 150
151 // Fee 151 // Fee
152 label = new QLabel( tr( "Fee:" ), container ); 152 label = new QLabel( tr( "Fee:" ), container );
153 QWhatsThis::add( label, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) ); 153 QWhatsThis::add( label, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) );
154 layout->addWidget( label, 6, 0 ); 154 layout->addWidget( label, 6, 0 );
155 feeEdit = new QLineEdit( container ); 155 feeEdit = new QLineEdit( container );
156 QWhatsThis::add( feeEdit, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) ); 156 QWhatsThis::add( feeEdit, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) );
157 layout->addMultiCellWidget( feeEdit, 6, 6, 1, 3 ); 157 layout->addMultiCellWidget( feeEdit, 6, 6, 1, 3 );
158 158
159 // Notes 159 // Notes
160 label = new QLabel( tr( "Notes:" ), container ); 160 label = new QLabel( tr( "Notes:" ), container );
161 QWhatsThis::add( label, tr( "Enter any additional information for this transaction here." ) ); 161 QWhatsThis::add( label, tr( "Enter any additional information for this transaction here." ) );
162 layout->addWidget( label, 7, 0 ); 162 layout->addWidget( label, 7, 0 );
163 noteEdit = new QMultiLineEdit( container ); 163 noteEdit = new QMultiLineEdit( container );
164 QWhatsThis::add( noteEdit, tr( "Enter any additional information for this transaction here." ) ); 164 QWhatsThis::add( noteEdit, tr( "Enter any additional information for this transaction here." ) );
165 layout->addMultiCellWidget( noteEdit, 8, 8, 0, 3 ); 165 layout->addMultiCellWidget( noteEdit, 8, 8, 0, 3 );
166 166
167 // init date 167 // init date
168 initFromInfo( info ); 168 initFromInfo( info );
169 169
170 // not new handlers 170 // not new handlers
171 connect( withBtn, SIGNAL( toggled(bool) ), this, SLOT( slotNotNew() ) ); 171 connect( withBtn, SIGNAL( toggled(bool) ), this, SLOT( slotNotNew() ) );
172 connect( depBtn, SIGNAL( toggled(bool) ), this, SLOT( slotNotNew() ) ); 172 connect( depBtn, SIGNAL( toggled(bool) ), this, SLOT( slotNotNew() ) );
173 connect( catList, SIGNAL(activated(const QString &)), this, SLOT( slotNotNew() ) ); 173 connect( catList, SIGNAL(activated(const QString&)), this, SLOT( slotNotNew() ) );
174 connect( typeList, SIGNAL(activated(const QString &)), this, SLOT( slotNotNew() ) ); 174 connect( typeList, SIGNAL(activated(const QString&)), this, SLOT( slotNotNew() ) );
175 connect( amtEdit, SIGNAL(textChanged(const QString &)), this, SLOT( slotNotNew() ) ); 175 connect( amtEdit, SIGNAL(textChanged(const QString&)), this, SLOT( slotNotNew() ) );
176 connect( feeEdit, SIGNAL(textChanged(const QString &)), this, SLOT( slotNotNew() ) ); 176 connect( feeEdit, SIGNAL(textChanged(const QString&)), this, SLOT( slotNotNew() ) );
177 connect( noteEdit, SIGNAL(textChanged()), this, SLOT( slotNotNew() ) ); 177 connect( noteEdit, SIGNAL(textChanged()), this, SLOT( slotNotNew() ) );
178} 178}
179 179
180// --- initFromInfo ----------------------------------------------------------- 180// --- initFromInfo -----------------------------------------------------------
181void Transaction::initFromInfo(TranInfo *info, bool bPopulateOld) 181void Transaction::initFromInfo(TranInfo *info, bool bPopulateOld)
182{ 182{
183 // Populate current values if provided 183 // Populate current values if provided
184 if ( info ) 184 if ( info )
185 { 185 {
186 if ( info->withdrawal() ) 186 if ( info->withdrawal() )
187 { 187 {
188 withBtn->setChecked( TRUE ); 188 withBtn->setChecked( TRUE );
189 slotWithdrawalClicked(); 189 slotWithdrawalClicked();
190 } 190 }
191 else 191 else
192 { 192 {
193 depBtn->setChecked( TRUE ); 193 depBtn->setChecked( TRUE );
194 slotDepositClicked(); 194 slotDepositClicked();
195 } 195 }
196 196
197 if( !bPopulateOld ) { 197 if( !bPopulateOld ) {
198 QDate dt = info->date(); 198 QDate dt = info->date();
199 slotDateChanged( dt.year(), dt.month(), dt.day() ); 199 slotDateChanged( dt.year(), dt.month(), dt.day() );
200 datePicker->setDate( dt ); 200 datePicker->setDate( dt );
201 numEdit->setText( info->number() ); 201 numEdit->setText( info->number() );
202 } 202 }
203 QString temptext = info->category(); 203 QString temptext = info->category();
204 204
205 // set description field 205 // set description field
206 int i; 206 int i;
207 for(i=_cbDesc->count()-1; i>=0; i--) { 207 for(i=_cbDesc->count()-1; i>=0; i--) {
208 if( _cbDesc->text(i)==info->desc() ) { 208 if( _cbDesc->text(i)==info->desc() ) {
209 _cbDesc->setCurrentItem(i); 209 _cbDesc->setCurrentItem(i);
210 break; 210 break;
211 } 211 }
212 } 212 }
213 if( i<=0 ) 213 if( i<=0 )
214 _cbDesc->setEditText( info->desc() ); 214 _cbDesc->setEditText( info->desc() );
215 215
216 i = catList->count(); 216 i = catList->count();
217 while ( i > 0 ) 217 while ( i > 0 )
218 { 218 {
219 i--; 219 i--;
220 catList->setCurrentItem( i ); 220 catList->setCurrentItem( i );
221 if ( catList->currentText() == temptext ) 221 if ( catList->currentText() == temptext )
222 { 222 {
223 break; 223 break;
224 } 224 }
225 } 225 }
226 temptext = info->type(); 226 temptext = info->type();
227 i = typeList->count(); 227 i = typeList->count();
228 while ( i > 0 ) 228 while ( i > 0 )
229 { 229 {
230 i--; 230 i--;
231 typeList->setCurrentItem( i ); 231 typeList->setCurrentItem( i );
232 if ( typeList->currentText() == temptext ) 232 if ( typeList->currentText() == temptext )
233 { 233 {
234 break; 234 break;
235 } 235 }
236 } 236 }
237 amtEdit->setText( QString( "%1" ).arg( info->amount(), 0, 'f', 2 ) ); 237 amtEdit->setText( QString( "%1" ).arg( info->amount(), 0, 'f', 2 ) );
238 feeEdit->setText( QString( "%1" ).arg( info->fee(), 0, 'f', 2 ) ); 238 feeEdit->setText( QString( "%1" ).arg( info->fee(), 0, 'f', 2 ) );
239 noteEdit->setText( info->notes() ); 239 noteEdit->setText( info->notes() );
240 } 240 }
diff --git a/noncore/apps/confedit/mainwindow.cpp b/noncore/apps/confedit/mainwindow.cpp
index 5f7ad50..6ef1043 100644
--- a/noncore/apps/confedit/mainwindow.cpp
+++ b/noncore/apps/confedit/mainwindow.cpp
@@ -1,116 +1,116 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 9
10// (c) 2002 Patrick S. Vogt <tille@handhelds.org> 10// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
11 11
12 12
13#include "mainwindow.h" 13#include "mainwindow.h"
14 14
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qlayout.h> 16#include <qlayout.h>
17#include <qlineedit.h> 17#include <qlineedit.h>
18 18
19#include "listviewconfdir.h" 19#include "listviewconfdir.h"
20#include "listviewitemconfigentry.h" 20#include "listviewitemconfigentry.h"
21 21
22 22
23MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : 23MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
24 QMainWindow( parent, name, f ), _currentItem(0), _fileItem(0) 24 QMainWindow( parent, name, f ), _currentItem(0), _fileItem(0)
25{ 25{
26 setCaption( tr("Conf File Editor") ); 26 setCaption( tr("Conf File Editor") );
27 27
28 //setBaseSize( qApp->globalStrut() ); 28 //setBaseSize( qApp->globalStrut() );
29 setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); 29 setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) );
30 30
31 mainLayout = new QVBoxLayout( this ); 31 mainLayout = new QVBoxLayout( this );
32 mainLayout->setSpacing( 0 ); 32 mainLayout->setSpacing( 0 );
33 mainLayout->setMargin( 0 ); 33 mainLayout->setMargin( 0 );
34 34
35 35
36 qDebug("creating settingList"); 36 qDebug("creating settingList");
37 settingList = new ListViewConfDir( QDir::homeDirPath() + "/Settings", this, "settingslist"); 37 settingList = new ListViewConfDir( QDir::homeDirPath() + "/Settings", this, "settingslist");
38 settingList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); 38 settingList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) );
39 mainLayout->addWidget( settingList, 0); 39 mainLayout->addWidget( settingList, 0);
40 40
41 qDebug("creating editor"); 41 qDebug("creating editor");
42 editor = new EditWidget(this); 42 editor = new EditWidget(this);
43 editor->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum));//, sizePolicy().hasHeightForWidth() ) ); 43 editor->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum));//, sizePolicy().hasHeightForWidth() ) );
44 mainLayout->addWidget( editor, 1 ); 44 mainLayout->addWidget( editor, 1 );
45 editor->layoutType( ListViewItemConf::File ); 45 editor->layoutType( ListViewItemConf::File );
46 46
47 makeMenu(); 47 makeMenu();
48 48
49 connect(settingList, SIGNAL( pressed(QListViewItem*) ), 49 connect(settingList, SIGNAL( pressed(QListViewItem*) ),
50 this, SLOT(setCurrent(QListViewItem*))); 50 this, SLOT(setCurrent(QListViewItem*)));
51 connect( settingList, SIGNAL( clicked( QListViewItem* ) ), 51 connect( settingList, SIGNAL( clicked(QListViewItem*) ),
52 this, SLOT( stopTimer( QListViewItem* ) ) ); 52 this, SLOT( stopTimer(QListViewItem*) ) );
53 53
54 connect( editor->LineEditGroup, SIGNAL( textChanged(const QString&) ), 54 connect( editor->LineEditGroup, SIGNAL( textChanged(const QString&) ),
55 SLOT( groupChanged(const QString&) ) ); 55 SLOT( groupChanged(const QString&) ) );
56 connect( editor->LineEditKey, SIGNAL( textChanged(const QString&) ), 56 connect( editor->LineEditKey, SIGNAL( textChanged(const QString&) ),
57 SLOT( keyChanged(const QString&) ) ); 57 SLOT( keyChanged(const QString&) ) );
58 connect( editor->LineEditValue, SIGNAL( textChanged(const QString&) ), 58 connect( editor->LineEditValue, SIGNAL( textChanged(const QString&) ),
59 SLOT( valueChanged(const QString&) ) ); 59 SLOT( valueChanged(const QString&) ) );
60 60
61 setCurrent(0); 61 setCurrent(0);
62 editor->layoutType(EditWidget::File); 62 editor->layoutType(EditWidget::File);
63} 63}
64 64
65void MainWindow::makeMenu() 65void MainWindow::makeMenu()
66{ 66{
67 popupTimer = new QTimer(this); 67 popupTimer = new QTimer(this);
68 popupMenuFile = new QPopupMenu(this); 68 popupMenuFile = new QPopupMenu(this);
69 popupMenuEntry = new QPopupMenu(this); 69 popupMenuEntry = new QPopupMenu(this);
70 70
71 popupActionSave = new QAction( tr("Save"),QString::null, 0, this, 0 ); 71 popupActionSave = new QAction( tr("Save"),QString::null, 0, this, 0 );
72 popupActionSave->addTo( popupMenuFile ); 72 popupActionSave->addTo( popupMenuFile );
73 // popupActionSave->addTo( popupMenuEntry ); 73 // popupActionSave->addTo( popupMenuEntry );
74 connect( popupActionSave, SIGNAL( activated() ), 74 connect( popupActionSave, SIGNAL( activated() ),
75 this , SLOT( saveConfFile() ) ); 75 this , SLOT( saveConfFile() ) );
76 76
77 popupActionRevert = new QAction( tr("Revert"),QString::null, 0, this, 0 ); 77 popupActionRevert = new QAction( tr("Revert"),QString::null, 0, this, 0 );
78 popupActionRevert->addTo( popupMenuFile ); 78 popupActionRevert->addTo( popupMenuFile );
79 popupActionRevert->addTo( popupMenuEntry ); 79 popupActionRevert->addTo( popupMenuEntry );
80 connect( popupActionRevert, SIGNAL( activated() ), 80 connect( popupActionRevert, SIGNAL( activated() ),
81 this , SLOT( revertConfFile() ) ); 81 this , SLOT( revertConfFile() ) );
82 82
83 popupActionDelete = new QAction( tr("Delete"),QString::null, 0, this, 0 ); 83 popupActionDelete = new QAction( tr("Delete"),QString::null, 0, this, 0 );
84 popupActionDelete->addTo( popupMenuFile ); 84 popupActionDelete->addTo( popupMenuFile );
85 popupActionDelete->addTo( popupMenuEntry ); 85 popupActionDelete->addTo( popupMenuEntry );
86 connect( popupActionDelete, SIGNAL( activated() ), 86 connect( popupActionDelete, SIGNAL( activated() ),
87 this , SLOT( removeConfFile() ) ); 87 this , SLOT( removeConfFile() ) );
88 88
89 connect( popupTimer, SIGNAL(timeout()), 89 connect( popupTimer, SIGNAL(timeout()),
90 this, SLOT(showPopup()) ); 90 this, SLOT(showPopup()) );
91} 91}
92 92
93MainWindow::~MainWindow() 93MainWindow::~MainWindow()
94{ 94{
95} 95}
96 96
97 97
98 98
99void MainWindow::setCurrent(QListViewItem *item) 99void MainWindow::setCurrent(QListViewItem *item)
100{ 100{
101 //qDebug("MainWindow::setCurrent"); 101 //qDebug("MainWindow::setCurrent");
102 if (!item) return; 102 if (!item) return;
103 _item = (ListViewItemConf*) item; 103 _item = (ListViewItemConf*) item;
104 if (!_item) return; 104 if (!_item) return;
105 popupTimer->start( 750, true ); 105 popupTimer->start( 750, true );
106 if (_item->getType() == ListViewItemConf::File) 106 if (_item->getType() == ListViewItemConf::File)
107 { 107 {
108 editor->layoutType(EditWidget::File); 108 editor->layoutType(EditWidget::File);
109 _currentItem=0; 109 _currentItem=0;
110 _fileItem = (ListViewItemConfFile*)item; 110 _fileItem = (ListViewItemConfFile*)item;
111 return; 111 return;
112 } 112 }
113 _fileItem = 0; 113 _fileItem = 0;
114 _currentItem = (ListViewItemConfigEntry*)item; 114 _currentItem = (ListViewItemConfigEntry*)item;
115 if (!_currentItem) return; 115 if (!_currentItem) return;
116 QString file = _currentItem->getFile(); 116 QString file = _currentItem->getFile();
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp
index d5c6d75..4c99964 100644
--- a/noncore/apps/odict/odict.cpp
+++ b/noncore/apps/odict/odict.cpp
@@ -145,71 +145,71 @@ void ODict::slotStartQuery()
145 slotSettings(); 145 slotSettings();
146 break; 146 break;
147 case 1: // stop here 147 case 1: // stop here
148 return; 148 return;
149 } 149 }
150 } 150 }
151 151
152 /* 152 /*
153 * ok, the user has defined a dict 153 * ok, the user has defined a dict
154 */ 154 */
155 ding->setCaseSensitive( casesens ); 155 ding->setCaseSensitive( casesens );
156 156
157 BroswerContent test = ding->setText( querystring ); 157 BroswerContent test = ding->setText( querystring );
158 158
159 browser_top->setText( test.top ); 159 browser_top->setText( test.top );
160 browser_bottom->setText( test.bottom ); 160 browser_bottom->setText( test.bottom );
161 } 161 }
162} 162}
163 163
164void ODict::slotSettings() 164void ODict::slotSettings()
165{ 165{
166 ConfigDlg dlg( this, "Config" , true); 166 ConfigDlg dlg( this, "Config" , true);
167 if ( dlg.exec() == QDialog::Accepted ) 167 if ( dlg.exec() == QDialog::Accepted )
168 saveConfig(); 168 saveConfig();
169} 169}
170 170
171void ODict::slotSetParameter( int count ) 171void ODict::slotSetParameter( int count )
172{ 172{
173 if ( count == 0 ) 173 if ( count == 0 )
174 { 174 {
175 if ( casesens ) 175 if ( casesens )
176 casesens = false; 176 casesens = false;
177 else 177 else
178 casesens = true; 178 casesens = true;
179 } 179 }
180 180
181 saveConfig(); 181 saveConfig();
182} 182}
183 183
184void ODict::slotMethodChanged( const QString& methodnumber ) 184void ODict::slotMethodChanged( const QString& methodnumber )
185{ 185{
186 activated_name = methodnumber; 186 activated_name = methodnumber;
187 187
188 if ( activated_name != ding->loadedDict() ) 188 if ( activated_name != ding->loadedDict() )
189 { 189 {
190 ding->loadDict(activated_name); 190 ding->loadDict(activated_name);
191 191
192 lookupLanguageNames( activated_name ); 192 lookupLanguageNames( activated_name );
193 top_name->setText( top_name_content ); 193 top_name->setText( top_name_content );
194 bottom_name->setText( bottom_name_content ); 194 bottom_name->setText( bottom_name_content );
195 } 195 }
196} 196}
197 197
198void ODict::setupMenus() 198void ODict::setupMenus()
199{ 199{
200 menu = new QMenuBar( this ); 200 menu = new QMenuBar( this );
201 201
202 settings = new QPopupMenu( menu ); 202 settings = new QPopupMenu( menu );
203 setting_a = new QAction(tr( "Configuration" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); 203 setting_a = new QAction(tr( "Configuration" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
204 connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); 204 connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
205 setting_a->addTo( settings ); 205 setting_a->addTo( settings );
206 setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 ); 206 setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 );
207 207
208 parameter = new QPopupMenu( menu ); 208 parameter = new QPopupMenu( menu );
209 connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); 209 connect( parameter, SIGNAL( activated(int) ), this, SLOT( slotSetParameter(int) ) );
210 parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); 210 parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 );
211 parameter->insertSeparator(); 211 parameter->insertSeparator();
212 212
213 menu->insertItem( tr( "Settings" ) , settings ); 213 menu->insertItem( tr( "Settings" ) , settings );
214 menu->insertItem( tr( "Parameter" ) , parameter ); 214 menu->insertItem( tr( "Parameter" ) , parameter );
215} 215}
diff --git a/noncore/apps/opie-bartender/bartender.cpp b/noncore/apps/opie-bartender/bartender.cpp
index 3c010e9..b6401ed 100644
--- a/noncore/apps/opie-bartender/bartender.cpp
+++ b/noncore/apps/opie-bartender/bartender.cpp
@@ -41,131 +41,131 @@
41#include <errno.h> 41#include <errno.h>
42 42
43 43
44Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) 44Bartender::Bartender( QWidget* parent, const char* name, WFlags fl )
45 : QMainWindow( parent, name, fl ) { 45 : QMainWindow( parent, name, fl ) {
46 if ( !name ) 46 if ( !name )
47 setName( "Bartender" ); 47 setName( "Bartender" );
48 QGridLayout *layout = new QGridLayout( this ); 48 QGridLayout *layout = new QGridLayout( this );
49 layout->setSpacing( 2); 49 layout->setSpacing( 2);
50 layout->setMargin( 2); 50 layout->setMargin( 2);
51 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 51 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
52 52
53 setCaption( tr( "Bartender" ) ); 53 setCaption( tr( "Bartender" ) );
54 54
55 ToolBar1 = new QToolBar( this, "ToolBar1" ); 55 ToolBar1 = new QToolBar( this, "ToolBar1" );
56 ToolBar1->setFixedHeight(22); 56 ToolBar1->setFixedHeight(22);
57 layout->addMultiCellWidget( ToolBar1, 0, 0, 0, 4 ); 57 layout->addMultiCellWidget( ToolBar1, 0, 0, 0, 4 );
58 58
59 QMenuBar *menuBar = new QMenuBar( ToolBar1 ); 59 QMenuBar *menuBar = new QMenuBar( ToolBar1 );
60 QPopupMenu *fileMenu; 60 QPopupMenu *fileMenu;
61 fileMenu = new QPopupMenu( this); 61 fileMenu = new QPopupMenu( this);
62 menuBar->insertItem( tr("File"), fileMenu ); 62 menuBar->insertItem( tr("File"), fileMenu );
63 63
64 fileMenu->insertItem(tr("New Drink")); 64 fileMenu->insertItem(tr("New Drink"));
65 fileMenu->insertItem(tr("Open Drink")); 65 fileMenu->insertItem(tr("Open Drink"));
66 fileMenu->insertItem(tr("Find by Drink Name")); 66 fileMenu->insertItem(tr("Find by Drink Name"));
67 fileMenu->insertItem(tr("Find by Alcohol")); 67 fileMenu->insertItem(tr("Find by Alcohol"));
68 68
69 QPopupMenu *editMenu; 69 QPopupMenu *editMenu;
70 editMenu = new QPopupMenu( this); 70 editMenu = new QPopupMenu( this);
71 menuBar->insertItem( tr("Edit"), editMenu ); 71 menuBar->insertItem( tr("Edit"), editMenu );
72 editMenu->insertItem(tr("edit")); 72 editMenu->insertItem(tr("edit"));
73 73
74 connect( fileMenu, SIGNAL( activated(int) ), this, SLOT( fileMenuActivated(int) )); 74 connect( fileMenu, SIGNAL( activated(int) ), this, SLOT( fileMenuActivated(int) ));
75 connect( editMenu, SIGNAL( activated(int) ), this, SLOT( editMenuActivated(int) )); 75 connect( editMenu, SIGNAL( activated(int) ), this, SLOT( editMenuActivated(int) ));
76 76
77 77
78 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), "New", 0, this, 0 ); 78 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), "New", 0, this, 0 );
79 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 79 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
80 a->addTo( ToolBar1 ); 80 a->addTo( ToolBar1 );
81 81
82 a = new QAction( tr( "Open" ), Resource::loadPixmap( "bartender/bartender_sm" ), "open", 0, this, 0 ); 82 a = new QAction( tr( "Open" ), Resource::loadPixmap( "bartender/bartender_sm" ), "open", 0, this, 0 );
83 connect( a, SIGNAL( activated() ), this, SLOT( openCurrentDrink() ) ); 83 connect( a, SIGNAL( activated() ), this, SLOT( openCurrentDrink() ) );
84 a->addTo( ToolBar1 ); 84 a->addTo( ToolBar1 );
85 85
86 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), "Find", 0, this, 0 ); 86 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), "Find", 0, this, 0 );
87 connect( a, SIGNAL( activated() ), this, SLOT( askSearch() ) ); 87 connect( a, SIGNAL( activated() ), this, SLOT( askSearch() ) );
88 a->addTo( ToolBar1 ); 88 a->addTo( ToolBar1 );
89 89
90 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ),"Edit", 0, this, 0 ); 90 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ),"Edit", 0, this, 0 );
91 connect( a, SIGNAL( activated() ), this, SLOT( doEdit() ) ); 91 connect( a, SIGNAL( activated() ), this, SLOT( doEdit() ) );
92 a->addTo( ToolBar1 ); 92 a->addTo( ToolBar1 );
93 93
94 QPushButton *t; 94 QPushButton *t;
95 t= new QPushButton( "BAC", ToolBar1, "bacButtin"); 95 t= new QPushButton( "BAC", ToolBar1, "bacButtin");
96 connect( t, SIGNAL( clicked() ), this, SLOT( doBac() ) ); 96 connect( t, SIGNAL( clicked() ), this, SLOT( doBac() ) );
97 97
98 DrinkView = new QListView( this, "DrinkView" ); 98 DrinkView = new QListView( this, "DrinkView" );
99 DrinkView->addColumn( tr( "Name of Drink" ) ); 99 DrinkView->addColumn( tr( "Name of Drink" ) );
100// DrinkView->setRootIsDecorated( TRUE ); 100// DrinkView->setRootIsDecorated( TRUE );
101 DrinkView->header()->hide(); 101 DrinkView->header()->hide();
102 102
103 QPEApplication::setStylusOperation( DrinkView->viewport(),QPEApplication::RightOnHold); 103 QPEApplication::setStylusOperation( DrinkView->viewport(),QPEApplication::RightOnHold);
104 104
105 connect(DrinkView, SIGNAL( doubleClicked(QListViewItem*)),this,SLOT(showDrink( QListViewItem*))); 105 connect(DrinkView, SIGNAL( doubleClicked(QListViewItem*)),this,SLOT(showDrink(QListViewItem*)));
106 connect(DrinkView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 106 connect(DrinkView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
107 this,SLOT( showDrink(int, QListViewItem *, const QPoint&, int))); 107 this,SLOT( showDrink(int,QListViewItem*,const QPoint&,int)));
108 108
109 layout->addMultiCellWidget( DrinkView, 1, 2, 0, 4 ); 109 layout->addMultiCellWidget( DrinkView, 1, 2, 0, 4 );
110 if(QDir("db").exists()) { 110 if(QDir("db").exists()) {
111 dbFile.setName( "db/drinkdb.txt"); 111 dbFile.setName( "db/drinkdb.txt");
112 } else 112 } else
113 dbFile.setName( QPEApplication::qpeDir()+"/etc/bartender/drinkdb.txt"); 113 dbFile.setName( QPEApplication::qpeDir()+"/etc/bartender/drinkdb.txt");
114 initDrinkDb(); 114 initDrinkDb();
115} 115}
116 116
117Bartender::~Bartender() { 117Bartender::~Bartender() {
118} 118}
119 119
120/* 120/*
121this happens right before exit */ 121this happens right before exit */
122void Bartender::cleanUp() { 122void Bartender::cleanUp() {
123 dbFile.close(); 123 dbFile.close();
124 124
125} 125}
126 126
127void Bartender::initDrinkDb() { 127void Bartender::initDrinkDb() {
128 128
129 if(!dbFile.isOpen()) 129 if(!dbFile.isOpen())
130 if ( !dbFile.open( IO_ReadOnly)) { 130 if ( !dbFile.open( IO_ReadOnly)) {
131 QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); 131 QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) );
132 return; 132 return;
133 } 133 }
134 fillList(); 134 fillList();
135} 135}
136 136
137void Bartender::fillList() { 137void Bartender::fillList() {
138 dbFile.at(1); 138 dbFile.at(1);
139 DrinkView->clear(); 139 DrinkView->clear();
140 int i=0; 140 int i=0;
141 QListViewItem * item ; 141 QListViewItem * item ;
142 QTextStream t( &dbFile); 142 QTextStream t( &dbFile);
143 QString s; 143 QString s;
144 while ( !t.eof()) { 144 while ( !t.eof()) {
145 s = t.readLine(); 145 s = t.readLine();
146 if(s.find("#",0,TRUE) != -1) { 146 if(s.find("#",0,TRUE) != -1) {
147// qDebug(s.right(s.length()-2)); 147// qDebug(s.right(s.length()-2));
148 item= new QListViewItem( DrinkView, 0 ); 148 item= new QListViewItem( DrinkView, 0 );
149 item->setText( 0, s.right(s.length()-2)); 149 item->setText( 0, s.right(s.length()-2));
150 i++; 150 i++;
151 } 151 }
152 } 152 }
153 qDebug("there are currently %d of drinks", i); 153 qDebug("there are currently %d of drinks", i);
154} 154}
155 155
156void Bartender::fileNew() { 156void Bartender::fileNew() {
157 157
158 New_Drink *newDrinks; 158 New_Drink *newDrinks;
159 newDrinks = new New_Drink(this,"New Drink....", TRUE); 159 newDrinks = new New_Drink(this,"New Drink....", TRUE);
160 QString newName, newIng; 160 QString newName, newIng;
161 QPEApplication::execDialog( newDrinks ); 161 QPEApplication::execDialog( newDrinks );
162 newName = newDrinks->LineEdit1->text(); 162 newName = newDrinks->LineEdit1->text();
163 newIng= newDrinks->MultiLineEdit1->text(); 163 newIng= newDrinks->MultiLineEdit1->text();
164 164
165 if(dbFile.isOpen()) 165 if(dbFile.isOpen())
166 dbFile.close(); 166 dbFile.close();
167 if ( !dbFile.open( IO_WriteOnly| IO_Append)) { 167 if ( !dbFile.open( IO_WriteOnly| IO_Append)) {
168 QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); 168 QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) );
169 return; 169 return;
170 } 170 }
171 if(newDrinks ->result() == 1 ) { 171 if(newDrinks ->result() == 1 ) {
diff --git a/noncore/apps/opie-bartender/searchresults.cpp b/noncore/apps/opie-bartender/searchresults.cpp
index 4900d1f..a511a57 100644
--- a/noncore/apps/opie-bartender/searchresults.cpp
+++ b/noncore/apps/opie-bartender/searchresults.cpp
@@ -1,43 +1,43 @@
1/**************************************************************************** 1/****************************************************************************
2** Created: Sat Jul 20 08:23:27 2002 2** Created: Sat Jul 20 08:23:27 2002
3** by: L.J. Potter <ljp@llornkcor.com> 3** by: L.J. Potter <ljp@llornkcor.com>
4** copyright : (C) 2002 by ljp 4** copyright : (C) 2002 by ljp
5 email : ljp@llornkcor.com 5 email : ljp@llornkcor.com
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by * 7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or * 8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. * 9 * (at your option) any later version. *
10 ***************************************************************************/ 10 ***************************************************************************/
11#include "searchresults.h" 11#include "searchresults.h"
12 12
13 13
14#include <qlistbox.h> 14#include <qlistbox.h>
15#include <qlayout.h> 15#include <qlayout.h>
16 16
17Search_Results::Search_Results( QWidget* parent, const char* name, bool modal, WFlags fl ) 17Search_Results::Search_Results( QWidget* parent, const char* name, bool modal, WFlags fl )
18 : QDialog( parent, name, modal, fl ) { 18 : QDialog( parent, name, modal, fl ) {
19 if ( !name ) 19 if ( !name )
20 setName( drinkName); 20 setName( drinkName);
21 21
22 drinkName = name; 22 drinkName = name;
23 setCaption( drinkName ); 23 setCaption( drinkName );
24 24
25 Layout5 = new QGridLayout( this ); 25 Layout5 = new QGridLayout( this );
26 Layout5->setSpacing( 6 ); 26 Layout5->setSpacing( 6 );
27 Layout5->setMargin( 4 ); 27 Layout5->setMargin( 4 );
28 28
29 ListBox1 = new QListBox( this, "ListBox1" ); 29 ListBox1 = new QListBox( this, "ListBox1" );
30 30
31 Layout5->addMultiCellWidget( ListBox1, 0, 1, 0, 3 ); 31 Layout5->addMultiCellWidget( ListBox1, 0, 1, 0, 3 );
32 connect( ListBox1, SIGNAL( clicked( QListBoxItem *)), SLOT( listSelected( QListBoxItem *)) ); 32 connect( ListBox1, SIGNAL( clicked(QListBoxItem*)), SLOT( listSelected(QListBoxItem*)) );
33} 33}
34 34
35Search_Results::~Search_Results() { 35Search_Results::~Search_Results() {
36} 36}
37 37
38 38
39void Search_Results::listSelected(QListBoxItem *) { 39void Search_Results::listSelected(QListBoxItem *) {
40 40
41 QDialog::accept(); 41 QDialog::accept();
42} 42}
43 43
diff --git a/noncore/apps/opie-console/btconfigwidget.cpp b/noncore/apps/opie-console/btconfigwidget.cpp
index 64046d8..0ac337f 100644
--- a/noncore/apps/opie-console/btconfigwidget.cpp
+++ b/noncore/apps/opie-console/btconfigwidget.cpp
@@ -1,107 +1,107 @@
1#include <qlabel.h> 1#include <qlabel.h>
2#include <qlayout.h> 2#include <qlayout.h>
3#include <qlineedit.h> 3#include <qlineedit.h>
4#include <qcombobox.h> 4#include <qcombobox.h>
5#include <qhbox.h> 5#include <qhbox.h>
6#include <qradiobutton.h> 6#include <qradiobutton.h>
7 7
8#include "iolayerbase.h" 8#include "iolayerbase.h"
9#include "btconfigwidget.h" 9#include "btconfigwidget.h"
10 10
11namespace { 11namespace {
12 void setCurrent( const QString& str, QComboBox* bo ) { 12 void setCurrent( const QString& str, QComboBox* bo ) {
13 uint b = bo->count(); 13 uint b = bo->count();
14 for (int i = 0; i < bo->count(); i++ ) { 14 for (int i = 0; i < bo->count(); i++ ) {
15 if ( bo->text(i) == str ) { 15 if ( bo->text(i) == str ) {
16 bo->setCurrentItem( i ); 16 bo->setCurrentItem( i );
17 return; 17 return;
18 } 18 }
19 } 19 }
20 bo->insertItem( str ); 20 bo->insertItem( str );
21 bo->setCurrentItem( b ); 21 bo->setCurrentItem( b );
22 } 22 }
23} 23}
24 24
25BTConfigWidget::BTConfigWidget( const QString& name, 25BTConfigWidget::BTConfigWidget( const QString& name,
26 QWidget* parent, 26 QWidget* parent,
27 const char* na ) 27 const char* na )
28 : ProfileDialogConnectionWidget( name, parent, na ) { 28 : ProfileDialogConnectionWidget( name, parent, na ) {
29 29
30 m_lay = new QVBoxLayout( this ); 30 m_lay = new QVBoxLayout( this );
31 31
32 m_device = new QLabel( tr( "Device" ), this ); 32 m_device = new QLabel( tr( "Device" ), this );
33 QHBox *deviceBox = new QHBox( this ); 33 QHBox *deviceBox = new QHBox( this );
34 m_devRadio = new QRadioButton( deviceBox ); 34 m_devRadio = new QRadioButton( deviceBox );
35 connect( m_devRadio, SIGNAL( toggled( bool ) ), this, SLOT( slotDevRadio( bool ) ) ); 35 connect( m_devRadio, SIGNAL( toggled(bool) ), this, SLOT( slotDevRadio(bool) ) );
36 m_deviceCmb = new QComboBox( deviceBox ); 36 m_deviceCmb = new QComboBox( deviceBox );
37 m_deviceCmb->setEditable( TRUE ); 37 m_deviceCmb->setEditable( TRUE );
38 38
39 QLabel *macLabel = new QLabel( this ); 39 QLabel *macLabel = new QLabel( this );
40 macLabel->setText( tr( "Or peer mac address" ) ); 40 macLabel->setText( tr( "Or peer mac address" ) );
41 QHBox *macBox = new QHBox( this ); 41 QHBox *macBox = new QHBox( this );
42 m_macRadio = new QRadioButton( macBox ); 42 m_macRadio = new QRadioButton( macBox );
43 connect( m_macRadio, SIGNAL( toggled( bool ) ), this, SLOT( slotMacRadio( bool ) ) ); 43 connect( m_macRadio, SIGNAL( toggled(bool) ), this, SLOT( slotMacRadio(bool) ) );
44 m_mac = new QLineEdit( macBox ); 44 m_mac = new QLineEdit( macBox );
45 45
46 m_base = new IOLayerBase(this, "base"); 46 m_base = new IOLayerBase(this, "base");
47 47
48 m_lay->addWidget( m_device ); 48 m_lay->addWidget( m_device );
49 m_lay->addWidget( deviceBox ); 49 m_lay->addWidget( deviceBox );
50 m_lay->addWidget( macLabel ); 50 m_lay->addWidget( macLabel );
51 m_lay->addWidget( macBox ); 51 m_lay->addWidget( macBox );
52 m_lay->addWidget( m_base ); 52 m_lay->addWidget( m_base );
53 53
54 m_deviceCmb->insertItem( "/dev/ttyU0" ); 54 m_deviceCmb->insertItem( "/dev/ttyU0" );
55 m_deviceCmb->insertItem( "/dev/ttyU1" ); 55 m_deviceCmb->insertItem( "/dev/ttyU1" );
56} 56}
57 57
58BTConfigWidget::~BTConfigWidget() { 58BTConfigWidget::~BTConfigWidget() {
59 59
60} 60}
61void BTConfigWidget::load( const Profile& prof ) { 61void BTConfigWidget::load( const Profile& prof ) {
62 int rad_flow = prof.readNumEntry("Flow"); 62 int rad_flow = prof.readNumEntry("Flow");
63 int rad_parity = prof.readNumEntry("Parity"); 63 int rad_parity = prof.readNumEntry("Parity");
64 int speed = prof.readNumEntry("Speed"); 64 int speed = prof.readNumEntry("Speed");
65 QString mac = prof.readEntry("Mac"); 65 QString mac = prof.readEntry("Mac");
66 66
67 if (!mac.isEmpty() ) { 67 if (!mac.isEmpty() ) {
68 m_mac->setText( mac ); 68 m_mac->setText( mac );
69 } else { 69 } else {
70 m_devRadio->setChecked( true ); 70 m_devRadio->setChecked( true );
71 } 71 }
72 72
73 if (rad_flow == 1) { 73 if (rad_flow == 1) {
74 m_base->setFlow( IOLayerBase::Hardware ); 74 m_base->setFlow( IOLayerBase::Hardware );
75 } else if (rad_flow == 2) { 75 } else if (rad_flow == 2) {
76 m_base->setFlow( IOLayerBase::Software ); 76 m_base->setFlow( IOLayerBase::Software );
77 } else if (rad_flow == 0) { 77 } else if (rad_flow == 0) {
78 m_base->setFlow( IOLayerBase::None ); 78 m_base->setFlow( IOLayerBase::None );
79 } 79 }
80 80
81 if (rad_parity == 1) { 81 if (rad_parity == 1) {
82 m_base->setParity( IOLayerBase::Even ); 82 m_base->setParity( IOLayerBase::Even );
83 } else if ( rad_parity == 2 ) { 83 } else if ( rad_parity == 2 ) {
84 m_base->setParity( IOLayerBase::Odd ); 84 m_base->setParity( IOLayerBase::Odd );
85 } else { 85 } else {
86 m_base->setParity( IOLayerBase::NonePar ); 86 m_base->setParity( IOLayerBase::NonePar );
87 } 87 }
88 88
89 switch( speed ) { 89 switch( speed ) {
90 case 115200: 90 case 115200:
91 m_base->setSpeed(IOLayerBase::Baud_115200 ); 91 m_base->setSpeed(IOLayerBase::Baud_115200 );
92 break; 92 break;
93 case 57600: 93 case 57600:
94 m_base->setSpeed( IOLayerBase::Baud_57600 ); 94 m_base->setSpeed( IOLayerBase::Baud_57600 );
95 break; 95 break;
96 case 38400: 96 case 38400:
97 m_base->setSpeed(IOLayerBase::Baud_38400 ); 97 m_base->setSpeed(IOLayerBase::Baud_38400 );
98 break; 98 break;
99 case 19200: 99 case 19200:
100 m_base->setSpeed( IOLayerBase::Baud_19200 ); 100 m_base->setSpeed( IOLayerBase::Baud_19200 );
101 break; 101 break;
102 case 9600: 102 case 9600:
103 default: 103 default:
104 m_base->setSpeed(IOLayerBase::Baud_9600 ); 104 m_base->setSpeed(IOLayerBase::Baud_9600 );
105 break; 105 break;
106 } 106 }
107 107
diff --git a/noncore/apps/opie-console/dialdialog.cpp b/noncore/apps/opie-console/dialdialog.cpp
index 6bc1240..526d55e 100644
--- a/noncore/apps/opie-console/dialdialog.cpp
+++ b/noncore/apps/opie-console/dialdialog.cpp
@@ -1,98 +1,98 @@
1 1
2 2
3#include <qlayout.h> 3#include <qlayout.h>
4#include <qlabel.h> 4#include <qlabel.h>
5#include <qpushbutton.h> 5#include <qpushbutton.h>
6#include <qbuttongroup.h> 6#include <qbuttongroup.h>
7 7
8#include "dialdialog.h" 8#include "dialdialog.h"
9 9
10 10
11 11
12DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 12DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
13 : QDialog( parent, name, modal, fl ) { 13 : QDialog( parent, name, modal, fl ) {
14 14
15 setCaption( tr( "Enter number" ) ); 15 setCaption( tr( "Enter number" ) );
16 16
17 QVBoxLayout *mainLayout = new QVBoxLayout( this ); 17 QVBoxLayout *mainLayout = new QVBoxLayout( this );
18 18
19 QLabel *textLabel = new QLabel( this ); 19 QLabel *textLabel = new QLabel( this );
20 textLabel->setTextFormat( QLabel::RichText ); 20 textLabel->setTextFormat( QLabel::RichText );
21 textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") ); 21 textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") );
22 22
23 m_dialLine = new QLineEdit( this ); 23 m_dialLine = new QLineEdit( this );
24 m_dialLine->setReadOnly( true ); 24 m_dialLine->setReadOnly( true );
25 m_dialLine->setFrame( false ); 25 m_dialLine->setFrame( false );
26 m_dialLine->setAlignment( Qt::AlignLeft ); 26 m_dialLine->setAlignment( Qt::AlignLeft );
27 QFont dialLine_font( m_dialLine->font() ); 27 QFont dialLine_font( m_dialLine->font() );
28 dialLine_font.setBold( TRUE ); 28 dialLine_font.setBold( TRUE );
29 dialLine_font.setPointSize( 18 ); 29 dialLine_font.setPointSize( 18 );
30 m_dialLine->setFont( dialLine_font ); 30 m_dialLine->setFont( dialLine_font );
31 31
32 QWidget* dialWidget = new QWidget( this ); 32 QWidget* dialWidget = new QWidget( this );
33 QGridLayout *layout = new QGridLayout( dialWidget , 4, 3 ); 33 QGridLayout *layout = new QGridLayout( dialWidget , 4, 3 );
34 34
35 QButtonGroup *dialButtons = new QButtonGroup( ); 35 QButtonGroup *dialButtons = new QButtonGroup( );
36 36
37 QPushButton *number0 = new QPushButton( dialWidget ); 37 QPushButton *number0 = new QPushButton( dialWidget );
38 number0->setText( QString( "0" ) ); 38 number0->setText( QString( "0" ) );
39 QFont number0_font( number0->font() ); 39 QFont number0_font( number0->font() );
40 number0_font.setBold( TRUE ); 40 number0_font.setBold( TRUE );
41 number0->setFont( number0_font ); 41 number0->setFont( number0_font );
42 layout->addWidget( number0, 4, 1 ); 42 layout->addWidget( number0, 4, 1 );
43 dialButtons->insert( number0 ); 43 dialButtons->insert( number0 );
44 44
45 int x = 0, y = 0; 45 int x = 0, y = 0;
46 for ( int i = 0 ; i < 9; i++ ) { 46 for ( int i = 0 ; i < 9; i++ ) {
47 QPushButton *number = new QPushButton( dialWidget ); 47 QPushButton *number = new QPushButton( dialWidget );
48 number->setText( QString( "%1" ).arg( i + 1 ) ); 48 number->setText( QString( "%1" ).arg( i + 1 ) );
49 QFont number_font( number->font() ); 49 QFont number_font( number->font() );
50 number_font.setBold( TRUE ); 50 number_font.setBold( TRUE );
51 number->setFont( number_font ); 51 number->setFont( number_font );
52 52
53 dialButtons->insert( number ); 53 dialButtons->insert( number );
54 54
55 layout->addWidget( number, x, y ); 55 layout->addWidget( number, x, y );
56 56
57 if ( y < 2 ) { 57 if ( y < 2 ) {
58 y++; 58 y++;
59 } else { 59 } else {
60 x++; 60 x++;
61 y = 0; 61 y = 0;
62 } 62 }
63 } 63 }
64 64
65 connect( dialButtons, SIGNAL( clicked( int ) ), this, SLOT( slotEnterNumber( int ) ) ); 65 connect( dialButtons, SIGNAL( clicked(int) ), this, SLOT( slotEnterNumber(int) ) );
66 66
67 mainLayout->addStretch( 2 ); 67 mainLayout->addStretch( 2 );
68 mainLayout->addWidget( textLabel ); 68 mainLayout->addWidget( textLabel );
69 mainLayout->addStretch( 1 ); 69 mainLayout->addStretch( 1 );
70 mainLayout->addWidget( m_dialLine ); 70 mainLayout->addWidget( m_dialLine );
71 mainLayout->addStretch( 2 ); 71 mainLayout->addStretch( 2 );
72 mainLayout->addWidget( dialWidget ); 72 mainLayout->addWidget( dialWidget );
73 mainLayout->addStretch( 4 ); 73 mainLayout->addStretch( 4 );
74} 74}
75 75
76 76
77void DialDialog::slotEnterNumber( int number ) { 77void DialDialog::slotEnterNumber( int number ) {
78 78
79 // pretty stupid, just for testing .-) 79 // pretty stupid, just for testing .-)
80 80
81 m_number.append(QString("%1").arg(number)); 81 m_number.append(QString("%1").arg(number));
82 82
83 setNumber(m_number); 83 setNumber(m_number);
84} 84}
85 85
86DialDialog::~DialDialog() { 86DialDialog::~DialDialog() {
87} 87}
88 88
89QString DialDialog::number() { 89QString DialDialog::number() {
90 return m_number; 90 return m_number;
91 91
92} 92}
93 93
94void DialDialog::setNumber( QString number ) 94void DialDialog::setNumber( QString number )
95{ 95{
96 m_dialLine->setText( QString("%1").arg( number ) ); 96 m_dialLine->setText( QString("%1").arg( number ) );
97} 97}
98 98
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp
index 2c1d888..99d069f 100644
--- a/noncore/apps/opie-console/emulation_handler.cpp
+++ b/noncore/apps/opie-console/emulation_handler.cpp
@@ -1,87 +1,87 @@
1 1
2#include "TEmuVt102.h" 2#include "TEmuVt102.h"
3 3
4#include "profile.h" 4#include "profile.h"
5#include "emulation_handler.h" 5#include "emulation_handler.h"
6#include "script.h" 6#include "script.h"
7 7
8EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) 8EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name )
9 : QObject(0, name ) 9 : QObject(0, name )
10{ 10{
11 m_teWid = new TEWidget( parent, "TerminalMain"); 11 m_teWid = new TEWidget( parent, "TerminalMain");
12 // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) 12 // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar)
13 // use setWrapAt(80) for normal console with scrollbar 13 // use setWrapAt(80) for normal console with scrollbar
14 setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80); 14 setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80);
15 m_teWid->setMinimumSize(150, 70 ); 15 m_teWid->setMinimumSize(150, 70 );
16 m_script = 0; 16 m_script = 0;
17 parent->resize( m_teWid->calcSize(80, 24 ) ); 17 parent->resize( m_teWid->calcSize(80, 24 ) );
18 m_teEmu = new TEmuVt102(m_teWid ); 18 m_teEmu = new TEmuVt102(m_teWid );
19 19
20 connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ), 20 connect(m_teEmu,SIGNAL(ImageSizeChanged(int,int) ),
21 this, SIGNAL(changeSize(int, int) ) ); 21 this, SIGNAL(changeSize(int,int) ) );
22 connect(m_teEmu, SIGNAL(sndBlock(const char*, int) ), 22 connect(m_teEmu, SIGNAL(sndBlock(const char*,int) ),
23 this, SLOT(recvEmulation(const char*, int) ) ); 23 this, SLOT(recvEmulation(const char*,int) ) );
24 m_teEmu->setConnect( true ); 24 m_teEmu->setConnect( true );
25 m_teEmu->setHistory( TRUE ); 25 m_teEmu->setHistory( TRUE );
26 load( prof ); 26 load( prof );
27 27
28 28
29 29
30} 30}
31TEmulation* EmulationHandler::emulation() { 31TEmulation* EmulationHandler::emulation() {
32 return m_teEmu; 32 return m_teEmu;
33} 33}
34EmulationHandler::~EmulationHandler() { 34EmulationHandler::~EmulationHandler() {
35 if (isRecording()) 35 if (isRecording())
36 clearScript(); 36 clearScript();
37 delete m_teEmu; 37 delete m_teEmu;
38 delete m_teWid; 38 delete m_teWid;
39} 39}
40 40
41void EmulationHandler::load( const Profile& prof) { 41void EmulationHandler::load( const Profile& prof) {
42 m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); 42 m_teWid->setVTFont( font( prof.readNumEntry("Font") ) );
43 int num = prof.readNumEntry("Color"); 43 int num = prof.readNumEntry("Color");
44 setColor( foreColor(num), backColor(num) ); 44 setColor( foreColor(num), backColor(num) );
45 m_teWid->setBackgroundColor(backColor(num) ); 45 m_teWid->setBackgroundColor(backColor(num) );
46 46
47 int term = prof.readNumEntry("Terminal", 0) ; 47 int term = prof.readNumEntry("Terminal", 0) ;
48 switch(term) { 48 switch(term) {
49 default: 49 default:
50 case Profile::VT102: 50 case Profile::VT102:
51 case Profile::VT100: 51 case Profile::VT100:
52 m_teEmu->setKeytrans("vt100.keytab"); 52 m_teEmu->setKeytrans("vt100.keytab");
53 break; 53 break;
54 case Profile::Linux: 54 case Profile::Linux:
55 m_teEmu->setKeytrans("linux.keytab"); 55 m_teEmu->setKeytrans("linux.keytab");
56 break; 56 break;
57 case Profile::XTerm: 57 case Profile::XTerm:
58 m_teEmu->setKeytrans("default.Keytab"); 58 m_teEmu->setKeytrans("default.Keytab");
59 break; 59 break;
60 } 60 }
61} 61}
62void EmulationHandler::recv( const QByteArray& ar) { 62void EmulationHandler::recv( const QByteArray& ar) {
63 m_teEmu->onRcvBlock(ar.data(), ar.count() ); 63 m_teEmu->onRcvBlock(ar.data(), ar.count() );
64} 64}
65void EmulationHandler::recvEmulation(const char* src, int len ) { 65void EmulationHandler::recvEmulation(const char* src, int len ) {
66 QByteArray ar(len); 66 QByteArray ar(len);
67 67
68 memcpy(ar.data(), src, sizeof(char) * len ); 68 memcpy(ar.data(), src, sizeof(char) * len );
69 if (isRecording()) 69 if (isRecording())
70 m_script->append(ar); 70 m_script->append(ar);
71 emit send(ar); 71 emit send(ar);
72} 72}
73QWidget* EmulationHandler::widget() { 73QWidget* EmulationHandler::widget() {
74 return m_teWid; 74 return m_teWid;
75} 75}
76/* 76/*
77 * allocate a new table of colors 77 * allocate a new table of colors
78 */ 78 */
79void EmulationHandler::setColor( const QColor& fore, const QColor& back ) { 79void EmulationHandler::setColor( const QColor& fore, const QColor& back ) {
80 ColorEntry table[TABLE_COLORS]; 80 ColorEntry table[TABLE_COLORS];
81 const ColorEntry *defaultCt = m_teWid->getdefaultColorTable(); 81 const ColorEntry *defaultCt = m_teWid->getdefaultColorTable();
82 82
83 for (int i = 0; i < TABLE_COLORS; i++ ) { 83 for (int i = 0; i < TABLE_COLORS; i++ ) {
84 if ( i == 0 || i == 10 ) { 84 if ( i == 0 || i == 10 ) {
85 table[i].color = fore; 85 table[i].color = fore;
86 }else if ( i == 1 || i == 11 ) { 86 }else if ( i == 1 || i == 11 ) {
87 table[i].color = back; 87 table[i].color = back;
diff --git a/noncore/apps/opie-console/emulation_layer.cpp b/noncore/apps/opie-console/emulation_layer.cpp
index 2bef801..fd30ad7 100644
--- a/noncore/apps/opie-console/emulation_layer.cpp
+++ b/noncore/apps/opie-console/emulation_layer.cpp
@@ -45,140 +45,140 @@
45 45
46 First, experiments show that directly displaying the operation results 46 First, experiments show that directly displaying the operation results
47 in slowing down the overall performance of emulations. Displaying 47 in slowing down the overall performance of emulations. Displaying
48 individual characters using X11 creates a lot of overhead. 48 individual characters using X11 creates a lot of overhead.
49 49
50 Second, by using the following refreshing method, the screen operations 50 Second, by using the following refreshing method, the screen operations
51 can be completely separated from the displaying. This greatly simplifies 51 can be completely separated from the displaying. This greatly simplifies
52 the programmer's task of coding and maintaining the screen operations, 52 the programmer's task of coding and maintaining the screen operations,
53 since one need not worry about differential modifications on the 53 since one need not worry about differential modifications on the
54 display affecting the operation of concern. 54 display affecting the operation of concern.
55 55
56 We use a refreshing algorithm here that has been adoped from rxvt/kvt. 56 We use a refreshing algorithm here that has been adoped from rxvt/kvt.
57 57
58 By this, refreshing is driven by a timer, which is (re)started whenever 58 By this, refreshing is driven by a timer, which is (re)started whenever
59 a new bunch of data to be interpreted by the emulation arives at `onRcvBlock'. 59 a new bunch of data to be interpreted by the emulation arives at `onRcvBlock'.
60 As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger 60 As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger
61 refresh. This rule suits both bulk display operation as done by curses as 61 refresh. This rule suits both bulk display operation as done by curses as
62 well as individual characters typed. 62 well as individual characters typed.
63 (BULK_TIMEOUT < 1000 / max characters received from keyboard per second). 63 (BULK_TIMEOUT < 1000 / max characters received from keyboard per second).
64 64
65 Additionally, we trigger refreshing by newlines comming in to make visual 65 Additionally, we trigger refreshing by newlines comming in to make visual
66 snapshots of lists as produced by `cat', `ls' and likely programs, thereby 66 snapshots of lists as produced by `cat', `ls' and likely programs, thereby
67 producing the illusion of a permanent and immediate display operation. 67 producing the illusion of a permanent and immediate display operation.
68 68
69 As a sort of catch-all needed for cases where none of the above 69 As a sort of catch-all needed for cases where none of the above
70 conditions catch, the screen refresh is also triggered by a count 70 conditions catch, the screen refresh is also triggered by a count
71 of incoming bulks (`bulk_incnt'). 71 of incoming bulks (`bulk_incnt').
72*/ 72*/
73 73
74/* FIXME 74/* FIXME
75 - evtl. the bulk operations could be made more transparent. 75 - evtl. the bulk operations could be made more transparent.
76*/ 76*/
77 77
78#include "emulation_layer.h" 78#include "emulation_layer.h"
79#include <stdio.h> 79#include <stdio.h>
80#include <stdlib.h> 80#include <stdlib.h>
81#include <unistd.h> 81#include <unistd.h>
82 82
83 83
84/* ------------------------------------------------------------------------- */ 84/* ------------------------------------------------------------------------- */
85/* */ 85/* */
86/* EmulationLayer */ 86/* EmulationLayer */
87/* */ 87/* */
88/* ------------------------------------------------------------------------- */ 88/* ------------------------------------------------------------------------- */
89 89
90#define CNTL(c) ((c)-'@') 90#define CNTL(c) ((c)-'@')
91 91
92/*! 92/*!
93*/ 93*/
94 94
95EmulationLayer::EmulationLayer( WidgetLayer* gui ) 95EmulationLayer::EmulationLayer( WidgetLayer* gui )
96: decoder((QTextDecoder*)NULL) 96: decoder((QTextDecoder*)NULL)
97{ 97{
98 this->gui = gui; 98 this->gui = gui;
99 99
100 screen[0] = new Screen(gui->lines(),gui->columns()); 100 screen[0] = new Screen(gui->lines(),gui->columns());
101 screen[1] = new Screen(gui->lines(),gui->columns()); 101 screen[1] = new Screen(gui->lines(),gui->columns());
102 scr = screen[0]; 102 scr = screen[0];
103 103
104 bulk_nlcnt = 0; // reset bulk newline counter 104 bulk_nlcnt = 0; // reset bulk newline counter
105 bulk_incnt = 0; // reset bulk counter 105 bulk_incnt = 0; // reset bulk counter
106 connected = FALSE; 106 connected = FALSE;
107 107
108 QObject::connect(&bulk_timer, SIGNAL( timeout() ), this, SLOT( showBulk() ) ); 108 QObject::connect(&bulk_timer, SIGNAL( timeout() ), this, SLOT( showBulk() ) );
109 QObject::connect(gui,SIGNAL( imageSizeChanged( int, int ) ), 109 QObject::connect(gui,SIGNAL( imageSizeChanged(int,int) ),
110 this,SLOT( onImageSizeChange( int, int ) ) ); 110 this,SLOT( onImageSizeChange(int,int) ) );
111 QObject::connect(gui,SIGNAL( changedHistoryCursor( int ) ), 111 QObject::connect(gui,SIGNAL( changedHistoryCursor(int) ),
112 this,SLOT( historyCursorChange( int ) ) ); 112 this,SLOT( historyCursorChange(int) ) );
113 QObject::connect(gui,SIGNAL( keyPressed( QKeyEvent* ) ), 113 QObject::connect(gui,SIGNAL( keyPressed(QKeyEvent*) ),
114 this,SLOT( onKeyPress( QKeyEvent* ) ) ); 114 this,SLOT( onKeyPress(QKeyEvent*) ) );
115 QObject::connect(gui,SIGNAL( selectionBegin( const int, const int) ), 115 QObject::connect(gui,SIGNAL( selectionBegin(const int,const int) ),
116 this,SLOT( onSelectionBegin( const int, const int ) ) ); 116 this,SLOT( onSelectionBegin(const int,const int) ) );
117 QObject::connect(gui,SIGNAL( selectionExtended( const int, const int ) ), 117 QObject::connect(gui,SIGNAL( selectionExtended(const int,const int) ),
118 this,SLOT( onSelectionExtend( const int,const int ) ) ); 118 this,SLOT( onSelectionExtend(const int,const int) ) );
119 QObject::connect(gui,SIGNAL( selectionEnd( const bool ) ), 119 QObject::connect(gui,SIGNAL( selectionEnd(const bool) ),
120 this,SLOT( setSelection( const bool ) ) ); 120 this,SLOT( setSelection(const bool) ) );
121 QObject::connect(gui,SIGNAL( selectionCleared() ), 121 QObject::connect(gui,SIGNAL( selectionCleared() ),
122 this,SLOT( clearSelection() ) ); 122 this,SLOT( clearSelection() ) );
123} 123}
124 124
125/*! 125/*!
126*/ 126*/
127 127
128EmulationLayer::~EmulationLayer() 128EmulationLayer::~EmulationLayer()
129{ 129{
130 delete screen[0]; 130 delete screen[0];
131 delete screen[1]; 131 delete screen[1];
132 bulk_timer.stop(); 132 bulk_timer.stop();
133} 133}
134 134
135/*! change between primary and alternate screen 135/*! change between primary and alternate screen
136*/ 136*/
137 137
138void EmulationLayer::setScreen(int n) 138void EmulationLayer::setScreen(int n)
139{ 139{
140 scr = screen[n&1]; 140 scr = screen[n&1];
141} 141}
142 142
143void EmulationLayer::setHistory(bool on) 143void EmulationLayer::setHistory(bool on)
144{ 144{
145 screen[0]->setScroll(on); 145 screen[0]->setScroll(on);
146 if (!connected) return; 146 if (!connected) return;
147 showBulk(); 147 showBulk();
148} 148}
149 149
150bool EmulationLayer::history() 150bool EmulationLayer::history()
151{ 151{
152 return screen[0]->hasScroll(); 152 return screen[0]->hasScroll();
153} 153}
154 154
155void EmulationLayer::setCodec(int c) 155void EmulationLayer::setCodec(int c)
156{ 156{
157 //FIXME: check whether we have to free codec 157 //FIXME: check whether we have to free codec
158 codec = c ? QTextCodec::codecForName("utf8") 158 codec = c ? QTextCodec::codecForName("utf8")
159 : QTextCodec::codecForLocale(); 159 : QTextCodec::codecForLocale();
160 if (decoder) delete decoder; 160 if (decoder) delete decoder;
161 decoder = codec->makeDecoder(); 161 decoder = codec->makeDecoder();
162} 162}
163 163
164void EmulationLayer::setKeytrans(int no) 164void EmulationLayer::setKeytrans(int no)
165{ 165{
166 keytrans = KeyTrans::find(no); 166 keytrans = KeyTrans::find(no);
167} 167}
168 168
169void EmulationLayer::setKeytrans(const char * no) 169void EmulationLayer::setKeytrans(const char * no)
170{ 170{
171 keytrans = KeyTrans::find(no); 171 keytrans = KeyTrans::find(no);
172} 172}
173 173
174// Interpreting Codes --------------------------------------------------------- 174// Interpreting Codes ---------------------------------------------------------
175 175
176/* 176/*
177 This section deals with decoding the incoming character stream. 177 This section deals with decoding the incoming character stream.
178 Decoding means here, that the stream is first seperated into `tokens' 178 Decoding means here, that the stream is first seperated into `tokens'
179 which are then mapped to a `meaning' provided as operations by the 179 which are then mapped to a `meaning' provided as operations by the
180 `Screen' class. 180 `Screen' class.
181*/ 181*/
182 182
183/*! 183/*!
184*/ 184*/
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp
index c232d89..eb32551 100644
--- a/noncore/apps/opie-console/function_keyboard.cpp
+++ b/noncore/apps/opie-console/function_keyboard.cpp
@@ -199,167 +199,167 @@ void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) {
199 emit keyPressed(k, row, col, 0); 199 emit keyPressed(k, row, col, 0);
200 } 200 }
201 201
202} 202}
203 203
204 204
205void FunctionKeyboard::resizeEvent(QResizeEvent*) { 205void FunctionKeyboard::resizeEvent(QResizeEvent*) {
206 206
207 /* set he default font height/width */ 207 /* set he default font height/width */
208 QFontMetrics fm=fontMetrics(); 208 QFontMetrics fm=fontMetrics();
209 keyHeight = fm.lineSpacing() + 2; 209 keyHeight = fm.lineSpacing() + 2;
210 keyWidth = (double)width()/numCols; 210 keyWidth = (double)width()/numCols;
211 211
212} 212}
213 213
214QSize FunctionKeyboard::sizeHint() const { 214QSize FunctionKeyboard::sizeHint() const {
215 215
216 return QSize(width(), keyHeight * numRows + 1); 216 return QSize(width(), keyHeight * numRows + 1);
217} 217}
218 218
219void FunctionKeyboard::loadDefaults() { 219void FunctionKeyboard::loadDefaults() {
220 220
221 numRows = DEFAULT_ROWS; 221 numRows = DEFAULT_ROWS;
222 numCols = DEFAULT_COLS; 222 numCols = DEFAULT_COLS;
223 keyWidth = (double)width()/numCols; // have to reset this thing too 223 keyWidth = (double)width()/numCols; // have to reset this thing too
224 224
225 keys.insert( "r0c0", FKey ("Enter", "enter", Qt::Key_Enter, 0)); 225 keys.insert( "r0c0", FKey ("Enter", "enter", Qt::Key_Enter, 0));
226 keys.insert( "r0c1", FKey ("Space", "space", Qt::Key_Space, Qt::Key_Space)); 226 keys.insert( "r0c1", FKey ("Space", "space", Qt::Key_Space, Qt::Key_Space));
227 keys.insert( "r0c2", FKey ("Tab", "tab", Qt::Key_Tab, 0)); 227 keys.insert( "r0c2", FKey ("Tab", "tab", Qt::Key_Tab, 0));
228 keys.insert( "r0c3", FKey ("Up", "up", Qt::Key_Up, 0)); 228 keys.insert( "r0c3", FKey ("Up", "up", Qt::Key_Up, 0));
229 keys.insert( "r0c4", FKey ("Down", "down", Qt::Key_Down, 0)); 229 keys.insert( "r0c4", FKey ("Down", "down", Qt::Key_Down, 0));
230 230
231 keys.insert( "r0c7", FKey ("Ho", 0, 4112, 0)); 231 keys.insert( "r0c7", FKey ("Ho", 0, 4112, 0));
232 keys.insert( "r0c8", FKey ("End", 0, 4113, 0)); 232 keys.insert( "r0c8", FKey ("End", 0, 4113, 0));
233 keys.insert( "r0c9", FKey ("Pu", 0, 4118, 0)); 233 keys.insert( "r0c9", FKey ("Pu", 0, 4118, 0));
234 keys.insert( "r0c10", FKey ("Pd", 0, 4119, 0)); 234 keys.insert( "r0c10", FKey ("Pd", 0, 4119, 0));
235 keys.insert( "r0c11", FKey ("Esc", 0, Qt::Key_Escape, 0xfff)); 235 keys.insert( "r0c11", FKey ("Esc", 0, Qt::Key_Escape, 0xfff));
236 236
237 keys.insert( "r1c0", FKey ("F1", 0, 4144, 0)); 237 keys.insert( "r1c0", FKey ("F1", 0, 4144, 0));
238 keys.insert( "r1c1", FKey ("F2", 0, 4145, 0)); 238 keys.insert( "r1c1", FKey ("F2", 0, 4145, 0));
239 keys.insert( "r1c2", FKey ("F3", 0, 4146, 0)); 239 keys.insert( "r1c2", FKey ("F3", 0, 4146, 0));
240 keys.insert( "r1c3", FKey ("F4", 0, 4147, 0)); 240 keys.insert( "r1c3", FKey ("F4", 0, 4147, 0));
241 keys.insert( "r1c4", FKey ("F5", 0, 4148, 0)); 241 keys.insert( "r1c4", FKey ("F5", 0, 4148, 0));
242 keys.insert( "r1c5", FKey ("F6", 0, 4149, 0)); 242 keys.insert( "r1c5", FKey ("F6", 0, 4149, 0));
243 keys.insert( "r1c6", FKey ("F7", 0, 4150, 0)); 243 keys.insert( "r1c6", FKey ("F7", 0, 4150, 0));
244 keys.insert( "r1c7", FKey ("F8", 0, 4151, 0)); 244 keys.insert( "r1c7", FKey ("F8", 0, 4151, 0));
245 keys.insert( "r1c8", FKey ("F9", 0, 4152, 0)); 245 keys.insert( "r1c8", FKey ("F9", 0, 4152, 0));
246 keys.insert( "r1c9", FKey ("F10", 0, 4153, 0)); 246 keys.insert( "r1c9", FKey ("F10", 0, 4153, 0));
247 keys.insert( "r1c10", FKey ("F11", 0, 4154, 0)); 247 keys.insert( "r1c10", FKey ("F11", 0, 4154, 0));
248 keys.insert( "r1c11", FKey ("F12", 0, 4155, 0)); 248 keys.insert( "r1c11", FKey ("F12", 0, 4155, 0));
249 249
250 250
251} 251}
252 252
253/* FunctionKeyboardConfig {{{1 */ 253/* FunctionKeyboardConfig {{{1 */
254 254
255FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na ) 255FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na )
256 : ProfileDialogKeyWidget(name, parent, na), 256 : ProfileDialogKeyWidget(name, parent, na),
257 selectedRow(0), selectedCol(0) 257 selectedRow(0), selectedCol(0)
258{ 258{
259 qWarning("FunctionKeyboardConfig"); 259 qWarning("FunctionKeyboardConfig");
260 260
261 261
262 kb = new FunctionKeyboard(this); 262 kb = new FunctionKeyboard(this);
263 connect (kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), 263 connect (kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)),
264 this, SLOT(slotKeyPressed(FKey, ushort, ushort, bool))); 264 this, SLOT(slotKeyPressed(FKey,ushort,ushort,bool)));
265 265
266 QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimensions"), this); 266 QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimensions"), this);
267 QLabel *l = new QLabel("Rows", dimentions); 267 QLabel *l = new QLabel("Rows", dimentions);
268 m_rowBox = new QSpinBox(1, 15, 1, dimentions); 268 m_rowBox = new QSpinBox(1, 15, 1, dimentions);
269 connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int))); 269 connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int)));
270 l = new QLabel("Columns", dimentions); 270 l = new QLabel("Columns", dimentions);
271 m_colBox = new QSpinBox(1, 15, 1, dimentions); 271 m_colBox = new QSpinBox(1, 15, 1, dimentions);
272 connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int))); 272 connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int)));
273 273
274 QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this); 274 QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this);
275 l = new QLabel("Label", editKey); 275 l = new QLabel("Label", editKey);
276 m_labels = new QComboBox(true, editKey); 276 m_labels = new QComboBox(true, editKey);
277 m_labels->setInsertionPolicy(QComboBox::AtCurrent); 277 m_labels->setInsertionPolicy(QComboBox::AtCurrent);
278 m_labels->insertItem(""); 278 m_labels->insertItem("");
279 279
280 QStringList files = QDir( QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList(); 280 QStringList files = QDir( QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList();
281 281
282 for (uint i = 0; i < files.count(); i++) { 282 for (uint i = 0; i < files.count(); i++) {
283 283
284 m_labels->insertItem( Resource::loadPixmap("console/keys/" + files[i]), files[i]); 284 m_labels->insertItem( Resource::loadPixmap("console/keys/" + files[i]), files[i]);
285 } 285 }
286 connect (m_labels, SIGNAL(activated(int)), this, SLOT(slotChangeIcon(int))); 286 connect (m_labels, SIGNAL(activated(int)), this, SLOT(slotChangeIcon(int)));
287 connect (m_labels, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeLabelText(const QString&))); 287 connect (m_labels, SIGNAL(textChanged(const QString&)), this, SLOT(slotChangeLabelText(const QString&)));
288 288
289 l = new QLabel("Q Keycode", editKey); 289 l = new QLabel("Q Keycode", editKey);
290 m_qvalues = new QComboBox(true, editKey); 290 m_qvalues = new QComboBox(true, editKey);
291 m_qvalues->setInsertionPolicy(QComboBox::AtTop); 291 m_qvalues->setInsertionPolicy(QComboBox::AtTop);
292 m_qvalues->setDuplicatesEnabled(false); 292 m_qvalues->setDuplicatesEnabled(false);
293 m_qvalues->insertItem(""); 293 m_qvalues->insertItem("");
294 connect (m_qvalues, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeQCode(const QString&))); 294 connect (m_qvalues, SIGNAL(textChanged(const QString&)), this, SLOT(slotChangeQCode(const QString&)));
295 295
296 l = new QLabel("Unicode Value", editKey); 296 l = new QLabel("Unicode Value", editKey);
297 m_uniValues = new QComboBox(true, editKey); 297 m_uniValues = new QComboBox(true, editKey);
298 m_uniValues->setInsertionPolicy(QComboBox::AtTop); 298 m_uniValues->setInsertionPolicy(QComboBox::AtTop);
299 m_uniValues->setDuplicatesEnabled(false); 299 m_uniValues->setDuplicatesEnabled(false);
300 m_uniValues->insertItem(""); 300 m_uniValues->insertItem("");
301 connect (m_uniValues, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeUnicode(const QString&))); 301 connect (m_uniValues, SIGNAL(textChanged(const QString&)), this, SLOT(slotChangeUnicode(const QString&)));
302 302
303 QVBoxLayout *root = new QVBoxLayout(this, 2); 303 QVBoxLayout *root = new QVBoxLayout(this, 2);
304 root->addWidget(kb); 304 root->addWidget(kb);
305 root->addWidget(dimentions); 305 root->addWidget(dimentions);
306 root->addWidget(editKey); 306 root->addWidget(editKey);
307} 307}
308FunctionKeyboardConfig::~FunctionKeyboardConfig() { 308FunctionKeyboardConfig::~FunctionKeyboardConfig() {
309 309
310} 310}
311void FunctionKeyboardConfig::load (const Profile& prof) { 311void FunctionKeyboardConfig::load (const Profile& prof) {
312 312
313 kb->keys.clear(); 313 kb->keys.clear();
314 kb->loadDefaults(); 314 kb->loadDefaults();
315 315
316 m_rowBox->setValue(prof.readNumEntry("keb_rows", 2)); 316 m_rowBox->setValue(prof.readNumEntry("keb_rows", 2));
317 m_colBox->setValue(prof.readNumEntry("keb_cols", 10)); 317 m_colBox->setValue(prof.readNumEntry("keb_cols", 10));
318 318
319 /* load all the keys to the keyboard */ 319 /* load all the keys to the keyboard */
320 for (int i = 0; i <= m_rowBox->value() -1; i++) 320 for (int i = 0; i <= m_rowBox->value() -1; i++)
321 for (int j = 0; j <= m_colBox->value() -1; j++) { 321 for (int j = 0; j <= m_colBox->value() -1; j++) {
322 322
323 QString h = "r" + QString::number(i) + "c" + QString::number(j); 323 QString h = "r" + QString::number(i) + "c" + QString::number(j);
324 QString values = prof.readEntry("keb_" + h); 324 QString values = prof.readEntry("keb_" + h);
325 325
326 if (!values.isEmpty()) { 326 if (!values.isEmpty()) {
327 327
328 QStringList l = QStringList::split(QChar('|'), values, TRUE); 328 QStringList l = QStringList::split(QChar('|'), values, TRUE);
329 kb->keys[h] = FKey(l[0], l[1], l[2].toInt(), l[3].toInt()); 329 kb->keys[h] = FKey(l[0], l[1], l[2].toInt(), l[3].toInt());
330 330
331 // load pixmap if used 331 // load pixmap if used
332 if (!l[1].isEmpty()) { 332 if (!l[1].isEmpty()) {
333 333
334 kb->keys[h].pix = new QPixmap( Resource::loadPixmap( "console/keys/" + l[1] ) ); 334 kb->keys[h].pix = new QPixmap( Resource::loadPixmap( "console/keys/" + l[1] ) );
335 } 335 }
336 } 336 }
337 } 337 }
338 338
339} 339}
340void FunctionKeyboardConfig::save (Profile& prof) { 340void FunctionKeyboardConfig::save (Profile& prof) {
341 341
342 prof.writeEntry("keb_rows", m_rowBox->value()); 342 prof.writeEntry("keb_rows", m_rowBox->value());
343 prof.writeEntry("keb_cols", m_colBox->value()); 343 prof.writeEntry("keb_cols", m_colBox->value());
344 344
345 QMap<QString, FKey>::Iterator it; 345 QMap<QString, FKey>::Iterator it;
346 for ( it = kb->keys.begin(); it != kb->keys.end(); it++) { 346 for ( it = kb->keys.begin(); it != kb->keys.end(); it++) {
347 347
348 FKey k = it.data(); 348 FKey k = it.data();
349 QString entry = k.label + "|" 349 QString entry = k.label + "|"
350 + k.pixFile + "|" 350 + k.pixFile + "|"
351 + QString::number(k.qcode) + "|" 351 + QString::number(k.qcode) + "|"
352 + QString::number(k.unicode); 352 + QString::number(k.unicode);
353 353
354 prof.writeEntry("keb_" + it.key(), entry); 354 prof.writeEntry("keb_" + it.key(), entry);
355 355
356 } 356 }
357 357
358} 358}
359void FunctionKeyboardConfig::slotChangeRows(int r) { 359void FunctionKeyboardConfig::slotChangeRows(int r) {
360 360
361 kb->changeRows(r); 361 kb->changeRows(r);
362 362
363} 363}
364void FunctionKeyboardConfig::slotChangeCols(int c) { 364void FunctionKeyboardConfig::slotChangeCols(int c) {
365 365
diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp
index 37bf797..1a8c979 100644
--- a/noncore/apps/opie-console/io_bt.cpp
+++ b/noncore/apps/opie-console/io_bt.cpp
@@ -1,92 +1,92 @@
1 1
2#include "io_bt.h" 2#include "io_bt.h"
3 3
4IOBt::IOBt( const Profile &config ) : IOSerial( config ) { 4IOBt::IOBt( const Profile &config ) : IOSerial( config ) {
5 m_attach = 0; 5 m_attach = 0;
6} 6}
7 7
8 8
9IOBt::~IOBt() { 9IOBt::~IOBt() {
10 if ( m_attach ) { 10 if ( m_attach ) {
11 delete m_attach; 11 delete m_attach;
12 } 12 }
13} 13}
14 14
15 15
16void IOBt::close() { 16void IOBt::close() {
17 17
18 IOSerial::close(); 18 IOSerial::close();
19 // still need error handling 19 // still need error handling
20 if ( m_attach ) { 20 if ( m_attach ) {
21 delete m_attach; 21 delete m_attach;
22 m_attach = 0; 22 m_attach = 0;
23 } 23 }
24} 24}
25 25
26bool IOBt::open() { 26bool IOBt::open() {
27 bool ret = false; 27 bool ret = false;
28 28
29 // only set up bt stuff if mac address was set, otherwise use the device set 29 // only set up bt stuff if mac address was set, otherwise use the device set
30 if ( !m_mac.isEmpty() ) { 30 if ( !m_mac.isEmpty() ) {
31 31
32 // now it should also be checked, if there is a connection to the device with that mac allready 32 // now it should also be checked, if there is a connection to the device with that mac allready
33 // hciattach here 33 // hciattach here
34 m_attach = new OProcess(); 34 m_attach = new OProcess();
35 *m_attach << "hciattach /dev/ttyS2 any 57600"; 35 *m_attach << "hciattach /dev/ttyS2 any 57600";
36 36
37 // then start hcid, then rcfomm handling (m_mac) 37 // then start hcid, then rcfomm handling (m_mac)
38 38
39 connect( m_attach, SIGNAL( processExited( OProcess* ) ), 39 connect( m_attach, SIGNAL( processExited(OProcess*) ),
40 this, SLOT( slotExited( OProcess* ) ) ); 40 this, SLOT( slotExited(OProcess*) ) );
41 41
42 if ( m_attach->start() ) { 42 if ( m_attach->start() ) {
43 ret = IOSerial::open(); 43 ret = IOSerial::open();
44 } else { 44 } else {
45 qWarning("could not attach to device"); 45 qWarning("could not attach to device");
46 delete m_attach; 46 delete m_attach;
47 m_attach = 0; 47 m_attach = 0;
48 } 48 }
49 } else { 49 } else {
50 // directly to the normal serial 50 // directly to the normal serial
51 // TODO: look first if the connection really exists. ( is set up ) 51 // TODO: look first if the connection really exists. ( is set up )
52 52
53 ret =IOSerial::open(); 53 ret =IOSerial::open();
54 } 54 }
55 return ret; 55 return ret;
56} 56}
57 57
58void IOBt::reload( const Profile &config ) { 58void IOBt::reload( const Profile &config ) {
59 m_device = config.readEntry("Device", BT_DEFAULT_DEVICE); 59 m_device = config.readEntry("Device", BT_DEFAULT_DEVICE);
60 m_mac = config.readEntry("Mac", BT_DEFAULT_MAC); 60 m_mac = config.readEntry("Mac", BT_DEFAULT_MAC);
61 m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD); 61 m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD);
62 m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY); 62 m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY);
63 m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS); 63 m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS);
64 m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS); 64 m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS);
65 m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW); 65 m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW);
66} 66}
67 67
68 68
69QString IOBt::identifier() const { 69QString IOBt::identifier() const {
70 return "bluetooth"; 70 return "bluetooth";
71} 71}
72 72
73QString IOBt::name() const { 73QString IOBt::name() const {
74 return "BLuetooth IO Layer"; 74 return "BLuetooth IO Layer";
75} 75}
76 76
77void IOBt::slotExited( OProcess* proc ){ 77void IOBt::slotExited( OProcess* proc ){
78 close(); 78 close();
79 delete proc; 79 delete proc;
80} 80}
81 81
82QBitArray IOBt::supports() const { 82QBitArray IOBt::supports() const {
83 return QBitArray( 3 ); 83 return QBitArray( 3 );
84} 84}
85 85
86bool IOBt::isConnected() { 86bool IOBt::isConnected() {
87 return false; 87 return false;
88} 88}
89 89
90void IOBt::send(const QByteArray &data) { 90void IOBt::send(const QByteArray &data) {
91 qDebug( "Please overload me..." ); 91 qDebug( "Please overload me..." );
92} 92}
diff --git a/noncore/apps/opie-console/io_irda.cpp b/noncore/apps/opie-console/io_irda.cpp
index e360fb4..b281b7d 100644
--- a/noncore/apps/opie-console/io_irda.cpp
+++ b/noncore/apps/opie-console/io_irda.cpp
@@ -1,77 +1,77 @@
1 1
2#include "io_irda.h" 2#include "io_irda.h"
3 3
4IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) { 4IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) {
5 m_attach = 0; 5 m_attach = 0;
6} 6}
7 7
8 8
9IOIrda::~IOIrda() { 9IOIrda::~IOIrda() {
10 if ( m_attach ) { 10 if ( m_attach ) {
11 delete m_attach; 11 delete m_attach;
12 } 12 }
13} 13}
14 14
15 15
16void IOIrda::close() { 16void IOIrda::close() {
17 17
18 IOSerial::close(); 18 IOSerial::close();
19 // still need error handling 19 // still need error handling
20 delete m_attach; 20 delete m_attach;
21} 21}
22 22
23bool IOIrda::open() { 23bool IOIrda::open() {
24 bool ret; 24 bool ret;
25 25
26 // irdaattach here 26 // irdaattach here
27 m_attach = new OProcess(); 27 m_attach = new OProcess();
28 *m_attach << "irattach /dev/ttyS2 -s"; 28 *m_attach << "irattach /dev/ttyS2 -s";
29 29
30 connect( m_attach, SIGNAL( processExited( OProcess* ) ), 30 connect( m_attach, SIGNAL( processExited(OProcess*) ),
31 this, SLOT( slotExited( OProcess* ) ) ); 31 this, SLOT( slotExited(OProcess*) ) );
32 32
33 if ( m_attach->start() ) { 33 if ( m_attach->start() ) {
34 ret= IOSerial::open(); 34 ret= IOSerial::open();
35 } else { 35 } else {
36 // emit error!!! 36 // emit error!!!
37 qWarning("could not attach to device"); 37 qWarning("could not attach to device");
38 delete m_attach; 38 delete m_attach;
39 m_attach = 0l; 39 m_attach = 0l;
40 } 40 }
41 return ret; 41 return ret;
42} 42}
43 43
44void IOIrda::reload( const Profile &config ) { 44void IOIrda::reload( const Profile &config ) {
45 m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE); 45 m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE);
46 m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD); 46 m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD);
47 m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY); 47 m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY);
48 m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS); 48 m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS);
49 m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS); 49 m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS);
50 m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW); 50 m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW);
51} 51}
52 52
53 53
54QString IOIrda::identifier() const { 54QString IOIrda::identifier() const {
55 return "irda"; 55 return "irda";
56} 56}
57 57
58QString IOIrda::name() const { 58QString IOIrda::name() const {
59 return "Irda IO Layer"; 59 return "Irda IO Layer";
60} 60}
61 61
62void IOIrda::slotExited(OProcess* proc ){ 62void IOIrda::slotExited(OProcess* proc ){
63 close(); 63 close();
64 delete proc; 64 delete proc;
65} 65}
66 66
67QBitArray IOIrda::supports()const { 67QBitArray IOIrda::supports()const {
68 return QBitArray( 3 ); 68 return QBitArray( 3 );
69} 69}
70 70
71bool IOIrda::isConnected() { 71bool IOIrda::isConnected() {
72 return false; 72 return false;
73} 73}
74 74
75void IOIrda::send(const QByteArray &data) { 75void IOIrda::send(const QByteArray &data) {
76 qDebug( "Please overload me..." ); 76 qDebug( "Please overload me..." );
77} 77}
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 1d2385f..197f799 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -149,168 +149,168 @@ void MainWindow::initUI() {
149 m_console->insertSeparator(); 149 m_console->insertSeparator();
150 150
151 QAction *a = new QAction(); 151 QAction *a = new QAction();
152 a->setText( tr("Save history") ); 152 a->setText( tr("Save history") );
153 a->addTo( m_console ); 153 a->addTo( m_console );
154 connect(a, SIGNAL(activated() ), 154 connect(a, SIGNAL(activated() ),
155 this, SLOT(slotSaveHistory() ) ); 155 this, SLOT(slotSaveHistory() ) );
156 /* 156 /*
157 * terminate action 157 * terminate action
158 */ 158 */
159 m_terminate = new QAction(); 159 m_terminate = new QAction();
160 m_terminate->setText( tr("Terminate") ); 160 m_terminate->setText( tr("Terminate") );
161 m_terminate->addTo( m_console ); 161 m_terminate->addTo( m_console );
162 connect(m_terminate, SIGNAL(activated() ), 162 connect(m_terminate, SIGNAL(activated() ),
163 this, SLOT(slotTerminate() ) ); 163 this, SLOT(slotTerminate() ) );
164 164
165 m_closewindow = new QAction(); 165 m_closewindow = new QAction();
166 m_closewindow->setText( tr("Close Window") ); 166 m_closewindow->setText( tr("Close Window") );
167 m_closewindow->addTo( m_console ); 167 m_closewindow->addTo( m_console );
168 connect( m_closewindow, SIGNAL(activated() ), 168 connect( m_closewindow, SIGNAL(activated() ),
169 this, SLOT(slotClose() ) ); 169 this, SLOT(slotClose() ) );
170 170
171 171
172 /* 172 /*
173 * script actions 173 * script actions
174 */ 174 */
175 m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); 175 m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0);
176 connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); 176 connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int)));
177 177
178 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); 178 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0);
179 m_recordScript->addTo(m_scripts); 179 m_recordScript->addTo(m_scripts);
180 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); 180 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript()));
181 181
182 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); 182 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0);
183 m_saveScript->addTo(m_scripts); 183 m_saveScript->addTo(m_scripts);
184 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); 184 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript()));
185 185
186 186
187 /* 187 /*
188 * action that open/closes the keyboard 188 * action that open/closes the keyboard
189 */ 189 */
190 m_openKeys = new QAction (tr("Open Keyboard..."), 190 m_openKeys = new QAction (tr("Open Keyboard..."),
191 Resource::loadPixmap( "console/keys/keyboard_icon" ), 191 Resource::loadPixmap( "console/keys/keyboard_icon" ),
192 QString::null, 0, this, 0); 192 QString::null, 0, this, 0);
193 m_openKeys->setToggleAction(true); 193 m_openKeys->setToggleAction(true);
194 connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); 194 connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool)));
195 195
196 /* insert the submenu */ 196 /* insert the submenu */
197 m_console->insertItem(tr("New from Profile"), m_sessionsPop, 197 m_console->insertItem(tr("New from Profile"), m_sessionsPop,
198 -1, 0); 198 -1, 0);
199 199
200 /* insert the connection menu */ 200 /* insert the connection menu */
201 m_bar->insertItem( tr("Connection"), m_console ); 201 m_bar->insertItem( tr("Connection"), m_console );
202 202
203 /* the scripts menu */ 203 /* the scripts menu */
204 m_bar->insertItem( tr("Scripts"), m_scripts ); 204 m_bar->insertItem( tr("Scripts"), m_scripts );
205 205
206 /* and the keyboard */ 206 /* and the keyboard */
207 m_keyBar = new QToolBar(this); 207 m_keyBar = new QToolBar(this);
208 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); 208 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE );
209 m_keyBar->setHorizontalStretchable( TRUE ); 209 m_keyBar->setHorizontalStretchable( TRUE );
210 m_keyBar->hide(); 210 m_keyBar->hide();
211 211
212 m_kb = new FunctionKeyboard(m_keyBar); 212 m_kb = new FunctionKeyboard(m_keyBar);
213 connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), 213 connect(m_kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)),
214 this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); 214 this, SLOT(slotKeyReceived(FKey,ushort,ushort,bool)));
215 215
216 216
217 a = new QAction(tr("Copy"), 217 a = new QAction(tr("Copy"),
218 Resource::loadPixmap("copy"), QString::null, 218 Resource::loadPixmap("copy"), QString::null,
219 0, this, 0 ); 219 0, this, 0 );
220 //a->addTo( m_icons ); 220 //a->addTo( m_icons );
221 connect( a, SIGNAL(activated() ), 221 connect( a, SIGNAL(activated() ),
222 this, SLOT(slotCopy() ) ); 222 this, SLOT(slotCopy() ) );
223 223
224 QAction *paste = new QAction(tr("Paste"), 224 QAction *paste = new QAction(tr("Paste"),
225 Resource::loadPixmap("paste"), QString::null, 225 Resource::loadPixmap("paste"), QString::null,
226 0, this, 0 ); 226 0, this, 0 );
227 connect( paste, SIGNAL(activated() ), 227 connect( paste, SIGNAL(activated() ),
228 this, SLOT(slotPaste() ) ); 228 this, SLOT(slotPaste() ) );
229 229
230 230
231 newCon->addTo( m_icons ); 231 newCon->addTo( m_icons );
232 //m_setProfiles->addTo( m_icons ); 232 //m_setProfiles->addTo( m_icons );
233 paste->addTo( m_icons ); 233 paste->addTo( m_icons );
234 m_openKeys->addTo(m_icons); 234 m_openKeys->addTo(m_icons);
235 m_fullscreen->addTo( m_icons ); 235 m_fullscreen->addTo( m_icons );
236 236
237 m_connect->setEnabled( false ); 237 m_connect->setEnabled( false );
238 m_disconnect->setEnabled( false ); 238 m_disconnect->setEnabled( false );
239 m_terminate->setEnabled( false ); 239 m_terminate->setEnabled( false );
240 m_transfer->setEnabled( false ); 240 m_transfer->setEnabled( false );
241 m_scripts->setItemEnabled(m_runScript_id, false); 241 m_scripts->setItemEnabled(m_runScript_id, false);
242 m_recordScript->setEnabled( false ); 242 m_recordScript->setEnabled( false );
243 m_saveScript->setEnabled( false ); 243 m_saveScript->setEnabled( false );
244 m_fullscreen->setEnabled( false ); 244 m_fullscreen->setEnabled( false );
245 m_closewindow->setEnabled( false ); 245 m_closewindow->setEnabled( false );
246 m_wrap->setEnabled( false ); 246 m_wrap->setEnabled( false );
247 247
248 /* 248 /*
249 * connect to the menu activation 249 * connect to the menu activation
250 */ 250 */
251 connect( m_sessionsPop, SIGNAL(activated( int ) ), 251 connect( m_sessionsPop, SIGNAL(activated(int) ),
252 this, SLOT(slotProfile( int ) ) ); 252 this, SLOT(slotProfile(int) ) );
253 253
254 m_consoleWindow = new TabWidget( this, "blah"); 254 m_consoleWindow = new TabWidget( this, "blah");
255 connect(m_consoleWindow, SIGNAL(activated(Session*) ), 255 connect(m_consoleWindow, SIGNAL(activated(Session*) ),
256 this, SLOT(slotSessionChanged(Session*) ) ); 256 this, SLOT(slotSessionChanged(Session*) ) );
257 setCentralWidget( m_consoleWindow ); 257 setCentralWidget( m_consoleWindow );
258 258
259 slotQuickLaunch(); 259 slotQuickLaunch();
260} 260}
261 261
262ProfileManager* MainWindow::manager() { 262ProfileManager* MainWindow::manager() {
263 return m_manager; 263 return m_manager;
264} 264}
265TabWidget* MainWindow::tabWidget() { 265TabWidget* MainWindow::tabWidget() {
266 return m_consoleWindow; 266 return m_consoleWindow;
267} 267}
268void MainWindow::populateProfiles() { 268void MainWindow::populateProfiles() {
269 m_sessionsPop->clear(); 269 m_sessionsPop->clear();
270 Profile::ValueList list = manager()->all(); 270 Profile::ValueList list = manager()->all();
271 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { 271 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) {
272 m_sessionsPop->insertItem( (*it).name() ); 272 m_sessionsPop->insertItem( (*it).name() );
273 } 273 }
274 274
275} 275}
276 276
277void MainWindow::populateScripts() { 277void MainWindow::populateScripts() {
278 m_scriptsPop->clear(); 278 m_scriptsPop->clear();
279 m_scriptsData.clear(); 279 m_scriptsData.clear();
280 DocLnkSet files(QPEApplication::documentDir(), "text/plain"); 280 DocLnkSet files(QPEApplication::documentDir(), "text/plain");
281 QListIterator<DocLnk> dit(files.children()); 281 QListIterator<DocLnk> dit(files.children());
282 for (; dit.current(); ++dit) { 282 for (; dit.current(); ++dit) {
283 if (*dit && (*dit)->name().length()>0) { 283 if (*dit && (*dit)->name().length()>0) {
284 QFileInfo info((*dit)->file()); 284 QFileInfo info((*dit)->file());
285 if (info.extension(false) == "script") { 285 if (info.extension(false) == "script") {
286 m_scriptsData.append(new DocLnk(**dit)); 286 m_scriptsData.append(new DocLnk(**dit));
287 m_scriptsPop->insertItem((*dit)->name()); 287 m_scriptsPop->insertItem((*dit)->name());
288 } 288 }
289 } 289 }
290 } 290 }
291 291
292} 292}
293 293
294MainWindow::~MainWindow() { 294MainWindow::~MainWindow() {
295 delete m_factory; 295 delete m_factory;
296 manager()->save(); 296 manager()->save();
297} 297}
298 298
299MetaFactory* MainWindow::factory() { 299MetaFactory* MainWindow::factory() {
300 return m_factory; 300 return m_factory;
301} 301}
302 302
303Session* MainWindow::currentSession() { 303Session* MainWindow::currentSession() {
304 return m_curSession; 304 return m_curSession;
305} 305}
306 306
307QList<Session> MainWindow::sessions() { 307QList<Session> MainWindow::sessions() {
308 return m_sessions; 308 return m_sessions;
309} 309}
310 310
311void MainWindow::slotNew() { 311void MainWindow::slotNew() {
312 ProfileEditorDialog dlg(factory() ); 312 ProfileEditorDialog dlg(factory() );
313 dlg.setCaption( tr("New Connection") ); 313 dlg.setCaption( tr("New Connection") );
314 int ret = QPEApplication::execDialog( &dlg ); 314 int ret = QPEApplication::execDialog( &dlg );
315 315
316 if ( ret == QDialog::Accepted ) { 316 if ( ret == QDialog::Accepted ) {
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index 979e89d..6e1e23e 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -70,132 +70,132 @@ void ProfileEditorDialog::initUI()
70 m_svTerm = new QScrollView( m_tabTerm ); 70 m_svTerm = new QScrollView( m_tabTerm );
71 m_svTerm->setResizePolicy( QScrollView::AutoOneFit ); 71 m_svTerm->setResizePolicy( QScrollView::AutoOneFit );
72 //m_svTerm->setHScrollBarMode( QScrollView::AlwaysOff ); 72 //m_svTerm->setHScrollBarMode( QScrollView::AlwaysOff );
73 m_svTerm->setFrameShape( QFrame::NoFrame ); 73 m_svTerm->setFrameShape( QFrame::NoFrame );
74 74
75 /* base layout for tabs */ 75 /* base layout for tabs */
76 m_layCon = new QHBoxLayout( m_tabCon , 2 ); 76 m_layCon = new QHBoxLayout( m_tabCon , 2 );
77 m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); 77 m_layTerm = new QHBoxLayout( m_tabTerm, 2 );
78 m_layKey = new QHBoxLayout( m_tabKey, 2 ); 78 m_layKey = new QHBoxLayout( m_tabKey, 2 );
79 79
80 m_layCon->addWidget( m_svCon ); 80 m_layCon->addWidget( m_svCon );
81 m_layTerm->addWidget( m_svTerm ); 81 m_layTerm->addWidget( m_svTerm );
82 82
83 // profile tab 83 // profile tab
84 84
85 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); 85 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof);
86 m_name = new QLineEdit(tabprof); 86 m_name = new QLineEdit(tabprof);
87 QLabel *con = new QLabel(tr("Connection"), tabprof ); 87 QLabel *con = new QLabel(tr("Connection"), tabprof );
88 QLabel *term = new QLabel(tr("Terminal"), tabprof ); 88 QLabel *term = new QLabel(tr("Terminal"), tabprof );
89 m_conCmb = new QComboBox( tabprof ); 89 m_conCmb = new QComboBox( tabprof );
90 m_termCmb = new QComboBox( tabprof ); 90 m_termCmb = new QComboBox( tabprof );
91 m_autoConnect = new QCheckBox(tr("Auto connect after load"), tabprof); 91 m_autoConnect = new QCheckBox(tr("Auto connect after load"), tabprof);
92 92
93 // layouting 93 // layouting
94 QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); 94 QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2);
95 vbox3->add(name); 95 vbox3->add(name);
96 vbox3->add(m_name); 96 vbox3->add(m_name);
97 vbox3->add(con ); 97 vbox3->add(con );
98 vbox3->add(m_conCmb ); 98 vbox3->add(m_conCmb );
99 vbox3->add(term ); 99 vbox3->add(term );
100 vbox3->add(m_termCmb ); 100 vbox3->add(m_termCmb );
101 vbox3->add(m_autoConnect); 101 vbox3->add(m_autoConnect);
102 vbox3->addStretch(1); 102 vbox3->addStretch(1);
103 103
104 m_showconntab = 0; 104 m_showconntab = 0;
105 tabWidget->addTab(tabprof, "", QObject::tr("Profile")); 105 tabWidget->addTab(tabprof, "", QObject::tr("Profile"));
106 tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); 106 tabWidget->addTab(m_tabCon, "", QObject::tr("Connection"));
107 tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); 107 tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal"));
108 tabWidget->addTab(m_tabKey, "", QObject::tr("Special Keys")); 108 tabWidget->addTab(m_tabKey, "", QObject::tr("Special Keys"));
109 tabWidget->setCurrentTab( tabprof ); 109 tabWidget->setCurrentTab( tabprof );
110 110
111 111
112 // fill the comboboxes 112 // fill the comboboxes
113 QStringList list = m_fact->connectionWidgets(); 113 QStringList list = m_fact->connectionWidgets();
114 QStringList::Iterator it; 114 QStringList::Iterator it;
115 for (it =list.begin(); it != list.end(); ++it ) { 115 for (it =list.begin(); it != list.end(); ++it ) {
116 m_conCmb->insertItem( (*it) ); 116 m_conCmb->insertItem( (*it) );
117 } 117 }
118 list = m_fact->terminalWidgets(); 118 list = m_fact->terminalWidgets();
119 for (it =list.begin(); it != list.end(); ++it ) { 119 for (it =list.begin(); it != list.end(); ++it ) {
120 m_termCmb->insertItem( (*it) ); 120 m_termCmb->insertItem( (*it) );
121 } 121 }
122 122
123 // load profile values 123 // load profile values
124 m_name->setText(m_prof.name()); 124 m_name->setText(m_prof.name());
125 slotKeyActivated( "Default Keyboard" ); 125 slotKeyActivated( "Default Keyboard" );
126 setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); 126 setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb );
127 setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); 127 setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb );
128 slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); 128 slotConActivated( m_fact->external(m_prof.ioLayerName() ) );
129 slotTermActivated( m_fact->external(m_prof.terminalName() ) ); 129 slotTermActivated( m_fact->external(m_prof.terminalName() ) );
130 m_autoConnect->setChecked(m_prof.autoConnect()); 130 m_autoConnect->setChecked(m_prof.autoConnect());
131 131
132 132
133 // signal and slots 133 // signal and slots
134 connect(m_conCmb, SIGNAL(activated(const QString& ) ), 134 connect(m_conCmb, SIGNAL(activated(const QString&) ),
135 this, SLOT(slotConActivated(const QString&) ) ); 135 this, SLOT(slotConActivated(const QString&) ) );
136 connect(m_termCmb, SIGNAL(activated(const QString& ) ), 136 connect(m_termCmb, SIGNAL(activated(const QString&) ),
137 this, SLOT(slotTermActivated(const QString& ) ) ); 137 this, SLOT(slotTermActivated(const QString&) ) );
138 138
139} 139}
140 140
141ProfileEditorDialog::~ProfileEditorDialog() { 141ProfileEditorDialog::~ProfileEditorDialog() {
142 142
143} 143}
144void ProfileEditorDialog::accept() 144void ProfileEditorDialog::accept()
145{ 145{
146 if(profName().isEmpty()) 146 if(profName().isEmpty())
147 { 147 {
148 QMessageBox::information(this, 148 QMessageBox::information(this,
149 QObject::tr("Invalid profile"), 149 QObject::tr("Invalid profile"),
150 QObject::tr("Please enter a profile name.")); 150 QObject::tr("Please enter a profile name."));
151 return; 151 return;
152 } 152 }
153 // Save profile and plugin profile 153 // Save profile and plugin profile
154 //if(plugin_plugin) plugin_plugin->save(); 154 //if(plugin_plugin) plugin_plugin->save();
155 155
156 // Save general values 156 // Save general values
157 m_prof.setName( profName() ); 157 m_prof.setName( profName() );
158 m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); 158 m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) );
159 m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); 159 m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) );
160 m_prof.setAutoConnect( m_autoConnect->isChecked() ); 160 m_prof.setAutoConnect( m_autoConnect->isChecked() );
161 161
162 if (m_con ) 162 if (m_con )
163 m_con->save( m_prof ); 163 m_con->save( m_prof );
164 if (m_term ) 164 if (m_term )
165 m_term->save( m_prof ); 165 m_term->save( m_prof );
166 if (m_key) 166 if (m_key)
167 m_key->save( m_prof ); 167 m_key->save( m_prof );
168 168
169 QDialog::accept(); 169 QDialog::accept();
170} 170}
171 171
172 172
173QString ProfileEditorDialog::profName()const 173QString ProfileEditorDialog::profName()const
174{ 174{
175 return m_name->text(); 175 return m_name->text();
176} 176}
177 177
178QCString ProfileEditorDialog::profType()const 178QCString ProfileEditorDialog::profType()const
179{ 179{
180 /*QStringList w = m_fact->configWidgets(); 180 /*QStringList w = m_fact->configWidgets();
181 for(QStringList::Iterator it = w.begin(); it != w.end(); it++) 181 for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
182 if(device_box->currentText() == m_fact->name((*it))) return (*it); 182 if(device_box->currentText() == m_fact->name((*it))) return (*it);
183 */ 183 */
184 return QCString(); 184 return QCString();
185} 185}
186/* 186/*
187 * we need to switch the widget 187 * we need to switch the widget
188 */ 188 */
189void ProfileEditorDialog::slotConActivated( const QString& str ) { 189void ProfileEditorDialog::slotConActivated( const QString& str ) {
190 190
191 delete m_con; 191 delete m_con;
192 192
193 m_con = m_fact->newConnectionPlugin( str, m_svCon->viewport() ); 193 m_con = m_fact->newConnectionPlugin( str, m_svCon->viewport() );
194 194
195 if ( !m_con ) { 195 if ( !m_con ) {
196 m_con = new NoOptions( str, m_svCon->viewport(), "name"); 196 m_con = new NoOptions( str, m_svCon->viewport(), "name");
197 } 197 }
198 198
199 // FIXME ugly hack right. Right solution would be to look into the layer and see if it 199 // FIXME ugly hack right. Right solution would be to look into the layer and see if it
200 // supports auto connect and then set it as prefered 200 // supports auto connect and then set it as prefered
201 if ( m_conCmb ->currentText() == tr("Local Console") ) { 201 if ( m_conCmb ->currentText() == tr("Local Console") ) {
diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp
index 1034ede..b7f14c5 100644
--- a/noncore/apps/opie-console/session.cpp
+++ b/noncore/apps/opie-console/session.cpp
@@ -1,115 +1,115 @@
1 1
2 2
3#include "file_layer.h" 3#include "file_layer.h"
4#include "emulation_handler.h" 4#include "emulation_handler.h"
5#include "session.h" 5#include "session.h"
6 6
7 7
8Session::Session() { 8Session::Session() {
9 m_widget = 0l; 9 m_widget = 0l;
10 m_layer = 0l; 10 m_layer = 0l;
11 m_emu = 0l; 11 m_emu = 0l;
12 m_transfer = 0l; 12 m_transfer = 0l;
13} 13}
14Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay) 14Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay)
15 : m_name( na ), m_widget( widget ), m_layer( lay ) 15 : m_name( na ), m_widget( widget ), m_layer( lay )
16{ 16{
17// m_widLay = 0l; 17// m_widLay = 0l;
18// m_emLay = 0l; 18// m_emLay = 0l;
19 m_emu = 0l; 19 m_emu = 0l;
20} 20}
21Session::~Session() { 21Session::~Session() {
22 delete m_layer; 22 delete m_layer;
23 delete m_emu; 23 delete m_emu;
24 delete m_widget; 24 delete m_widget;
25 /* the widget layer should be deleted by the m_widget */ 25 /* the widget layer should be deleted by the m_widget */
26} 26}
27QString Session::name()const { 27QString Session::name()const {
28 return m_name; 28 return m_name;
29} 29}
30QWidgetStack* Session::widgetStack() { 30QWidgetStack* Session::widgetStack() {
31 return m_widget; 31 return m_widget;
32} 32}
33IOLayer* Session::layer() { 33IOLayer* Session::layer() {
34 return m_layer; 34 return m_layer;
35} 35}
36EmulationHandler* Session::emulationHandler() { 36EmulationHandler* Session::emulationHandler() {
37 return m_emu; 37 return m_emu;
38} 38}
39QWidget* Session::widget() { 39QWidget* Session::widget() {
40 if (!m_emu ) 40 if (!m_emu )
41 return 0l; 41 return 0l;
42 42
43 return m_emu->widget(); 43 return m_emu->widget();
44} 44}
45Profile Session::profile()const { 45Profile Session::profile()const {
46 return m_prof; 46 return m_prof;
47} 47}
48/* 48/*
49WidgetLayer* Session::emulationWidget() { 49WidgetLayer* Session::emulationWidget() {
50 return m_widLay; 50 return m_widLay;
51} 51}
52*/ 52*/
53void Session::connect() { 53void Session::connect() {
54 if ( !m_layer || !m_emu ) 54 if ( !m_layer || !m_emu )
55 return; 55 return;
56 56
57 QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ), 57 QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ),
58 m_emu, SLOT(recv(const QByteArray&) ) ); 58 m_emu, SLOT(recv(const QByteArray&) ) );
59 QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ), 59 QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ),
60 m_layer, SLOT(send(const QByteArray&) ) ); 60 m_layer, SLOT(send(const QByteArray&) ) );
61 QObject::connect(m_emu, SIGNAL(changeSize(int, int) ), 61 QObject::connect(m_emu, SIGNAL(changeSize(int,int) ),
62 m_layer, SLOT(setSize(int, int) ) ); 62 m_layer, SLOT(setSize(int,int) ) );
63} 63}
64 64
65void Session::disconnect() { 65void Session::disconnect() {
66 66
67 if ( !m_layer || !m_emu ) 67 if ( !m_layer || !m_emu )
68 return; 68 return;
69 69
70 QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ), 70 QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ),
71 m_emu, SLOT(recv(const QByteArray&) ) ); 71 m_emu, SLOT(recv(const QByteArray&) ) );
72 QObject::disconnect(m_emu, SIGNAL(send(const QByteArray&) ), 72 QObject::disconnect(m_emu, SIGNAL(send(const QByteArray&) ),
73 m_layer, SLOT(send(const QByteArray&) ) ); 73 m_layer, SLOT(send(const QByteArray&) ) );
74} 74}
75 75
76void Session::setName( const QString& na){ 76void Session::setName( const QString& na){
77 m_name = na; 77 m_name = na;
78} 78}
79 79
80void Session::setWidgetStack( QWidgetStack* wid ) { 80void Session::setWidgetStack( QWidgetStack* wid ) {
81 delete m_emu; 81 delete m_emu;
82 m_emu = 0l; 82 m_emu = 0l;
83 delete m_widget; 83 delete m_widget;
84 /* the EmulationLayer was destroyed... */ 84 /* the EmulationLayer was destroyed... */
85 85
86 m_widget = wid; 86 m_widget = wid;
87} 87}
88void Session::setIOLayer( IOLayer* lay ) { 88void Session::setIOLayer( IOLayer* lay ) {
89 delete m_layer; 89 delete m_layer;
90 m_layer = lay; 90 m_layer = lay;
91} 91}
92 92
93void Session::setEmulationHandler( EmulationHandler* lay ) { 93void Session::setEmulationHandler( EmulationHandler* lay ) {
94 delete m_emu; 94 delete m_emu;
95 m_emu = lay; 95 m_emu = lay;
96} 96}
97void Session::setProfile( const Profile& prof ) { 97void Session::setProfile( const Profile& prof ) {
98 m_prof = prof; 98 m_prof = prof;
99} 99}
100/* 100/*
101void Session::setEmulationWidget( WidgetLayer* lay ) { 101void Session::setEmulationWidget( WidgetLayer* lay ) {
102 delete m_widLay; 102 delete m_widLay;
103 m_widLay = lay; 103 m_widLay = lay;
104} 104}
105*/ 105*/
106void Session::setTransferDialog(QWidget *d) 106void Session::setTransferDialog(QWidget *d)
107{ 107{
108 m_transfer = d; 108 m_transfer = d;
109} 109}
110 110
111QWidget *Session::transferDialog() 111QWidget *Session::transferDialog()
112{ 112{
113 return m_transfer; 113 return m_transfer;
114} 114}
115 115
diff --git a/noncore/apps/opie-console/sz_transfer.cpp b/noncore/apps/opie-console/sz_transfer.cpp
index c47e73e..2f82417 100644
--- a/noncore/apps/opie-console/sz_transfer.cpp
+++ b/noncore/apps/opie-console/sz_transfer.cpp
@@ -1,84 +1,84 @@
1 1
2#include "sz_transfer.h" 2#include "sz_transfer.h"
3#include <qfile.h> 3#include <qfile.h>
4#include <stdio.h> 4#include <stdio.h>
5#include <sys/termios.h> 5#include <sys/termios.h>
6 6
7 7
8 8
9SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t) 9SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t)
10{ 10{
11} 11}
12 12
13SzTransfer::~SzTransfer() { 13SzTransfer::~SzTransfer() {
14} 14}
15 15
16void SzTransfer::sendFile(const QFile& file) { 16void SzTransfer::sendFile(const QFile& file) {
17 17
18 sendFile(file.name()); 18 sendFile(file.name());
19} 19}
20 20
21void SzTransfer::sendFile(const QString& file) { 21void SzTransfer::sendFile(const QString& file) {
22 22
23 //setcbreak(2); /* raw no echo */ 23 //setcbreak(2); /* raw no echo */
24 24
25 proc = new OProcess; 25 proc = new OProcess;
26 *proc << "sz"; 26 *proc << "sz";
27 *proc << "-v" << "-v" << "-b" << file; 27 *proc << "-v" << "-v" << "-b" << file;
28 connect(proc, SIGNAL(processExited(OProcess *)), 28 connect(proc, SIGNAL(processExited(OProcess*)),
29 this, SLOT(sent())); 29 this, SLOT(sent()));
30 connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)), 30 connect(proc, SIGNAL(receivedStdout(OProcess*,char*,int)),
31 this, SLOT(SzReceivedStdout(OProcess *, char *, int))); 31 this, SLOT(SzReceivedStdout(OProcess*,char*,int)));
32 connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), 32 connect(proc, SIGNAL(receivedStderr(OProcess*,char*,int)),
33 this, SLOT(SzReceivedStderr(OProcess *, char *, int))); 33 this, SLOT(SzReceivedStderr(OProcess*,char*,int)));
34 connect(layer(), SIGNAL(received(const QByteArray &)), 34 connect(layer(), SIGNAL(received(const QByteArray&)),
35 this, SLOT(receivedStdin(const QByteArray &))); 35 this, SLOT(receivedStdin(const QByteArray&)));
36 proc->start(OProcess::NotifyOnExit, OProcess::All); 36 proc->start(OProcess::NotifyOnExit, OProcess::All);
37 37
38} 38}
39 39
40void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) { 40void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) {
41 41
42 qWarning("recieved from sz on stdout %d bytes", buflen); 42 qWarning("recieved from sz on stdout %d bytes", buflen);
43 43
44 QByteArray data(buflen); 44 QByteArray data(buflen);
45 data.fill(*buffer, buflen); 45 data.fill(*buffer, buflen);
46 for (uint i = 0; i < data.count(); i++ ) { 46 for (uint i = 0; i < data.count(); i++ ) {
47 printf("%c", buffer[i] ); 47 printf("%c", buffer[i] );
48 } 48 }
49 printf("\n"); 49 printf("\n");
50 50
51 // send out through the io layer 51 // send out through the io layer
52 layer()->send(data); 52 layer()->send(data);
53} 53}
54 54
55void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) { 55void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) {
56 56
57 // parse and show data in a progress dialog/widget 57 // parse and show data in a progress dialog/widget
58 printf("stderr:\n"); 58 printf("stderr:\n");
59 //for (int i = 0; i < length; i++) 59 //for (int i = 0; i < length; i++)
60 // printf("%c", buffer[i]); 60 // printf("%c", buffer[i]);
61 //printf("\n"); 61 //printf("\n");
62} 62}
63 63
64void SzTransfer::receivedStdin(const QByteArray &data) { 64void SzTransfer::receivedStdin(const QByteArray &data) {
65 65
66 qWarning("recieved from io_serial %d bytes", data.size()); 66 qWarning("recieved from io_serial %d bytes", data.size());
67 67
68 // recieved data from the io layer goes to sz 68 // recieved data from the io layer goes to sz
69 proc->writeStdin(data.data(), data.size()); 69 proc->writeStdin(data.data(), data.size());
70 70
71} 71}
72 72
73void SzTransfer::sent() { 73void SzTransfer::sent() {
74 74
75 qWarning("sent file"); 75 qWarning("sent file");
76 76
77 //setcbreak(0); /* default */ 77 //setcbreak(0); /* default */
78 78
79 79
80 delete proc; 80 delete proc;
81 disconnect(layer(), SIGNAL(received(const QByteArray &)), 81 disconnect(layer(), SIGNAL(received(const QByteArray&)),
82 this, SLOT(receivedStdin(const QByteArray &))); 82 this, SLOT(receivedStdin(const QByteArray&)));
83 83
84} 84}
diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp
index 4a7202d..b1725db 100644
--- a/noncore/apps/opie-console/test/senderui.cpp
+++ b/noncore/apps/opie-console/test/senderui.cpp
@@ -1,77 +1,77 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <stdio.h> 2#include <stdio.h>
3#include <fcntl.h> 3#include <fcntl.h>
4#include <sys/termios.h> 4#include <sys/termios.h>
5 5
6#include <qmultilineedit.h> 6#include <qmultilineedit.h>
7#include <qsocketnotifier.h> 7#include <qsocketnotifier.h>
8 8
9#include "../profile.h" 9#include "../profile.h"
10#include "../io_serial.h" 10#include "../io_serial.h"
11#include "../filetransfer.h" 11#include "../filetransfer.h"
12#include "../filereceive.h" 12#include "../filereceive.h"
13 13
14#include <opie2/oprocess.h> 14#include <opie2/oprocess.h>
15 15
16#include "senderui.h" 16#include "senderui.h"
17 17
18SenderUI::SenderUI() 18SenderUI::SenderUI()
19 : Sender() { 19 : Sender() {
20 20
21 /* we do that manually */ 21 /* we do that manually */
22 Profile prof; 22 Profile prof;
23 QString str = "/dev/bty0"; 23 QString str = "/dev/bty0";
24 prof.writeEntry("Device",str ); 24 prof.writeEntry("Device",str );
25 prof.writeEntry("Baud", 19200 ); 25 prof.writeEntry("Baud", 19200 );
26 26
27 qWarning("prof " + prof.readEntry("Device") + " " + str); 27 qWarning("prof " + prof.readEntry("Device") + " " + str);
28 ser = new IOSerial(prof); 28 ser = new IOSerial(prof);
29 connect(ser, SIGNAL(received(const QByteArray& ) ), 29 connect(ser, SIGNAL(received(const QByteArray&) ),
30 this, SLOT(got(const QByteArray&) ) ); 30 this, SLOT(got(const QByteArray&) ) );
31 31
32 if ( ser->open() ) 32 if ( ser->open() )
33 qWarning("opened!!!"); 33 qWarning("opened!!!");
34 else 34 else
35 qWarning("could not open"); 35 qWarning("could not open");
36 36
37 37
38} 38}
39SenderUI::~SenderUI() { 39SenderUI::~SenderUI() {
40 40
41} 41}
42void SenderUI::slotSendFile() { 42void SenderUI::slotSendFile() {
43 43
44 sz = new FileTransfer(FileTransfer::SY, ser); 44 sz = new FileTransfer(FileTransfer::SY, ser);
45 sz->sendFile("/home/ich/bootopie-v06-13.jffs2"); 45 sz->sendFile("/home/ich/bootopie-v06-13.jffs2");
46 46
47 connect (sz, SIGNAL(sent()), 47 connect (sz, SIGNAL(sent()),
48 this, SLOT(fileTransComplete())); 48 this, SLOT(fileTransComplete()));
49} 49}
50 50
51void SenderUI::slotSend() { 51void SenderUI::slotSend() {
52 QCString str = MultiLineEdit1->text().utf8(); 52 QCString str = MultiLineEdit1->text().utf8();
53 qWarning("sending: %s", str.data() ); 53 qWarning("sending: %s", str.data() );
54 str = str.replace( QRegExp("\n"), "\r"); 54 str = str.replace( QRegExp("\n"), "\r");
55 ser->send( str ); 55 ser->send( str );
56} 56}
57void SenderUI::got(const QByteArray& ar) { 57void SenderUI::got(const QByteArray& ar) {
58 qWarning("got:"); 58 qWarning("got:");
59 for ( uint i = 0; i < ar.count(); i++ ) { 59 for ( uint i = 0; i < ar.count(); i++ ) {
60 printf("%c", ar[i] ); 60 printf("%c", ar[i] );
61 } 61 }
62 printf("\n"); 62 printf("\n");
63} 63}
64 64
65void SenderUI::fileTransComplete() { 65void SenderUI::fileTransComplete() {
66 66
67 qWarning("file transfer complete"); 67 qWarning("file transfer complete");
68} 68}
69void SenderUI::send() { 69void SenderUI::send() {
70 70
71} 71}
72void SenderUI::slotRev(){ 72void SenderUI::slotRev(){
73qWarning("Going to receive!"); 73qWarning("Going to receive!");
74FileReceive *rev = new FileReceive( FileReceive::SZ, ser ); 74FileReceive *rev = new FileReceive( FileReceive::SZ, ser );
75rev->receive(); 75rev->receive();
76 76
77} 77}
diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp
index 30e7caf..d494a6c 100644
--- a/noncore/apps/opie-console/transferdialog.cpp
+++ b/noncore/apps/opie-console/transferdialog.cpp
@@ -64,141 +64,141 @@ TransferDialog::TransferDialog(QWidget *parent, MainWindow *mainwindow, const ch
64 ok = new QPushButton(QObject::tr("Start transfer"), this); 64 ok = new QPushButton(QObject::tr("Start transfer"), this);
65 cancel = new QPushButton(QObject::tr("Cancel"), this); 65 cancel = new QPushButton(QObject::tr("Cancel"), this);
66 66
67 vbox = new QVBoxLayout(this, 2); 67 vbox = new QVBoxLayout(this, 2);
68 vbox->add(group); 68 vbox->add(group);
69 vbox->add(file); 69 vbox->add(file);
70 hbox = new QHBoxLayout(vbox, 0); 70 hbox = new QHBoxLayout(vbox, 0);
71 hbox->add(filename); 71 hbox->add(filename);
72 hbox->add(selector); 72 hbox->add(selector);
73 vbox->add(mode); 73 vbox->add(mode);
74 vbox->add(protocol); 74 vbox->add(protocol);
75 vbox->add(progress); 75 vbox->add(progress);
76 vbox->add(progressbar); 76 vbox->add(progressbar);
77 vbox->add(status); 77 vbox->add(status);
78 vbox->add(statusbar); 78 vbox->add(statusbar);
79 vbox->addStretch(1); 79 vbox->addStretch(1);
80 hbox2 = new QHBoxLayout(vbox, 2); 80 hbox2 = new QHBoxLayout(vbox, 2);
81 hbox2->add(ok); 81 hbox2->add(ok);
82 hbox2->add(cancel); 82 hbox2->add(cancel);
83 83
84 setCaption(QObject::tr("File transfer")); 84 setCaption(QObject::tr("File transfer"));
85 show(); 85 show();
86 86
87 connect(selector, SIGNAL(clicked()), SLOT(slotFilename())); 87 connect(selector, SIGNAL(clicked()), SLOT(slotFilename()));
88 connect(ok, SIGNAL(clicked()), SLOT(slotTransfer())); 88 connect(ok, SIGNAL(clicked()), SLOT(slotTransfer()));
89 connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); 89 connect(cancel, SIGNAL(clicked()), SLOT(slotCancel()));
90 connect(group, SIGNAL(clicked(int)), SLOT(slotMode(int))); 90 connect(group, SIGNAL(clicked(int)), SLOT(slotMode(int)));
91} 91}
92 92
93TransferDialog::~TransferDialog() 93TransferDialog::~TransferDialog()
94{ 94{
95} 95}
96 96
97void TransferDialog::slotFilename() 97void TransferDialog::slotFilename()
98{ 98{
99 QString f; 99 QString f;
100 100
101 f = Opie::OFileDialog::getOpenFileName(0); 101 f = Opie::OFileDialog::getOpenFileName(0);
102 if(!f.isNull()) filename->setText(f); 102 if(!f.isNull()) filename->setText(f);
103} 103}
104 104
105void TransferDialog::slotTransfer() 105void TransferDialog::slotTransfer()
106{ 106{
107 if((m_transfermode == id_send) && (filename->text().isEmpty())) 107 if((m_transfermode == id_send) && (filename->text().isEmpty()))
108 { 108 {
109 QMessageBox::information(this, 109 QMessageBox::information(this,
110 QObject::tr("Attention"), 110 QObject::tr("Attention"),
111 QObject::tr("No file has been specified.")); 111 QObject::tr("No file has been specified."));
112 return; 112 return;
113 } 113 }
114 114
115 ok->setEnabled(false); 115 ok->setEnabled(false);
116 116
117 cleanup(); 117 cleanup();
118 m_autocleanup = 0; 118 m_autocleanup = 0;
119 119
120 if(m_transfermode == id_send) statusbar->setText(QObject::tr("Sending...")); 120 if(m_transfermode == id_send) statusbar->setText(QObject::tr("Sending..."));
121 else statusbar->setText(QObject::tr("Receiving...")); 121 else statusbar->setText(QObject::tr("Receiving..."));
122 122
123 if(m_transfermode == id_send) 123 if(m_transfermode == id_send)
124 { 124 {
125 m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer()); 125 m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer());
126 m_lay->sendFile(filename->text()); 126 m_lay->sendFile(filename->text());
127 127
128 connect(m_lay, SIGNAL(progress(const QString&, int, int, int, int, int)), 128 connect(m_lay, SIGNAL(progress(const QString&,int,int,int,int,int)),
129 SLOT(slotProgress(const QString&, int, int, int, int, int))); 129 SLOT(slotProgress(const QString&,int,int,int,int,int)));
130 connect(m_lay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); 130 connect(m_lay, SIGNAL(error(int,const QString&)), SLOT(slotError(int,const QString&)));
131 connect(m_lay, SIGNAL(sent()), SLOT(slotSent())); 131 connect(m_lay, SIGNAL(sent()), SLOT(slotSent()));
132 } 132 }
133 else 133 else
134 { 134 {
135 m_recvlay = m_win->factory()->newReceive(protocol->currentText(), m_win->currentSession()->layer()); 135 m_recvlay = m_win->factory()->newReceive(protocol->currentText(), m_win->currentSession()->layer());
136 m_recvlay->receive(); 136 m_recvlay->receive();
137 137
138 connect(m_recvlay, SIGNAL(progress(const QString&, int, int, int, int, int)), 138 connect(m_recvlay, SIGNAL(progress(const QString&,int,int,int,int,int)),
139 SLOT(slotProgress(const QString&, int, int, int, int, int))); 139 SLOT(slotProgress(const QString&,int,int,int,int,int)));
140 connect(m_recvlay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); 140 connect(m_recvlay, SIGNAL(error(int,const QString&)), SLOT(slotError(int,const QString&)));
141 connect(m_recvlay, SIGNAL(received(const QString&)), SLOT(slotReceived(const QString&))); 141 connect(m_recvlay, SIGNAL(received(const QString&)), SLOT(slotReceived(const QString&)));
142 } 142 }
143} 143}
144 144
145void TransferDialog::cleanup() 145void TransferDialog::cleanup()
146{ 146{
147 if(m_lay) 147 if(m_lay)
148 { 148 {
149 m_lay->cancel(); 149 m_lay->cancel();
150 delete m_lay; 150 delete m_lay;
151 m_lay = 0l; 151 m_lay = 0l;
152 } 152 }
153 if(m_recvlay) 153 if(m_recvlay)
154 { 154 {
155 m_recvlay->cancel(); 155 m_recvlay->cancel();
156 delete m_recvlay; 156 delete m_recvlay;
157 m_recvlay = 0l; 157 m_recvlay = 0l;
158 } 158 }
159} 159}
160 160
161void TransferDialog::slotCancel() 161void TransferDialog::slotCancel()
162{ 162{
163 ok->setEnabled(true); 163 ok->setEnabled(true);
164 statusbar->setText(QObject::tr("Ready")); 164 statusbar->setText(QObject::tr("Ready"));
165 165
166 if((m_lay) || (m_recvlay)) 166 if((m_lay) || (m_recvlay))
167 { 167 {
168 cleanup(); 168 cleanup();
169 if(m_autocleanup) 169 if(m_autocleanup)
170 { 170 {
171 m_running = false; 171 m_running = false;
172 close(); 172 close();
173 } 173 }
174 else 174 else
175 { 175 {
176 QMessageBox::information(this, 176 QMessageBox::information(this,
177 QObject::tr("Cancelled"), 177 QObject::tr("Cancelled"),
178 QObject::tr("The file transfer has been cancelled.")); 178 QObject::tr("The file transfer has been cancelled."));
179 } 179 }
180 } 180 }
181 else 181 else
182 { 182 {
183 m_running = false; 183 m_running = false;
184 close(); 184 close();
185 } 185 }
186} 186}
187 187
188void TransferDialog::slotProgress(const QString& , int progress, int , int , int, int ) 188void TransferDialog::slotProgress(const QString& , int progress, int , int , int, int )
189{ 189{
190 progressbar->setProgress(progress); 190 progressbar->setProgress(progress);
191} 191}
192 192
193void TransferDialog::slotError(int error, const QString& ) 193void TransferDialog::slotError(int error, const QString& )
194{ 194{
195 statusbar->setText(QObject::tr("Ready")); 195 statusbar->setText(QObject::tr("Ready"));
196 196
197 switch(error) 197 switch(error)
198 { 198 {
199 case FileTransferLayer::NotSupported: 199 case FileTransferLayer::NotSupported:
200 QMessageBox::critical(this, 200 QMessageBox::critical(this,
201 QObject::tr("Error"), 201 QObject::tr("Error"),
202 QObject::tr("Operation not supported.")); 202 QObject::tr("Operation not supported."));
203 break; 203 break;
204 case FileTransferLayer::StartError: 204 case FileTransferLayer::StartError:
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp
index e759249..b0d589e 100644
--- a/noncore/apps/opie-reader/QTReaderApp.cpp
+++ b/noncore/apps/opie-reader/QTReaderApp.cpp
@@ -268,253 +268,253 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
268 QFileInfo fi(d, INIFILE); 268 QFileInfo fi(d, INIFILE);
269// qDebug("Path:%s", (const char*)fi.absFilePath()); 269// qDebug("Path:%s", (const char*)fi.absFilePath());
270 Config config(fi.absFilePath()); 270 Config config(fi.absFilePath());
271#endif 271#endif
272 config.setGroup("Toolbar"); 272 config.setGroup("Toolbar");
273 m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false); 273 m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false);
274 m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1); 274 m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1);
275 m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2); 275 m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2);
276 menubar = new QToolBar("Menus", this, m_tbposition); 276 menubar = new QToolBar("Menus", this, m_tbposition);
277 277
278// fileBar = new QToolBar("File", this); 278// fileBar = new QToolBar("File", this);
279// QToolBar* viewBar = new QToolBar("File", this); 279// QToolBar* viewBar = new QToolBar("File", this);
280// QToolBar* navBar = new QToolBar("File", this); 280// QToolBar* navBar = new QToolBar("File", this);
281// QToolBar* markBar = new QToolBar("File", this); 281// QToolBar* markBar = new QToolBar("File", this);
282 282
283#ifdef USEQPE 283#ifdef USEQPE
284 mb = new QMenuBar( menubar ); 284 mb = new QMenuBar( menubar );
285#else 285#else
286 mb = new QMenuBar( menubar ); 286 mb = new QMenuBar( menubar );
287#endif 287#endif
288 288
289//#ifdef USEQPE 289//#ifdef USEQPE
290 QPopupMenu* tmp = new QPopupMenu(mb); 290 QPopupMenu* tmp = new QPopupMenu(mb);
291 mb->insertItem( geticon( "AppsIcon" ), tmp ); 291 mb->insertItem( geticon( "AppsIcon" ), tmp );
292//#else 292//#else
293// QMenuBar* tmp = mb; 293// QMenuBar* tmp = mb;
294//#endif 294//#endif
295 295
296 QPopupMenu *file = new QPopupMenu( mb ); 296 QPopupMenu *file = new QPopupMenu( mb );
297 tmp->insertItem( tr( "File" ), file ); 297 tmp->insertItem( tr( "File" ), file );
298 298
299 QPopupMenu *navigation = new QPopupMenu(mb); 299 QPopupMenu *navigation = new QPopupMenu(mb);
300 tmp->insertItem( tr( "Navigation" ), navigation ); 300 tmp->insertItem( tr( "Navigation" ), navigation );
301 301
302 QPopupMenu *view = new QPopupMenu( mb ); 302 QPopupMenu *view = new QPopupMenu( mb );
303 tmp->insertItem( tr( "View" ), view ); 303 tmp->insertItem( tr( "View" ), view );
304 304
305 QPopupMenu *marks = new QPopupMenu( this ); 305 QPopupMenu *marks = new QPopupMenu( this );
306 tmp->insertItem( tr( "Marks" ), marks ); 306 tmp->insertItem( tr( "Marks" ), marks );
307 307
308 QPopupMenu *settings = new QPopupMenu( this ); 308 QPopupMenu *settings = new QPopupMenu( this );
309 tmp->insertItem( tr( "Settings" ), settings ); 309 tmp->insertItem( tr( "Settings" ), settings );
310 310
311// addToolBar(menubar, "Menus",QMainWindow::Top); 311// addToolBar(menubar, "Menus",QMainWindow::Top);
312// addToolBar(fileBar, "Toolbar",QMainWindow::Top); 312// addToolBar(fileBar, "Toolbar",QMainWindow::Top);
313 313
314 // QPopupMenu *edit = new QPopupMenu( this ); 314 // QPopupMenu *edit = new QPopupMenu( this );
315 315
316 /* 316 /*
317 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); 317 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
318 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 318 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
319 a->addTo( bar ); 319 a->addTo( bar );
320 a->addTo( file ); 320 a->addTo( file );
321 */ 321 */
322 322
323 editorStack = new QWidgetStack( this ); 323 editorStack = new QWidgetStack( this );
324 setCentralWidget( editorStack ); 324 setCentralWidget( editorStack );
325 325
326 searchVisible = FALSE; 326 searchVisible = FALSE;
327 regVisible = FALSE; 327 regVisible = FALSE;
328 m_fontVisible = false; 328 m_fontVisible = false;
329 329
330 m_annoWin = new CAnnoEdit(editorStack); 330 m_annoWin = new CAnnoEdit(editorStack);
331 editorStack->addWidget(m_annoWin, get_unique_id()); 331 editorStack->addWidget(m_annoWin, get_unique_id());
332 connect( m_annoWin, SIGNAL( finished(const QString&, const QString&) ), this, SLOT( addAnno(const QString&, const QString&) ) ); 332 connect( m_annoWin, SIGNAL( finished(const QString&,const QString&) ), this, SLOT( addAnno(const QString&,const QString&) ) );
333 connect( m_annoWin, SIGNAL( cancelled() ), this, SLOT( infoClose() ) ); 333 connect( m_annoWin, SIGNAL( cancelled() ), this, SLOT( infoClose() ) );
334 334
335 m_infoWin = new infowin(editorStack); 335 m_infoWin = new infowin(editorStack);
336 editorStack->addWidget(m_infoWin, get_unique_id()); 336 editorStack->addWidget(m_infoWin, get_unique_id());
337 connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) ); 337 connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) );
338 338
339 m_graphicwin = new GraphicWin(editorStack); 339 m_graphicwin = new GraphicWin(editorStack);
340 editorStack->addWidget(m_graphicwin, get_unique_id()); 340 editorStack->addWidget(m_graphicwin, get_unique_id());
341 connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) ); 341 connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) );
342 342
343// bkmkselector = new QListBox(editorStack, "Bookmarks"); 343// bkmkselector = new QListBox(editorStack, "Bookmarks");
344 bkmkselector = new CBkmkSelector(editorStack, "Bookmarks"); 344 bkmkselector = new CBkmkSelector(editorStack, "Bookmarks");
345 // connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) ); 345 // connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) );
346 connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( gotobkmk(int) ) ); 346 connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( gotobkmk(int) ) );
347 connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) ); 347 connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) );
348 editorStack->addWidget( bkmkselector, get_unique_id() ); 348 editorStack->addWidget( bkmkselector, get_unique_id() );
349 349
350/* 350/*
351 importSelector = new FileSelector( "*", editorStack, "importselector", false ); 351 importSelector = new FileSelector( "*", editorStack, "importselector", false );
352 connect( importSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( importFile( const DocLnk & ) ) ); 352 connect( importSelector, SIGNAL( fileSelected(const DocLnk&) ), this, SLOT( importFile(const DocLnk&) ) );
353 353
354 editorStack->addWidget( importSelector, get_unique_id() ); 354 editorStack->addWidget( importSelector, get_unique_id() );
355 355
356 // don't need the close visible, it is redundant... 356 // don't need the close visible, it is redundant...
357 importSelector->setCloseVisible( FALSE ); 357 importSelector->setCloseVisible( FALSE );
358*/ 358*/
359// qDebug("Reading file list"); 359// qDebug("Reading file list");
360 readfilelist(); 360 readfilelist();
361 361
362 reader = new QTReader( editorStack ); 362 reader = new QTReader( editorStack );
363 363
364 reader->bDoUpdates = false; 364 reader->bDoUpdates = false;
365 365
366#ifdef USEQPE 366#ifdef USEQPE
367 ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold); 367 ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold);
368#endif 368#endif
369 369
370// qDebug("Reading config"); 370// qDebug("Reading config");
371// Config config( APPDIR ); 371// Config config( APPDIR );
372 config.setGroup( "View" ); 372 config.setGroup( "View" );
373 m_debounce = config.readNumEntry("Debounce", 0); 373 m_debounce = config.readNumEntry("Debounce", 0);
374#ifdef USEQPE 374#ifdef USEQPE
375 m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); 375 m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false);
376#else 376#else
377 m_bFloatingDialog = config.readBoolEntry("FloatDialogs", true); 377 m_bFloatingDialog = config.readBoolEntry("FloatDialogs", true);
378#endif 378#endif
379 reader->bstripcr = config.readBoolEntry( "StripCr", true ); 379 reader->bstripcr = config.readBoolEntry( "StripCr", true );
380 reader->bfulljust = config.readBoolEntry( "FullJust", false ); 380 reader->bfulljust = config.readBoolEntry( "FullJust", false );
381 reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 )); 381 reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 ));
382 reader->setlead(config.readNumEntry( "ExtraLead", 0 )); 382 reader->setlead(config.readNumEntry( "ExtraLead", 0 ));
383 reader->btextfmt = config.readBoolEntry( "TextFmt", false ); 383 reader->btextfmt = config.readBoolEntry( "TextFmt", false );
384 reader->bautofmt = config.readBoolEntry( "AutoFmt", true ); 384 reader->bautofmt = config.readBoolEntry( "AutoFmt", true );
385 reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); 385 reader->bstriphtml = config.readBoolEntry( "StripHtml", false );
386 reader->bpeanut = config.readBoolEntry( "Peanut", false ); 386 reader->bpeanut = config.readBoolEntry( "Peanut", false );
387 reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); 387 reader->bdehyphen = config.readBoolEntry( "Dehyphen", false );
388 reader->bdepluck = config.readBoolEntry( "Depluck", false ); 388 reader->bdepluck = config.readBoolEntry( "Depluck", false );
389 reader->bdejpluck = config.readBoolEntry( "Dejpluck", false ); 389 reader->bdejpluck = config.readBoolEntry( "Dejpluck", false );
390 reader->bonespace = config.readBoolEntry( "OneSpace", false ); 390 reader->bonespace = config.readBoolEntry( "OneSpace", false );
391 reader->bunindent = config.readBoolEntry( "Unindent", false ); 391 reader->bunindent = config.readBoolEntry( "Unindent", false );
392 reader->brepara = config.readBoolEntry( "Repara", false ); 392 reader->brepara = config.readBoolEntry( "Repara", false );
393 reader->bdblspce = config.readBoolEntry( "DoubleSpace", false ); 393 reader->bdblspce = config.readBoolEntry( "DoubleSpace", false );
394 reader->bindenter = config.readNumEntry( "Indent", 0 ); 394 reader->bindenter = config.readNumEntry( "Indent", 0 );
395 reader->m_textsize = config.readNumEntry( "FontSize", 12 ); 395 reader->m_textsize = config.readNumEntry( "FontSize", 12 );
396 reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); 396 reader->m_delay = config.readNumEntry( "ScrollDelay", 5184);
397 reader->m_lastfile = config.readEntry( "LastFile", QString::null ); 397 reader->m_lastfile = config.readEntry( "LastFile", QString::null );
398 reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); 398 reader->m_lastposn = config.readNumEntry( "LastPosn", 0 );
399 reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); 399 reader->m_bpagemode = config.readBoolEntry( "PageMode", true );
400 reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false); 400 reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false);
401 reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false); 401 reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false);
402 reader->m_fontname = config.readEntry( "Fontname", "helvetica" ); 402 reader->m_fontname = config.readEntry( "Fontname", "helvetica" );
403 reader->m_encd = config.readNumEntry( "Encoding", 0 ); 403 reader->m_encd = config.readNumEntry( "Encoding", 0 );
404 reader->m_charpc = config.readNumEntry( "CharSpacing", 100 ); 404 reader->m_charpc = config.readNumEntry( "CharSpacing", 100 );
405 reader->m_overlap = config.readNumEntry( "Overlap", 0 ); 405 reader->m_overlap = config.readNumEntry( "Overlap", 0 );
406 reader->m_border = config.readNumEntry( "Margin", 6 ); 406 reader->m_border = config.readNumEntry( "Margin", 6 );
407#ifdef REPALM 407#ifdef REPALM
408 reader->brepalm = config.readBoolEntry( "Repalm", true ); 408 reader->brepalm = config.readBoolEntry( "Repalm", true );
409#endif 409#endif
410 reader->bremap = config.readBoolEntry( "Remap", true ); 410 reader->bremap = config.readBoolEntry( "Remap", true );
411 reader->bmakebold = config.readBoolEntry( "MakeBold", false ); 411 reader->bmakebold = config.readBoolEntry( "MakeBold", false );
412 reader->setContinuous(config.readBoolEntry( "Continuous", true )); 412 reader->setContinuous(config.readBoolEntry( "Continuous", true ));
413 m_targetapp = config.readEntry( "TargetApp", QString::null ); 413 m_targetapp = config.readEntry( "TargetApp", QString::null );
414 m_targetmsg = config.readEntry( "TargetMsg", QString::null ); 414 m_targetmsg = config.readEntry( "TargetMsg", QString::null );
415#ifdef _SCROLLPIPE 415#ifdef _SCROLLPIPE
416 reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null ); 416 reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null );
417 reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true ); 417 reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true );
418#endif 418#endif
419 m_twoTouch = config.readBoolEntry( "TwoTouch", false); 419 m_twoTouch = config.readBoolEntry( "TwoTouch", false);
420 m_doAnnotation = config.readBoolEntry( "Annotation", false); 420 m_doAnnotation = config.readBoolEntry( "Annotation", false);
421 m_doDictionary = config.readBoolEntry( "Dictionary", false); 421 m_doDictionary = config.readBoolEntry( "Dictionary", false);
422 m_doClipboard = config.readBoolEntry( "Clipboard", false); 422 m_doClipboard = config.readBoolEntry( "Clipboard", false);
423 m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll); 423 m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll);
424 m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone); 424 m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone);
425 m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen); 425 m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen);
426 m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut); 426 m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut);
427 m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn); 427 m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn);
428 m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp); 428 m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp);
429 m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown); 429 m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown);
430 430
431 m_leftScroll = config.readBoolEntry("LeftScroll", false); 431 m_leftScroll = config.readBoolEntry("LeftScroll", false);
432 m_rightScroll = config.readBoolEntry("RightScroll", false); 432 m_rightScroll = config.readBoolEntry("RightScroll", false);
433 m_upScroll = config.readBoolEntry("UpScroll", true); 433 m_upScroll = config.readBoolEntry("UpScroll", true);
434 m_downScroll = config.readBoolEntry("DownScroll", true); 434 m_downScroll = config.readBoolEntry("DownScroll", true);
435 435
436 m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false); 436 m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false);
437 reader->setBaseSize(config.readNumEntry( "Basesize", 10 )); 437 reader->setBaseSize(config.readNumEntry( "Basesize", 10 ));
438 438
439#ifndef USEQPE 439#ifndef USEQPE
440 config.setGroup( "Geometry" ); 440 config.setGroup( "Geometry" );
441 setGeometry(0,0, 441 setGeometry(0,0,
442 config.readNumEntry( "width", QApplication::desktop()->width()/2 ), 442 config.readNumEntry( "width", QApplication::desktop()->width()/2 ),
443 config.readNumEntry( "height", QApplication::desktop()->height()/2 )); 443 config.readNumEntry( "height", QApplication::desktop()->height()/2 ));
444 move( 444 move(
445 config.readNumEntry( "x", 20 ), 445 config.readNumEntry( "x", 20 ),
446 config.readNumEntry( "y", 20 )); 446 config.readNumEntry( "y", 20 ));
447#endif 447#endif
448 448
449 449
450 450
451 setTwoTouch(m_twoTouch); 451 setTwoTouch(m_twoTouch);
452 452
453 connect( reader, SIGNAL( OnShowPicture(QImage&) ), this, SLOT( showgraphic(QImage&) ) ); 453 connect( reader, SIGNAL( OnShowPicture(QImage&) ), this, SLOT( showgraphic(QImage&) ) );
454 454
455 connect( reader, SIGNAL( OnRedraw() ), this, SLOT( OnRedraw() ) ); 455 connect( reader, SIGNAL( OnRedraw() ), this, SLOT( OnRedraw() ) );
456 connect( reader, SIGNAL( OnWordSelected(const QString&, size_t, const QString&) ), this, SLOT( OnWordSelected(const QString&, size_t, const QString&) ) ); 456 connect( reader, SIGNAL( OnWordSelected(const QString&,size_t,const QString&) ), this, SLOT( OnWordSelected(const QString&,size_t,const QString&) ) );
457 connect( reader, SIGNAL( OnURLSelected(const QString&) ), this, SLOT( OnURLSelected(const QString&) ) ); 457 connect( reader, SIGNAL( OnURLSelected(const QString&) ), this, SLOT( OnURLSelected(const QString&) ) );
458 editorStack->addWidget( reader, get_unique_id() ); 458 editorStack->addWidget( reader, get_unique_id() );
459 459
460 m_preferences_action = new QAction( tr( "Configuration" ), geticon( "SettingsIcon" ), QString::null, 0, this, NULL); 460 m_preferences_action = new QAction( tr( "Configuration" ), geticon( "SettingsIcon" ), QString::null, 0, this, NULL);
461 connect( m_preferences_action, SIGNAL( activated() ), this, SLOT( showprefs() ) ); 461 connect( m_preferences_action, SIGNAL( activated() ), this, SLOT( showprefs() ) );
462 m_preferences_action->addTo( settings ); 462 m_preferences_action->addTo( settings );
463 463
464 m_saveconfig_action = new QAction( tr( "Save Config" ), QString::null, 0, this, NULL); 464 m_saveconfig_action = new QAction( tr( "Save Config" ), QString::null, 0, this, NULL);
465 connect( m_saveconfig_action, SIGNAL( activated() ), this, SLOT( SaveConfig() ) ); 465 connect( m_saveconfig_action, SIGNAL( activated() ), this, SLOT( SaveConfig() ) );
466 m_saveconfig_action->addTo( settings ); 466 m_saveconfig_action->addTo( settings );
467 467
468 m_loadconfig_action = new QAction( tr( "Load Config" ), QString::null, 0, this, NULL); 468 m_loadconfig_action = new QAction( tr( "Load Config" ), QString::null, 0, this, NULL);
469 connect( m_loadconfig_action, SIGNAL( activated() ), this, SLOT( LoadConfig() ) ); 469 connect( m_loadconfig_action, SIGNAL( activated() ), this, SLOT( LoadConfig() ) );
470 m_loadconfig_action->addTo( settings ); 470 m_loadconfig_action->addTo( settings );
471 471
472 m_tidyconfig_action = new QAction( tr( "Delete Config" ), QString::null, 0, this, NULL); 472 m_tidyconfig_action = new QAction( tr( "Delete Config" ), QString::null, 0, this, NULL);
473 connect( m_tidyconfig_action, SIGNAL( activated() ), this, SLOT( TidyConfig() ) ); 473 connect( m_tidyconfig_action, SIGNAL( activated() ), this, SLOT( TidyConfig() ) );
474 m_tidyconfig_action->addTo( settings ); 474 m_tidyconfig_action->addTo( settings );
475 475
476 settings->insertSeparator(); 476 settings->insertSeparator();
477 m_toolbarprefs_action = new QAction( tr( "Toolbars" ), QString::null, 0, this, NULL); 477 m_toolbarprefs_action = new QAction( tr( "Toolbars" ), QString::null, 0, this, NULL);
478 connect( m_toolbarprefs_action, SIGNAL( activated() ), this, SLOT( showtoolbarprefs() ) ); 478 connect( m_toolbarprefs_action, SIGNAL( activated() ), this, SLOT( showtoolbarprefs() ) );
479 m_toolbarprefs_action->addTo( settings ); 479 m_toolbarprefs_action->addTo( settings );
480 480
481 m_open_action = new QAction( tr( "Open" ), geticon( "fileopen" ), QString::null, 0, this, 0 ); 481 m_open_action = new QAction( tr( "Open" ), geticon( "fileopen" ), QString::null, 0, this, 0 );
482 connect( m_open_action, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); 482 connect( m_open_action, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
483 m_open_action->addTo( file ); 483 m_open_action->addTo( file );
484 484
485 m_close_action = new QAction( tr( "Close" ), geticon( "close" ), QString::null, 0, this, 0 ); 485 m_close_action = new QAction( tr( "Close" ), geticon( "close" ), QString::null, 0, this, 0 );
486 connect( m_close_action, SIGNAL( activated() ), this, SLOT( fileClose() ) ); 486 connect( m_close_action, SIGNAL( activated() ), this, SLOT( fileClose() ) );
487 m_close_action->addTo( file ); 487 m_close_action->addTo( file );
488 488
489#ifdef _SCRIPT 489#ifdef _SCRIPT
490 a = new QAction( tr( "Run Script" ), QString::null, 0, this, NULL); 490 a = new QAction( tr( "Run Script" ), QString::null, 0, this, NULL);
491 connect( a, SIGNAL( activated() ), this, SLOT( RunScript() ) ); 491 connect( a, SIGNAL( activated() ), this, SLOT( RunScript() ) );
492 a->addTo( file ); 492 a->addTo( file );
493#endif 493#endif
494 /* 494 /*
495 a = new QAction( tr( "Revert" ), geticon( "close" ), QString::null, 0, this, 0 ); 495 a = new QAction( tr( "Revert" ), geticon( "close" ), QString::null, 0, this, 0 );
496 connect( a, SIGNAL( activated() ), this, SLOT( fileRevert() ) ); 496 connect( a, SIGNAL( activated() ), this, SLOT( fileRevert() ) );
497 a->addTo( file ); 497 a->addTo( file );
498 498
499 a = new QAction( tr( "Cut" ), geticon( "cut" ), QString::null, 0, this, 0 ); 499 a = new QAction( tr( "Cut" ), geticon( "cut" ), QString::null, 0, this, 0 );
500 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); 500 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
501 a->addTo( filebar() ); 501 a->addTo( filebar() );
502 a->addTo( edit ); 502 a->addTo( edit );
503 */ 503 */
504 504
505 m_info_action = new QAction( tr( "Info" ), geticon( "UtilsIcon" ), QString::null, 0, this, NULL); 505 m_info_action = new QAction( tr( "Info" ), geticon( "UtilsIcon" ), QString::null, 0, this, NULL);
506 connect( m_info_action, SIGNAL( activated() ), this, SLOT( showinfo() ) ); 506 connect( m_info_action, SIGNAL( activated() ), this, SLOT( showinfo() ) );
507 m_info_action->addTo( file ); 507 m_info_action->addTo( file );
508 508
509 m_touch_action = new QAction( tr( "Two/One Touch" ), geticon( "1to1" ), QString::null, 0, this, NULL, true ); 509 m_touch_action = new QAction( tr( "Two/One Touch" ), geticon( "1to1" ), QString::null, 0, this, NULL, true );
510 connect( m_touch_action, SIGNAL( toggled(bool) ), this, SLOT( setTwoTouch(bool) ) ); 510 connect( m_touch_action, SIGNAL( toggled(bool) ), this, SLOT( setTwoTouch(bool) ) );
511 m_touch_action->setOn(m_twoTouch); 511 m_touch_action->setOn(m_twoTouch);
512 m_touch_action->addTo( file ); 512 m_touch_action->addTo( file );
513 513
514 m_find_action = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, NULL); 514 m_find_action = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, NULL);
515 connect( m_find_action, SIGNAL( activated() ), this, SLOT( editFind() ) ); 515 connect( m_find_action, SIGNAL( activated() ), this, SLOT( editFind() ) );
516 file->insertSeparator(); 516 file->insertSeparator();
517// a->addTo( bar ); 517// a->addTo( bar );
518 m_find_action->addTo( file ); 518 m_find_action->addTo( file );
519 519
520 m_exportlinks_action = new QAction( tr( "Export Links" ), QString::null, 0, this, NULL); 520 m_exportlinks_action = new QAction( tr( "Export Links" ), QString::null, 0, this, NULL);
@@ -665,202 +665,202 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
665 connect( m_mark_action, SIGNAL( activated() ), this, SLOT( addbkmk() ) ); 665 connect( m_mark_action, SIGNAL( activated() ), this, SLOT( addbkmk() ) );
666 m_mark_action->addTo( marks ); 666 m_mark_action->addTo( marks );
667 667
668 m_annotate_action = new QAction( tr( "Annotate" ), getmyicon( "annotate" ), QString::null, 0, this, NULL); 668 m_annotate_action = new QAction( tr( "Annotate" ), getmyicon( "annotate" ), QString::null, 0, this, NULL);
669 connect( m_annotate_action, SIGNAL( activated() ), this, SLOT( addanno() ) ); 669 connect( m_annotate_action, SIGNAL( activated() ), this, SLOT( addanno() ) );
670 m_annotate_action->addTo( marks ); 670 m_annotate_action->addTo( marks );
671 671
672 m_goto_action = new QAction( tr( "Goto" ), getmyicon( "bookmark_goto" ), QString::null, 0, this, NULL, false ); 672 m_goto_action = new QAction( tr( "Goto" ), getmyicon( "bookmark_goto" ), QString::null, 0, this, NULL, false );
673 connect( m_goto_action, SIGNAL( activated() ), this, SLOT( do_gotomark() ) ); 673 connect( m_goto_action, SIGNAL( activated() ), this, SLOT( do_gotomark() ) );
674 m_goto_action->addTo( marks ); 674 m_goto_action->addTo( marks );
675 675
676 m_delete_action = new QAction( tr( "Delete" ), getmyicon( "bookmark_delete" ), QString::null, 0, this, NULL); 676 m_delete_action = new QAction( tr( "Delete" ), getmyicon( "bookmark_delete" ), QString::null, 0, this, NULL);
677 connect( m_delete_action, SIGNAL( activated() ), this, SLOT( do_delmark() ) ); 677 connect( m_delete_action, SIGNAL( activated() ), this, SLOT( do_delmark() ) );
678 m_delete_action->addTo( marks ); 678 m_delete_action->addTo( marks );
679 679
680 m_autogen_action = new QAction( tr( "Autogen" ), geticon( "exec" ), QString::null, 0, this, NULL, false ); 680 m_autogen_action = new QAction( tr( "Autogen" ), geticon( "exec" ), QString::null, 0, this, NULL, false );
681 connect( m_autogen_action, SIGNAL( activated() ), this, SLOT( do_autogen() ) ); 681 connect( m_autogen_action, SIGNAL( activated() ), this, SLOT( do_autogen() ) );
682 marks->insertSeparator(); 682 marks->insertSeparator();
683 m_autogen_action->addTo( marks ); 683 m_autogen_action->addTo( marks );
684 684
685 m_clear_action = new QAction( tr( "Clear" ), getmyicon( "bookmark_clear" ), QString::null, 0, this, NULL); 685 m_clear_action = new QAction( tr( "Clear" ), getmyicon( "bookmark_clear" ), QString::null, 0, this, NULL);
686 connect( m_clear_action, SIGNAL( activated() ), this, SLOT( clearBkmkList() ) ); 686 connect( m_clear_action, SIGNAL( activated() ), this, SLOT( clearBkmkList() ) );
687 m_clear_action->addTo( marks ); 687 m_clear_action->addTo( marks );
688 688
689 m_save_action = new QAction( tr( "Save" ), getmyicon( "bookmark_save" ), QString::null, 0, this, NULL ); 689 m_save_action = new QAction( tr( "Save" ), getmyicon( "bookmark_save" ), QString::null, 0, this, NULL );
690 connect( m_save_action, SIGNAL( activated() ), this, SLOT( savebkmks() ) ); 690 connect( m_save_action, SIGNAL( activated() ), this, SLOT( savebkmks() ) );
691 m_save_action->addTo( marks ); 691 m_save_action->addTo( marks );
692 692
693 m_tidy_action = new QAction( tr( "Tidy" ), getmyicon( "bookmark_tidy" ), QString::null, 0, this, NULL); 693 m_tidy_action = new QAction( tr( "Tidy" ), getmyicon( "bookmark_tidy" ), QString::null, 0, this, NULL);
694 connect( m_tidy_action, SIGNAL( activated() ), this, SLOT( listBkmkFiles() ) ); 694 connect( m_tidy_action, SIGNAL( activated() ), this, SLOT( listBkmkFiles() ) );
695 marks->insertSeparator(); 695 marks->insertSeparator();
696 m_tidy_action->addTo( marks ); 696 m_tidy_action->addTo( marks );
697 697
698 m_startBlock_action = new QAction( tr( "Start Block" ), geticon( "new" ), QString::null, 0, this, NULL); 698 m_startBlock_action = new QAction( tr( "Start Block" ), geticon( "new" ), QString::null, 0, this, NULL);
699 connect( m_startBlock_action, SIGNAL( activated() ), this, SLOT( editMark() ) ); 699 connect( m_startBlock_action, SIGNAL( activated() ), this, SLOT( editMark() ) );
700 marks->insertSeparator(); 700 marks->insertSeparator();
701 m_startBlock_action->addTo( marks ); 701 m_startBlock_action->addTo( marks );
702 702
703 m_endBlock_action = new QAction( tr( "Copy Block" ), geticon( "copy" ), QString::null, 0, this, NULL); 703 m_endBlock_action = new QAction( tr( "Copy Block" ), geticon( "copy" ), QString::null, 0, this, NULL);
704 connect( m_endBlock_action, SIGNAL( activated() ), this, SLOT( editCopy() ) ); 704 connect( m_endBlock_action, SIGNAL( activated() ), this, SLOT( editCopy() ) );
705 m_endBlock_action->addTo( marks ); 705 m_endBlock_action->addTo( marks );
706 706
707 m_bkmkAvail = NULL; 707 m_bkmkAvail = NULL;
708 708
709 709
710 setToolBarsMovable(m_tbmove); 710 setToolBarsMovable(m_tbmove);
711 addtoolbars(&config); 711 addtoolbars(&config);
712 712
713 pbar = new QProgressBar(this); 713 pbar = new QProgressBar(this);
714 pbar->hide(); 714 pbar->hide();
715 715
716 searchBar = new QFloatBar( "Search", this, QMainWindow::Top, TRUE ); 716 searchBar = new QFloatBar( "Search", this, QMainWindow::Top, TRUE );
717 717
718 searchBar->setHorizontalStretchable( TRUE ); 718 searchBar->setHorizontalStretchable( TRUE );
719 719
720 connect(searchBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); 720 connect(searchBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() ));
721 721
722 searchEdit = new QLineEdit( searchBar, "searchEdit" ); 722 searchEdit = new QLineEdit( searchBar, "searchEdit" );
723// QFont f("unifont", 16 /*, QFont::Bold*/); 723// QFont f("unifont", 16 /*, QFont::Bold*/);
724// searchEdit->setFont( f ); 724// searchEdit->setFont( f );
725 searchBar->setStretchableWidget( searchEdit ); 725 searchBar->setStretchableWidget( searchEdit );
726 726
727 727
728#ifdef __ISEARCH 728#ifdef __ISEARCH
729 connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 729 connect( searchEdit, SIGNAL( textChanged(const QString&) ),
730 this, SLOT( search( const QString& ) ) ); 730 this, SLOT( search(const QString&) ) );
731#else 731#else
732 connect( searchEdit, SIGNAL( returnPressed( ) ), 732 connect( searchEdit, SIGNAL( returnPressed() ),
733 this, SLOT( search( ) ) ); 733 this, SLOT( search() ) );
734#endif 734#endif
735 QAction*a = new QAction( tr( "Find Next" ), geticon( "next" ), QString::null, 0, this, 0 ); 735 QAction*a = new QAction( tr( "Find Next" ), geticon( "next" ), QString::null, 0, this, 0 );
736 connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); 736 connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) );
737 a->addTo( searchBar ); 737 a->addTo( searchBar );
738 738
739 a = new QAction( tr( "Close Find" ), geticon( "close" ), QString::null, 0, this, 0 ); 739 a = new QAction( tr( "Close Find" ), geticon( "close" ), QString::null, 0, this, 0 );
740 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 740 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
741 a->addTo( searchBar ); 741 a->addTo( searchBar );
742 742
743 searchBar->hide(); 743 searchBar->hide();
744 744
745 regBar = new QFloatBar( "Autogen", this, QMainWindow::Top, TRUE ); 745 regBar = new QFloatBar( "Autogen", this, QMainWindow::Top, TRUE );
746 connect(regBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); 746 connect(regBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() ));
747 747
748 regBar->setHorizontalStretchable( TRUE ); 748 regBar->setHorizontalStretchable( TRUE );
749 749
750 regEdit = new QLineEdit( regBar, "regEdit" ); 750 regEdit = new QLineEdit( regBar, "regEdit" );
751// regEdit->setFont( f ); 751// regEdit->setFont( f );
752 752
753 regBar->setStretchableWidget( regEdit ); 753 regBar->setStretchableWidget( regEdit );
754 754
755 connect( regEdit, SIGNAL( returnPressed( ) ), 755 connect( regEdit, SIGNAL( returnPressed() ),
756 this, SLOT( do_regaction() ) ); 756 this, SLOT( do_regaction() ) );
757 757
758 a = new QAction( tr( "Do Reg" ), geticon( "enter" ), QString::null, 0, this, 0 ); 758 a = new QAction( tr( "Do Reg" ), geticon( "enter" ), QString::null, 0, this, 0 );
759 connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) ); 759 connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) );
760 a->addTo( regBar ); 760 a->addTo( regBar );
761 761
762 a = new QAction( tr( "Close Edit" ), geticon( "close" ), QString::null, 0, this, 0 ); 762 a = new QAction( tr( "Close Edit" ), geticon( "close" ), QString::null, 0, this, 0 );
763 connect( a, SIGNAL( activated() ), this, SLOT( regClose() ) ); 763 connect( a, SIGNAL( activated() ), this, SLOT( regClose() ) );
764 a->addTo( regBar ); 764 a->addTo( regBar );
765 765
766 regBar->hide(); 766 regBar->hide();
767 767
768 m_fontBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE ); 768 m_fontBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE );
769 769
770 m_fontBar->setHorizontalStretchable( TRUE ); 770 m_fontBar->setHorizontalStretchable( TRUE );
771 771
772// qDebug("Font selector"); 772// qDebug("Font selector");
773 m_fontSelector = new QComboBox(false, m_fontBar); 773 m_fontSelector = new QComboBox(false, m_fontBar);
774 m_fontBar->setStretchableWidget( m_fontSelector ); 774 m_fontBar->setStretchableWidget( m_fontSelector );
775 { 775 {
776#ifndef USEQPE 776#ifndef USEQPE
777 QFontDatabase f; 777 QFontDatabase f;
778#else 778#else
779 FontDatabase f; 779 FontDatabase f;
780#endif 780#endif
781 QStringList flist = f.families(); 781 QStringList flist = f.families();
782 bool realfont = false; 782 bool realfont = false;
783 for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) 783 for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++)
784 { 784 {
785 if (reader->m_fontname == *nm) 785 if (reader->m_fontname == *nm)
786 { 786 {
787 realfont = true; 787 realfont = true;
788 } 788 }
789 if ((*nm).contains(FIXEDFONT,false)) reader->m_fontControl.hasCourier(true, *nm); 789 if ((*nm).contains(FIXEDFONT,false)) reader->m_fontControl.hasCourier(true, *nm);
790 } 790 }
791 if (!realfont) reader->m_fontname = flist[0]; 791 if (!realfont) reader->m_fontname = flist[0];
792 } // delete the FontDatabase!!! 792 } // delete the FontDatabase!!!
793 connect( m_fontSelector, SIGNAL( activated(const QString& ) ), 793 connect( m_fontSelector, SIGNAL( activated(const QString&) ),
794 this, SLOT( do_setfont(const QString&) ) ); 794 this, SLOT( do_setfont(const QString&) ) );
795 connect( m_fontSelector, SIGNAL( activated(int ) ), 795 connect( m_fontSelector, SIGNAL( activated(int) ),
796 this, SLOT( do_setencoding(int) ) ); 796 this, SLOT( do_setencoding(int) ) );
797 797
798 m_fontBar->hide(); 798 m_fontBar->hide();
799 m_fontVisible = false; 799 m_fontVisible = false;
800#ifdef USEMSGS 800#ifdef USEMSGS
801 connect(qApp, SIGNAL( appMessage(const QCString&, const QByteArray& ) ), 801 connect(qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
802 this, SLOT( msgHandler(const QCString&, const QByteArray&) ) ); 802 this, SLOT( msgHandler(const QCString&,const QByteArray&) ) );
803#endif 803#endif
804// qDebug("Initing"); 804// qDebug("Initing");
805 reader->init(); 805 reader->init();
806// qDebug("Inited"); 806// qDebug("Inited");
807// m_buttonAction[m_spaceTarget]->setOn(true); 807// m_buttonAction[m_spaceTarget]->setOn(true);
808// qDebug("fonting"); 808// qDebug("fonting");
809 do_setfont(reader->m_fontname); 809 do_setfont(reader->m_fontname);
810 if (!reader->m_lastfile.isEmpty()) 810 if (!reader->m_lastfile.isEmpty())
811 { 811 {
812 //qDebug("doclnk"); 812 //qDebug("doclnk");
813 //doc = new DocLnk(reader->m_lastfile); 813 //doc = new DocLnk(reader->m_lastfile);
814 //qDebug("doclnk done"); 814 //qDebug("doclnk done");
815 if (pOpenlist != NULL) 815 if (pOpenlist != NULL)
816 { 816 {
817 817
818/* 818/*
819 int ind = 0; 819 int ind = 0;
820 Bkmk* p = (*pOpenlist)[ind]; 820 Bkmk* p = (*pOpenlist)[ind];
821 while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) 821 while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile)
822 { 822 {
823 p = (*pOpenlist)[++ind]; 823 p = (*pOpenlist)[++ind];
824 } 824 }
825*/ 825*/
826 Bkmk* p = NULL; 826 Bkmk* p = NULL;
827 for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) 827 for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++)
828 { 828 {
829 p = iter.pContent(); 829 p = iter.pContent();
830 if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) 830 if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile)
831 { 831 {
832 break; 832 break;
833 } 833 }
834 // qDebug("Item:%s", (const char*)toQString(CFiledata(p->anno()).name())); 834 // qDebug("Item:%s", (const char*)toQString(CFiledata(p->anno()).name()));
835 p = NULL; 835 p = NULL;
836 } 836 }
837 if (p != NULL) 837 if (p != NULL)
838 { 838 {
839 //qDebug("openfrombkmk"); 839 //qDebug("openfrombkmk");
840 if (!openfrombkmk(p)) 840 if (!openfrombkmk(p))
841 showEditTools(); 841 showEditTools();
842 } 842 }
843 else 843 else
844 { 844 {
845 //qDebug("openfile"); 845 //qDebug("openfile");
846 openFile( reader->m_lastfile ); 846 openFile( reader->m_lastfile );
847 } 847 }
848 } 848 }
849 else 849 else
850 { 850 {
851 // qDebug("Openfile 2"); 851 // qDebug("Openfile 2");
852 if (!reader->m_lastfile.isEmpty()) 852 if (!reader->m_lastfile.isEmpty())
853 openFile( reader->m_lastfile ); 853 openFile( reader->m_lastfile );
854 } 854 }
855 } 855 }
856 else 856 else
857 { 857 {
858 showEditTools(); 858 showEditTools();
859 } 859 }
860// qApp->processEvents(); 860// qApp->processEvents();
861 reader->bDoUpdates = true; 861 reader->bDoUpdates = true;
862 reader->update(); 862 reader->update();
863 config.setGroup("Version"); 863 config.setGroup("Version");
864 int major = config.readNumEntry("Major", 0); 864 int major = config.readNumEntry("Major", 0);
865 int bkmktype = config.readNumEntry("BkmkType", 0); 865 int bkmktype = config.readNumEntry("BkmkType", 0);
866 char minor = config.readNumEntry("Minor", 0); 866 char minor = config.readNumEntry("Minor", 0);
diff --git a/noncore/apps/opie-reader/fileBrowser.cpp b/noncore/apps/opie-reader/fileBrowser.cpp
index ebd14f3..e1cde6c 100644
--- a/noncore/apps/opie-reader/fileBrowser.cpp
+++ b/noncore/apps/opie-reader/fileBrowser.cpp
@@ -13,132 +13,132 @@ Extensive modification by Tim Wentford to allow it to work in rotated mode
13#include <qlineedit.h> 13#include <qlineedit.h>
14#include <qpushbutton.h> 14#include <qpushbutton.h>
15#ifndef _WINDOWS 15#ifndef _WINDOWS
16#include <unistd.h> 16#include <unistd.h>
17#endif 17#endif
18#include <qlayout.h> 18#include <qlayout.h>
19#ifdef _WINDOWS 19#ifdef _WINDOWS
20#include <direct.h> 20#include <direct.h>
21#endif 21#endif
22 22
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24 24
25 25
26fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter, const QString iPath ) 26fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter, const QString iPath )
27 : QDialog( parent, name, true, 27 : QDialog( parent, name, true,
28 fl/* | WStyle_Customize | WStyle_Tool*/), 28 fl/* | WStyle_Customize | WStyle_Tool*/),
29 filterspec(QDir::All) 29 filterspec(QDir::All)
30{ 30{
31// showMaximized(); 31// showMaximized();
32 if ( !name ) 32 if ( !name )
33 setName( "fileBrowser" ); 33 setName( "fileBrowser" );
34/* 34/*
35 if (parent != NULL) 35 if (parent != NULL)
36 { 36 {
37#ifdef OPIE 37#ifdef OPIE
38 move(0,0); 38 move(0,0);
39 resize( parent->width(), parent->height() ); 39 resize( parent->width(), parent->height() );
40#else 40#else
41 setGeometry(parent->x(), parent->y(), parent->width(), parent->height() ); 41 setGeometry(parent->x(), parent->y(), parent->width(), parent->height() );
42#endif 42#endif
43 } 43 }
44*/ 44*/
45// showFullScreen(); 45// showFullScreen();
46 setCaption(tr( "Browse for file" ) ); 46 setCaption(tr( "Browse for file" ) );
47 filterStr=filter; 47 filterStr=filter;
48 48
49 buttonOk = new QPushButton( this, "buttonOk" ); 49 buttonOk = new QPushButton( this, "buttonOk" );
50 buttonOk->setFixedSize( 25, 25 ); 50 buttonOk->setFixedSize( 25, 25 );
51 buttonOk->setAutoDefault( false ); 51 buttonOk->setAutoDefault( false );
52 buttonOk->setText( tr( "/" ) ); 52 buttonOk->setText( tr( "/" ) );
53 53
54 buttonShowHidden = new QPushButton( this, "buttonShowHidden" ); 54 buttonShowHidden = new QPushButton( this, "buttonShowHidden" );
55// buttonShowHidden->setFixedSize( 50, 25 ); 55// buttonShowHidden->setFixedSize( 50, 25 );
56 buttonShowHidden->setText( tr( "Hidden" ) ); 56 buttonShowHidden->setText( tr( "Hidden" ) );
57 buttonShowHidden->setAutoDefault( false ); 57 buttonShowHidden->setAutoDefault( false );
58 buttonShowHidden->setToggleButton( true ); 58 buttonShowHidden->setToggleButton( true );
59 buttonShowHidden->setOn( false ); 59 buttonShowHidden->setOn( false );
60 60
61 dirLabel = new QLabel(this, "DirLabel"); 61 dirLabel = new QLabel(this, "DirLabel");
62 dirLabel->setAlignment(AlignLeft | AlignVCenter | ExpandTabs | WordBreak); 62 dirLabel->setAlignment(AlignLeft | AlignVCenter | ExpandTabs | WordBreak);
63 dirLabel->setText(currentDir.canonicalPath()); 63 dirLabel->setText(currentDir.canonicalPath());
64 64
65 ListView = new QtrListView( this, "ListView" ); 65 ListView = new QtrListView( this, "ListView" );
66 ListView->addColumn( tr( "Name" ) ); 66 ListView->addColumn( tr( "Name" ) );
67 ListView->setSorting( 2, FALSE); 67 ListView->setSorting( 2, FALSE);
68 ListView->addColumn( tr( "Size" ) ); 68 ListView->addColumn( tr( "Size" ) );
69 ListView->setSelectionMode(QListView::Single); 69 ListView->setSelectionMode(QListView::Single);
70 ListView->setAllColumnsShowFocus( TRUE ); 70 ListView->setAllColumnsShowFocus( TRUE );
71 ListView->setColumnWidthMode(0, QListView::Manual); 71 ListView->setColumnWidthMode(0, QListView::Manual);
72 ListView->setColumnWidthMode(1, QListView::Manual); 72 ListView->setColumnWidthMode(1, QListView::Manual);
73 73
74 // signals and slots connections 74 // signals and slots connections
75 connect( buttonShowHidden, SIGNAL( toggled(bool) ), this, SLOT( setHidden(bool) ) ); 75 connect( buttonShowHidden, SIGNAL( toggled(bool) ), this, SLOT( setHidden(bool) ) );
76 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( OnRoot() ) ); 76 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( OnRoot() ) );
77 connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); 77 connect( ListView, SIGNAL(doubleClicked(QListViewItem*)), SLOT(listDoubleClicked(QListViewItem*)) );
78 connect( ListView, SIGNAL(clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); 78 connect( ListView, SIGNAL(clicked(QListViewItem*)), SLOT(listClicked(QListViewItem*)) );
79 connect( ListView, SIGNAL(OnOKButton( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); 79 connect( ListView, SIGNAL(OnOKButton(QListViewItem*)), SLOT(listClicked(QListViewItem*)) );
80 connect( ListView, SIGNAL(OnCentreButton( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); 80 connect( ListView, SIGNAL(OnCentreButton(QListViewItem*)), SLOT(listClicked(QListViewItem*)) );
81 connect( ListView, SIGNAL(OnCancelButton()), SLOT(OnCancel()) ); 81 connect( ListView, SIGNAL(OnCancelButton()), SLOT(OnCancel()) );
82 82
83 QVBoxLayout* grid = new QVBoxLayout(this); 83 QVBoxLayout* grid = new QVBoxLayout(this);
84 QHBoxLayout* hgrid = new QHBoxLayout(grid); 84 QHBoxLayout* hgrid = new QHBoxLayout(grid);
85 hgrid->addWidget(dirLabel,1); 85 hgrid->addWidget(dirLabel,1);
86 hgrid->addWidget(buttonShowHidden); 86 hgrid->addWidget(buttonShowHidden);
87 hgrid->addWidget(buttonOk); 87 hgrid->addWidget(buttonOk);
88 grid->addWidget(ListView,1); 88 grid->addWidget(ListView,1);
89 if (allownew) 89 if (allownew)
90 { 90 {
91 m_filename = new QLineEdit(this); 91 m_filename = new QLineEdit(this);
92 grid->addWidget(m_filename); 92 grid->addWidget(m_filename);
93 connect( m_filename, SIGNAL( returnPressed() ), this, SLOT( onReturn() )); 93 connect( m_filename, SIGNAL( returnPressed() ), this, SLOT( onReturn() ));
94 } 94 }
95 else 95 else
96 { 96 {
97 m_filename = NULL; 97 m_filename = NULL;
98 } 98 }
99 99
100 if (QFileInfo(iPath).exists()) 100 if (QFileInfo(iPath).exists())
101 { 101 {
102 currentDir.setPath(iPath); 102 currentDir.setPath(iPath);
103#ifdef _WINDOWS 103#ifdef _WINDOWS
104 _chdir(iPath.latin1()); 104 _chdir(iPath.latin1());
105#else 105#else
106 chdir(iPath.latin1()); 106 chdir(iPath.latin1());
107#endif 107#endif
108 } 108 }
109 else 109 else
110 { 110 {
111 currentDir.setPath(QDir::currentDirPath()); 111 currentDir.setPath(QDir::currentDirPath());
112 chdir(QDir::currentDirPath().latin1()); 112 chdir(QDir::currentDirPath().latin1());
113 } 113 }
114 114
115 populateList(); 115 populateList();
116 116
117 if (modal) 117 if (modal)
118 QPEApplication::showDialog( this ); 118 QPEApplication::showDialog( this );
119} 119}
120 120
121void fileBrowser::resizeEvent(QResizeEvent* e) 121void fileBrowser::resizeEvent(QResizeEvent* e)
122{ 122{
123 ListView->setColumnWidth(1,(ListView->width())/4); 123 ListView->setColumnWidth(1,(ListView->width())/4);
124 ListView->setColumnWidth(0,ListView->width()-20-ListView->columnWidth(1)); 124 ListView->setColumnWidth(0,ListView->width()-20-ListView->columnWidth(1));
125} 125}
126 126
127fileBrowser::~fileBrowser() 127fileBrowser::~fileBrowser()
128{ 128{
129} 129}
130 130
131 131
132void fileBrowser::populateList() 132void fileBrowser::populateList()
133{ 133{
134 ListView->clear(); 134 ListView->clear();
135////qDebug(currentDir.canonicalPath()); 135////qDebug(currentDir.canonicalPath());
136// currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks ); 136// currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks );
137 currentDir.setFilter( filterspec ); 137 currentDir.setFilter( filterspec );
138 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 138 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
139 currentDir.setMatchAllDirs(TRUE); 139 currentDir.setMatchAllDirs(TRUE);
140 140
141 currentDir.setNameFilter(filterStr); 141 currentDir.setNameFilter(filterStr);
142// currentDir.setNameFilter("*.txt;*.etx"); 142// currentDir.setNameFilter("*.txt;*.etx");
143 QString fileL, fileS; 143 QString fileL, fileS;
144 const QFileInfoList *list = currentDir.entryInfoList(); 144 const QFileInfoList *list = currentDir.entryInfoList();
diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp
index 1fb2a3d..061748e 100644
--- a/noncore/apps/opie-sheet/mainwindow.cpp
+++ b/noncore/apps/opie-sheet/mainwindow.cpp
@@ -1,110 +1,110 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 9
10/* 10/*
11 * Opie Sheet (formerly Sheet/Qt) 11 * Opie Sheet (formerly Sheet/Qt)
12 * by Serdar Ozler <sozler@sitebest.com> 12 * by Serdar Ozler <sozler@sitebest.com>
13 */ 13 */
14 14
15#include "mainwindow.h" 15#include "mainwindow.h"
16 16
17#include <qpe/resource.h> 17#include <qpe/resource.h>
18#include <qpe/qpeapplication.h> 18#include <qpe/qpeapplication.h>
19 19
20#include <qmessagebox.h> 20#include <qmessagebox.h>
21#include <qradiobutton.h> 21#include <qradiobutton.h>
22 22
23#include "cellformat.h" 23#include "cellformat.h"
24#include "numberdlg.h" 24#include "numberdlg.h"
25#include "textdlg.h" 25#include "textdlg.h"
26#include "sortdlg.h" 26#include "sortdlg.h"
27#include "finddlg.h" 27#include "finddlg.h"
28 28
29#define DEFAULT_NUM_ROWS 300 29#define DEFAULT_NUM_ROWS 300
30#define DEFAULT_NUM_COLS (26*3) 30#define DEFAULT_NUM_COLS (26*3)
31#define DEFAULT_NUM_SHEETS 3 31#define DEFAULT_NUM_SHEETS 3
32 32
33MainWindow::MainWindow(QWidget *parent, const char* n, WFlags fl) 33MainWindow::MainWindow(QWidget *parent, const char* n, WFlags fl)
34 :QMainWindow(parent, n, fl) 34 :QMainWindow(parent, n, fl)
35{ 35{
36 // initialize variables 36 // initialize variables
37 documentModified=FALSE; 37 documentModified=FALSE;
38 38
39 // construct objects 39 // construct objects
40 currentDoc=0; 40 currentDoc=0;
41 fileSelector=new FileSelector("application/sheet-qt", this, QString::null); 41 fileSelector=new FileSelector("application/sheet-qt", this, QString::null);
42 ExcelSelector=new FileSelector("application/excel",this,QString::null,FALSE); 42 ExcelSelector=new FileSelector("application/excel",this,QString::null,FALSE);
43 connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide())); 43 connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide()));
44 connect(fileSelector, SIGNAL(newSelected(const DocLnk &)), this, SLOT(selectorFileNew(const DocLnk &))); 44 connect(fileSelector, SIGNAL(newSelected(const DocLnk&)), this, SLOT(selectorFileNew(const DocLnk&)));
45 connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), this, SLOT(selectorFileOpen(const DocLnk &))); 45 connect(fileSelector, SIGNAL(fileSelected(const DocLnk&)), this, SLOT(selectorFileOpen(const DocLnk&)));
46 connect(ExcelSelector,SIGNAL(fileSelected(const DocLnk &)),this,SLOT(slotImportExcel(const DocLnk &))); 46 connect(ExcelSelector,SIGNAL(fileSelected(const DocLnk&)),this,SLOT(slotImportExcel(const DocLnk&)));
47 connect(ExcelSelector,SIGNAL(closeMe()), this, SLOT(ExcelSelectorHide())); 47 connect(ExcelSelector,SIGNAL(closeMe()), this, SLOT(ExcelSelectorHide()));
48 48
49 49
50 listSheets.setAutoDelete(TRUE); 50 listSheets.setAutoDelete(TRUE);
51 51
52 initActions(); 52 initActions();
53 initMenu(); 53 initMenu();
54 initEditToolbar(); 54 initEditToolbar();
55 initFunctionsToolbar(); 55 initFunctionsToolbar();
56 initStandardToolbar(); 56 initStandardToolbar();
57 initSheet(); 57 initSheet();
58 58
59 // set window title 59 // set window title
60 setCaption(tr("Opie Sheet")); 60 setCaption(tr("Opie Sheet"));
61 61
62 // create sheets 62 // create sheets
63 selectorFileNew(DocLnk()); 63 selectorFileNew(DocLnk());
64} 64}
65 65
66MainWindow::~MainWindow() 66MainWindow::~MainWindow()
67{ 67{
68 if (currentDoc) delete currentDoc; 68 if (currentDoc) delete currentDoc;
69} 69}
70 70
71void MainWindow::documentSave(DocLnk *lnkDoc) 71void MainWindow::documentSave(DocLnk *lnkDoc)
72{ 72{
73 FileManager fm; 73 FileManager fm;
74 QByteArray streamBuffer; 74 QByteArray streamBuffer;
75 QDataStream stream(streamBuffer, IO_WriteOnly); 75 QDataStream stream(streamBuffer, IO_WriteOnly);
76 76
77 typeSheet *currentSheet=findSheet(sheet->getName()); 77 typeSheet *currentSheet=findSheet(sheet->getName());
78 if (!currentSheet) 78 if (!currentSheet)
79 { 79 {
80 QMessageBox::critical(this, tr("Error"), tr("Inconsistency error!")); 80 QMessageBox::critical(this, tr("Error"), tr("Inconsistency error!"));
81 return; 81 return;
82 } 82 }
83 sheet->copySheetData(&currentSheet->data); 83 sheet->copySheetData(&currentSheet->data);
84 stream.writeRawBytes("SQT100", 6); 84 stream.writeRawBytes("SQT100", 6);
85 stream << (Q_UINT32)listSheets.count(); 85 stream << (Q_UINT32)listSheets.count();
86 for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) 86 for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next())
87 { 87 {
88 stream << tempSheet->name << (Q_UINT32)tempSheet->data.count(); 88 stream << tempSheet->name << (Q_UINT32)tempSheet->data.count();
89 for (typeCellData *tempCell=tempSheet->data.first(); tempCell; tempCell=tempSheet->data.next()) 89 for (typeCellData *tempCell=tempSheet->data.first(); tempCell; tempCell=tempSheet->data.next())
90 stream << (Q_UINT32)tempCell->col << (Q_UINT32)tempCell->row << tempCell->borders.right << tempCell->borders.bottom << tempCell->background << (Q_UINT32)tempCell->alignment << tempCell->fontColor << tempCell->font << tempCell->data; 90 stream << (Q_UINT32)tempCell->col << (Q_UINT32)tempCell->row << tempCell->borders.right << tempCell->borders.bottom << tempCell->background << (Q_UINT32)tempCell->alignment << tempCell->fontColor << tempCell->font << tempCell->data;
91 } 91 }
92 92
93 lnkDoc->setType("application/sheet-qt"); 93 lnkDoc->setType("application/sheet-qt");
94 if (!fm.saveFile(*lnkDoc, streamBuffer)) 94 if (!fm.saveFile(*lnkDoc, streamBuffer))
95 { 95 {
96 QMessageBox::critical(this, tr("Error"), tr("File cannot be saved!")); 96 QMessageBox::critical(this, tr("Error"), tr("File cannot be saved!"));
97 return; 97 return;
98 } 98 }
99 documentModified=FALSE; 99 documentModified=FALSE;
100} 100}
101 101
102void MainWindow::documentOpen(const DocLnk &lnkDoc) 102void MainWindow::documentOpen(const DocLnk &lnkDoc)
103{ 103{
104 FileManager fm; 104 FileManager fm;
105 QByteArray streamBuffer; 105 QByteArray streamBuffer;
106 if (!lnkDoc.isValid() || !fm.loadFile(lnkDoc, streamBuffer)) 106 if (!lnkDoc.isValid() || !fm.loadFile(lnkDoc, streamBuffer))
107 { 107 {
108 QMessageBox::critical(this, tr("Error"), tr("File cannot be opened!")); 108 QMessageBox::critical(this, tr("Error"), tr("File cannot be opened!"));
109 documentModified=FALSE; 109 documentModified=FALSE;
110 selectorFileNew(DocLnk()); 110 selectorFileNew(DocLnk());
@@ -519,189 +519,189 @@ void MainWindow::initMenu()
519 submenuFuncStat=new QPopupMenu; 519 submenuFuncStat=new QPopupMenu;
520 addFlyAction(tr("AVERAGE(range)"), tr("AVERAGE(range)"), "AVERAGE(",submenuFuncStat); 520 addFlyAction(tr("AVERAGE(range)"), tr("AVERAGE(range)"), "AVERAGE(",submenuFuncStat);
521 addFlyAction(tr("COUNT(range)"), tr("COUNT(range)"), "COUNT(",submenuFuncStat); 521 addFlyAction(tr("COUNT(range)"), tr("COUNT(range)"), "COUNT(",submenuFuncStat);
522 addFlyAction(tr("COUNTIF(range,eqls)"), tr("COUNTIF(range,eqls)"), "COUNTIF(",submenuFuncStat); 522 addFlyAction(tr("COUNTIF(range,eqls)"), tr("COUNTIF(range,eqls)"), "COUNTIF(",submenuFuncStat);
523 addFlyAction(tr("MAX(range)"), tr("MAX(range)"), "MAX(",submenuFuncStat); 523 addFlyAction(tr("MAX(range)"), tr("MAX(range)"), "MAX(",submenuFuncStat);
524 addFlyAction(tr("MIN(range)"), tr("MIN(range)"), "MIN(",submenuFuncStat); 524 addFlyAction(tr("MIN(range)"), tr("MIN(range)"), "MIN(",submenuFuncStat);
525 addFlyAction(tr("SUM(range)"), tr("SUM(range)"), "SUM(",submenuFuncStat); 525 addFlyAction(tr("SUM(range)"), tr("SUM(range)"), "SUM(",submenuFuncStat);
526 addFlyAction(tr("SUMSQ(range)"), tr("SUMSQ(range)"), "SUMSQ(",submenuFuncStat); 526 addFlyAction(tr("SUMSQ(range)"), tr("SUMSQ(range)"), "SUMSQ(",submenuFuncStat);
527 submenuFuncStat->insertSeparator(); 527 submenuFuncStat->insertSeparator();
528 addFlyAction(tr("AVERAGE(range)"), tr("AVERAGE(range)"), "AVERAGE(",submenuFuncStat); 528 addFlyAction(tr("AVERAGE(range)"), tr("AVERAGE(range)"), "AVERAGE(",submenuFuncStat);
529 addFlyAction(tr("VAR(range)"), tr("VAR(range)"), "VAR(",submenuFuncStat); 529 addFlyAction(tr("VAR(range)"), tr("VAR(range)"), "VAR(",submenuFuncStat);
530 addFlyAction(tr("VARP(range)"), tr("VARP(range)"), "VARP(",submenuFuncStat); 530 addFlyAction(tr("VARP(range)"), tr("VARP(range)"), "VARP(",submenuFuncStat);
531 addFlyAction(tr("STDEV(range)"), tr("STDEV(range)"), "STDEV(",submenuFuncStat); 531 addFlyAction(tr("STDEV(range)"), tr("STDEV(range)"), "STDEV(",submenuFuncStat);
532 addFlyAction(tr("STDEVP(range)"), tr("STDEVP(range)"), "STDEVP(",submenuFuncStat); 532 addFlyAction(tr("STDEVP(range)"), tr("STDEVP(range)"), "STDEVP(",submenuFuncStat);
533 addFlyAction(tr("SKEW(range)"), tr("SKEW(range)"), "SKEW(",submenuFuncStat); 533 addFlyAction(tr("SKEW(range)"), tr("SKEW(range)"), "SKEW(",submenuFuncStat);
534 addFlyAction(tr("KURT(range)"), tr("KURT(range)"), "KURT(",submenuFuncStat); 534 addFlyAction(tr("KURT(range)"), tr("KURT(range)"), "KURT(",submenuFuncStat);
535 submenuFunc->insertItem(tr("Sta&tistical"), submenuFuncStat); 535 submenuFunc->insertItem(tr("Sta&tistical"), submenuFuncStat);
536 536
537 submenuFuncScientific=new QPopupMenu; 537 submenuFuncScientific=new QPopupMenu;
538 addFlyAction(tr("BESSELI(x,n)"), tr("BESSELI(x,n)"), "BESSELI(",submenuFuncScientific); 538 addFlyAction(tr("BESSELI(x,n)"), tr("BESSELI(x,n)"), "BESSELI(",submenuFuncScientific);
539 addFlyAction(tr("BESSELJ(x,n)"), tr("BESSELJ(x,n)"), "BESSELJ(",submenuFuncScientific); 539 addFlyAction(tr("BESSELJ(x,n)"), tr("BESSELJ(x,n)"), "BESSELJ(",submenuFuncScientific);
540 addFlyAction(tr("BESSELK(x,n)"), tr("BESSELK(x,n)"), "BESSELK(",submenuFuncScientific); 540 addFlyAction(tr("BESSELK(x,n)"), tr("BESSELK(x,n)"), "BESSELK(",submenuFuncScientific);
541 addFlyAction(tr("BESSELY(x,n)"), tr("BESSELY(x,n)"), "BESSELY(",submenuFuncScientific); 541 addFlyAction(tr("BESSELY(x,n)"), tr("BESSELY(x,n)"), "BESSELY(",submenuFuncScientific);
542 submenuFuncScientific->insertSeparator(); 542 submenuFuncScientific->insertSeparator();
543 addFlyAction(tr("BETAI(x,a,b)"), tr("BETAI(x,a,b)"), "BETAI(",submenuFuncScientific); 543 addFlyAction(tr("BETAI(x,a,b)"), tr("BETAI(x,a,b)"), "BETAI(",submenuFuncScientific);
544 addFlyAction(tr("ERF(a,b)"), tr("ERF(a,b)"), "ERF(",submenuFuncScientific); 544 addFlyAction(tr("ERF(a,b)"), tr("ERF(a,b)"), "ERF(",submenuFuncScientific);
545 addFlyAction(tr("ERFC(a,b)"), tr("ERFC(a,b)"), "ERFC(",submenuFuncScientific); 545 addFlyAction(tr("ERFC(a,b)"), tr("ERFC(a,b)"), "ERFC(",submenuFuncScientific);
546 addFlyAction(tr("GAMMALN(x)"), tr("GAMMALN(x)"), "GAMMALN(",submenuFuncScientific); 546 addFlyAction(tr("GAMMALN(x)"), tr("GAMMALN(x)"), "GAMMALN(",submenuFuncScientific);
547 addFlyAction(tr("GAMMAP(x,a)"), tr("GAMMAP(x,a)"), "GAMMAP(",submenuFuncScientific); 547 addFlyAction(tr("GAMMAP(x,a)"), tr("GAMMAP(x,a)"), "GAMMAP(",submenuFuncScientific);
548 addFlyAction(tr("GAMMAQ(x,a)"), tr("GAMMAQ(x,a)"), "GAMMAQ(",submenuFuncScientific); 548 addFlyAction(tr("GAMMAQ(x,a)"), tr("GAMMAQ(x,a)"), "GAMMAQ(",submenuFuncScientific);
549 submenuFunc->insertItem(tr("Scienti&fic"), submenuFuncScientific); 549 submenuFunc->insertItem(tr("Scienti&fic"), submenuFuncScientific);
550 550
551 submenuFuncDistr=new QPopupMenu; 551 submenuFuncDistr=new QPopupMenu;
552 addFlyAction(tr("BETADIST(z,a,b,Q?)"), tr("BETADIST(z,a,b,Q?)"), "BETADIST(",submenuFuncDistr); 552 addFlyAction(tr("BETADIST(z,a,b,Q?)"), tr("BETADIST(z,a,b,Q?)"), "BETADIST(",submenuFuncDistr);
553 addFlyAction(tr("CHI2DIST(x,n,Q?)"), tr("CHI2DIST(x,n,Q?)"), "CHI2DIST(",submenuFuncDistr); 553 addFlyAction(tr("CHI2DIST(x,n,Q?)"), tr("CHI2DIST(x,n,Q?)"), "CHI2DIST(",submenuFuncDistr);
554 addFlyAction(tr("CHIDIST(x,n,Q?)"), tr("CHIDIST(x,n,Q?)"), "CHIDIST(",submenuFuncDistr); 554 addFlyAction(tr("CHIDIST(x,n,Q?)"), tr("CHIDIST(x,n,Q?)"), "CHIDIST(",submenuFuncDistr);
555 addFlyAction(tr("FDIST(z,deg1,deg2,Q?)"), tr("FDIST(z,deg1,deg2,Q?)"), "FDIST(",submenuFuncDistr); 555 addFlyAction(tr("FDIST(z,deg1,deg2,Q?)"), tr("FDIST(z,deg1,deg2,Q?)"), "FDIST(",submenuFuncDistr);
556 addFlyAction(tr("GAMMADIST(x,a,b,Q?)"), tr("GAMMADIST(x,a,b,Q?)"), "GAMMADIST(",submenuFuncDistr); 556 addFlyAction(tr("GAMMADIST(x,a,b,Q?)"), tr("GAMMADIST(x,a,b,Q?)"), "GAMMADIST(",submenuFuncDistr);
557 addFlyAction(tr("NORMALDIST(x,m,s,Q?)"), tr("NORMALDIST(x,m,s,Q?)"), "NORMALDIST(",submenuFuncDistr); 557 addFlyAction(tr("NORMALDIST(x,m,s,Q?)"), tr("NORMALDIST(x,m,s,Q?)"), "NORMALDIST(",submenuFuncDistr);
558 addFlyAction(tr("PHI(x,Q?)"), tr("PHI(x,Q?)"), "PHI(",submenuFuncDistr); 558 addFlyAction(tr("PHI(x,Q?)"), tr("PHI(x,Q?)"), "PHI(",submenuFuncDistr);
559 addFlyAction(tr("POISSON(x,n,Q?)"), tr("POISSON(x,n,Q?)"), "POISSON(",submenuFuncDistr); 559 addFlyAction(tr("POISSON(x,n,Q?)"), tr("POISSON(x,n,Q?)"), "POISSON(",submenuFuncDistr);
560 submenuFunc->insertItem(tr("&Distributions"), submenuFuncDistr); 560 submenuFunc->insertItem(tr("&Distributions"), submenuFuncDistr);
561 561
562 562
563 563
564 menuInsert->insertSeparator(); 564 menuInsert->insertSeparator();
565 insertCells->addTo(menuInsert); 565 insertCells->addTo(menuInsert);
566 insertRows->addTo(menuInsert); 566 insertRows->addTo(menuInsert);
567 insertCols->addTo(menuInsert); 567 insertCols->addTo(menuInsert);
568 insertSheets->addTo(menuInsert); 568 insertSheets->addTo(menuInsert);
569} 569}
570 570
571void MainWindow::initStandardToolbar() 571void MainWindow::initStandardToolbar()
572{ 572{
573 toolbarStandard=new QToolBar(this); 573 toolbarStandard=new QToolBar(this);
574 toolbarStandard->setHorizontalStretchable(TRUE); 574 toolbarStandard->setHorizontalStretchable(TRUE);
575 moveToolBar(toolbarStandard, Top); 575 moveToolBar(toolbarStandard, Top);
576 576
577 fileNew->addTo(toolbarStandard); 577 fileNew->addTo(toolbarStandard);
578 fileOpen->addTo(toolbarStandard); 578 fileOpen->addTo(toolbarStandard);
579 fileSave->addTo(toolbarStandard); 579 fileSave->addTo(toolbarStandard);
580 580
581 comboSheets=new QComboBox(toolbarStandard); 581 comboSheets=new QComboBox(toolbarStandard);
582 toolbarStandard->setStretchableWidget(comboSheets); 582 toolbarStandard->setStretchableWidget(comboSheets);
583 connect(comboSheets, SIGNAL(activated(const QString &)), this, SLOT(slotSheetChanged(const QString &))); 583 connect(comboSheets, SIGNAL(activated(const QString&)), this, SLOT(slotSheetChanged(const QString&)));
584} 584}
585 585
586void MainWindow::initFunctionsToolbar() 586void MainWindow::initFunctionsToolbar()
587{ 587{
588 toolbarFunctions=new QToolBar(this); 588 toolbarFunctions=new QToolBar(this);
589 toolbarFunctions->setHorizontalStretchable(TRUE); 589 toolbarFunctions->setHorizontalStretchable(TRUE);
590 moveToolBar(toolbarFunctions, Bottom); 590 moveToolBar(toolbarFunctions, Bottom);
591 591
592 funcEqual->addTo(toolbarFunctions); 592 funcEqual->addTo(toolbarFunctions);
593 funcPlus->addTo(toolbarFunctions); 593 funcPlus->addTo(toolbarFunctions);
594 funcMinus->addTo(toolbarFunctions); 594 funcMinus->addTo(toolbarFunctions);
595 funcCross->addTo(toolbarFunctions); 595 funcCross->addTo(toolbarFunctions);
596 funcDivide->addTo(toolbarFunctions); 596 funcDivide->addTo(toolbarFunctions);
597 funcParanOpen->addTo(toolbarFunctions); 597 funcParanOpen->addTo(toolbarFunctions);
598 funcParanClose->addTo(toolbarFunctions); 598 funcParanClose->addTo(toolbarFunctions);
599 funcComma->addTo(toolbarFunctions); 599 funcComma->addTo(toolbarFunctions);
600 600
601 toolFunction=new QToolButton(toolbarFunctions); 601 toolFunction=new QToolButton(toolbarFunctions);
602 toolFunction->setPixmap(Resource::loadPixmap( "opie-sheet/func-func" )); 602 toolFunction->setPixmap(Resource::loadPixmap( "opie-sheet/func-func" ));
603 toolFunction->setTextLabel(tr("Functions")); 603 toolFunction->setTextLabel(tr("Functions"));
604 toolFunction->setPopup(submenuFunc); 604 toolFunction->setPopup(submenuFunc);
605 toolFunction->setPopupDelay(0); 605 toolFunction->setPopupDelay(0);
606} 606}
607 607
608void MainWindow::initEditToolbar() 608void MainWindow::initEditToolbar()
609{ 609{
610 toolbarEdit=new QToolBar(this); 610 toolbarEdit=new QToolBar(this);
611 toolbarEdit->setHorizontalStretchable(TRUE); 611 toolbarEdit->setHorizontalStretchable(TRUE);
612 moveToolBar(toolbarEdit, Bottom); 612 moveToolBar(toolbarEdit, Bottom);
613 613
614 editAccept->addTo(toolbarEdit); 614 editAccept->addTo(toolbarEdit);
615 editCancel->addTo(toolbarEdit); 615 editCancel->addTo(toolbarEdit);
616 616
617 editData=new QLineEdit(toolbarEdit); 617 editData=new QLineEdit(toolbarEdit);
618 toolbarEdit->setStretchableWidget(editData); 618 toolbarEdit->setStretchableWidget(editData);
619 connect(editData, SIGNAL(returnPressed()), this, SLOT(slotEditAccept())); 619 connect(editData, SIGNAL(returnPressed()), this, SLOT(slotEditAccept()));
620 620
621 editCellSelect->addTo(toolbarEdit); 621 editCellSelect->addTo(toolbarEdit);
622} 622}
623 623
624void MainWindow::slotHelpAbout() 624void MainWindow::slotHelpAbout()
625{ 625{
626 QDialog dialogAbout(this, 0, TRUE); 626 QDialog dialogAbout(this, 0, TRUE);
627 dialogAbout.resize(width()-40, height()-80); 627 dialogAbout.resize(width()-40, height()-80);
628 dialogAbout.setCaption(tr("About Opie Sheet")); 628 dialogAbout.setCaption(tr("About Opie Sheet"));
629 629
630 QLabel label(tr("Opie Sheet\nSpreadsheet Software for Opie\nQWDC Beta Winner (as Sheet/Qt)\n\nDeveloped by: Serdar Ozler\nRelease 1.0.2\nRelease Date: October 08, 2002\n\nThis product is licensed under GPL. It is freely distributable. If you want to get the latest version and also the source code, please visit the web site.\n\nhttp://qtopia.sitebest.com"), &dialogAbout); 630 QLabel label(tr("Opie Sheet\nSpreadsheet Software for Opie\nQWDC Beta Winner (as Sheet/Qt)\n\nDeveloped by: Serdar Ozler\nRelease 1.0.2\nRelease Date: October 08, 2002\n\nThis product is licensed under GPL. It is freely distributable. If you want to get the latest version and also the source code, please visit the web site.\n\nhttp://qtopia.sitebest.com"), &dialogAbout);
631 label.setGeometry(dialogAbout.rect()); 631 label.setGeometry(dialogAbout.rect());
632 label.setAlignment(Qt::AlignCenter | Qt::WordBreak); 632 label.setAlignment(Qt::AlignCenter | Qt::WordBreak);
633 633
634 dialogAbout.exec(); 634 dialogAbout.exec();
635} 635}
636 636
637void MainWindow::initSheet() 637void MainWindow::initSheet()
638{ 638{
639 sheet=new Sheet(DEFAULT_NUM_ROWS, DEFAULT_NUM_COLS, this); 639 sheet=new Sheet(DEFAULT_NUM_ROWS, DEFAULT_NUM_COLS, this);
640 setCentralWidget(sheet); 640 setCentralWidget(sheet);
641 641
642 connect(sheet, SIGNAL(currentDataChanged(const QString &)), editData, SLOT(setText(const QString &))); 642 connect(sheet, SIGNAL(currentDataChanged(const QString&)), editData, SLOT(setText(const QString&)));
643 connect(sheet, SIGNAL(cellClicked(const QString &)), this, SLOT(slotCellClicked(const QString &))); 643 connect(sheet, SIGNAL(cellClicked(const QString&)), this, SLOT(slotCellClicked(const QString&)));
644 connect(sheet, SIGNAL(sheetModified()), this, SLOT(slotDocModified())); 644 connect(sheet, SIGNAL(sheetModified()), this, SLOT(slotDocModified()));
645 645
646 connect(editCut, SIGNAL(activated()), sheet, SLOT(editCut())); 646 connect(editCut, SIGNAL(activated()), sheet, SLOT(editCut()));
647 connect(editCopy, SIGNAL(activated()), sheet, SLOT(editCopy())); 647 connect(editCopy, SIGNAL(activated()), sheet, SLOT(editCopy()));
648 connect(editClear, SIGNAL(activated()), sheet, SLOT(editClear())); 648 connect(editClear, SIGNAL(activated()), sheet, SLOT(editClear()));
649} 649}
650 650
651void MainWindow::slotEditAccept() 651void MainWindow::slotEditAccept()
652{ 652{
653 sheet->setData(editData->text()); 653 sheet->setData(editData->text());
654} 654}
655 655
656void MainWindow::slotEditCancel() 656void MainWindow::slotEditCancel()
657{ 657{
658 editData->setText(sheet->getData()); 658 editData->setText(sheet->getData());
659} 659}
660 660
661void MainWindow::slotCellSelect(bool lock) 661void MainWindow::slotCellSelect(bool lock)
662{ 662{
663 sheet->lockClicks(lock); 663 sheet->lockClicks(lock);
664} 664}
665 665
666void MainWindow::addToData(const QString &data) 666void MainWindow::addToData(const QString &data)
667{ 667{
668 editData->setText(editData->text().insert(editData->cursorPosition(), data)); 668 editData->setText(editData->text().insert(editData->cursorPosition(), data));
669} 669}
670 670
671void MainWindow::slotFuncOutput() 671void MainWindow::slotFuncOutput()
672{ 672{
673 if (sender()->isA("QAction")) 673 if (sender()->isA("QAction"))
674 addToData(((QAction *)sender())->toolTip()); 674 addToData(((QAction *)sender())->toolTip());
675} 675}
676 676
677void MainWindow::slotInsertRows() 677void MainWindow::slotInsertRows()
678{ 678{
679 NumberDialog dialogNumber(this); 679 NumberDialog dialogNumber(this);
680 if (dialogNumber.exec(tr("Insert Rows"), tr("&Number of rows:"))==QDialog::Accepted) 680 if (dialogNumber.exec(tr("Insert Rows"), tr("&Number of rows:"))==QDialog::Accepted)
681 sheet->insertRows(dialogNumber.getValue()); 681 sheet->insertRows(dialogNumber.getValue());
682} 682}
683 683
684void MainWindow::slotInsertCols() 684void MainWindow::slotInsertCols()
685{ 685{
686 NumberDialog dialogNumber(this); 686 NumberDialog dialogNumber(this);
687 if (dialogNumber.exec(tr("Insert Columns"), tr("&Number of columns:"))==QDialog::Accepted) 687 if (dialogNumber.exec(tr("Insert Columns"), tr("&Number of columns:"))==QDialog::Accepted)
688 sheet->insertColumns(dialogNumber.getValue()); 688 sheet->insertColumns(dialogNumber.getValue());
689} 689}
690 690
691void MainWindow::slotInsertSheets() 691void MainWindow::slotInsertSheets()
692{ 692{
693 NumberDialog dialogNumber(this); 693 NumberDialog dialogNumber(this);
694 if (dialogNumber.exec(tr("Add Sheets"), tr("&Number of sheets:"))==QDialog::Accepted) 694 if (dialogNumber.exec(tr("Add Sheets"), tr("&Number of sheets:"))==QDialog::Accepted)
695 for (int i=dialogNumber.getValue(); i>0; --i) createNewSheet(); 695 for (int i=dialogNumber.getValue(); i>0; --i) createNewSheet();
696} 696}
697 697
698void MainWindow::slotCellClicked(const QString &cell) 698void MainWindow::slotCellClicked(const QString &cell)
699{ 699{
700 editCellSelect->setOn(FALSE); 700 editCellSelect->setOn(FALSE);
701 addToData(cell); 701 addToData(cell);
702} 702}
703 703
704typeSheet *MainWindow::createNewSheet() 704typeSheet *MainWindow::createNewSheet()
705{ 705{
706 typeSheet *newSheet=new typeSheet; 706 typeSheet *newSheet=new typeSheet;
707 int currentNo=1, tempNo=0; 707 int currentNo=1, tempNo=0;
diff --git a/noncore/apps/opie-sheet/sheet.cpp b/noncore/apps/opie-sheet/sheet.cpp
index f303d33..d4419af 100644
--- a/noncore/apps/opie-sheet/sheet.cpp
+++ b/noncore/apps/opie-sheet/sheet.cpp
@@ -1,111 +1,111 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 9
10/* 10/*
11 * Opie Sheet (formerly Sheet/Qt) 11 * Opie Sheet (formerly Sheet/Qt)
12 * by Serdar Ozler <sozler@sitebest.com> 12 * by Serdar Ozler <sozler@sitebest.com>
13 */ 13 */
14 14
15#include "sheet.h" 15#include "sheet.h"
16 16
17#include <qmessagebox.h> 17#include <qmessagebox.h>
18#include <math.h> 18#include <math.h>
19#include <stdlib.h> 19#include <stdlib.h>
20#include <stdio.h> 20#include <stdio.h>
21#include <time.h> 21#include <time.h>
22 22
23#define DEFAULT_COL_WIDTH 50 23#define DEFAULT_COL_WIDTH 50
24 24
25Sheet::Sheet(int numRows, int numCols, QWidget *parent) 25Sheet::Sheet(int numRows, int numCols, QWidget *parent)
26 :QTable(numRows, numCols, parent) 26 :QTable(numRows, numCols, parent)
27{ 27{
28 defaultBorders.right=defaultBorders.bottom=QPen(Qt::gray, 1, Qt::SolidLine); 28 defaultBorders.right=defaultBorders.bottom=QPen(Qt::gray, 1, Qt::SolidLine);
29 defaultCellData.data=""; 29 defaultCellData.data="";
30 defaultCellData.background=QBrush(Qt::white, Qt::SolidPattern); 30 defaultCellData.background=QBrush(Qt::white, Qt::SolidPattern);
31 defaultCellData.alignment=(Qt::AlignmentFlags)(Qt::AlignLeft | Qt::AlignTop); 31 defaultCellData.alignment=(Qt::AlignmentFlags)(Qt::AlignLeft | Qt::AlignTop);
32 defaultCellData.fontColor=Qt::black; 32 defaultCellData.fontColor=Qt::black;
33 defaultCellData.font=font(); 33 defaultCellData.font=font();
34 defaultCellData.borders=defaultBorders; 34 defaultCellData.borders=defaultBorders;
35 35
36 clicksLocked=FALSE; 36 clicksLocked=FALSE;
37 selectionNo=-1; 37 selectionNo=-1;
38 setSelectionMode(QTable::Single); 38 setSelectionMode(QTable::Single);
39 39
40 sheetData.setAutoDelete(TRUE); 40 sheetData.setAutoDelete(TRUE);
41 clipboardData.setAutoDelete(TRUE); 41 clipboardData.setAutoDelete(TRUE);
42 for (int i=0; i<numCols; ++i) 42 for (int i=0; i<numCols; ++i)
43 horizontalHeader()->setLabel(i, getHeaderString(i+1), DEFAULT_COL_WIDTH); 43 horizontalHeader()->setLabel(i, getHeaderString(i+1), DEFAULT_COL_WIDTH);
44 44
45 45
46 connect(this, SIGNAL(currentChanged(int, int)), this, SLOT(slotCellSelected(int, int))); 46 connect(this, SIGNAL(currentChanged(int,int)), this, SLOT(slotCellSelected(int,int)));
47 connect(this, SIGNAL(valueChanged(int, int)), this, SLOT(slotCellChanged(int, int))); 47 connect(this, SIGNAL(valueChanged(int,int)), this, SLOT(slotCellChanged(int,int)));
48} 48}
49 49
50Sheet::~Sheet() 50Sheet::~Sheet()
51{ 51{
52} 52}
53 53
54typeCellData *Sheet::findCellData(int row, int col) 54typeCellData *Sheet::findCellData(int row, int col)
55{ 55{
56 typeCellData *tempCellData; 56 typeCellData *tempCellData;
57 for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next()) 57 for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next())
58 { 58 {
59 if (tempCellData->row==row && tempCellData->col==col) return tempCellData; 59 if (tempCellData->row==row && tempCellData->col==col) return tempCellData;
60 } 60 }
61 return NULL; 61 return NULL;
62} 62}
63 63
64void Sheet::slotCellSelected(int row, int col) 64void Sheet::slotCellSelected(int row, int col)
65{ 65{
66 typeCellData *cellData=findCellData(row, col); 66 typeCellData *cellData=findCellData(row, col);
67 if (cellData) 67 if (cellData)
68 { 68 {
69 emit currentDataChanged(cellData->data); 69 emit currentDataChanged(cellData->data);
70 }else 70 }else
71 emit currentDataChanged(""); 71 emit currentDataChanged("");
72} 72}
73 73
74typeCellData *Sheet::createCellData(int row, int col) 74typeCellData *Sheet::createCellData(int row, int col)
75{ 75{
76 if (row<0 || col<0) return NULL; 76 if (row<0 || col<0) return NULL;
77 typeCellData *cellData=new typeCellData; 77 typeCellData *cellData=new typeCellData;
78 cellData->row=row; 78 cellData->row=row;
79 cellData->col=col; 79 cellData->col=col;
80 cellData->data=defaultCellData.data; 80 cellData->data=defaultCellData.data;
81 cellData->borders=defaultCellData.borders; 81 cellData->borders=defaultCellData.borders;
82 cellData->alignment=defaultCellData.alignment; 82 cellData->alignment=defaultCellData.alignment;
83 cellData->font=defaultCellData.font; 83 cellData->font=defaultCellData.font;
84 cellData->fontColor=defaultCellData.fontColor; 84 cellData->fontColor=defaultCellData.fontColor;
85 cellData->background=defaultCellData.background; 85 cellData->background=defaultCellData.background;
86 sheetData.append(cellData); 86 sheetData.append(cellData);
87 return cellData; 87 return cellData;
88} 88}
89 89
90void Sheet::slotCellChanged(int row, int col) 90void Sheet::slotCellChanged(int row, int col)
91{ 91{
92 typeCellData *cellData=findCellData(row, col); 92 typeCellData *cellData=findCellData(row, col);
93 if (!cellData) cellData=createCellData(row, col); 93 if (!cellData) cellData=createCellData(row, col);
94 if (cellData) cellData->data=text(row, col); 94 if (cellData) cellData->data=text(row, col);
95 for (cellData=sheetData.first(); cellData; cellData=sheetData.next()) 95 for (cellData=sheetData.first(); cellData; cellData=sheetData.next())
96 { 96 {
97 // modified by Toussis Manolis koppermind@panafonet.gr 97 // modified by Toussis Manolis koppermind@panafonet.gr
98 // the parser was crashing if there were no closed parenthesis. 98 // the parser was crashing if there were no closed parenthesis.
99 int w1,ii=0; 99 int w1,ii=0;
100 for(w1=0;w1<=(int)text(row, col).length();w1++) 100 for(w1=0;w1<=(int)text(row, col).length();w1++)
101 { 101 {
102 if(text(row,col)[w1]=='(') ii++; 102 if(text(row,col)[w1]=='(') ii++;
103 if(text(row,col)[w1]==')') ii--; 103 if(text(row,col)[w1]==')') ii--;
104 }; 104 };
105 if(ii==0) setText(cellData->row, cellData->col, dataParser(findCellName(cellData->row, cellData->col), cellData->data)); 105 if(ii==0) setText(cellData->row, cellData->col, dataParser(findCellName(cellData->row, cellData->col), cellData->data));
106 //end of modification 106 //end of modification
107 // old was plain: 107 // old was plain:
108 //setText(cellData->row, cellData->col, dataParser(findCellName(cellData->row, cellData->col), cellData->data)); 108 //setText(cellData->row, cellData->col, dataParser(findCellName(cellData->row, cellData->col), cellData->data));
109 }; 109 };
110 emit sheetModified(); 110 emit sheetModified();
111} 111}
diff --git a/noncore/apps/opie-write/mainwindow.cpp b/noncore/apps/opie-write/mainwindow.cpp
index 6bb524f..90e1a70 100644
--- a/noncore/apps/opie-write/mainwindow.cpp
+++ b/noncore/apps/opie-write/mainwindow.cpp
@@ -62,281 +62,281 @@ public:
62 if ( !popup()->count() ) { 62 if ( !popup()->count() ) {
63 setIconSet( icon ); 63 setIconSet( icon );
64 current = id; 64 current = id;
65 } 65 }
66 return popup()->insertItem( icon, text, id ); 66 return popup()->insertItem( icon, text, id );
67 } 67 }
68 68
69 void setCurrentItem( int id ) { 69 void setCurrentItem( int id ) {
70 if ( id != current ) { 70 if ( id != current ) {
71 current = id; 71 current = id;
72 setIconSet( *popup()->iconSet( id ) ); 72 setIconSet( *popup()->iconSet( id ) );
73 } 73 }
74 } 74 }
75 75
76 virtual QSize sizeHint() const { 76 virtual QSize sizeHint() const {
77 return QToolButton::sizeHint() + QSize( 4, 0 ); 77 return QToolButton::sizeHint() + QSize( 4, 0 );
78 } 78 }
79 79
80signals: 80signals:
81 void activated( int id ); 81 void activated( int id );
82 82
83protected slots: 83protected slots:
84 void selected( int id ) { 84 void selected( int id ) {
85 current = id; 85 current = id;
86 setIconSet( *popup()->iconSet( id ) ); 86 setIconSet( *popup()->iconSet( id ) );
87 emit activated( id ); 87 emit activated( id );
88 } 88 }
89 89
90protected: 90protected:
91 virtual void drawButtonLabel( QPainter *p ) { 91 virtual void drawButtonLabel( QPainter *p ) {
92 p->translate( -4, 0 ); 92 p->translate( -4, 0 );
93 QToolButton::drawButtonLabel( p ); 93 QToolButton::drawButtonLabel( p );
94 p->translate( 4, 0 ); 94 p->translate( 4, 0 );
95 } 95 }
96 96
97private: 97private:
98 int current; 98 int current;
99}; 99};
100 100
101//=========================================================================== 101//===========================================================================
102 102
103MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl ) 103MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl )
104 : QMainWindow( parent, name, fl ), 104 : QMainWindow( parent, name, fl ),
105 doc( 0 ) 105 doc( 0 )
106{ 106{
107 setRightJustification(TRUE); 107 setRightJustification(TRUE);
108 108
109 editorStack = new QWidgetStack( this ); 109 editorStack = new QWidgetStack( this );
110 110
111 fileSelector = new FileSelector( "text/html", 111 fileSelector = new FileSelector( "text/html",
112 editorStack, "fileselector" ); 112 editorStack, "fileselector" );
113 113
114 114
115 fileSelector->setCloseVisible( FALSE ); 115 fileSelector->setCloseVisible( FALSE );
116 editorStack->addWidget( fileSelector, 0 ); 116 editorStack->addWidget( fileSelector, 0 );
117 117
118 editor = new Qt3::QTextEdit( editorStack ); 118 editor = new Qt3::QTextEdit( editorStack );
119 editor->setTextFormat( Qt::RichText ); 119 editor->setTextFormat( Qt::RichText );
120 editorStack->addWidget( editor, 1 ); 120 editorStack->addWidget( editor, 1 );
121 121
122 setupActions(); 122 setupActions();
123 123
124 QObject::connect( fileSelector, SIGNAL(closeMe()), 124 QObject::connect( fileSelector, SIGNAL(closeMe()),
125 this, SLOT(showEditTools()) ); 125 this, SLOT(showEditTools()) );
126 QObject::connect( fileSelector, SIGNAL(fileSelected(const DocLnk &)), 126 QObject::connect( fileSelector, SIGNAL(fileSelected(const DocLnk&)),
127 this, SLOT(openFile(const DocLnk &)) ); 127 this, SLOT(openFile(const DocLnk&)) );
128 QObject::connect( fileSelector, SIGNAL(newSelected(const DocLnk&)), 128 QObject::connect( fileSelector, SIGNAL(newSelected(const DocLnk&)),
129 this, SLOT(newFile(const DocLnk&)) ); 129 this, SLOT(newFile(const DocLnk&)) );
130 130
131 if ( fileSelector->fileCount() < 1 ) 131 if ( fileSelector->fileCount() < 1 )
132 fileNew(); 132 fileNew();
133 else { 133 else {
134 fileOpen(); 134 fileOpen();
135 } 135 }
136 doConnections( editor ); 136 doConnections( editor );
137 137
138 setCentralWidget( editorStack ); 138 setCentralWidget( editorStack );
139} 139}
140 140
141MainWindow::~MainWindow() 141MainWindow::~MainWindow()
142{ 142{
143 save(); 143 save();
144} 144}
145 145
146void MainWindow::setupActions() 146void MainWindow::setupActions()
147{ 147{
148 setToolBarsMovable(false); 148 setToolBarsMovable(false);
149 149
150 tbMenu = new QToolBar( this ); 150 tbMenu = new QToolBar( this );
151 tbMenu->setHorizontalStretchable( TRUE ); 151 tbMenu->setHorizontalStretchable( TRUE );
152 152
153 QMenuBar *menu = new QMenuBar( tbMenu ); 153 QMenuBar *menu = new QMenuBar( tbMenu );
154 154
155 tbEdit = new QToolBar( this ); 155 tbEdit = new QToolBar( this );
156 156
157 QPopupMenu *file = new QPopupMenu( this ); 157 QPopupMenu *file = new QPopupMenu( this );
158 menu->insertItem( tr("File"), file ); 158 menu->insertItem( tr("File"), file );
159 159
160 QPopupMenu *edit = new QPopupMenu( this ); 160 QPopupMenu *edit = new QPopupMenu( this );
161 menu->insertItem( tr("Edit"), edit ); 161 menu->insertItem( tr("Edit"), edit );
162 162
163 // ### perhaps these shortcut keys should have some 163 // ### perhaps these shortcut keys should have some
164 // IPaq keys defined??? 164 // IPaq keys defined???
165 QAction *a; 165 QAction *a;
166 166
167 a = new QAction( tr( "New" ), Resource::loadPixmap("new"), QString::null, 0, this, 0 ); 167 a = new QAction( tr( "New" ), Resource::loadPixmap("new"), QString::null, 0, this, 0 );
168 connect( a, SIGNAL(activated()), this, SLOT(fileNew()) ); 168 connect( a, SIGNAL(activated()), this, SLOT(fileNew()) );
169 a->addTo( file ); 169 a->addTo( file );
170 170
171 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); 171 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 );
172 connect( a, SIGNAL(activated()), this, SLOT(fileOpen()) ); 172 connect( a, SIGNAL(activated()), this, SLOT(fileOpen()) );
173 a->addTo( file ); 173 a->addTo( file );
174 174
175 a = new QAction( tr( "Undo" ), Resource::loadIconSet("undo"), 175 a = new QAction( tr( "Undo" ), Resource::loadIconSet("undo"),
176 QString::null, 0, this, "editUndo" ); 176 QString::null, 0, this, "editUndo" );
177 connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) ); 177 connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) );
178 connect( editor, SIGNAL(undoAvailable(bool)), a, SLOT(setEnabled(bool)) ); 178 connect( editor, SIGNAL(undoAvailable(bool)), a, SLOT(setEnabled(bool)) );
179 a->addTo( tbEdit ); 179 a->addTo( tbEdit );
180 a->addTo( edit ); 180 a->addTo( edit );
181 a = new QAction( tr( "Redo" ), Resource::loadIconSet("redo"), 181 a = new QAction( tr( "Redo" ), Resource::loadIconSet("redo"),
182 QString::null, 0, this, "editRedo" ); 182 QString::null, 0, this, "editRedo" );
183 connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) ); 183 connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
184 connect( editor, SIGNAL(redoAvailable(bool)), a, SLOT(setEnabled(bool)) ); 184 connect( editor, SIGNAL(redoAvailable(bool)), a, SLOT(setEnabled(bool)) );
185 a->addTo( tbEdit ); 185 a->addTo( tbEdit );
186 a->addTo( edit ); 186 a->addTo( edit );
187 187
188 edit->insertSeparator(); 188 edit->insertSeparator();
189 189
190 a = new QAction( tr( "Copy" ), Resource::loadIconSet("copy"), 190 a = new QAction( tr( "Copy" ), Resource::loadIconSet("copy"),
191 QString::null, 0, this, "editCopy" ); 191 QString::null, 0, this, "editCopy" );
192 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); 192 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
193 connect( editor, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)) ); 193 connect( editor, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)) );
194 a->addTo( tbEdit ); 194 a->addTo( tbEdit );
195 a->addTo( edit ); 195 a->addTo( edit );
196 a = new QAction( tr( "Cut" ), Resource::loadIconSet("cut"), 196 a = new QAction( tr( "Cut" ), Resource::loadIconSet("cut"),
197 QString::null, 0, this, "editCut" ); 197 QString::null, 0, this, "editCut" );
198 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); 198 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
199 connect( editor, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)) ); 199 connect( editor, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)) );
200 a->addTo( tbEdit ); 200 a->addTo( tbEdit );
201 a->addTo( edit ); 201 a->addTo( edit );
202 a = new QAction( tr( "Paste" ), Resource::loadPixmap("paste"), 202 a = new QAction( tr( "Paste" ), Resource::loadPixmap("paste"),
203 QString::null, 0, this, "editPaste" ); 203 QString::null, 0, this, "editPaste" );
204 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); 204 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
205 a->addTo( tbEdit ); 205 a->addTo( tbEdit );
206 a->addTo( edit ); 206 a->addTo( edit );
207 207
208 tbFont = new QToolBar( this ); 208 tbFont = new QToolBar( this );
209 tbFont->setLabel( "Font Actions" ); 209 tbFont->setLabel( "Font Actions" );
210 tbFont->setHorizontalStretchable(TRUE); 210 tbFont->setHorizontalStretchable(TRUE);
211 211
212 comboFont = new QComboBox( FALSE, tbFont ); 212 comboFont = new QComboBox( FALSE, tbFont );
213 FontDatabase db; 213 FontDatabase db;
214 QStringList f= db.families(); 214 QStringList f= db.families();
215 comboFont->insertStringList( db.families() ); 215 comboFont->insertStringList( db.families() );
216 connect( comboFont, SIGNAL( activated( const QString & ) ), 216 connect( comboFont, SIGNAL( activated(const QString&) ),
217 this, SLOT( textFamily( const QString & ) ) ); 217 this, SLOT( textFamily(const QString&) ) );
218 comboFont->setCurrentItem( comboFont->listBox()->index( comboFont->listBox()->findItem( QApplication::font().family() ) ) ); 218 comboFont->setCurrentItem( comboFont->listBox()->index( comboFont->listBox()->findItem( QApplication::font().family() ) ) );
219 comboFont->setMaximumWidth(90); 219 comboFont->setMaximumWidth(90);
220 220
221 comboSize = new QComboBox( TRUE, tbFont ); 221 comboSize = new QComboBox( TRUE, tbFont );
222 QValueList<int> sizes = db.standardSizes(); 222 QValueList<int> sizes = db.standardSizes();
223 QValueList<int>::Iterator it = sizes.begin(); 223 QValueList<int>::Iterator it = sizes.begin();
224 for ( ; it != sizes.end(); ++it ) 224 for ( ; it != sizes.end(); ++it )
225 comboSize->insertItem( QString::number( *it ) ); 225 comboSize->insertItem( QString::number( *it ) );
226 connect( comboSize, SIGNAL( activated( const QString & ) ), 226 connect( comboSize, SIGNAL( activated(const QString&) ),
227 this, SLOT( textSize( const QString & ) ) ); 227 this, SLOT( textSize(const QString&) ) );
228 comboSize->lineEdit()->setText( QString::number( QApplication::font().pointSize() ) ); 228 comboSize->lineEdit()->setText( QString::number( QApplication::font().pointSize() ) );
229 comboSize->setFixedWidth( 38 ); 229 comboSize->setFixedWidth( 38 );
230 230
231 tbStyle = new QToolBar( this ); 231 tbStyle = new QToolBar( this );
232 tbStyle->setLabel( "Style Actions" ); 232 tbStyle->setLabel( "Style Actions" );
233 233
234 actionTextBold = new QAction( tr( "Bold" ), 234 actionTextBold = new QAction( tr( "Bold" ),
235 Resource::loadPixmap("bold"), 235 Resource::loadPixmap("bold"),
236 QString::null, CTRL + Key_B, 236 QString::null, CTRL + Key_B,
237 this, "textBold" ); 237 this, "textBold" );
238 connect( actionTextBold, SIGNAL( activated() ), this, SLOT( textBold() ) ); 238 connect( actionTextBold, SIGNAL( activated() ), this, SLOT( textBold() ) );
239 actionTextBold->addTo( tbStyle ); 239 actionTextBold->addTo( tbStyle );
240 actionTextBold->setToggleAction( TRUE ); 240 actionTextBold->setToggleAction( TRUE );
241 actionTextItalic = new QAction( tr( "Italic" ), 241 actionTextItalic = new QAction( tr( "Italic" ),
242 Resource::loadPixmap("italic"), 242 Resource::loadPixmap("italic"),
243 tr( "&Italic" ), CTRL + Key_I, 243 tr( "&Italic" ), CTRL + Key_I,
244 this, "textItalic" ); 244 this, "textItalic" );
245 connect( actionTextItalic, SIGNAL( activated() ), this, 245 connect( actionTextItalic, SIGNAL( activated() ), this,
246 SLOT( textItalic() ) ); 246 SLOT( textItalic() ) );
247 actionTextItalic->addTo( tbStyle ); 247 actionTextItalic->addTo( tbStyle );
248 actionTextItalic->setToggleAction( TRUE ); 248 actionTextItalic->setToggleAction( TRUE );
249 actionTextUnderline = new QAction( tr( "Underline" ), 249 actionTextUnderline = new QAction( tr( "Underline" ),
250 Resource::loadPixmap("underline"), 250 Resource::loadPixmap("underline"),
251 tr( "&Underline" ), CTRL + Key_U, 251 tr( "&Underline" ), CTRL + Key_U,
252 this, "textUnderline" ); 252 this, "textUnderline" );
253 connect( actionTextUnderline, SIGNAL( activated() ), 253 connect( actionTextUnderline, SIGNAL( activated() ),
254 this, SLOT( textUnderline() ) ); 254 this, SLOT( textUnderline() ) );
255 actionTextUnderline->addTo( tbStyle ); 255 actionTextUnderline->addTo( tbStyle );
256 actionTextUnderline->setToggleAction( TRUE ); 256 actionTextUnderline->setToggleAction( TRUE );
257 257
258 alignMenu = new ButtonMenu( tbStyle ); 258 alignMenu = new ButtonMenu( tbStyle );
259 alignMenu->insertItem( Resource::loadPixmap("left"), tr("Left"), AlignLeft ); 259 alignMenu->insertItem( Resource::loadPixmap("left"), tr("Left"), AlignLeft );
260 alignMenu->insertItem( Resource::loadPixmap("center"), tr("Center"), AlignCenter ); 260 alignMenu->insertItem( Resource::loadPixmap("center"), tr("Center"), AlignCenter );
261 alignMenu->insertItem( Resource::loadPixmap("right"), tr("Right"), AlignRight ); 261 alignMenu->insertItem( Resource::loadPixmap("right"), tr("Right"), AlignRight );
262 alignMenu->insertItem( Resource::loadPixmap("opie-write/justify"), tr("Full"), Qt3::AlignJustify ); 262 alignMenu->insertItem( Resource::loadPixmap("opie-write/justify"), tr("Full"), Qt3::AlignJustify );
263 connect( alignMenu, SIGNAL(activated(int)), this, SLOT(textAlign(int)) ); 263 connect( alignMenu, SIGNAL(activated(int)), this, SLOT(textAlign(int)) );
264} 264}
265 265
266Qt3::QTextEdit *MainWindow::currentEditor() const 266Qt3::QTextEdit *MainWindow::currentEditor() const
267{ 267{
268 return editor; 268 return editor;
269} 269}
270 270
271void MainWindow::doConnections( Qt3::QTextEdit *e ) 271void MainWindow::doConnections( Qt3::QTextEdit *e )
272{ 272{
273 connect( e, SIGNAL( currentFontChanged( const QFont & ) ), 273 connect( e, SIGNAL( currentFontChanged(const QFont&) ),
274 this, SLOT( fontChanged( const QFont & ) ) ); 274 this, SLOT( fontChanged(const QFont&) ) );
275 connect( e, SIGNAL( currentColorChanged( const QColor & ) ), 275 connect( e, SIGNAL( currentColorChanged(const QColor&) ),
276 this, SLOT( colorChanged( const QColor & ) ) ); 276 this, SLOT( colorChanged(const QColor&) ) );
277 connect( e, SIGNAL( currentAlignmentChanged( int ) ), 277 connect( e, SIGNAL( currentAlignmentChanged(int) ),
278 this, SLOT( alignmentChanged( int ) ) ); 278 this, SLOT( alignmentChanged(int) ) );
279} 279}
280 280
281void MainWindow::updateFontSizeCombo( const QFont &f ) 281void MainWindow::updateFontSizeCombo( const QFont &f )
282{ 282{
283 comboSize->clear(); 283 comboSize->clear();
284 FontDatabase fdb; 284 FontDatabase fdb;
285 QValueList<int> sizes = fdb.pointSizes( f.family() ); 285 QValueList<int> sizes = fdb.pointSizes( f.family() );
286 QValueList<int>::Iterator it = sizes.begin(); 286 QValueList<int>::Iterator it = sizes.begin();
287 for ( ; it != sizes.end(); ++it ) 287 for ( ; it != sizes.end(); ++it )
288 comboSize->insertItem( QString::number( *it ) ); 288 comboSize->insertItem( QString::number( *it ) );
289} 289}
290 290
291void MainWindow::editUndo() 291void MainWindow::editUndo()
292{ 292{
293 if ( !currentEditor() ) 293 if ( !currentEditor() )
294 return; 294 return;
295 currentEditor()->undo(); 295 currentEditor()->undo();
296} 296}
297 297
298void MainWindow::editRedo() 298void MainWindow::editRedo()
299{ 299{
300 if ( !currentEditor() ) 300 if ( !currentEditor() )
301 return; 301 return;
302 currentEditor()->redo(); 302 currentEditor()->redo();
303} 303}
304 304
305void MainWindow::editCut() 305void MainWindow::editCut()
306{ 306{
307 if ( !currentEditor() ) 307 if ( !currentEditor() )
308 return; 308 return;
309 currentEditor()->cut(); 309 currentEditor()->cut();
310} 310}
311 311
312void MainWindow::editCopy() 312void MainWindow::editCopy()
313{ 313{
314 if ( !currentEditor() ) 314 if ( !currentEditor() )
315 return; 315 return;
316 currentEditor()->copy(); 316 currentEditor()->copy();
317} 317}
318 318
319void MainWindow::editPaste() 319void MainWindow::editPaste()
320{ 320{
321 if ( !currentEditor() ) 321 if ( !currentEditor() )
322 return; 322 return;
323 currentEditor()->paste(); 323 currentEditor()->paste();
324} 324}
325 325
326void MainWindow::textBold() 326void MainWindow::textBold()
327{ 327{
328 if ( !currentEditor() ) 328 if ( !currentEditor() )
329 return; 329 return;
330 currentEditor()->setBold( actionTextBold->isOn() ); 330 currentEditor()->setBold( actionTextBold->isOn() );
331} 331}
332 332
333void MainWindow::textUnderline() 333void MainWindow::textUnderline()
334{ 334{
335 if ( !currentEditor() ) 335 if ( !currentEditor() )
336 return; 336 return;
337 currentEditor()->setUnderline( actionTextUnderline->isOn() ); 337 currentEditor()->setUnderline( actionTextUnderline->isOn() );
338} 338}
339 339
340void MainWindow::textItalic() 340void MainWindow::textItalic()
341{ 341{
342 if ( !currentEditor() ) 342 if ( !currentEditor() )
diff --git a/noncore/apps/opie-write/qtextedit.cpp b/noncore/apps/opie-write/qtextedit.cpp
index 27dd515..73b7b7b 100644
--- a/noncore/apps/opie-write/qtextedit.cpp
+++ b/noncore/apps/opie-write/qtextedit.cpp
@@ -616,130 +616,130 @@ static bool block_set_alignment = FALSE;
616 616
617 \warning QTextCursor is not in the public API, but in special 617 \warning QTextCursor is not in the public API, but in special
618 circumstances you might wish to use it. 618 circumstances you might wish to use it.
619*/ 619*/
620 620
621/*! Constructs an empty QTextEdit with parent \a parent and name \a 621/*! Constructs an empty QTextEdit with parent \a parent and name \a
622 name. 622 name.
623*/ 623*/
624 624
625QTextEdit::QTextEdit( QWidget *parent, const char *name ) 625QTextEdit::QTextEdit( QWidget *parent, const char *name )
626 : QScrollView( parent, name, WStaticContents | WRepaintNoErase | WResizeNoErase ), 626 : QScrollView( parent, name, WStaticContents | WRepaintNoErase | WResizeNoErase ),
627 doc( new QTextDocument( 0 ) ), undoRedoInfo( doc ) 627 doc( new QTextDocument( 0 ) ), undoRedoInfo( doc )
628{ 628{
629 init(); 629 init();
630} 630}
631 631
632/*! 632/*!
633 Constructs a QTextEdit with parent \a parent and name \a name. The 633 Constructs a QTextEdit with parent \a parent and name \a name. The
634 text edit will display the text \a text using context \a context. 634 text edit will display the text \a text using context \a context.
635 635
636 The \a context is a path which the text edit's QMimeSourceFactory 636 The \a context is a path which the text edit's QMimeSourceFactory
637 uses to resolve the locations of files and images. It is passed to 637 uses to resolve the locations of files and images. It is passed to
638 the mimeSourceFactory() when quering data. 638 the mimeSourceFactory() when quering data.
639 639
640 For example if the text contains an image tag, 640 For example if the text contains an image tag,
641 \c{<img src="image.png">}, and the context is "path/to/look/in", the 641 \c{<img src="image.png">}, and the context is "path/to/look/in", the
642 QMimeSourceFactory will try to load the image from 642 QMimeSourceFactory will try to load the image from
643 "path/to/look/in/image.png". If the tag was 643 "path/to/look/in/image.png". If the tag was
644 \c{<img src="/image.png">}, the context will not be used (because 644 \c{<img src="/image.png">}, the context will not be used (because
645 QMimeSourceFactory recognizes that we have used an absolute path) 645 QMimeSourceFactory recognizes that we have used an absolute path)
646 and will try to load "/image.png". The context is applied in exactly 646 and will try to load "/image.png". The context is applied in exactly
647 the same way to \e hrefs, for example, 647 the same way to \e hrefs, for example,
648 \c{<a href="target.html">Target</a>}, would resolve to 648 \c{<a href="target.html">Target</a>}, would resolve to
649 "path/to/look/in/target.html". 649 "path/to/look/in/target.html".
650 650
651*/ 651*/
652 652
653QTextEdit::QTextEdit( const QString& text, const QString& context, 653QTextEdit::QTextEdit( const QString& text, const QString& context,
654 QWidget *parent, const char *name) 654 QWidget *parent, const char *name)
655 : QScrollView( parent, name, WStaticContents | WRepaintNoErase | WResizeNoErase ), 655 : QScrollView( parent, name, WStaticContents | WRepaintNoErase | WResizeNoErase ),
656 doc( new QTextDocument( 0 ) ), undoRedoInfo( doc ) 656 doc( new QTextDocument( 0 ) ), undoRedoInfo( doc )
657{ 657{
658 init(); 658 init();
659 setText( text, context ); 659 setText( text, context );
660} 660}
661 661
662/*! \reimp */ 662/*! \reimp */
663 663
664QTextEdit::~QTextEdit() 664QTextEdit::~QTextEdit()
665{ 665{
666 delete undoRedoInfo.d; 666 delete undoRedoInfo.d;
667 undoRedoInfo.d = 0; 667 undoRedoInfo.d = 0;
668 delete cursor; 668 delete cursor;
669 delete doc; 669 delete doc;
670 delete d; 670 delete d;
671} 671}
672 672
673void QTextEdit::init() 673void QTextEdit::init()
674{ 674{
675 setFrameStyle( Sunken ); 675 setFrameStyle( Sunken );
676 undoEnabled = TRUE; 676 undoEnabled = TRUE;
677 readonly = TRUE; 677 readonly = TRUE;
678 setReadOnly( FALSE ); 678 setReadOnly( FALSE );
679 d = new QTextEditPrivate; 679 d = new QTextEditPrivate;
680 connect( doc, SIGNAL( minimumWidthChanged( int ) ), 680 connect( doc, SIGNAL( minimumWidthChanged(int) ),
681 this, SLOT( documentWidthChanged( int ) ) ); 681 this, SLOT( documentWidthChanged(int) ) );
682 682
683 mousePressed = FALSE; 683 mousePressed = FALSE;
684 inDoubleClick = FALSE; 684 inDoubleClick = FALSE;
685 modified = FALSE; 685 modified = FALSE;
686 onLink = QString::null; 686 onLink = QString::null;
687 overWrite = FALSE; 687 overWrite = FALSE;
688 wrapMode = WidgetWidth; 688 wrapMode = WidgetWidth;
689 wrapWidth = -1; 689 wrapWidth = -1;
690 wPolicy = AtWhiteSpace; 690 wPolicy = AtWhiteSpace;
691 inDnD = FALSE; 691 inDnD = FALSE;
692 692
693 doc->setFormatter( new QTextFormatterBreakWords ); 693 doc->setFormatter( new QTextFormatterBreakWords );
694 doc->formatCollection()->defaultFormat()->setFont( QScrollView::font() ); 694 doc->formatCollection()->defaultFormat()->setFont( QScrollView::font() );
695 doc->formatCollection()->defaultFormat()->setColor( colorGroup().color( QColorGroup::Text ) ); 695 doc->formatCollection()->defaultFormat()->setColor( colorGroup().color( QColorGroup::Text ) );
696 currentFormat = doc->formatCollection()->defaultFormat(); 696 currentFormat = doc->formatCollection()->defaultFormat();
697 currentAlignment = Qt3::AlignAuto; 697 currentAlignment = Qt3::AlignAuto;
698 698
699 viewport()->setBackgroundMode( PaletteBase ); 699 viewport()->setBackgroundMode( PaletteBase );
700 viewport()->setAcceptDrops( TRUE ); 700 viewport()->setAcceptDrops( TRUE );
701 resizeContents( 0, doc->lastParagraph() ? 701 resizeContents( 0, doc->lastParagraph() ?
702 ( doc->lastParagraph()->paragId() + 1 ) * doc->formatCollection()->defaultFormat()->height() : 0 ); 702 ( doc->lastParagraph()->paragId() + 1 ) * doc->formatCollection()->defaultFormat()->height() : 0 );
703 703
704 setKeyCompression( TRUE ); 704 setKeyCompression( TRUE );
705 viewport()->setMouseTracking( TRUE ); 705 viewport()->setMouseTracking( TRUE );
706#ifndef QT_NO_CURSOR 706#ifndef QT_NO_CURSOR
707 viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); 707 viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor );
708#endif 708#endif
709 cursor = new QTextCursor( doc ); 709 cursor = new QTextCursor( doc );
710 710
711 formatTimer = new QTimer( this ); 711 formatTimer = new QTimer( this );
712 connect( formatTimer, SIGNAL( timeout() ), 712 connect( formatTimer, SIGNAL( timeout() ),
713 this, SLOT( formatMore() ) ); 713 this, SLOT( formatMore() ) );
714 lastFormatted = doc->firstParagraph(); 714 lastFormatted = doc->firstParagraph();
715 715
716 scrollTimer = new QTimer( this ); 716 scrollTimer = new QTimer( this );
717 connect( scrollTimer, SIGNAL( timeout() ), 717 connect( scrollTimer, SIGNAL( timeout() ),
718 this, SLOT( autoScrollTimerDone() ) ); 718 this, SLOT( autoScrollTimerDone() ) );
719 719
720 interval = 0; 720 interval = 0;
721 changeIntervalTimer = new QTimer( this ); 721 changeIntervalTimer = new QTimer( this );
722 connect( changeIntervalTimer, SIGNAL( timeout() ), 722 connect( changeIntervalTimer, SIGNAL( timeout() ),
723 this, SLOT( doChangeInterval() ) ); 723 this, SLOT( doChangeInterval() ) );
724 724
725 cursorVisible = TRUE; 725 cursorVisible = TRUE;
726 blinkTimer = new QTimer( this ); 726 blinkTimer = new QTimer( this );
727 connect( blinkTimer, SIGNAL( timeout() ), 727 connect( blinkTimer, SIGNAL( timeout() ),
728 this, SLOT( blinkCursor() ) ); 728 this, SLOT( blinkCursor() ) );
729 729
730#ifndef QT_NO_DRAGANDDROP 730#ifndef QT_NO_DRAGANDDROP
731 dragStartTimer = new QTimer( this ); 731 dragStartTimer = new QTimer( this );
732 connect( dragStartTimer, SIGNAL( timeout() ), 732 connect( dragStartTimer, SIGNAL( timeout() ),
733 this, SLOT( startDrag() ) ); 733 this, SLOT( startDrag() ) );
734#endif 734#endif
735 735
736 736
737 formatMore(); 737 formatMore();
738 738
739 blinkCursorVisible = FALSE; 739 blinkCursorVisible = FALSE;
740 740
741 viewport()->setFocusProxy( this ); 741 viewport()->setFocusProxy( this );
742 viewport()->setFocusPolicy( WheelFocus ); 742 viewport()->setFocusPolicy( WheelFocus );
743 viewport()->installEventFilter( this ); 743 viewport()->installEventFilter( this );
744 installEventFilter( this ); 744 installEventFilter( this );
745} 745}
diff --git a/noncore/apps/qashmoney/accountdisplay.cpp b/noncore/apps/qashmoney/accountdisplay.cpp
index 5ef5454..0fe5b09 100755
--- a/noncore/apps/qashmoney/accountdisplay.cpp
+++ b/noncore/apps/qashmoney/accountdisplay.cpp
@@ -1,113 +1,113 @@
1#include <qmessagebox.h> 1#include <qmessagebox.h>
2#include <qheader.h> 2#include <qheader.h>
3 3
4#include "accountdisplay.h" 4#include "accountdisplay.h"
5#include "newaccount.h" 5#include "newaccount.h"
6#include "transaction.h" 6#include "transaction.h"
7#include "transferdialog.h" 7#include "transferdialog.h"
8#include "transfer.h" 8#include "transfer.h"
9 9
10extern Account *account; 10extern Account *account;
11extern Transaction *transaction; 11extern Transaction *transaction;
12extern Transfer *transfer; 12extern Transfer *transfer;
13extern Preferences *preferences; 13extern Preferences *preferences;
14 14
15AccountDisplay::AccountDisplay ( QWidget *parent ) : QWidget ( parent ) 15AccountDisplay::AccountDisplay ( QWidget *parent ) : QWidget ( parent )
16 { 16 {
17 cleared = 0; 17 cleared = 0;
18 18
19 firstline = new QHBox ( this ); 19 firstline = new QHBox ( this );
20 firstline->setSpacing ( 2 ); 20 firstline->setSpacing ( 2 );
21 21
22 newaccount = new QPushButton ( firstline ); 22 newaccount = new QPushButton ( firstline );
23 newaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") ); 23 newaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") );
24 connect ( newaccount, SIGNAL ( released () ), this, SLOT ( addAccount () ) ); 24 connect ( newaccount, SIGNAL ( released() ), this, SLOT ( addAccount() ) );
25 25
26 editaccount = new QPushButton ( firstline ); 26 editaccount = new QPushButton ( firstline );
27 editaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); 27 editaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/edit.png") );
28 connect ( editaccount, SIGNAL ( released () ), this, SLOT ( editAccount () ) ); 28 connect ( editaccount, SIGNAL ( released() ), this, SLOT ( editAccount() ) );
29 29
30 deleteaccount = new QPushButton ( firstline ); 30 deleteaccount = new QPushButton ( firstline );
31 deleteaccount->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") ); 31 deleteaccount->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") );
32 connect ( deleteaccount, SIGNAL ( released () ), this, SLOT ( deleteAccount () ) ); 32 connect ( deleteaccount, SIGNAL ( released() ), this, SLOT ( deleteAccount() ) );
33 33
34 transferbutton = new QPushButton ( firstline ); 34 transferbutton = new QPushButton ( firstline );
35 transferbutton->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/transfer.png") ); 35 transferbutton->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/transfer.png") );
36 transferbutton->setToggleButton ( TRUE ); 36 transferbutton->setToggleButton ( TRUE );
37 connect ( transferbutton, SIGNAL ( toggled ( bool ) ), this, SLOT ( accountTransfer ( bool ) ) ); 37 connect ( transferbutton, SIGNAL ( toggled(bool) ), this, SLOT ( accountTransfer(bool) ) );
38 38
39 listview = new QListView ( this ); 39 listview = new QListView ( this );
40 listview->setAllColumnsShowFocus ( TRUE ); 40 listview->setAllColumnsShowFocus ( TRUE );
41 listview->setShowSortIndicator ( TRUE ); 41 listview->setShowSortIndicator ( TRUE );
42 listview->setRootIsDecorated ( TRUE ); 42 listview->setRootIsDecorated ( TRUE );
43 listview->setMultiSelection ( FALSE ); 43 listview->setMultiSelection ( FALSE );
44 connect ( listview, SIGNAL ( expanded ( QListViewItem * ) ), this, SLOT ( setAccountExpanded ( QListViewItem * ) ) ); 44 connect ( listview, SIGNAL ( expanded(QListViewItem*) ), this, SLOT ( setAccountExpanded(QListViewItem*) ) );
45 connect ( listview, SIGNAL ( collapsed ( QListViewItem * ) ), this, SLOT ( setAccountCollapsed ( QListViewItem * ) ) ); 45 connect ( listview, SIGNAL ( collapsed(QListViewItem*) ), this, SLOT ( setAccountCollapsed(QListViewItem*) ) );
46 46
47 listview->header()->setTracking ( FALSE ); 47 listview->header()->setTracking ( FALSE );
48 connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); 48 connect ( listview->header(), SIGNAL ( sizeChange(int,int,int) ), this, SLOT ( saveColumnSize(int,int,int) ) );
49 connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); 49 connect ( listview->header(), SIGNAL ( clicked(int) ), this, SLOT ( saveSortingPreference(int) ) );
50 50
51 layout = new QVBoxLayout ( this, 2, 5 ); 51 layout = new QVBoxLayout ( this, 2, 5 );
52 layout->addWidget ( firstline ); 52 layout->addWidget ( firstline );
53 layout->addWidget ( listview ); 53 layout->addWidget ( listview );
54 } 54 }
55 55
56void AccountDisplay::setTabs ( QWidget *newtab2, QTabWidget *newtabs ) 56void AccountDisplay::setTabs ( QWidget *newtab2, QTabWidget *newtabs )
57 { 57 {
58 tab2 = newtab2; 58 tab2 = newtab2;
59 maintabs = newtabs; 59 maintabs = newtabs;
60 } 60 }
61 61
62void AccountDisplay::addAccount () 62void AccountDisplay::addAccount ()
63 { 63 {
64 // initialize local variables 64 // initialize local variables
65 int parentid = 0; 65 int parentid = 0;
66 type = 0; 66 type = 0;
67 QString parentlist [ listview->childCount() + 1 ] [ 3 ] ; 67 QString parentlist [ listview->childCount() + 1 ] [ 3 ] ;
68 68
69 // create new account window for entering data 69 // create new account window for entering data
70 NewAccount *newaccount = new NewAccount ( this ); 70 NewAccount *newaccount = new NewAccount ( this );
71 int width = this->width(); 71 int width = this->width();
72 newaccount->accountbox->setMaximumWidth ( ( int ) ( width * 0.5 ) ); 72 newaccount->accountbox->setMaximumWidth ( ( int ) ( width * 0.5 ) );
73 newaccount->datebox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); 73 newaccount->datebox->setMaximumWidth ( ( int ) ( width * 0.4 ) );
74 newaccount->childbox->setMaximumWidth ( ( int ) ( width * 0.5 ) ); 74 newaccount->childbox->setMaximumWidth ( ( int ) ( width * 0.5 ) );
75 newaccount->balancebox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); 75 newaccount->balancebox->setMaximumWidth ( ( int ) ( width * 0.4 ) );
76 newaccount->creditlimitbox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); 76 newaccount->creditlimitbox->setMaximumWidth ( ( int ) ( width * 0.4 ) );
77 77
78 // if there are no accounts, disable the child check box 78 // if there are no accounts, disable the child check box
79 if ( account->getNumberOfAccounts () == 0 ) 79 if ( account->getNumberOfAccounts () == 0 )
80 newaccount->childcheckbox->setEnabled ( FALSE ); 80 newaccount->childcheckbox->setEnabled ( FALSE );
81 81
82 // if there are accounts, fill up the pulldown menu for 82 // if there are accounts, fill up the pulldown menu for
83 // selecting a parent account. We should only add those parents without transactions 83 // selecting a parent account. We should only add those parents without transactions
84 else 84 else
85 { 85 {
86 int c = 0; 86 int c = 0;
87 QListViewItemIterator it ( listview ); 87 QListViewItemIterator it ( listview );
88 for ( ; it.current(); ++it ) 88 for ( ; it.current(); ++it )
89 { 89 {
90 int id = it.current()->text ( getIDColumn() ).toInt(); 90 int id = it.current()->text ( getIDColumn() ).toInt();
91 // iterate through accountdisplay listview and add parents with no transactions 91 // iterate through accountdisplay listview and add parents with no transactions
92 // add this item to the list box only if it is a parent and has no transactions 92 // add this item to the list box only if it is a parent and has no transactions
93 if ( transfer->getNumberOfTransfers ( id ) == 0 && transaction->getNumberOfTransactions ( id ) == 0 && it.current()->parent() == 0 ) 93 if ( transfer->getNumberOfTransfers ( id ) == 0 && transaction->getNumberOfTransactions ( id ) == 0 && it.current()->parent() == 0 )
94 { 94 {
95 newaccount->childbox->insertItem ( it.current()->text ( 0 ) ); 95 newaccount->childbox->insertItem ( it.current()->text ( 0 ) );
96 parentlist [ c ] [ 0 ] = it.current()->text ( 0 ); 96 parentlist [ c ] [ 0 ] = it.current()->text ( 0 );
97 parentlist [ c ] [ 1 ] = it.current()->text ( getIDColumn() ); 97 parentlist [ c ] [ 1 ] = it.current()->text ( getIDColumn() );
98 parentlist [ c ] [ 2 ] = QString::number ( c ); 98 parentlist [ c ] [ 2 ] = QString::number ( c );
99 c++; 99 c++;
100 } 100 }
101 } 101 }
102 } 102 }
103 103
104 if ( preferences->getPreference ( 4 ) == 0 ) 104 if ( preferences->getPreference ( 4 ) == 0 )
105 newaccount->currencybox->setEnabled ( FALSE ); 105 newaccount->currencybox->setEnabled ( FALSE );
106 106
107 // enter today's date in the date box as default 107 // enter today's date in the date box as default
108 QDate today = QDate::currentDate (); 108 QDate today = QDate::currentDate ();
109 int defaultday = today.day(); 109 int defaultday = today.day();
110 int defaultmonth = today.month(); 110 int defaultmonth = today.month();
111 int defaultyear = today.year(); 111 int defaultyear = today.year();
112 newaccount->startdate->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) ); 112 newaccount->startdate->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) );
113 113
@@ -164,195 +164,195 @@ void AccountDisplay::deleteAccount ()
164 else 164 else
165 { 165 {
166 QMessageBox mb ( "Delete Account", "This will delete all transactions\nand transfers for this account.", QMessageBox::Information, QMessageBox::Ok, QMessageBox::Cancel, QMessageBox::NoButton ); 166 QMessageBox mb ( "Delete Account", "This will delete all transactions\nand transfers for this account.", QMessageBox::Information, QMessageBox::Ok, QMessageBox::Cancel, QMessageBox::NoButton );
167 if ( mb.exec() == QMessageBox::Ok ) 167 if ( mb.exec() == QMessageBox::Ok )
168 { 168 {
169 int accountid = listview->selectedItem()->text ( getIDColumn() ).toInt (); 169 int accountid = listview->selectedItem()->text ( getIDColumn() ).toInt ();
170 int parentid = account->getParentAccountID ( accountid ); 170 int parentid = account->getParentAccountID ( accountid );
171 171
172 // delete all the transactions and transfers for the account 172 // delete all the transactions and transfers for the account
173 transaction->deleteAllTransactions ( accountid ); 173 transaction->deleteAllTransactions ( accountid );
174 transfer->deleteAllTransfers ( accountid ); 174 transfer->deleteAllTransfers ( accountid );
175 175
176 // delete the account 176 // delete the account
177 account->deleteAccount ( accountid ); 177 account->deleteAccount ( accountid );
178 178
179 // update account balances 179 // update account balances
180 if ( parentid != -1 ) 180 if ( parentid != -1 )
181 account->changeParentAccountBalance ( parentid ); 181 account->changeParentAccountBalance ( parentid );
182 182
183 //redisplay accounts 183 //redisplay accounts
184 account->displayAccounts ( listview ); 184 account->displayAccounts ( listview );
185 185
186 //remove all the columns from the accountdisplay if there are not any accounts 186 //remove all the columns from the accountdisplay if there are not any accounts
187 if ( account->getNumberOfAccounts() == 0 ) 187 if ( account->getNumberOfAccounts() == 0 )
188 { 188 {
189 int columns = listview->columns(); 189 int columns = listview->columns();
190 int counter; 190 int counter;
191 for ( counter = 0; counter <= columns; counter++ ) 191 for ( counter = 0; counter <= columns; counter++ )
192 listview->removeColumn ( 0 ); 192 listview->removeColumn ( 0 );
193 } 193 }
194 194
195 setToggleButton(); 195 setToggleButton();
196 } 196 }
197 } 197 }
198 maintabs->setTabEnabled ( tab2, FALSE ); 198 maintabs->setTabEnabled ( tab2, FALSE );
199 } 199 }
200 200
201void AccountDisplay::setToggleButton () 201void AccountDisplay::setToggleButton ()
202 { 202 {
203 // iterate through account display and determine how many "transferable" accounts we have 203 // iterate through account display and determine how many "transferable" accounts we have
204 // if there are less than two, disable the transfer button 204 // if there are less than two, disable the transfer button
205 QListViewItemIterator it ( listview ); 205 QListViewItemIterator it ( listview );
206 int counter = 0; 206 int counter = 0;
207 for ( ; it.current(); ++it ) 207 for ( ; it.current(); ++it )
208 { 208 {
209 // add one to counter if we find a transferable account 209 // add one to counter if we find a transferable account
210 if ( it.current()->parent() != 0 || ( it.current()->childCount() ) == 0 ) 210 if ( it.current()->parent() != 0 || ( it.current()->childCount() ) == 0 )
211 counter++; 211 counter++;
212 } 212 }
213 if ( counter > 1 ) 213 if ( counter > 1 )
214 transferbutton->show(); 214 transferbutton->show();
215 else 215 else
216 transferbutton->hide(); 216 transferbutton->hide();
217 } 217 }
218 218
219void AccountDisplay::accountTransfer ( bool state ) 219void AccountDisplay::accountTransfer ( bool state )
220 { 220 {
221 if ( state == TRUE ) 221 if ( state == TRUE )
222 { 222 {
223 firstaccountid = -1; 223 firstaccountid = -1;
224 secondaccountid = -1; 224 secondaccountid = -1;
225 listview->clearSelection (); 225 listview->clearSelection ();
226 listview->setMultiSelection ( TRUE ); 226 listview->setMultiSelection ( TRUE );
227 disableParentsWithChildren (); 227 disableParentsWithChildren ();
228 connect ( listview, SIGNAL ( clicked ( QListViewItem * ) ), this, SLOT ( getTransferAccounts ( QListViewItem * ) ) ); 228 connect ( listview, SIGNAL ( clicked(QListViewItem*) ), this, SLOT ( getTransferAccounts(QListViewItem*) ) );
229 } 229 }
230 else 230 else
231 { 231 {
232 firstaccountid = -1; 232 firstaccountid = -1;
233 secondaccountid = -1; 233 secondaccountid = -1;
234 listview->clearSelection (); 234 listview->clearSelection ();
235 listview->setMultiSelection ( FALSE ); 235 listview->setMultiSelection ( FALSE );
236 enableAccounts (); 236 enableAccounts ();
237 disconnect ( listview, SIGNAL ( clicked ( QListViewItem * ) ), this, SLOT ( getTransferAccounts ( QListViewItem * ) ) ); 237 disconnect ( listview, SIGNAL ( clicked(QListViewItem*) ), this, SLOT ( getTransferAccounts(QListViewItem*) ) );
238 } 238 }
239 } 239 }
240 240
241void AccountDisplay::getTransferAccounts ( QListViewItem * item ) 241void AccountDisplay::getTransferAccounts ( QListViewItem * item )
242 { 242 {
243 if ( item->parent() != 0 || item->childCount() == 0 ) // only set an account for transfer if its a child or parent with no children 243 if ( item->parent() != 0 || item->childCount() == 0 ) // only set an account for transfer if its a child or parent with no children
244 { 244 {
245 if ( firstaccountid == -1 ) 245 if ( firstaccountid == -1 )
246 firstaccountid = item->text ( getIDColumn() ).toInt(); // set first account if we've selected a valid account 246 firstaccountid = item->text ( getIDColumn() ).toInt(); // set first account if we've selected a valid account
247 else 247 else
248 if ( item->text ( getIDColumn() ).toInt() != firstaccountid ) // set the second account if its not equal to the first 248 if ( item->text ( getIDColumn() ).toInt() != firstaccountid ) // set the second account if its not equal to the first
249 secondaccountid = item->text ( getIDColumn() ).toInt(); 249 secondaccountid = item->text ( getIDColumn() ).toInt();
250 } 250 }
251 251
252 // open transfer window if both accounts are set 252 // open transfer window if both accounts are set
253 if ( firstaccountid != -1 && secondaccountid != -1 ) 253 if ( firstaccountid != -1 && secondaccountid != -1 )
254 { 254 {
255 // construct the transferdialog window 255 // construct the transferdialog window
256 TransferDialog *td = new TransferDialog ( this, firstaccountid, secondaccountid ); 256 TransferDialog *td = new TransferDialog ( this, firstaccountid, secondaccountid );
257 257
258 // enter today's date in the date box as default 258 // enter today's date in the date box as default
259 QDate today = QDate::currentDate (); 259 QDate today = QDate::currentDate ();
260 int defaultday = today.day(); 260 int defaultday = today.day();
261 int defaultmonth = today.month(); 261 int defaultmonth = today.month();
262 int defaultyear = today.year(); 262 int defaultyear = today.year();
263 td->date->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) ); 263 td->date->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) );
264 264
265 if ( td->exec() == QDialog::Accepted ) 265 if ( td->exec() == QDialog::Accepted )
266 { 266 {
267 // set the cleared integer if the checkbox is checked 267 // set the cleared integer if the checkbox is checked
268 if ( td->clearedcheckbox->isChecked() == TRUE ) 268 if ( td->clearedcheckbox->isChecked() == TRUE )
269 cleared = 1; 269 cleared = 1;
270 qDebug("Year from transferdialog = %i",td->getYear()); 270 qDebug("Year from transferdialog = %i",td->getYear());
271 // add the transfer with a new date if its been edited or use the default date 271 // add the transfer with a new date if its been edited or use the default date
272 if ( td->getDateEdited () == TRUE ) 272 if ( td->getDateEdited () == TRUE )
273 transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), td->getDay(), td->getMonth(), td->getYear(), td->amount->text().toFloat(), cleared ); 273 transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), td->getDay(), td->getMonth(), td->getYear(), td->amount->text().toFloat(), cleared );
274 else 274 else
275 transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), defaultday, defaultmonth, defaultyear, td->amount->text().toFloat(), cleared ); 275 transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), defaultday, defaultmonth, defaultyear, td->amount->text().toFloat(), cleared );
276 276
277 // update account balances of both accounts and parents if necessary 277 // update account balances of both accounts and parents if necessary
278 account->updateAccountBalance ( firstaccountid ); 278 account->updateAccountBalance ( firstaccountid );
279 if ( account->getParentAccountID ( firstaccountid ) != -1 ) 279 if ( account->getParentAccountID ( firstaccountid ) != -1 )
280 account->changeParentAccountBalance ( account->getParentAccountID ( firstaccountid ) ); 280 account->changeParentAccountBalance ( account->getParentAccountID ( firstaccountid ) );
281 account->updateAccountBalance ( secondaccountid ); 281 account->updateAccountBalance ( secondaccountid );
282 if ( account->getParentAccountID ( secondaccountid ) != -1 ) 282 if ( account->getParentAccountID ( secondaccountid ) != -1 )
283 account->changeParentAccountBalance ( account->getParentAccountID ( secondaccountid ) ); 283 account->changeParentAccountBalance ( account->getParentAccountID ( secondaccountid ) );
284 284
285 // redisplay accounts 285 // redisplay accounts
286 account->displayAccounts ( listview ); 286 account->displayAccounts ( listview );
287 } 287 }
288 else 288 else
289 { 289 {
290 firstaccountid = -1; 290 firstaccountid = -1;
291 secondaccountid = -1; 291 secondaccountid = -1;
292 listview->clearSelection (); 292 listview->clearSelection ();
293 listview->setMultiSelection ( FALSE ); 293 listview->setMultiSelection ( FALSE );
294 disconnect ( listview, SIGNAL ( clicked ( QListViewItem * ) ), this, SLOT ( getTransferAccounts ( QListViewItem * ) ) ); 294 disconnect ( listview, SIGNAL ( clicked(QListViewItem*) ), this, SLOT ( getTransferAccounts(QListViewItem*) ) );
295 } 295 }
296 296
297 // reset the accounts display window 297 // reset the accounts display window
298 transferbutton->toggle(); // toggling this button with clear the window as well 298 transferbutton->toggle(); // toggling this button with clear the window as well
299 299
300 // reenable all the accounts so the transaction tab will be properly set 300 // reenable all the accounts so the transaction tab will be properly set
301 enableAccounts (); 301 enableAccounts ();
302 } 302 }
303 } 303 }
304 304
305void AccountDisplay::disableParentsWithChildren () 305void AccountDisplay::disableParentsWithChildren ()
306 { 306 {
307 // iterate through accountdisplay listview and disable all the parents that have children 307 // iterate through accountdisplay listview and disable all the parents that have children
308 QListViewItemIterator it ( listview ); 308 QListViewItemIterator it ( listview );
309 for ( ; it.current(); ++it ) 309 for ( ; it.current(); ++it )
310 { 310 {
311 if ( it.current()->parent() == 0 && it.current()->childCount() != 0 ) 311 if ( it.current()->parent() == 0 && it.current()->childCount() != 0 )
312 it.current()->setSelectable ( FALSE ); 312 it.current()->setSelectable ( FALSE );
313 } 313 }
314 } 314 }
315 315
316void AccountDisplay::enableAccounts () 316void AccountDisplay::enableAccounts ()
317 { 317 {
318 // iterate through accountdisplay listview and enable all accounts 318 // iterate through accountdisplay listview and enable all accounts
319 QListViewItemIterator it ( listview ); 319 QListViewItemIterator it ( listview );
320 for ( ; it.current(); ++it ) 320 for ( ; it.current(); ++it )
321 it.current()->setSelectable ( TRUE ); 321 it.current()->setSelectable ( TRUE );
322 } 322 }
323 323
324void AccountDisplay::saveColumnSize ( int column, int oldsize, int newsize ) 324void AccountDisplay::saveColumnSize ( int column, int oldsize, int newsize )
325 { 325 {
326 switch ( column ) 326 switch ( column )
327 { 327 {
328 case 0: 328 case 0:
329 if ( listview->columns() == 3 ) 329 if ( listview->columns() == 3 )
330 preferences->changeColumnPreference ( 1, newsize ); 330 preferences->changeColumnPreference ( 1, newsize );
331 else 331 else
332 preferences->changeColumnPreference ( 10, newsize ); 332 preferences->changeColumnPreference ( 10, newsize );
333 break; 333 break;
334 case 1: 334 case 1:
335 if ( listview->columns() == 3 ) 335 if ( listview->columns() == 3 )
336 preferences->changeColumnPreference ( 2, newsize ); 336 preferences->changeColumnPreference ( 2, newsize );
337 else 337 else
338 preferences->changeColumnPreference ( 11, newsize ); 338 preferences->changeColumnPreference ( 11, newsize );
339 break; 339 break;
340 case 2: 340 case 2:
341 preferences->changeColumnPreference ( 12, newsize ); 341 preferences->changeColumnPreference ( 12, newsize );
342 break; 342 break;
343 } 343 }
344 344
345 } 345 }
346 346
347void AccountDisplay::saveSortingPreference ( int column ) 347void AccountDisplay::saveSortingPreference ( int column )
348 { 348 {
349 preferences->changeSortingPreference ( 1, column ); 349 preferences->changeSortingPreference ( 1, column );
350 } 350 }
351 351
352int AccountDisplay::getIDColumn () 352int AccountDisplay::getIDColumn ()
353 { 353 {
354 int counter; 354 int counter;
355 int columns = listview->columns(); 355 int columns = listview->columns();
356 for ( counter = 0; counter <= columns; counter++ ) 356 for ( counter = 0; counter <= columns; counter++ )
357 if ( listview->header()->label ( counter ).length() == 0 ) 357 if ( listview->header()->label ( counter ).length() == 0 )
358 return counter; 358 return counter;
diff --git a/noncore/apps/qashmoney/budgetdisplay.cpp b/noncore/apps/qashmoney/budgetdisplay.cpp
index d4047bf..3fc4e6c 100755
--- a/noncore/apps/qashmoney/budgetdisplay.cpp
+++ b/noncore/apps/qashmoney/budgetdisplay.cpp
@@ -1,146 +1,146 @@
1#include <qmessagebox.h> 1#include <qmessagebox.h>
2#include <qheader.h> 2#include <qheader.h>
3#include <sqlite.h> 3#include <sqlite.h>
4 4
5#include "budgetdisplay.h" 5#include "budgetdisplay.h"
6#include "budget.h" 6#include "budget.h"
7#include "datepicker.h" 7#include "datepicker.h"
8#include "transaction.h" 8#include "transaction.h"
9 9
10extern Preferences *preferences; 10extern Preferences *preferences;
11extern Budget *budget; 11extern Budget *budget;
12extern Transaction *transaction; 12extern Transaction *transaction;
13 13
14BudgetDisplay::BudgetDisplay ( QWidget *parent ) : QWidget ( parent ) 14BudgetDisplay::BudgetDisplay ( QWidget *parent ) : QWidget ( parent )
15 { 15 {
16 QFont font = this->font(); 16 QFont font = this->font();
17 font.setWeight ( QFont::Bold ); 17 font.setWeight ( QFont::Bold );
18 18
19 //set the default date to today 19 //set the default date to today
20 newDate = QDate::currentDate (); 20 newDate = QDate::currentDate ();
21 year = newDate.year(); 21 year = newDate.year();
22 month = newDate.month(); 22 month = newDate.month();
23 day = newDate.day(); 23 day = newDate.day();
24 datelabel = preferences->getDate ( year, month ); 24 datelabel = preferences->getDate ( year, month );
25 25
26 setCaption ( "Budget" ); 26 setCaption ( "Budget" );
27 27
28 firstline = new QHBox ( this ); 28 firstline = new QHBox ( this );
29 firstline->setSpacing ( 2 ); 29 firstline->setSpacing ( 2 );
30 secondline = new QHBox ( this ); 30 secondline = new QHBox ( this );
31 secondline->setSpacing ( 10 ); 31 secondline->setSpacing ( 10 );
32 32
33 menu = new QMenuBar ( this ); 33 menu = new QMenuBar ( this );
34 menu->setFrameStyle ( QFrame::Box | QFrame::Sunken ); 34 menu->setFrameStyle ( QFrame::Box | QFrame::Sunken );
35 budgetmenu = new QPopupMenu ( this ); 35 budgetmenu = new QPopupMenu ( this );
36 lineitemsmenu = new QPopupMenu ( this ); 36 lineitemsmenu = new QPopupMenu ( this );
37 datemenu = new QPopupMenu ( this ); 37 datemenu = new QPopupMenu ( this );
38 menu->insertItem ( "Budget", budgetmenu ); 38 menu->insertItem ( "Budget", budgetmenu );
39 menu->insertItem ( "Line Item", lineitemsmenu ); 39 menu->insertItem ( "Line Item", lineitemsmenu );
40 menu->insertItem ( "Date", datemenu ); 40 menu->insertItem ( "Date", datemenu );
41 budgetmenu->insertItem ( "New", this, SLOT ( newBudget () ), 0, 1 ); 41 budgetmenu->insertItem ( "New", this, SLOT ( newBudget() ), 0, 1 );
42 budgetmenu->insertItem ( "Edit", this, SLOT ( editBudget () ), 0, 2 ); 42 budgetmenu->insertItem ( "Edit", this, SLOT ( editBudget() ), 0, 2 );
43 budgetmenu->insertItem ( "Delete", this, SLOT ( deleteBudget () ), 0, 3 ); 43 budgetmenu->insertItem ( "Delete", this, SLOT ( deleteBudget() ), 0, 3 );
44 lineitemsmenu->insertItem ( "New", this, SLOT ( newLineItem () ), 0, 1 ); 44 lineitemsmenu->insertItem ( "New", this, SLOT ( newLineItem() ), 0, 1 );
45 lineitemsmenu->insertItem ( "Edit", this, SLOT ( editLineItem () ), 0, 2 ); 45 lineitemsmenu->insertItem ( "Edit", this, SLOT ( editLineItem() ), 0, 2 );
46 lineitemsmenu->insertItem ( "Delete", this, SLOT ( deleteLineItem () ), 0, 3 ); 46 lineitemsmenu->insertItem ( "Delete", this, SLOT ( deleteLineItem() ), 0, 3 );
47 datemenu->insertItem ( "Change", this, SLOT ( showCalendar() ) ); 47 datemenu->insertItem ( "Change", this, SLOT ( showCalendar() ) );
48 48
49 budgetbox = new QComboBox ( firstline ); 49 budgetbox = new QComboBox ( firstline );
50 connect ( budgetbox, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentBudget ( int ) ) ); 50 connect ( budgetbox, SIGNAL ( activated(int) ), this, SLOT ( setCurrentBudget(int) ) );
51 51
52 budgetview = new QComboBox ( firstline ); 52 budgetview = new QComboBox ( firstline );
53 budgetview->insertItem ( "Month" ); 53 budgetview->insertItem ( "Month" );
54 budgetview->insertItem ( "Year" ); 54 budgetview->insertItem ( "Year" );
55 connect ( budgetview, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentView ( int ) ) ); 55 connect ( budgetview, SIGNAL ( activated(int) ), this, SLOT ( setCurrentView(int) ) );
56 56
57 budgeted = new QLabel ( secondline ); 57 budgeted = new QLabel ( secondline );
58 budgeted->setFont ( font ); 58 budgeted->setFont ( font );
59 actual = new QLabel ( secondline ); 59 actual = new QLabel ( secondline );
60 actual->setFont ( font ); 60 actual->setFont ( font );
61 date = new QLabel ( secondline ); 61 date = new QLabel ( secondline );
62 date->setFont ( font ); 62 date->setFont ( font );
63 63
64 listview = new QListView ( this ); 64 listview = new QListView ( this );
65 listview->setAllColumnsShowFocus ( TRUE ); 65 listview->setAllColumnsShowFocus ( TRUE );
66 listview->setShowSortIndicator ( TRUE ); 66 listview->setShowSortIndicator ( TRUE );
67 listview->setRootIsDecorated ( TRUE ); 67 listview->setRootIsDecorated ( TRUE );
68 listview->setMultiSelection ( FALSE ); 68 listview->setMultiSelection ( FALSE );
69 listview->addColumn ( "Line Item", preferences->getColumnPreference ( 13 ) ); // column id 13 69 listview->addColumn ( "Line Item", preferences->getColumnPreference ( 13 ) ); // column id 13
70 listview->addColumn ( "Budget", preferences->getColumnPreference ( 14 ) ); // column id 14 70 listview->addColumn ( "Budget", preferences->getColumnPreference ( 14 ) ); // column id 14
71 listview->addColumn ( "Actual", preferences->getColumnPreference ( 15 ) ); // column id 15 71 listview->addColumn ( "Actual", preferences->getColumnPreference ( 15 ) ); // column id 15
72 listview->addColumn ( "", 0 ); // line item ids 72 listview->addColumn ( "", 0 ); // line item ids
73 listview->setColumnWidthMode ( 0, QListView::Manual ); 73 listview->setColumnWidthMode ( 0, QListView::Manual );
74 listview->setColumnWidthMode ( 1, QListView::Manual ); 74 listview->setColumnWidthMode ( 1, QListView::Manual );
75 listview->setColumnWidthMode ( 2, QListView::Manual ); 75 listview->setColumnWidthMode ( 2, QListView::Manual );
76 listview->setColumnAlignment ( 1, Qt::AlignRight ); 76 listview->setColumnAlignment ( 1, Qt::AlignRight );
77 listview->setColumnAlignment ( 2, Qt::AlignRight ); 77 listview->setColumnAlignment ( 2, Qt::AlignRight );
78 listview->setColumnWidthMode ( 3, QListView::Manual ); 78 listview->setColumnWidthMode ( 3, QListView::Manual );
79 79
80 listview->header()->setTracking ( FALSE ); 80 listview->header()->setTracking ( FALSE );
81 connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); 81 connect ( listview->header(), SIGNAL ( sizeChange(int,int,int) ), this, SLOT ( saveColumnSize(int,int,int) ) );
82 connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); 82 connect ( listview->header(), SIGNAL ( clicked(int) ), this, SLOT ( saveSortingPreference(int) ) );
83 83
84 // pull the column sorting preference from the preferences table, and configure the listview accordingly 84 // pull the column sorting preference from the preferences table, and configure the listview accordingly
85 int column = 0; 85 int column = 0;
86 int direction = 0; 86 int direction = 0;
87 preferences->getSortingPreference ( 3, &column, &direction ); 87 preferences->getSortingPreference ( 3, &column, &direction );
88 listview->setSorting ( column, direction ); 88 listview->setSorting ( column, direction );
89 89
90 displayBudgetNames(); 90 displayBudgetNames();
91 91
92 layout = new QVBoxLayout ( this, 2, 2 ); 92 layout = new QVBoxLayout ( this, 2, 2 );
93 layout->setMenuBar ( menu ); 93 layout->setMenuBar ( menu );
94 layout->addWidget ( firstline ); 94 layout->addWidget ( firstline );
95 layout->addWidget ( secondline ); 95 layout->addWidget ( secondline );
96 layout->addWidget ( listview ); 96 layout->addWidget ( listview );
97 } 97 }
98 98
99void BudgetDisplay::deleteBudget () 99void BudgetDisplay::deleteBudget ()
100 { 100 {
101 listview->clear(); 101 listview->clear();
102 transaction->clearBudgetIDs ( currentbudget ); 102 transaction->clearBudgetIDs ( currentbudget );
103 budget->deleteBudget ( currentbudget ); 103 budget->deleteBudget ( currentbudget );
104 if ( budgetbox->count() != 0 ) 104 if ( budgetbox->count() != 0 )
105 displayBudgetNames(); 105 displayBudgetNames();
106 checkBudgets(); 106 checkBudgets();
107 } 107 }
108 108
109void BudgetDisplay::saveColumnSize ( int column, int oldsize, int newsize ) 109void BudgetDisplay::saveColumnSize ( int column, int oldsize, int newsize )
110 { 110 {
111 switch ( column ) 111 switch ( column )
112 { 112 {
113 case 0: 113 case 0:
114 preferences->changeColumnPreference ( 13, newsize ); 114 preferences->changeColumnPreference ( 13, newsize );
115 break; 115 break;
116 case 1: 116 case 1:
117 preferences->changeColumnPreference ( 14, newsize ); 117 preferences->changeColumnPreference ( 14, newsize );
118 break; 118 break;
119 case 2: 119 case 2:
120 preferences->changeColumnPreference ( 15, newsize ); 120 preferences->changeColumnPreference ( 15, newsize );
121 break; 121 break;
122 } 122 }
123 } 123 }
124 124
125void BudgetDisplay::saveSortingPreference ( int column ) 125void BudgetDisplay::saveSortingPreference ( int column )
126 { 126 {
127 preferences->changeSortingPreference ( 3, column ); 127 preferences->changeSortingPreference ( 3, column );
128 } 128 }
129 129
130int BudgetDisplay::getIDColumn () 130int BudgetDisplay::getIDColumn ()
131 { 131 {
132 int counter; 132 int counter;
133 int columns = listview->columns(); 133 int columns = listview->columns();
134 for ( counter = 0; counter <= columns; counter++ ) 134 for ( counter = 0; counter <= columns; counter++ )
135 if ( listview->header()->label ( counter ).length() == 0 ) 135 if ( listview->header()->label ( counter ).length() == 0 )
136 return counter; 136 return counter;
137 } 137 }
138 138
139void BudgetDisplay::newBudget () 139void BudgetDisplay::newBudget ()
140 { 140 {
141 constructBudgetWindow(); 141 constructBudgetWindow();
142 int response = nb->exec(); 142 int response = nb->exec();
143 if ( response == 1 ) 143 if ( response == 1 )
144 { 144 {
145 // open a new budget object 145 // open a new budget object
146 int addedbudget = budget->addBudget ( budgetname->text(), 0, description->text(), currencybox->currencybox->currentText(), day, month, year, day, month, year, 0 ); 146 int addedbudget = budget->addBudget ( budgetname->text(), 0, description->text(), currencybox->currencybox->currentText(), day, month, year, day, month, year, 0 );
diff --git a/noncore/apps/qashmoney/calculator.cpp b/noncore/apps/qashmoney/calculator.cpp
index 0e0a043..2c92103 100755
--- a/noncore/apps/qashmoney/calculator.cpp
+++ b/noncore/apps/qashmoney/calculator.cpp
@@ -1,113 +1,113 @@
1#include "calculator.h" 1#include "calculator.h"
2 2
3#include <qpushbutton.h> 3#include <qpushbutton.h>
4 4
5Calculator::Calculator ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) 5Calculator::Calculator ( QWidget* parent ) : QDialog ( parent, 0, TRUE )
6 { 6 {
7 7
8 display = new QLineEdit ( this, "display" ); 8 display = new QLineEdit ( this, "display" );
9 display->setFrame ( FALSE ); 9 display->setFrame ( FALSE );
10 display->setAlignment ( Qt::AlignRight ); 10 display->setAlignment ( Qt::AlignRight );
11 11
12 QPushButton *one = new QPushButton ( "1", this, "one" ); // make buttons for first row 12 QPushButton *one = new QPushButton ( "1", this, "one" ); // make buttons for first row
13 one->setFlat ( TRUE ); 13 one->setFlat ( TRUE );
14 connect ( one, SIGNAL ( released () ), this, SLOT ( displayOne () ) ); 14 connect ( one, SIGNAL ( released() ), this, SLOT ( displayOne() ) );
15 15
16 QPushButton *two = new QPushButton ( "2", this, "two" ); 16 QPushButton *two = new QPushButton ( "2", this, "two" );
17 two->setFlat ( TRUE ); 17 two->setFlat ( TRUE );
18 connect ( two, SIGNAL ( released () ), this, SLOT ( displayTwo () ) ); 18 connect ( two, SIGNAL ( released() ), this, SLOT ( displayTwo() ) );
19 19
20 QPushButton *three = new QPushButton ( "3", this, "three" ); 20 QPushButton *three = new QPushButton ( "3", this, "three" );
21 three->setFlat ( TRUE ); 21 three->setFlat ( TRUE );
22 connect ( three, SIGNAL ( released () ), this, SLOT ( displayThree () ) ); 22 connect ( three, SIGNAL ( released() ), this, SLOT ( displayThree() ) );
23 23
24 QPushButton *four = new QPushButton ( "4", this, "four" ); // make buttons for second row 24 QPushButton *four = new QPushButton ( "4", this, "four" ); // make buttons for second row
25 four->setFlat ( TRUE ); 25 four->setFlat ( TRUE );
26 connect ( four, SIGNAL ( released () ), this, SLOT ( displayFour () ) ); 26 connect ( four, SIGNAL ( released() ), this, SLOT ( displayFour() ) );
27 27
28 QPushButton *five = new QPushButton ( "5", this, "five" ); 28 QPushButton *five = new QPushButton ( "5", this, "five" );
29 five->setFlat ( TRUE ); 29 five->setFlat ( TRUE );
30 connect ( five, SIGNAL ( released () ), this, SLOT ( displayFive () ) ); 30 connect ( five, SIGNAL ( released() ), this, SLOT ( displayFive() ) );
31 31
32 QPushButton *six = new QPushButton ( "6", this, "six" ); 32 QPushButton *six = new QPushButton ( "6", this, "six" );
33 six->setFlat ( TRUE ); 33 six->setFlat ( TRUE );
34 connect ( six, SIGNAL ( released () ), this, SLOT ( displaySix () ) ); 34 connect ( six, SIGNAL ( released() ), this, SLOT ( displaySix() ) );
35 35
36 QPushButton *seven = new QPushButton ( "7", this, "seven" ); // make buttons for third row 36 QPushButton *seven = new QPushButton ( "7", this, "seven" ); // make buttons for third row
37 seven->setFlat ( TRUE ); 37 seven->setFlat ( TRUE );
38 connect ( seven, SIGNAL ( released () ), this, SLOT ( displaySeven () ) ); 38 connect ( seven, SIGNAL ( released() ), this, SLOT ( displaySeven() ) );
39 39
40 QPushButton *eight = new QPushButton ( "8", this, "eight" ); 40 QPushButton *eight = new QPushButton ( "8", this, "eight" );
41 eight->setFlat ( TRUE ); 41 eight->setFlat ( TRUE );
42 connect ( eight, SIGNAL ( released () ), this, SLOT ( displayEight () ) ); 42 connect ( eight, SIGNAL ( released() ), this, SLOT ( displayEight() ) );
43 43
44 QPushButton *nine = new QPushButton ( "9", this, "nine" ); 44 QPushButton *nine = new QPushButton ( "9", this, "nine" );
45 nine->setFlat ( TRUE ); 45 nine->setFlat ( TRUE );
46 connect ( nine, SIGNAL ( released () ), this, SLOT ( displayNine () ) ); 46 connect ( nine, SIGNAL ( released() ), this, SLOT ( displayNine() ) );
47 47
48 QPushButton *zero = new QPushButton ( "0", this, "zero" ); 48 QPushButton *zero = new QPushButton ( "0", this, "zero" );
49 zero->setFlat ( TRUE ); 49 zero->setFlat ( TRUE );
50 connect ( zero, SIGNAL ( released () ), this, SLOT ( displayZero () ) ); 50 connect ( zero, SIGNAL ( released() ), this, SLOT ( displayZero() ) );
51 51
52 QPushButton *dp = new QPushButton ( ".", this, "dp" ); 52 QPushButton *dp = new QPushButton ( ".", this, "dp" );
53 dp->setFlat ( TRUE ); 53 dp->setFlat ( TRUE );
54 connect ( dp, SIGNAL ( released () ), this, SLOT ( displayPoint () ) ); 54 connect ( dp, SIGNAL ( released() ), this, SLOT ( displayPoint() ) );
55 55
56 QPushButton *back = new QPushButton ( "<-", this, "back" ); 56 QPushButton *back = new QPushButton ( "<-", this, "back" );
57 back->setFlat ( TRUE ); 57 back->setFlat ( TRUE );
58 connect ( back, SIGNAL ( released () ), this, SLOT ( back () ) ); 58 connect ( back, SIGNAL ( released() ), this, SLOT ( back() ) );
59 59
60 layout = new QGridLayout ( this, 5, 3, 5, 1, "calculatorlayout" ); 60 layout = new QGridLayout ( this, 5, 3, 5, 1, "calculatorlayout" );
61 layout->addMultiCellWidget ( display, 0, 0, 0, 2 ); 61 layout->addMultiCellWidget ( display, 0, 0, 0, 2 );
62 layout->addWidget ( one, 1, 0 ); 62 layout->addWidget ( one, 1, 0 );
63 layout->addWidget ( two, 1, 1 ); 63 layout->addWidget ( two, 1, 1 );
64 layout->addWidget ( three, 1, 2 ); 64 layout->addWidget ( three, 1, 2 );
65 layout->addWidget ( four, 2, 0 ); 65 layout->addWidget ( four, 2, 0 );
66 layout->addWidget ( five, 2, 1 ); 66 layout->addWidget ( five, 2, 1 );
67 layout->addWidget ( six, 2, 2 ); 67 layout->addWidget ( six, 2, 2 );
68 layout->addWidget ( seven, 3, 0 ); 68 layout->addWidget ( seven, 3, 0 );
69 layout->addWidget ( eight, 3, 1 ); 69 layout->addWidget ( eight, 3, 1 );
70 layout->addWidget ( nine, 3, 2 ); 70 layout->addWidget ( nine, 3, 2 );
71 layout->addWidget ( zero, 4, 0 ); 71 layout->addWidget ( zero, 4, 0 );
72 layout->addWidget ( dp, 4, 1 ); 72 layout->addWidget ( dp, 4, 1 );
73 layout->addWidget ( back, 4, 2 ); 73 layout->addWidget ( back, 4, 2 );
74 74
75 } 75 }
76 76
77void Calculator::displayOne () 77void Calculator::displayOne ()
78 { display->insert ( "1" ); } 78 { display->insert ( "1" ); }
79 79
80void Calculator::displayTwo () 80void Calculator::displayTwo ()
81 { display->insert ( "2" ); } 81 { display->insert ( "2" ); }
82 82
83void Calculator::displayThree () 83void Calculator::displayThree ()
84 { display->insert ( "3" ); } 84 { display->insert ( "3" ); }
85 85
86void Calculator::displayFour () 86void Calculator::displayFour ()
87 { display->insert ( "4" ); } 87 { display->insert ( "4" ); }
88 88
89void Calculator::displayFive () 89void Calculator::displayFive ()
90 { display->insert ( "5" ); } 90 { display->insert ( "5" ); }
91 91
92void Calculator::displaySix () 92void Calculator::displaySix ()
93 { display->insert ( "6" ); } 93 { display->insert ( "6" ); }
94 94
95void Calculator::displaySeven () 95void Calculator::displaySeven ()
96 { display->insert ( "7" ); } 96 { display->insert ( "7" ); }
97 97
98void Calculator::displayEight () 98void Calculator::displayEight ()
99 { display->insert ( "8" ); } 99 { display->insert ( "8" ); }
100 100
101void Calculator::displayNine () 101void Calculator::displayNine ()
102 { display->insert ( "9" ); } 102 { display->insert ( "9" ); }
103 103
104void Calculator::displayZero () 104void Calculator::displayZero ()
105 { display->insert ( "0" ); } 105 { display->insert ( "0" ); }
106 106
107void Calculator::displayPoint () 107void Calculator::displayPoint ()
108 { display->insert ( "." ); } 108 { display->insert ( "." ); }
109 109
110void Calculator::back () 110void Calculator::back ()
111 { display->backspace(); } 111 { display->backspace(); }
112 112
113 113
diff --git a/noncore/apps/qashmoney/datepicker.cpp b/noncore/apps/qashmoney/datepicker.cpp
index 02fbcf3..7997c0b 100755
--- a/noncore/apps/qashmoney/datepicker.cpp
+++ b/noncore/apps/qashmoney/datepicker.cpp
@@ -1,86 +1,86 @@
1#include "datepicker.h" 1#include "datepicker.h"
2 2
3DatePicker::DatePicker ( QDate entrydate ) : QDialog ( 0, 0, TRUE ) 3DatePicker::DatePicker ( QDate entrydate ) : QDialog ( 0, 0, TRUE )
4 { 4 {
5 setCaption ( "Select Date" ); 5 setCaption ( "Select Date" );
6 date = entrydate; 6 date = entrydate;
7 day = date.day(); 7 day = date.day();
8 month = date.month(); 8 month = date.month();
9 year = date.year(); 9 year = date.year();
10 10
11 daylabel = new QLabel ( "Day", this ); 11 daylabel = new QLabel ( "Day", this );
12 monthlabel = new QLabel ( "Month", this ); 12 monthlabel = new QLabel ( "Month", this );
13 yearlabel = new QLabel ( "Year", this ); 13 yearlabel = new QLabel ( "Year", this );
14 14
15 daybox = new QComboBox ( this, "daybox" ); 15 daybox = new QComboBox ( this, "daybox" );
16 connect ( daybox, SIGNAL ( activated ( int ) ), this, SLOT ( setDay ( int ) ) ); 16 connect ( daybox, SIGNAL ( activated(int) ), this, SLOT ( setDay(int) ) );
17 displayDays ( daybox ); 17 displayDays ( daybox );
18 monthbox = new QComboBox ( this, "monthbox" ); 18 monthbox = new QComboBox ( this, "monthbox" );
19 connect ( monthbox, SIGNAL ( activated ( int ) ), this, SLOT ( setMonth ( int ) ) ); 19 connect ( monthbox, SIGNAL ( activated(int) ), this, SLOT ( setMonth(int) ) );
20 displayMonths ( monthbox ); 20 displayMonths ( monthbox );
21 yearbox = new QComboBox ( this, "yearbox" ); 21 yearbox = new QComboBox ( this, "yearbox" );
22 connect ( yearbox, SIGNAL ( activated ( int ) ), this, SLOT ( setYear ( int ) ) ); 22 connect ( yearbox, SIGNAL ( activated(int) ), this, SLOT ( setYear(int) ) );
23 displayYears ( yearbox ); 23 displayYears ( yearbox );
24 24
25 layout = new QGridLayout ( this, 2, 3, 5, 5, "datepickerlayout" ); 25 layout = new QGridLayout ( this, 2, 3, 5, 5, "datepickerlayout" );
26 layout->addWidget ( daylabel, 0, 2 ); 26 layout->addWidget ( daylabel, 0, 2 );
27 layout->addWidget ( monthlabel, 0, 1 ); 27 layout->addWidget ( monthlabel, 0, 1 );
28 layout->addWidget ( yearlabel, 0, 0 ); 28 layout->addWidget ( yearlabel, 0, 0 );
29 layout->addWidget ( daybox, 1, 2 ); 29 layout->addWidget ( daybox, 1, 2 );
30 layout->addWidget ( monthbox, 1, 1 ); 30 layout->addWidget ( monthbox, 1, 1 );
31 layout->addWidget ( yearbox, 1, 0 ); 31 layout->addWidget ( yearbox, 1, 0 );
32 } 32 }
33 33
34void DatePicker::displayDays ( QComboBox *daybox ) 34void DatePicker::displayDays ( QComboBox *daybox )
35 { 35 {
36 int counter; 36 int counter;
37 int days = date.daysInMonth(); 37 int days = date.daysInMonth();
38 for ( counter = 1; counter <= days; counter++ ) 38 for ( counter = 1; counter <= days; counter++ )
39 daybox->insertItem ( QString::number ( counter ) ); 39 daybox->insertItem ( QString::number ( counter ) );
40 daybox->setCurrentItem ( ( date.day() ) - 1 ); 40 daybox->setCurrentItem ( ( date.day() ) - 1 );
41 } 41 }
42 42
43void DatePicker::displayMonths ( QComboBox *monthbox ) 43void DatePicker::displayMonths ( QComboBox *monthbox )
44 { 44 {
45 int counter; 45 int counter;
46 for ( counter = 1; counter <= 12; counter++ ) 46 for ( counter = 1; counter <= 12; counter++ )
47 monthbox->insertItem ( QString::number ( counter ) ); 47 monthbox->insertItem ( QString::number ( counter ) );
48 monthbox->setCurrentItem ( ( date.month() ) - 1 ); 48 monthbox->setCurrentItem ( ( date.month() ) - 1 );
49 } 49 }
50 50
51void DatePicker::displayYears ( QComboBox *yearbox ) 51void DatePicker::displayYears ( QComboBox *yearbox )
52 { 52 {
53 int counter; 53 int counter;
54 int indexcounter = 0; 54 int indexcounter = 0;
55 int yearindex = 0; 55 int yearindex = 0;
56 int year = date.year(); 56 int year = date.year();
57 for ( counter = ( year - 1 ); counter <= ( year + 1 ); counter++ ) 57 for ( counter = ( year - 1 ); counter <= ( year + 1 ); counter++ )
58 { 58 {
59 yearbox->insertItem ( QString::number ( counter ) ); 59 yearbox->insertItem ( QString::number ( counter ) );
60 if ( date.year() == counter ) 60 if ( date.year() == counter )
61 yearindex = indexcounter; 61 yearindex = indexcounter;
62 indexcounter ++; 62 indexcounter ++;
63 } 63 }
64 yearbox->setCurrentItem ( yearindex ); 64 yearbox->setCurrentItem ( yearindex );
65 } 65 }
66 66
67void DatePicker::setDay ( int index ) 67void DatePicker::setDay ( int index )
68 { 68 {
69 day = daybox->text ( index ).toInt(); 69 day = daybox->text ( index ).toInt();
70 } 70 }
71 71
72void DatePicker::setMonth ( int index ) 72void DatePicker::setMonth ( int index )
73 { 73 {
74 month = monthbox->text( index ).toInt(); 74 month = monthbox->text( index ).toInt();
75 } 75 }
76 76
77void DatePicker::setYear ( int index ) 77void DatePicker::setYear ( int index )
78 { 78 {
79 year = yearbox->text ( index ).toInt(); 79 year = yearbox->text ( index ).toInt();
80 } 80 }
81 81
82int DatePicker::getDay () 82int DatePicker::getDay ()
83 { return day; } 83 { return day; }
84 84
85int DatePicker::getMonth () 85int DatePicker::getMonth ()
86 { return month; } 86 { return month; }
diff --git a/noncore/apps/qashmoney/memorydialog.cpp b/noncore/apps/qashmoney/memorydialog.cpp
index e9ebd54..ba11540 100755
--- a/noncore/apps/qashmoney/memorydialog.cpp
+++ b/noncore/apps/qashmoney/memorydialog.cpp
@@ -1,86 +1,86 @@
1#include "memorydialog.h" 1#include "memorydialog.h"
2#include "memory.h" 2#include "memory.h"
3#include <qmessagebox.h> 3#include <qmessagebox.h>
4 4
5extern Memory *memory; 5extern Memory *memory;
6 6
7MemoryDialog::MemoryDialog () : QDialog ( 0, 0, TRUE ) 7MemoryDialog::MemoryDialog () : QDialog ( 0, 0, TRUE )
8{ 8{
9 setCaption ( tr ( "Edit Memory" ) ); 9 setCaption ( tr ( "Edit Memory" ) );
10 10
11 listbox = new QListBox ( this, "listbox" ); 11 listbox = new QListBox ( this, "listbox" );
12 memory->displayMemoryItems ( listbox ); 12 memory->displayMemoryItems ( listbox );
13 listbox->clearSelection(); 13 listbox->clearSelection();
14 14
15 secondline = new QHBox ( this ); 15 secondline = new QHBox ( this );
16 16
17 newbutton = new QPushButton ( secondline ); 17 newbutton = new QPushButton ( secondline );
18 newbutton->setPixmap( QPixmap ("/opt/QtPalmtop/pics/new.png") ); 18 newbutton->setPixmap( QPixmap ("/opt/QtPalmtop/pics/new.png") );
19 connect ( newbutton, SIGNAL ( released () ), this, SLOT ( addItem () ) ); 19 connect ( newbutton, SIGNAL ( released() ), this, SLOT ( addItem() ) );
20 20
21 editbutton = new QPushButton ( secondline ); 21 editbutton = new QPushButton ( secondline );
22 editbutton->setPixmap( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); 22 editbutton->setPixmap( QPixmap ("/opt/QtPalmtop/pics/edit.png") );
23 connect ( editbutton, SIGNAL ( released () ), this, SLOT ( editItem () ) ); 23 connect ( editbutton, SIGNAL ( released() ), this, SLOT ( editItem() ) );
24 24
25 deletebutton = new QPushButton( secondline ); 25 deletebutton = new QPushButton( secondline );
26 deletebutton->setPixmap( QPixmap ("/opt/QtPalmtop/pics/delete.png") ); 26 deletebutton->setPixmap( QPixmap ("/opt/QtPalmtop/pics/delete.png") );
27 connect ( deletebutton, SIGNAL ( released () ), this, SLOT ( deleteItem () ) ); 27 connect ( deletebutton, SIGNAL ( released() ), this, SLOT ( deleteItem() ) );
28 28
29 lineedit = new QLineEdit ( this ); 29 lineedit = new QLineEdit ( this );
30 30
31 layout = new QVBoxLayout ( this, 2, 2 ); 31 layout = new QVBoxLayout ( this, 2, 2 );
32 layout->addWidget ( listbox ); 32 layout->addWidget ( listbox );
33 layout->addWidget ( secondline ); 33 layout->addWidget ( secondline );
34 layout->addWidget ( lineedit ); 34 layout->addWidget ( lineedit );
35} 35}
36 36
37MemoryDialog::~MemoryDialog() 37MemoryDialog::~MemoryDialog()
38 { 38 {
39 } 39 }
40 40
41void MemoryDialog::addItem () 41void MemoryDialog::addItem ()
42 { 42 {
43 if ( lineedit->text().length() != 0 ) 43 if ( lineedit->text().length() != 0 )
44 { 44 {
45 memory->addMemoryItem ( lineedit->text() ); 45 memory->addMemoryItem ( lineedit->text() );
46 listbox->clear (); 46 listbox->clear ();
47 memory->displayMemoryItems ( listbox ); 47 memory->displayMemoryItems ( listbox );
48 listbox->clearFocus(); 48 listbox->clearFocus();
49 listbox->clearSelection (); 49 listbox->clearSelection ();
50 lineedit->clear(); 50 lineedit->clear();
51 } 51 }
52 } 52 }
53 53
54void MemoryDialog::editItem () 54void MemoryDialog::editItem ()
55 { 55 {
56 if ( listbox->currentItem() != -1 ) 56 if ( listbox->currentItem() != -1 )
57 { 57 {
58 lineedit->setText ( listbox->currentText() ); 58 lineedit->setText ( listbox->currentText() );
59 memory->deleteMemoryItem ( listbox->currentText() ); 59 memory->deleteMemoryItem ( listbox->currentText() );
60 listbox->clear (); 60 listbox->clear ();
61 memory->displayMemoryItems ( listbox ); 61 memory->displayMemoryItems ( listbox );
62 listbox->clearSelection(); 62 listbox->clearSelection();
63 } 63 }
64 else 64 else
65 QMessageBox::warning ( this, "QashMoney", "Please select an item to edit." ); 65 QMessageBox::warning ( this, "QashMoney", "Please select an item to edit." );
66 } 66 }
67 67
68void MemoryDialog::deleteItem () 68void MemoryDialog::deleteItem ()
69 { 69 {
70 if ( listbox->currentItem() != -1 ) 70 if ( listbox->currentItem() != -1 )
71 { 71 {
72 memory->deleteMemoryItem ( listbox->currentText() ); 72 memory->deleteMemoryItem ( listbox->currentText() );
73 listbox->clear (); 73 listbox->clear ();
74 memory->displayMemoryItems ( listbox ); 74 memory->displayMemoryItems ( listbox );
75 listbox->clearSelection(); 75 listbox->clearSelection();
76 } 76 }
77 else 77 else
78 QMessageBox::warning ( this, "QashMoney", "Please select an item to delete." ); 78 QMessageBox::warning ( this, "QashMoney", "Please select an item to delete." );
79 } 79 }
80 80
81 81
82 82
83 83
84 84
85 85
86 86
diff --git a/noncore/apps/qashmoney/newaccount.cpp b/noncore/apps/qashmoney/newaccount.cpp
index 7e57a18..5932182 100755
--- a/noncore/apps/qashmoney/newaccount.cpp
+++ b/noncore/apps/qashmoney/newaccount.cpp
@@ -15,134 +15,134 @@ NewAccount::NewAccount ( QWidget *parent, const char *name, bool modal ) : QDial
15 15
16 accountbox = new QHBox ( this ); 16 accountbox = new QHBox ( this );
17 accountname = new QLineEdit ( accountbox ); 17 accountname = new QLineEdit ( accountbox );
18 descriptionbutton = new QPushButton ( accountbox ); 18 descriptionbutton = new QPushButton ( accountbox );
19 descriptionbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/info.png" ) ); 19 descriptionbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/info.png" ) );
20 20
21 datelabel = new QLabel ( "Date", this ); 21 datelabel = new QLabel ( "Date", this );
22 22
23 datebox = new QHBox ( this ); 23 datebox = new QHBox ( this );
24 startdate = new QLineEdit ( datebox ); 24 startdate = new QLineEdit ( datebox );
25 startdate->setDisabled ( TRUE ); 25 startdate->setDisabled ( TRUE );
26 datebutton = new QPushButton ( datebox ); 26 datebutton = new QPushButton ( datebox );
27 datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); 27 datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) );
28 28
29 childcheckbox = new QCheckBox ( this ); 29 childcheckbox = new QCheckBox ( this );
30 childcheckbox->setText( tr ( "Child Account" ) ); 30 childcheckbox->setText( tr ( "Child Account" ) );
31 31
32 childlabel = new QLabel ( "Child of", this ); 32 childlabel = new QLabel ( "Child of", this );
33 childbox = new QComboBox ( FALSE, this ); 33 childbox = new QComboBox ( FALSE, this );
34 hideChildPulldownMenu (); 34 hideChildPulldownMenu ();
35 35
36 balancelabel = new QLabel ( "Balance", this ); 36 balancelabel = new QLabel ( "Balance", this );
37 37
38 balancebox = new QHBox ( this ); 38 balancebox = new QHBox ( this );
39 accountbalance = new QLineEdit ( balancebox ); 39 accountbalance = new QLineEdit ( balancebox );
40 accountbalance->setText ( "0.00" ); 40 accountbalance->setText ( "0.00" );
41 balancecalculator = new QPushButton( balancebox ); 41 balancecalculator = new QPushButton( balancebox );
42 balancecalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); 42 balancecalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) );
43 43
44 creditlimitlabel = new QLabel ( "Credit Limit", this ); 44 creditlimitlabel = new QLabel ( "Credit Limit", this );
45 45
46 creditlimitbox = new QHBox ( this ); 46 creditlimitbox = new QHBox ( this );
47 creditlimit = new QLineEdit ( creditlimitbox ); 47 creditlimit = new QLineEdit ( creditlimitbox );
48 creditlimitbox->setEnabled ( FALSE ); 48 creditlimitbox->setEnabled ( FALSE );
49 creditlimitcalculator = new QPushButton( creditlimitbox ); 49 creditlimitcalculator = new QPushButton( creditlimitbox );
50 creditlimitcalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); 50 creditlimitcalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) );
51 51
52 currencybox = new Currency ( this ); 52 currencybox = new Currency ( this );
53 53
54 typelabel = new QLabel ( "Type", this ); 54 typelabel = new QLabel ( "Type", this );
55 accounttype = new QComboBox ( FALSE, this ); 55 accounttype = new QComboBox ( FALSE, this );
56 accounttype->insertItem( tr( "Bank" ) ); 56 accounttype->insertItem( tr( "Bank" ) );
57 accounttype->insertItem( tr( "Cash" ) ); 57 accounttype->insertItem( tr( "Cash" ) );
58 accounttype->insertItem( tr( "Credit Card" ) ); 58 accounttype->insertItem( tr( "Credit Card" ) );
59 accounttype->insertItem( tr( "Equity" ) ); 59 accounttype->insertItem( tr( "Equity" ) );
60 accounttype->insertItem( tr( "Asset" ) ); 60 accounttype->insertItem( tr( "Asset" ) );
61 accounttype->insertItem( tr( "Liability" ) ); 61 accounttype->insertItem( tr( "Liability" ) );
62 62
63 layout = new QGridLayout ( this, 7, 2, 4, 2 ); 63 layout = new QGridLayout ( this, 7, 2, 4, 2 );
64 layout->addWidget ( namelabel , 0, 0, Qt::AlignLeft ); 64 layout->addWidget ( namelabel , 0, 0, Qt::AlignLeft );
65 layout->addWidget ( accountbox, 1, 0, Qt::AlignLeft ); 65 layout->addWidget ( accountbox, 1, 0, Qt::AlignLeft );
66 layout->addWidget ( datelabel, 2, 0, Qt::AlignLeft ); 66 layout->addWidget ( datelabel, 2, 0, Qt::AlignLeft );
67 layout->addWidget ( datebox, 3, 0, Qt::AlignLeft ); 67 layout->addWidget ( datebox, 3, 0, Qt::AlignLeft );
68 layout->addWidget ( childcheckbox, 4, 0, Qt::AlignLeft ); 68 layout->addWidget ( childcheckbox, 4, 0, Qt::AlignLeft );
69 layout->addWidget ( childlabel, 5, 0, Qt::AlignLeft ); 69 layout->addWidget ( childlabel, 5, 0, Qt::AlignLeft );
70 layout->addWidget ( childbox, 6, 0, Qt::AlignLeft ); 70 layout->addWidget ( childbox, 6, 0, Qt::AlignLeft );
71 layout->addWidget ( balancelabel, 0, 1, Qt::AlignLeft ); 71 layout->addWidget ( balancelabel, 0, 1, Qt::AlignLeft );
72 layout->addWidget ( balancebox, 1, 1, Qt::AlignLeft ); 72 layout->addWidget ( balancebox, 1, 1, Qt::AlignLeft );
73 layout->addWidget ( creditlimitlabel, 2, 1, Qt::AlignLeft ); 73 layout->addWidget ( creditlimitlabel, 2, 1, Qt::AlignLeft );
74 layout->addWidget ( creditlimitbox, 3, 1, Qt::AlignLeft ); 74 layout->addWidget ( creditlimitbox, 3, 1, Qt::AlignLeft );
75 layout->addWidget ( currencybox, 4, 1, Qt::AlignLeft ); 75 layout->addWidget ( currencybox, 4, 1, Qt::AlignLeft );
76 layout->addWidget ( typelabel, 5, 1, Qt::AlignLeft ); 76 layout->addWidget ( typelabel, 5, 1, Qt::AlignLeft );
77 layout->addWidget ( accounttype, 6, 1, Qt::AlignLeft ); 77 layout->addWidget ( accounttype, 6, 1, Qt::AlignLeft );
78 78
79 connect ( childcheckbox, SIGNAL ( clicked () ), this, SLOT ( showChildPulldownMenu() ) ); 79 connect ( childcheckbox, SIGNAL ( clicked() ), this, SLOT ( showChildPulldownMenu() ) );
80 connect ( balancecalculator, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); 80 connect ( balancecalculator, SIGNAL ( released() ), this, SLOT ( showCalculator() ) );
81 connect ( creditlimitcalculator, SIGNAL ( released() ), this, SLOT ( showCreditLimitCalculator() ) ); 81 connect ( creditlimitcalculator, SIGNAL ( released() ), this, SLOT ( showCreditLimitCalculator() ) );
82 connect ( accounttype, SIGNAL ( activated ( int ) ), this, SLOT ( activateCreditLimit ( int ) ) ); 82 connect ( accounttype, SIGNAL ( activated(int) ), this, SLOT ( activateCreditLimit(int) ) );
83 connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); 83 connect ( datebutton, SIGNAL ( released() ), this, SLOT ( showCalendar() ) );
84 connect ( descriptionbutton, SIGNAL ( released () ), this, SLOT ( addAccountDescription() ) ); 84 connect ( descriptionbutton, SIGNAL ( released() ), this, SLOT ( addAccountDescription() ) );
85} 85}
86 86
87NewAccount::~NewAccount () 87NewAccount::~NewAccount ()
88 { 88 {
89 } 89 }
90 90
91void NewAccount::showChildPulldownMenu () 91void NewAccount::showChildPulldownMenu ()
92 { 92 {
93 if ( childcheckbox->isChecked() == TRUE ) 93 if ( childcheckbox->isChecked() == TRUE )
94 { 94 {
95 childlabel->setEnabled ( TRUE ); 95 childlabel->setEnabled ( TRUE );
96 childbox->setEnabled ( TRUE ); 96 childbox->setEnabled ( TRUE );
97 } 97 }
98 else 98 else
99 hideChildPulldownMenu(); 99 hideChildPulldownMenu();
100 } 100 }
101 101
102void NewAccount::hideChildPulldownMenu () 102void NewAccount::hideChildPulldownMenu ()
103 { 103 {
104 childlabel->setEnabled ( FALSE ); 104 childlabel->setEnabled ( FALSE );
105 childbox->setEnabled ( FALSE ); 105 childbox->setEnabled ( FALSE );
106 } 106 }
107 107
108void NewAccount::showCalculator () 108void NewAccount::showCalculator ()
109 { 109 {
110 Calculator *calculator = new Calculator ( this ); 110 Calculator *calculator = new Calculator ( this );
111 calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) ); 111 calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) );
112 if ( calculator->exec () == QDialog::Accepted ) 112 if ( calculator->exec () == QDialog::Accepted )
113 accountbalance->setText ( calculator->display->text() ); 113 accountbalance->setText ( calculator->display->text() );
114 } 114 }
115 115
116void NewAccount::showCreditLimitCalculator () 116void NewAccount::showCreditLimitCalculator ()
117 { 117 {
118 Calculator *calculator = new Calculator ( this ); 118 Calculator *calculator = new Calculator ( this );
119 calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) ); 119 calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) );
120 if ( calculator->exec () == QDialog::Accepted ) 120 if ( calculator->exec () == QDialog::Accepted )
121 creditlimit->setText ( calculator->display->text() ); 121 creditlimit->setText ( calculator->display->text() );
122 } 122 }
123 123
124void NewAccount::activateCreditLimit ( int index ) 124void NewAccount::activateCreditLimit ( int index )
125 { 125 {
126 if ( index == 2 || index == 5 ) 126 if ( index == 2 || index == 5 )
127 creditlimitbox->setEnabled ( TRUE ); 127 creditlimitbox->setEnabled ( TRUE );
128 else 128 else
129 { 129 {
130 creditlimit->clear (); 130 creditlimit->clear ();
131 creditlimitbox->setEnabled ( FALSE ); 131 creditlimitbox->setEnabled ( FALSE );
132 } 132 }
133 } 133 }
134 134
135void NewAccount::showCalendar () 135void NewAccount::showCalendar ()
136 { 136 {
137 QDate newDate = QDate::currentDate (); 137 QDate newDate = QDate::currentDate ();
138 DatePicker *dp = new DatePicker ( newDate ); 138 DatePicker *dp = new DatePicker ( newDate );
139 dp->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) ); 139 dp->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) );
140 140
141 int response = dp->exec(); 141 int response = dp->exec();
142 if ( response == QDialog::Accepted ) 142 if ( response == QDialog::Accepted )
143 { 143 {
144 // Set date integers 144 // Set date integers
145 year = dp->getYear(); 145 year = dp->getYear();
146 month = dp->getMonth(); 146 month = dp->getMonth();
147 day = dp->getDay(); 147 day = dp->getDay();
148 148
diff --git a/noncore/apps/qashmoney/newtransaction.cpp b/noncore/apps/qashmoney/newtransaction.cpp
index 5c78139..87b7f7e 100755
--- a/noncore/apps/qashmoney/newtransaction.cpp
+++ b/noncore/apps/qashmoney/newtransaction.cpp
@@ -1,152 +1,152 @@
1#include "newtransaction.h" 1#include "newtransaction.h"
2#include "calculator.h" 2#include "calculator.h"
3#include "datepicker.h" 3#include "datepicker.h"
4#include "budget.h" 4#include "budget.h"
5 5
6#include <qmultilineedit.h> 6#include <qmultilineedit.h>
7 7
8extern Budget *budget; 8extern Budget *budget;
9extern Preferences *preferences; 9extern Preferences *preferences;
10 10
11NewTransaction::NewTransaction ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) 11NewTransaction::NewTransaction ( QWidget* parent ) : QDialog ( parent, 0, TRUE )
12 { 12 {
13 transactiondescription = ""; 13 transactiondescription = "";
14 currentlineitem = -1; 14 currentlineitem = -1;
15 currentbudget = -1; 15 currentbudget = -1;
16 dateedited = FALSE; 16 dateedited = FALSE;
17 setCaption( tr( "Transaction" ) ); 17 setCaption( tr( "Transaction" ) );
18 18
19 // START FIRST COLUMN 19 // START FIRST COLUMN
20 20
21 namelabel = new QLabel ( "Transaction", this ); 21 namelabel = new QLabel ( "Transaction", this );
22 22
23 transactionnamebox = new QHBox ( this ); 23 transactionnamebox = new QHBox ( this );
24 transactionname = new QComboBox ( transactionnamebox ); 24 transactionname = new QComboBox ( transactionnamebox );
25 transactionname->setEditable ( TRUE ); 25 transactionname->setEditable ( TRUE );
26 descriptionbutton = new QPushButton ( transactionnamebox ); 26 descriptionbutton = new QPushButton ( transactionnamebox );
27 descriptionbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/info.png" ) ); 27 descriptionbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/info.png" ) );
28 connect ( descriptionbutton, SIGNAL ( released () ), this, SLOT ( addTransactionDescription() ) ); 28 connect ( descriptionbutton, SIGNAL ( released() ), this, SLOT ( addTransactionDescription() ) );
29 29
30 amountlabel = new QLabel ( "Amount", this ); 30 amountlabel = new QLabel ( "Amount", this );
31 31
32 transactionamountbox = new QHBox ( this ); 32 transactionamountbox = new QHBox ( this );
33 transactionamount = new QLineEdit ( transactionamountbox ); 33 transactionamount = new QLineEdit ( transactionamountbox );
34 transactionamount->setAlignment ( Qt::AlignRight ); 34 transactionamount->setAlignment ( Qt::AlignRight );
35 transactionamount->setText ( "0.00" ); 35 transactionamount->setText ( "0.00" );
36 calculatorbutton = new QPushButton( transactionamountbox ); 36 calculatorbutton = new QPushButton( transactionamountbox );
37 calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); 37 calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) );
38 connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); 38 connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) );
39 39
40 datelabel = new QLabel ( "Date", this ); 40 datelabel = new QLabel ( "Date", this );
41 41
42 transactiondatebox = new QHBox ( this ); 42 transactiondatebox = new QHBox ( this );
43 transactiondate = new QLineEdit ( transactiondatebox ); 43 transactiondate = new QLineEdit ( transactiondatebox );
44 transactiondate->setAlignment ( Qt::AlignRight ); 44 transactiondate->setAlignment ( Qt::AlignRight );
45 transactiondate->setDisabled ( TRUE ); 45 transactiondate->setDisabled ( TRUE );
46 datebutton = new QPushButton( transactiondatebox ); 46 datebutton = new QPushButton( transactiondatebox );
47 datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); 47 datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) );
48 connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); 48 connect ( datebutton, SIGNAL ( released() ), this, SLOT ( showCalendar() ) );
49 49
50 clearedcheckbox = new QCheckBox ( "Cleared", this ); 50 clearedcheckbox = new QCheckBox ( "Cleared", this );
51 depositbox = new QCheckBox ( "Credit", this ); 51 depositbox = new QCheckBox ( "Credit", this );
52 52
53 // START SECOND COLUMN 53 // START SECOND COLUMN
54 54
55 numberlabel = new QLabel ( "Number", this ); 55 numberlabel = new QLabel ( "Number", this );
56 transactionnumber = new QLineEdit ( this ); 56 transactionnumber = new QLineEdit ( this );
57 57
58 budgetlabel = new QLabel ( "Budget", this ); 58 budgetlabel = new QLabel ( "Budget", this );
59 budgetbox = new QComboBox ( FALSE, this ); 59 budgetbox = new QComboBox ( FALSE, this );
60 60
61 lineitemlabel = new QLabel ( "LineItem", this ); 61 lineitemlabel = new QLabel ( "LineItem", this );
62 lineitembox = new QComboBox ( FALSE, this ); 62 lineitembox = new QComboBox ( FALSE, this );
63 63
64 layout = new QGridLayout ( this, 7, 2, 2, 2 ); 64 layout = new QGridLayout ( this, 7, 2, 2, 2 );
65 layout->addWidget ( namelabel, 0, 0, Qt::AlignLeft ); 65 layout->addWidget ( namelabel, 0, 0, Qt::AlignLeft );
66 layout->addWidget ( transactionnamebox, 1, 0, Qt::AlignLeft ); 66 layout->addWidget ( transactionnamebox, 1, 0, Qt::AlignLeft );
67 layout->addWidget ( amountlabel, 2, 0, Qt::AlignLeft ); 67 layout->addWidget ( amountlabel, 2, 0, Qt::AlignLeft );
68 layout->addWidget ( transactionamountbox, 3, 0, Qt::AlignLeft ); 68 layout->addWidget ( transactionamountbox, 3, 0, Qt::AlignLeft );
69 layout->addWidget ( datelabel, 4, 0, Qt::AlignLeft ); 69 layout->addWidget ( datelabel, 4, 0, Qt::AlignLeft );
70 layout->addWidget ( transactiondatebox, 5, 0, Qt::AlignLeft ); 70 layout->addWidget ( transactiondatebox, 5, 0, Qt::AlignLeft );
71 layout->addWidget ( clearedcheckbox, 6, 0, Qt::AlignLeft ); 71 layout->addWidget ( clearedcheckbox, 6, 0, Qt::AlignLeft );
72 layout->addWidget ( numberlabel, 0, 1, Qt::AlignLeft ); 72 layout->addWidget ( numberlabel, 0, 1, Qt::AlignLeft );
73 layout->addWidget ( transactionnumber, 1, 1, Qt::AlignLeft ); 73 layout->addWidget ( transactionnumber, 1, 1, Qt::AlignLeft );
74 layout->addWidget ( budgetlabel, 2, 1, Qt::AlignLeft ); 74 layout->addWidget ( budgetlabel, 2, 1, Qt::AlignLeft );
75 layout->addWidget ( budgetbox, 3, 1, Qt::AlignLeft ); 75 layout->addWidget ( budgetbox, 3, 1, Qt::AlignLeft );
76 layout->addWidget ( lineitemlabel, 4, 1, Qt::AlignLeft ); 76 layout->addWidget ( lineitemlabel, 4, 1, Qt::AlignLeft );
77 layout->addWidget ( lineitembox, 5, 1, Qt::AlignLeft ); 77 layout->addWidget ( lineitembox, 5, 1, Qt::AlignLeft );
78 layout->addWidget ( depositbox, 6, 1, Qt::AlignLeft ); 78 layout->addWidget ( depositbox, 6, 1, Qt::AlignLeft );
79 79
80 if ( budget->getNumberOfBudgets() != 0 ) 80 if ( budget->getNumberOfBudgets() != 0 )
81 { 81 {
82 budgetnameslist = budget->getBudgetNames(); 82 budgetnameslist = budget->getBudgetNames();
83 budgetidslist = budget->getBudgetIDs(); 83 budgetidslist = budget->getBudgetIDs();
84 budgetbox->insertStringList ( *budgetnameslist ); 84 budgetbox->insertStringList ( *budgetnameslist );
85 lineitemlabel->setEnabled ( FALSE ); 85 lineitemlabel->setEnabled ( FALSE );
86 lineitembox->setEnabled ( FALSE ); 86 lineitembox->setEnabled ( FALSE );
87 connect ( budgetbox, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentBudget ( int ) ) ); 87 connect ( budgetbox, SIGNAL ( activated(int) ), this, SLOT ( setCurrentBudget(int) ) );
88 connect ( lineitembox, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentLineItem ( int ) ) ); 88 connect ( lineitembox, SIGNAL ( activated(int) ), this, SLOT ( setCurrentLineItem(int) ) );
89 } 89 }
90 else 90 else
91 { 91 {
92 budgetlabel->setEnabled ( FALSE ); 92 budgetlabel->setEnabled ( FALSE );
93 budgetbox->setEnabled ( FALSE ); 93 budgetbox->setEnabled ( FALSE );
94 lineitemlabel->setEnabled ( FALSE ); 94 lineitemlabel->setEnabled ( FALSE );
95 lineitembox->setEnabled ( FALSE ); 95 lineitembox->setEnabled ( FALSE );
96 } 96 }
97 97
98} 98}
99 99
100NewTransaction::~NewTransaction () 100NewTransaction::~NewTransaction ()
101 { 101 {
102 } 102 }
103 103
104void NewTransaction::showCalculator () 104void NewTransaction::showCalculator ()
105{ 105{
106 Calculator *calculator = new Calculator ( this ); 106 Calculator *calculator = new Calculator ( this );
107 calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) ); 107 calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) );
108 if ( calculator->exec () == QDialog::Accepted ) 108 if ( calculator->exec () == QDialog::Accepted )
109 transactionamount->setText ( calculator->display->text() ); 109 transactionamount->setText ( calculator->display->text() );
110} 110}
111 111
112void NewTransaction::showCalendar () 112void NewTransaction::showCalendar ()
113 { 113 {
114 QDate newDate = QDate::currentDate (); 114 QDate newDate = QDate::currentDate ();
115 DatePicker *dp = new DatePicker ( newDate ); 115 DatePicker *dp = new DatePicker ( newDate );
116 dp->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) ); 116 dp->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) );
117 117
118 int response = dp->exec(); 118 int response = dp->exec();
119 if ( response == QDialog::Accepted ) 119 if ( response == QDialog::Accepted )
120 { 120 {
121 // Set date integers 121 // Set date integers
122 year = dp->getYear(); 122 year = dp->getYear();
123 month = dp->getMonth(); 123 month = dp->getMonth();
124 day = dp->getDay(); 124 day = dp->getDay();
125 125
126 // Set dateedited to TRUE 126 // Set dateedited to TRUE
127 // This tells the transactiondisplay object that the user edited an transaction 127 // This tells the transactiondisplay object that the user edited an transaction
128 // and did change the date3 128 // and did change the date3
129 dateedited = TRUE; 129 dateedited = TRUE;
130 130
131 // Display date with our selected format 131 // Display date with our selected format
132 transactiondate->setText ( preferences->getDate ( year, month, day ) ); 132 transactiondate->setText ( preferences->getDate ( year, month, day ) );
133 } 133 }
134 } 134 }
135 135
136bool NewTransaction::getDateEdited () 136bool NewTransaction::getDateEdited ()
137 { 137 {
138 return dateedited; 138 return dateedited;
139 } 139 }
140 140
141int NewTransaction::getDay () 141int NewTransaction::getDay ()
142 { 142 {
143 return day; 143 return day;
144 } 144 }
145 145
146int NewTransaction::getMonth () 146int NewTransaction::getMonth ()
147 { 147 {
148 return month; 148 return month;
149 } 149 }
150 150
151int NewTransaction::getYear () 151int NewTransaction::getYear ()
152 { 152 {
diff --git a/noncore/apps/qashmoney/preferencedialogs.cpp b/noncore/apps/qashmoney/preferencedialogs.cpp
index 5408a5b..b83c957 100755
--- a/noncore/apps/qashmoney/preferencedialogs.cpp
+++ b/noncore/apps/qashmoney/preferencedialogs.cpp
@@ -1,216 +1,216 @@
1#include "preferencedialogs.h" 1#include "preferencedialogs.h"
2#include "preferences.h" 2#include "preferences.h"
3 3
4extern Preferences *preferences; 4extern Preferences *preferences;
5 5
6DatePreferences::DatePreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) 6DatePreferences::DatePreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE )
7 { 7 {
8 setCaption( tr( "Date" ) ); 8 setCaption( tr( "Date" ) );
9 9
10 QLabel *datelabel = new QLabel ( "Format", this ); 10 QLabel *datelabel = new QLabel ( "Format", this );
11 dateformat = new QComboBox ( this ); 11 dateformat = new QComboBox ( this );
12 dateformat->setEditable ( FALSE ); 12 dateformat->setEditable ( FALSE );
13 dateformat->insertItem ( "yyyymmdd" ); 13 dateformat->insertItem ( "yyyymmdd" );
14 dateformat->insertItem ( "yymmdd" ); 14 dateformat->insertItem ( "yymmdd" );
15 dateformat->insertItem ( "mmddyyyy" ); 15 dateformat->insertItem ( "mmddyyyy" );
16 dateformat->insertItem ( "mmddyy" ); 16 dateformat->insertItem ( "mmddyy" );
17 dateformat->insertItem ( "yyyyddmm" ); 17 dateformat->insertItem ( "yyyyddmm" );
18 dateformat->insertItem ( "yyddmm" ); 18 dateformat->insertItem ( "yyddmm" );
19 dateformat->insertItem ( "ddmmyyyy" ); 19 dateformat->insertItem ( "ddmmyyyy" );
20 dateformat->insertItem ( "ddmmyy" ); 20 dateformat->insertItem ( "ddmmyy" );
21 connect ( dateformat, SIGNAL ( activated ( int ) ), this, SLOT ( changeDateFormat ( int ) ) ); 21 connect ( dateformat, SIGNAL ( activated(int) ), this, SLOT ( changeDateFormat(int) ) );
22 22
23 QLabel *dateseparatorlabel = new QLabel ( "Separator", this ); 23 QLabel *dateseparatorlabel = new QLabel ( "Separator", this );
24 dateseparator = new QComboBox ( this ); 24 dateseparator = new QComboBox ( this );
25 dateseparator->insertItem ( "/" ); 25 dateseparator->insertItem ( "/" );
26 dateseparator->insertItem ( "-" ); 26 dateseparator->insertItem ( "-" );
27 dateseparator->insertItem ( "." ); 27 dateseparator->insertItem ( "." );
28 connect ( dateseparator, SIGNAL ( activated ( int ) ), this, SLOT ( changeDateSeparator ( int ) ) ); 28 connect ( dateseparator, SIGNAL ( activated(int) ), this, SLOT ( changeDateSeparator(int) ) );
29 29
30 defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); 30 defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this );
31 connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultDatePreferences () ) ); 31 connect ( defaults, SIGNAL ( released() ), this, SLOT ( setDefaultDatePreferences() ) );
32 32
33 dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 ); 33 dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 );
34 dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 ); 34 dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 );
35 35
36 layout = new QVBoxLayout ( this, 2, 2 ); 36 layout = new QVBoxLayout ( this, 2, 2 );
37 layout->addWidget ( datelabel ); 37 layout->addWidget ( datelabel );
38 layout->addWidget ( dateformat ); 38 layout->addWidget ( dateformat );
39 layout->addWidget ( dateseparatorlabel ); 39 layout->addWidget ( dateseparatorlabel );
40 layout->addWidget ( dateseparator ); 40 layout->addWidget ( dateseparator );
41 layout->insertSpacing ( 4, 5 ); 41 layout->insertSpacing ( 4, 5 );
42 layout->addWidget ( defaults ); 42 layout->addWidget ( defaults );
43 43
44 } 44 }
45 45
46DatePreferences::~DatePreferences () 46DatePreferences::~DatePreferences ()
47 { 47 {
48 } 48 }
49 49
50void DatePreferences::changeDateFormat ( int index ) 50void DatePreferences::changeDateFormat ( int index )
51 { 51 {
52 index ++; 52 index ++;
53 preferences->changePreference ( 1, index ); 53 preferences->changePreference ( 1, index );
54 } 54 }
55 55
56void DatePreferences::changeDateSeparator ( int index ) 56void DatePreferences::changeDateSeparator ( int index )
57 { 57 {
58 index ++; 58 index ++;
59 preferences->changePreference ( 2, index ); 59 preferences->changePreference ( 2, index );
60 } 60 }
61 61
62void DatePreferences::setDefaultDatePreferences () 62void DatePreferences::setDefaultDatePreferences ()
63 { 63 {
64 preferences->setDefaultDatePreferences (); 64 preferences->setDefaultDatePreferences ();
65 dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 ); 65 dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 );
66 dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 ); 66 dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 );
67 } 67 }
68 68
69// START TRANSACTION PREFERENCES 69// START TRANSACTION PREFERENCES
70 70
71TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) 71TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE )
72{ 72{
73 setCaption( tr ( "Transaction" ) ); 73 setCaption( tr ( "Transaction" ) );
74 74
75 showclearedtransactions = new QCheckBox ( this ); 75 showclearedtransactions = new QCheckBox ( this );
76 showclearedtransactions->setText ( "Show Cleared Transactions" ); 76 showclearedtransactions->setText ( "Show Cleared Transactions" );
77 77
78 limittransactionsbox = new QHBox ( this ); 78 limittransactionsbox = new QHBox ( this );
79 limittransactionsbox->setSpacing ( 2 ); 79 limittransactionsbox->setSpacing ( 2 );
80 limittransactionslabel = new QLabel ( "Show ", limittransactionsbox ); 80 limittransactionslabel = new QLabel ( "Show ", limittransactionsbox );
81 limittransactions = new QComboBox ( limittransactionsbox ); 81 limittransactions = new QComboBox ( limittransactionsbox );
82 QLabel *limittransactionslabel2 = new QLabel ( "of cleared transactions. ", limittransactionsbox ); 82 QLabel *limittransactionslabel2 = new QLabel ( "of cleared transactions. ", limittransactionsbox );
83 limittransactions->insertItem ( "14 days" ); 83 limittransactions->insertItem ( "14 days" );
84 limittransactions->insertItem ( "30 days" ); 84 limittransactions->insertItem ( "30 days" );
85 limittransactions->insertItem ( "90 days" ); 85 limittransactions->insertItem ( "90 days" );
86 limittransactions->insertItem ( "180 days" ); 86 limittransactions->insertItem ( "180 days" );
87 limittransactions->insertItem ( "365 days" ); 87 limittransactions->insertItem ( "365 days" );
88 limittransactions->insertItem ( "All" ); 88 limittransactions->insertItem ( "All" );
89 limittransactions->setCurrentItem ( preferences->getPreference ( 7 ) ); 89 limittransactions->setCurrentItem ( preferences->getPreference ( 7 ) );
90 90
91 excludetransfers = new QCheckBox ( this ); 91 excludetransfers = new QCheckBox ( this );
92 excludetransfers->setText ( "Include Transfers In Limit View" ); 92 excludetransfers->setText ( "Include Transfers In Limit View" );
93 93
94 if ( preferences->getPreference ( 3 ) == 1 ) 94 if ( preferences->getPreference ( 3 ) == 1 )
95 showclearedtransactions->setChecked ( TRUE ); 95 showclearedtransactions->setChecked ( TRUE );
96 else 96 else
97 showclearedtransactions->setChecked ( FALSE ); 97 showclearedtransactions->setChecked ( FALSE );
98 98
99 if ( preferences->getPreference ( 6 ) == 1 ) 99 if ( preferences->getPreference ( 6 ) == 1 )
100 excludetransfers->setChecked ( TRUE ); 100 excludetransfers->setChecked ( TRUE );
101 else 101 else
102 excludetransfers->setChecked ( FALSE ); 102 excludetransfers->setChecked ( FALSE );
103 103
104 defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); 104 defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this );
105 connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultTransactionPreferences () ) ); 105 connect ( defaults, SIGNAL ( released() ), this, SLOT ( setDefaultTransactionPreferences() ) );
106 106
107 layout = new QVBoxLayout ( this, 2, 2 ); 107 layout = new QVBoxLayout ( this, 2, 2 );
108 layout->addWidget ( showclearedtransactions ); 108 layout->addWidget ( showclearedtransactions );
109 layout->addWidget ( limittransactionsbox ); 109 layout->addWidget ( limittransactionsbox );
110 layout->addWidget ( excludetransfers ); 110 layout->addWidget ( excludetransfers );
111 layout->insertSpacing ( 3, 5 ); 111 layout->insertSpacing ( 3, 5 );
112 layout->addWidget ( defaults ); 112 layout->addWidget ( defaults );
113 113
114 connect ( showclearedtransactions, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeShowClearedPreference ( bool ) ) ); 114 connect ( showclearedtransactions, SIGNAL ( toggled(bool) ), this, SLOT ( changeShowClearedPreference(bool) ) );
115 connect ( excludetransfers, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeExcludeTranfersPreference ( bool ) ) ); 115 connect ( excludetransfers, SIGNAL ( toggled(bool) ), this, SLOT ( changeExcludeTranfersPreference(bool) ) );
116 connect ( limittransactions, SIGNAL ( activated ( int ) ), this, SLOT ( changeLimitTransactionsPreference ( int ) ) ); 116 connect ( limittransactions, SIGNAL ( activated(int) ), this, SLOT ( changeLimitTransactionsPreference(int) ) );
117} 117}
118 118
119TransactionPreferences::~TransactionPreferences () 119TransactionPreferences::~TransactionPreferences ()
120 { 120 {
121 } 121 }
122 122
123void TransactionPreferences::changeLimitTransactionsPreference ( int pref ) 123void TransactionPreferences::changeLimitTransactionsPreference ( int pref )
124 { 124 {
125 preferences->changePreference ( 7, pref ); 125 preferences->changePreference ( 7, pref );
126 } 126 }
127 127
128void TransactionPreferences::changeShowClearedPreference ( bool state ) 128void TransactionPreferences::changeShowClearedPreference ( bool state )
129 { 129 {
130 if ( state == TRUE ) 130 if ( state == TRUE )
131 preferences->changePreference ( 3, 1 ); 131 preferences->changePreference ( 3, 1 );
132 else 132 else
133 preferences->changePreference ( 3, 0 ); 133 preferences->changePreference ( 3, 0 );
134 } 134 }
135 135
136void TransactionPreferences::changeExcludeTranfersPreference ( bool state ) 136void TransactionPreferences::changeExcludeTranfersPreference ( bool state )
137 { 137 {
138 if ( state == TRUE ) 138 if ( state == TRUE )
139 preferences->changePreference ( 6, 1 ); 139 preferences->changePreference ( 6, 1 );
140 else 140 else
141 preferences->changePreference ( 6, 0 ); 141 preferences->changePreference ( 6, 0 );
142 } 142 }
143 143
144void TransactionPreferences::setDefaultTransactionPreferences () 144void TransactionPreferences::setDefaultTransactionPreferences ()
145 { 145 {
146 preferences->changePreference ( 3, 0 ); 146 preferences->changePreference ( 3, 0 );
147 preferences->changePreference ( 6, 0 ); 147 preferences->changePreference ( 6, 0 );
148 preferences->changePreference ( 7, 0 ); 148 preferences->changePreference ( 7, 0 );
149 showclearedtransactions->setChecked ( FALSE ); 149 showclearedtransactions->setChecked ( FALSE );
150 limittransactions->setCurrentItem ( 0 ); 150 limittransactions->setCurrentItem ( 0 );
151 } 151 }
152 152
153// START ACCOUNT PREFERNCES 153// START ACCOUNT PREFERNCES
154 154
155AccountPreferences::AccountPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) 155AccountPreferences::AccountPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE )
156{ 156{
157 157
158 setCaption( tr ( "Account" ) ); 158 setCaption( tr ( "Account" ) );
159 159
160 currencysupport = new QCheckBox ( this ); 160 currencysupport = new QCheckBox ( this );
161 currencysupport->setText ( "Enable Currency Support" ); 161 currencysupport->setText ( "Enable Currency Support" );
162 162
163 onetouch = new QCheckBox ( this ); 163 onetouch = new QCheckBox ( this );
164 onetouch->setText ( "One Touch Account Viewing" ); 164 onetouch->setText ( "One Touch Account Viewing" );
165 165
166 if ( preferences->getPreference ( 4 ) == 1 ) 166 if ( preferences->getPreference ( 4 ) == 1 )
167 currencysupport->setChecked ( TRUE ); 167 currencysupport->setChecked ( TRUE );
168 else 168 else
169 currencysupport->setChecked ( FALSE ); 169 currencysupport->setChecked ( FALSE );
170 170
171 if ( preferences->getPreference ( 5 ) == 1 ) 171 if ( preferences->getPreference ( 5 ) == 1 )
172 onetouch->setChecked ( TRUE ); 172 onetouch->setChecked ( TRUE );
173 else 173 else
174 onetouch->setChecked ( FALSE ); 174 onetouch->setChecked ( FALSE );
175 175
176 defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); 176 defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this );
177 connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultAccountPreferences () ) ); 177 connect ( defaults, SIGNAL ( released() ), this, SLOT ( setDefaultAccountPreferences() ) );
178 178
179 layout = new QVBoxLayout ( this, 2, 2 ); 179 layout = new QVBoxLayout ( this, 2, 2 );
180 layout->addWidget ( currencysupport ); 180 layout->addWidget ( currencysupport );
181 layout->addWidget ( onetouch ); 181 layout->addWidget ( onetouch );
182 layout->insertSpacing ( 2, 5 ); 182 layout->insertSpacing ( 2, 5 );
183 layout->addWidget ( defaults ); 183 layout->addWidget ( defaults );
184 184
185 connect ( currencysupport, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeCurrencySupport ( bool ) ) ); 185 connect ( currencysupport, SIGNAL ( toggled(bool) ), this, SLOT ( changeCurrencySupport(bool) ) );
186 connect ( onetouch, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeOneTouchViewing ( bool ) ) ); 186 connect ( onetouch, SIGNAL ( toggled(bool) ), this, SLOT ( changeOneTouchViewing(bool) ) );
187} 187}
188 188
189AccountPreferences::~AccountPreferences () 189AccountPreferences::~AccountPreferences ()
190 { 190 {
191 } 191 }
192 192
193void AccountPreferences::changeCurrencySupport ( bool state ) 193void AccountPreferences::changeCurrencySupport ( bool state )
194 { 194 {
195 if ( state == TRUE ) 195 if ( state == TRUE )
196 preferences->changePreference ( 4, 1 ); 196 preferences->changePreference ( 4, 1 );
197 else 197 else
198 preferences->changePreference ( 4, 0 ); 198 preferences->changePreference ( 4, 0 );
199 } 199 }
200 200
201void AccountPreferences::changeOneTouchViewing ( bool state ) 201void AccountPreferences::changeOneTouchViewing ( bool state )
202 { 202 {
203 if ( state == TRUE ) 203 if ( state == TRUE )
204 preferences->changePreference ( 5, 1 ); 204 preferences->changePreference ( 5, 1 );
205 else 205 else
206 preferences->changePreference ( 5, 0 ); 206 preferences->changePreference ( 5, 0 );
207 } 207 }
208 208
209void AccountPreferences::setDefaultAccountPreferences () 209void AccountPreferences::setDefaultAccountPreferences ()
210 { 210 {
211 preferences->changePreference ( 4, 0 ); 211 preferences->changePreference ( 4, 0 );
212 preferences->changePreference ( 5, 0 ); 212 preferences->changePreference ( 5, 0 );
213 currencysupport->setChecked ( FALSE ); 213 currencysupport->setChecked ( FALSE );
214 onetouch->setChecked ( FALSE ); 214 onetouch->setChecked ( FALSE );
215 } 215 }
216 216
diff --git a/noncore/apps/qashmoney/qashmoney.cpp b/noncore/apps/qashmoney/qashmoney.cpp
index d4cbc14..1455eb0 100755
--- a/noncore/apps/qashmoney/qashmoney.cpp
+++ b/noncore/apps/qashmoney/qashmoney.cpp
@@ -1,134 +1,134 @@
1#include "qashmoney.h" 1#include "qashmoney.h"
2#include "preferencedialogs.h" 2#include "preferencedialogs.h"
3#include "memorydialog.h" 3#include "memorydialog.h"
4 4
5#include <qheader.h> 5#include <qheader.h>
6 6
7Budget *budget = new Budget (); 7Budget *budget = new Budget ();
8Preferences *preferences = new Preferences (); 8Preferences *preferences = new Preferences ();
9Account *account = new Account (); 9Account *account = new Account ();
10Transaction *transaction = new Transaction (); 10Transaction *transaction = new Transaction ();
11Transfer *transfer = new Transfer (); 11Transfer *transfer = new Transfer ();
12Memory *memory = new Memory (); 12Memory *memory = new Memory ();
13 13
14QashMoney::QashMoney () : QWidget () 14QashMoney::QashMoney () : QWidget ()
15 { 15 {
16 preferences->addPreferences (); 16 preferences->addPreferences ();
17 preferences->initializeColumnPreferences (); 17 preferences->initializeColumnPreferences ();
18 preferences->initializeSortingPreferences (); 18 preferences->initializeSortingPreferences ();
19 19
20 // set the text in the upper part of the frame 20 // set the text in the upper part of the frame
21 setCaption ( tr ( "QashMoney" ) ); 21 setCaption ( tr ( "QashMoney" ) );
22 22
23 // Create new menubar for our mainwindow 23 // Create new menubar for our mainwindow
24 // and add menu items 24 // and add menu items
25 mainmenu = new QMenuBar ( this ); 25 mainmenu = new QMenuBar ( this );
26 mainmenu->setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); 26 mainmenu->setFrameStyle ( QFrame::PopupPanel | QFrame::Raised );
27 preferencesmenu = new QPopupMenu ( this ); 27 preferencesmenu = new QPopupMenu ( this );
28 utilitiesmenu = new QPopupMenu ( this ); 28 utilitiesmenu = new QPopupMenu ( this );
29 mainmenu->insertItem ( "Preferences", preferencesmenu ); 29 mainmenu->insertItem ( "Preferences", preferencesmenu );
30 mainmenu->insertItem ( "Utilities", utilitiesmenu ); 30 mainmenu->insertItem ( "Utilities", utilitiesmenu );
31 preferencesmenu->insertItem ( "Date", this, SLOT ( displayDatePreferencesDialog () ) ); 31 preferencesmenu->insertItem ( "Date", this, SLOT ( displayDatePreferencesDialog() ) );
32 preferencesmenu->insertItem ( "Account", this, SLOT ( displayAccountPreferencesDialog () ) ); 32 preferencesmenu->insertItem ( "Account", this, SLOT ( displayAccountPreferencesDialog() ) );
33 preferencesmenu->insertItem ( "Transaction", this, SLOT ( displayTransactionPreferencesDialog () ) ); 33 preferencesmenu->insertItem ( "Transaction", this, SLOT ( displayTransactionPreferencesDialog() ) );
34 utilitiesmenu->insertItem ( "Memory", this, SLOT ( displayMemoryDialog () ) ); 34 utilitiesmenu->insertItem ( "Memory", this, SLOT ( displayMemoryDialog() ) );
35 35
36 // create the main tabwidget for displaying accounts and transactions 36 // create the main tabwidget for displaying accounts and transactions
37 maintabs = new QTabWidget ( this ); 37 maintabs = new QTabWidget ( this );
38 tab = new QWidget ( this ); 38 tab = new QWidget ( this );
39 tab_2 = new QWidget ( this ); 39 tab_2 = new QWidget ( this );
40 tab_3 = new QWidget ( this ); 40 tab_3 = new QWidget ( this );
41 maintabs->addTab ( tab, "Accounts" ); 41 maintabs->addTab ( tab, "Accounts" );
42 maintabs->addTab ( tab_2, "Transactions" ); 42 maintabs->addTab ( tab_2, "Transactions" );
43 maintabs->addTab ( tab_3, "Budgets" ); 43 maintabs->addTab ( tab_3, "Budgets" );
44 tabheight = tab->height(); 44 tabheight = tab->height();
45 maintabs->setTabEnabled ( tab_2, FALSE ); 45 maintabs->setTabEnabled ( tab_2, FALSE );
46 46
47 // create a new account display object 47 // create a new account display object
48 accountdisplay = new AccountDisplay ( maintabs ); 48 accountdisplay = new AccountDisplay ( maintabs );
49 accountdisplay->setTabs ( tab_2, maintabs ); 49 accountdisplay->setTabs ( tab_2, maintabs );
50 connect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( setTransactionTab () ) ); 50 connect ( accountdisplay->listview, SIGNAL ( selectionChanged() ), this, SLOT ( setTransactionTab() ) );
51 51
52 // set the connection to disable the one touch account viewing if we are transfering money 52 // set the connection to disable the one touch account viewing if we are transfering money
53 connect ( accountdisplay->transferbutton, SIGNAL ( toggled ( bool ) ), this, SLOT ( toggleOneTouchViewing ( bool ) ) ); 53 connect ( accountdisplay->transferbutton, SIGNAL ( toggled(bool) ), this, SLOT ( toggleOneTouchViewing(bool) ) );
54 54
55 // create a new transactiondisplay object 55 // create a new transactiondisplay object
56 transactiondisplay = new TransactionDisplay ( maintabs ); 56 transactiondisplay = new TransactionDisplay ( maintabs );
57 transactiondisplay->hide(); 57 transactiondisplay->hide();
58 58
59 // create new budgetdisplay object 59 // create new budgetdisplay object
60 budgetdisplay = new BudgetDisplay ( maintabs ); 60 budgetdisplay = new BudgetDisplay ( maintabs );
61 budgetdisplay->hide(); 61 budgetdisplay->hide();
62 62
63 tabslayout = new QVBoxLayout ( maintabs, 4, 2 ); 63 tabslayout = new QVBoxLayout ( maintabs, 4, 2 );
64 tabslayout->addSpacing ( tabheight ); 64 tabslayout->addSpacing ( tabheight );
65 tabslayout->addWidget ( accountdisplay ); 65 tabslayout->addWidget ( accountdisplay );
66 tabslayout->addWidget ( transactiondisplay ); 66 tabslayout->addWidget ( transactiondisplay );
67 tabslayout->addWidget ( budgetdisplay ); 67 tabslayout->addWidget ( budgetdisplay );
68 68
69 // connect a change in the maintabs with changing the tab display 69 // connect a change in the maintabs with changing the tab display
70 connect ( maintabs, SIGNAL ( currentChanged ( QWidget * ) ), this, SLOT ( changeTabDisplay () ) ); 70 connect ( maintabs, SIGNAL ( currentChanged(QWidget*) ), this, SLOT ( changeTabDisplay() ) );
71 71
72 // create layout that will contain the menubar and the maintabs 72 // create layout that will contain the menubar and the maintabs
73 layout = new QVBoxLayout ( this, 2, 2 ); 73 layout = new QVBoxLayout ( this, 2, 2 );
74 layout->setMenuBar ( mainmenu ); 74 layout->setMenuBar ( mainmenu );
75 layout->addWidget ( maintabs ); 75 layout->addWidget ( maintabs );
76 } 76 }
77 77
78QashMoney::~QashMoney () 78QashMoney::~QashMoney ()
79 { 79 {
80 delete budget; 80 delete budget;
81 delete preferences; 81 delete preferences;
82 delete account; 82 delete account;
83 delete transaction; 83 delete transaction;
84 delete transfer; 84 delete transfer;
85 delete memory; 85 delete memory;
86 } 86 }
87 87
88void QashMoney::changeTabDisplay () 88void QashMoney::changeTabDisplay ()
89 { 89 {
90 // if the user pressed the transactions tab, hide the account display 90 // if the user pressed the transactions tab, hide the account display
91 // object and create a new transaction display 91 // object and create a new transaction display
92 if ( maintabs->currentPageIndex() == 1 ) 92 if ( maintabs->currentPageIndex() == 1 )
93 { 93 {
94 // initialize variables 94 // initialize variables
95 bool children = FALSE; 95 bool children = FALSE;
96 96
97 // hide the account display and define accountid 97 // hide the account display and define accountid
98 int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt(); 98 int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt();
99 99
100 //remove all the columns from the transactiondisplay 100 //remove all the columns from the transactiondisplay
101 int columns = transactiondisplay->listview->columns(); 101 int columns = transactiondisplay->listview->columns();
102 int counter; 102 int counter;
103 for ( counter = 0; counter <= columns; counter++ ) 103 for ( counter = 0; counter <= columns; counter++ )
104 transactiondisplay->listview->removeColumn ( 0 ); 104 transactiondisplay->listview->removeColumn ( 0 );
105 105
106 // set the account name and account balance 106 // set the account name and account balance
107 QString name = account->getAccountName ( accountid ); 107 QString name = account->getAccountName ( accountid );
108 QString balance = account->getAccountBalance ( accountid ); 108 QString balance = account->getAccountBalance ( accountid );
109 transactiondisplay->name->setText ( name ); 109 transactiondisplay->name->setText ( name );
110 transactiondisplay->balance->setText ( balance ); 110 transactiondisplay->balance->setText ( balance );
111 111
112 // clear the limitbox 112 // clear the limitbox
113 transactiondisplay->limitbox->clear(); 113 transactiondisplay->limitbox->clear();
114 114
115 // get parent account id 115 // get parent account id
116 int parentaccountid = account->getParentAccountID ( accountid ); 116 int parentaccountid = account->getParentAccountID ( accountid );
117 117
118 // add columns based on which account is selected 118 // add columns based on which account is selected
119 // this first if determines if we selected a parent with no children or a child 119 // this first if determines if we selected a parent with no children or a child
120 // in these cases, we add standard three columns for date, transaction, amount 120 // in these cases, we add standard three columns for date, transaction, amount
121 transactiondisplay->listview->addColumn ( "Date", 0 ); 121 transactiondisplay->listview->addColumn ( "Date", 0 );
122 transactiondisplay->listview->addColumn ( "Transaction", 0 ); 122 transactiondisplay->listview->addColumn ( "Transaction", 0 );
123 transactiondisplay->listview->addColumn ( "Amt", 0); 123 transactiondisplay->listview->addColumn ( "Amt", 0);
124 transactiondisplay->listview->setColumnAlignment ( 2, Qt::AlignRight ); 124 transactiondisplay->listview->setColumnAlignment ( 2, Qt::AlignRight );
125 transactiondisplay->listview->addColumn ( "", 0 ); 125 transactiondisplay->listview->addColumn ( "", 0 );
126 126
127 if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) // we selected a parent with children 127 if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) // we selected a parent with children
128 { 128 {
129 // add an extra column for the account name for eac child transaction 129 // add an extra column for the account name for eac child transaction
130 transactiondisplay->listview->addColumn ( "Acct", 0 ); 130 transactiondisplay->listview->addColumn ( "Acct", 0 );
131 children = TRUE; 131 children = TRUE;
132 132
133 // hide the new transaction button 133 // hide the new transaction button
134 transactiondisplay->newtransaction->setEnabled ( FALSE ); 134 transactiondisplay->newtransaction->setEnabled ( FALSE );
@@ -291,112 +291,112 @@ void QashMoney::displayTransactionPreferencesDialog ()
291 TransactionPreferences *td = new TransactionPreferences ( this ); 291 TransactionPreferences *td = new TransactionPreferences ( this );
292 td->exec (); 292 td->exec ();
293 if ( transactiondisplay->isVisible() ) 293 if ( transactiondisplay->isVisible() )
294 { 294 {
295 // set the account id 295 // set the account id
296 int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt(); 296 int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt();
297 297
298 // set children so we can let displayTransfers know if there are children for the selected account 298 // set children so we can let displayTransfers know if there are children for the selected account
299 bool children; 299 bool children;
300 if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) 300 if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 )
301 children = TRUE; 301 children = TRUE;
302 else 302 else
303 children = FALSE; 303 children = FALSE;
304 304
305 // redisplay transactions incorporating any transaction preference changes 305 // redisplay transactions incorporating any transaction preference changes
306 transactiondisplay->listview->clear(); 306 transactiondisplay->listview->clear();
307 QString displaytext = "%"; 307 QString displaytext = "%";
308 displaytext.prepend ( transactiondisplay->limitbox->text() ); 308 displaytext.prepend ( transactiondisplay->limitbox->text() );
309 309
310 setTransactionDisplayDate(); 310 setTransactionDisplayDate();
311 if ( transaction->getNumberOfTransactions() > 0 ) 311 if ( transaction->getNumberOfTransactions() > 0 )
312 transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); 312 transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate );
313 313
314 if ( transfer->getNumberOfTransfers() != 0 ) 314 if ( transfer->getNumberOfTransfers() != 0 )
315 transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); 315 transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate );
316 } 316 }
317 else 317 else
318 { 318 {
319 accountdisplay->listview->clearSelection(); 319 accountdisplay->listview->clearSelection();
320 maintabs->setTabEnabled ( tab_2, FALSE ); 320 maintabs->setTabEnabled ( tab_2, FALSE );
321 } 321 }
322 } 322 }
323 323
324void QashMoney::displayAccountPreferencesDialog () 324void QashMoney::displayAccountPreferencesDialog ()
325 { 325 {
326 // display a dialog for setting preferences for accounts 326 // display a dialog for setting preferences for accounts
327 AccountPreferences *ap = new AccountPreferences ( this ); 327 AccountPreferences *ap = new AccountPreferences ( this );
328 ap->exec (); 328 ap->exec ();
329 329
330 if ( accountdisplay->isVisible() && account->getNumberOfAccounts() != 0 ) 330 if ( accountdisplay->isVisible() && account->getNumberOfAccounts() != 0 )
331 { 331 {
332 accountdisplay->listview->clear(); 332 accountdisplay->listview->clear();
333 account->displayAccounts ( accountdisplay->listview ); 333 account->displayAccounts ( accountdisplay->listview );
334 accountdisplay->listview->clearSelection(); 334 accountdisplay->listview->clearSelection();
335 maintabs->setTabEnabled ( tab_2, FALSE ); 335 maintabs->setTabEnabled ( tab_2, FALSE );
336 } 336 }
337 changeTabDisplay(); 337 changeTabDisplay();
338 } 338 }
339 339
340void QashMoney::displayMemoryDialog () 340void QashMoney::displayMemoryDialog ()
341 { 341 {
342 // opens a dialog to add, edit and delete memory items 342 // opens a dialog to add, edit and delete memory items
343 MemoryDialog *md = new MemoryDialog (); 343 MemoryDialog *md = new MemoryDialog ();
344 md->exec(); 344 md->exec();
345 } 345 }
346 346
347void QashMoney::showTransactions () 347void QashMoney::showTransactions ()
348 { 348 {
349 maintabs->setCurrentPage ( 1 ); 349 maintabs->setCurrentPage ( 1 );
350 } 350 }
351 351
352void QashMoney::enableOneTouchViewing () 352void QashMoney::enableOneTouchViewing ()
353 { 353 {
354 if ( preferences->getPreference ( 5 ) == 1 ) 354 if ( preferences->getPreference ( 5 ) == 1 )
355 connect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); 355 connect ( accountdisplay->listview, SIGNAL ( selectionChanged() ), this, SLOT ( showTransactions() ) );
356 else 356 else
357 disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); 357 disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged() ), this, SLOT ( showTransactions() ) );
358 } 358 }
359 359
360void QashMoney::disableOneTouchViewing () 360void QashMoney::disableOneTouchViewing ()
361 { 361 {
362 disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); 362 disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged() ), this, SLOT ( showTransactions() ) );
363 } 363 }
364 364
365void QashMoney::toggleOneTouchViewing ( bool state ) 365void QashMoney::toggleOneTouchViewing ( bool state )
366 { 366 {
367 if ( state == TRUE ) 367 if ( state == TRUE )
368 disableOneTouchViewing(); 368 disableOneTouchViewing();
369 else 369 else
370 enableOneTouchViewing(); 370 enableOneTouchViewing();
371 } 371 }
372 372
373void QashMoney::setTransactionDisplayDate () 373void QashMoney::setTransactionDisplayDate ()
374 { 374 {
375 // determine how many days of transactions to show 375 // determine how many days of transactions to show
376 int limittype = preferences->getPreference ( 7 ); 376 int limittype = preferences->getPreference ( 7 );
377 if ( limittype != 5 ) // set today's date if we are not showing all transactions 377 if ( limittype != 5 ) // set today's date if we are not showing all transactions
378 { 378 {
379 QDate today = QDate::currentDate (); 379 QDate today = QDate::currentDate ();
380 switch ( limittype ) // if we are not showing all transactions 380 switch ( limittype ) // if we are not showing all transactions
381 { 381 {
382 case 0: // viewing two weeks 382 case 0: // viewing two weeks
383 newdate = today.addDays ( -14 ); 383 newdate = today.addDays ( -14 );
384 break; 384 break;
385 case 1: // viewing one month 385 case 1: // viewing one month
386 newdate = today.addDays ( -30 ); 386 newdate = today.addDays ( -30 );
387 break; 387 break;
388 case 2: // three months 388 case 2: // three months
389 newdate = today.addDays ( -90 ); 389 newdate = today.addDays ( -90 );
390 break; 390 break;
391 case 3: // six months 391 case 3: // six months
392 newdate = today.addDays ( -180 ); 392 newdate = today.addDays ( -180 );
393 break; 393 break;
394 case 4: // one year 394 case 4: // one year
395 newdate = today.addDays ( -365 ); 395 newdate = today.addDays ( -365 );
396 break; 396 break;
397 } 397 }
398 } 398 }
399 else 399 else
400 newdate = QDate ( 1900, 1, 1 ); 400 newdate = QDate ( 1900, 1, 1 );
401 } 401 }
402 402
diff --git a/noncore/apps/qashmoney/transactiondisplay.cpp b/noncore/apps/qashmoney/transactiondisplay.cpp
index 474f11e..0b94d62 100755
--- a/noncore/apps/qashmoney/transactiondisplay.cpp
+++ b/noncore/apps/qashmoney/transactiondisplay.cpp
@@ -1,130 +1,130 @@
1#include "transactiondisplay.h" 1#include "transactiondisplay.h"
2#include "newtransaction.h" 2#include "newtransaction.h"
3#include "account.h" 3#include "account.h"
4#include "budget.h" 4#include "budget.h"
5#include "memory.h" 5#include "memory.h"
6#include "transfer.h" 6#include "transfer.h"
7#include "calculator.h" 7#include "calculator.h"
8#include "datepicker.h" 8#include "datepicker.h"
9 9
10#include <qmessagebox.h> 10#include <qmessagebox.h>
11#include <qheader.h> 11#include <qheader.h>
12#include <qmultilineedit.h> 12#include <qmultilineedit.h>
13 13
14extern Transaction *transaction; 14extern Transaction *transaction;
15extern Budget *budget; 15extern Budget *budget;
16extern Account *account; 16extern Account *account;
17extern Preferences *preferences; 17extern Preferences *preferences;
18extern Memory *memory; 18extern Memory *memory;
19extern Transfer *transfer; 19extern Transfer *transfer;
20 20
21TransactionDisplay::TransactionDisplay ( QWidget* parent ) : QWidget ( parent ) 21TransactionDisplay::TransactionDisplay ( QWidget* parent ) : QWidget ( parent )
22 { 22 {
23 // set transactiondisplay variables; 23 // set transactiondisplay variables;
24 accountid = 0; 24 accountid = 0;
25 children = TRUE; 25 children = TRUE;
26 26
27 firstline = new QHBox ( this ); 27 firstline = new QHBox ( this );
28 firstline->setSpacing ( 2 ); 28 firstline->setSpacing ( 2 );
29 29
30 newtransaction = new QPushButton ( firstline ); 30 newtransaction = new QPushButton ( firstline );
31 newtransaction->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") ); 31 newtransaction->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") );
32 connect ( newtransaction, SIGNAL ( released () ), this, SLOT ( addTransaction () ) ); 32 connect ( newtransaction, SIGNAL ( released() ), this, SLOT ( addTransaction() ) );
33 33
34 edittransaction = new QPushButton ( firstline ); 34 edittransaction = new QPushButton ( firstline );
35 edittransaction->setPixmap( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); 35 edittransaction->setPixmap( QPixmap ("/opt/QtPalmtop/pics/edit.png") );
36 connect ( edittransaction, SIGNAL ( released () ), this, SLOT ( checkListViewEdit () ) ); 36 connect ( edittransaction, SIGNAL ( released() ), this, SLOT ( checkListViewEdit() ) );
37 37
38 deletetransaction = new QPushButton ( firstline ); 38 deletetransaction = new QPushButton ( firstline );
39 deletetransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") ); 39 deletetransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") );
40 connect ( deletetransaction, SIGNAL ( released () ), this, SLOT ( checkListViewDelete () ) ); 40 connect ( deletetransaction, SIGNAL ( released() ), this, SLOT ( checkListViewDelete() ) );
41 41
42 toggletransaction = new QPushButton ( firstline ); 42 toggletransaction = new QPushButton ( firstline );
43 toggletransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/redo.png") ); 43 toggletransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/redo.png") );
44 connect ( toggletransaction, SIGNAL ( released () ), this, SLOT ( checkListViewToggle () ) ); 44 connect ( toggletransaction, SIGNAL ( released() ), this, SLOT ( checkListViewToggle() ) );
45 45
46 viewtransactionnotes = new QPushButton ( firstline ); 46 viewtransactionnotes = new QPushButton ( firstline );
47 viewtransactionnotes->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/info.png") ); 47 viewtransactionnotes->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/info.png") );
48 connect ( viewtransactionnotes, SIGNAL ( released () ), this, SLOT ( showTransactionNotes () ) ); 48 connect ( viewtransactionnotes, SIGNAL ( released() ), this, SLOT ( showTransactionNotes() ) );
49 49
50 secondline = new QHBox ( this ); 50 secondline = new QHBox ( this );
51 secondline->setSpacing ( 5 ); 51 secondline->setSpacing ( 5 );
52 52
53 name = new QLabel ( secondline ); 53 name = new QLabel ( secondline );
54 balance = new QLabel ( secondline ); 54 balance = new QLabel ( secondline );
55 55
56 QLabel *limit = new QLabel ( "Limit", secondline ); 56 QLabel *limit = new QLabel ( "Limit", secondline );
57 limitbox = new QLineEdit ( secondline ); 57 limitbox = new QLineEdit ( secondline );
58 limitbox->setMinimumWidth ( ( int ) ( this->width() / 6 ) ); 58 limitbox->setMinimumWidth ( ( int ) ( this->width() / 6 ) );
59 connect ( limitbox, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( limitDisplay ( const QString & ) ) ); 59 connect ( limitbox, SIGNAL ( textChanged(const QString&) ), this, SLOT ( limitDisplay(const QString&) ) );
60 60
61 listview = new QListView ( this ); 61 listview = new QListView ( this );
62 listview->setAllColumnsShowFocus ( TRUE ); 62 listview->setAllColumnsShowFocus ( TRUE );
63 listview->setShowSortIndicator ( TRUE ); 63 listview->setShowSortIndicator ( TRUE );
64 listview->header()->setTracking ( FALSE ); 64 listview->header()->setTracking ( FALSE );
65 connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); 65 connect ( listview->header(), SIGNAL ( sizeChange(int,int,int) ), this, SLOT ( saveColumnSize(int,int,int) ) );
66 connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); 66 connect ( listview->header(), SIGNAL ( clicked(int) ), this, SLOT ( saveSortingPreference(int) ) );
67 67
68 layout = new QVBoxLayout ( this, 2, 2 ); 68 layout = new QVBoxLayout ( this, 2, 2 );
69 layout->addWidget ( firstline ); 69 layout->addWidget ( firstline );
70 layout->addWidget ( secondline ); 70 layout->addWidget ( secondline );
71 layout->addWidget ( listview ); 71 layout->addWidget ( listview );
72 } 72 }
73 73
74void TransactionDisplay::addTransaction () 74void TransactionDisplay::addTransaction ()
75 { 75 {
76 // create local variables 76 // create local variables
77 int cleared = -1; 77 int cleared = -1;
78 78
79 // create new transaction window 79 // create new transaction window
80 NewTransaction *newtransaction = new NewTransaction ( this ); 80 NewTransaction *newtransaction = new NewTransaction ( this );
81 int width = this->size().width(); 81 int width = this->size().width();
82 newtransaction->transactionname->setMaximumWidth ( ( int ) ( width * 0.45 ) ); 82 newtransaction->transactionname->setMaximumWidth ( ( int ) ( width * 0.45 ) );
83 newtransaction->transactionname->setMinimumWidth ( ( int ) ( width * 0.35 ) ); 83 newtransaction->transactionname->setMinimumWidth ( ( int ) ( width * 0.35 ) );
84 newtransaction->lineitembox->setMaximumWidth ( ( int ) ( width * 0.45 ) ); 84 newtransaction->lineitembox->setMaximumWidth ( ( int ) ( width * 0.45 ) );
85 newtransaction->transactiondatebox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); 85 newtransaction->transactiondatebox->setMaximumWidth ( ( int ) ( width * 0.4 ) );
86 newtransaction->transactionamountbox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); 86 newtransaction->transactionamountbox->setMaximumWidth ( ( int ) ( width * 0.4 ) );
87 newtransaction->transactionnumber->setMaximumWidth ( ( int ) ( width * 0.25 ) ); 87 newtransaction->transactionnumber->setMaximumWidth ( ( int ) ( width * 0.25 ) );
88 88
89 // enter today's date in the date box as defaul 89 // enter today's date in the date box as defaul
90 QDate today = QDate::currentDate (); 90 QDate today = QDate::currentDate ();
91 int defaultday = today.day(); 91 int defaultday = today.day();
92 int defaultmonth = today.month(); 92 int defaultmonth = today.month();
93 int defaultyear = today.year(); 93 int defaultyear = today.year();
94 newtransaction->transactiondate->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) ); 94 newtransaction->transactiondate->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) );
95 95
96 // add memory items to the transactionname combobox 96 // add memory items to the transactionname combobox
97 memory->displayMemoryItems ( newtransaction->transactionname ); 97 memory->displayMemoryItems ( newtransaction->transactionname );
98 newtransaction->transactionname->insertItem ( "", 0 ); 98 newtransaction->transactionname->insertItem ( "", 0 );
99 99
100 if ( newtransaction->exec () == QDialog::Accepted ) 100 if ( newtransaction->exec () == QDialog::Accepted )
101 { 101 {
102 if ( newtransaction->clearedcheckbox->isChecked () == TRUE ) // set a parent id and type for a child transaction 102 if ( newtransaction->clearedcheckbox->isChecked () == TRUE ) // set a parent id and type for a child transaction
103 cleared = 1; 103 cleared = 1;
104 else 104 else
105 cleared = 0; 105 cleared = 0;
106 106
107 float amount = newtransaction->transactionamount->text().toFloat(); 107 float amount = newtransaction->transactionamount->text().toFloat();
108 if ( newtransaction->depositbox->isChecked() == FALSE ) 108 if ( newtransaction->depositbox->isChecked() == FALSE )
109 amount = amount * -1; 109 amount = amount * -1;
110 110
111 // add the transaction name to the memory items 111 // add the transaction name to the memory items
112 memory->addMemoryItem ( newtransaction->transactionname->currentText() ); 112 memory->addMemoryItem ( newtransaction->transactionname->currentText() );
113 113
114 // add the transaction 114 // add the transaction
115 if ( newtransaction->getDateEdited () == TRUE ) 115 if ( newtransaction->getDateEdited () == TRUE )
116 transaction->addTransaction ( newtransaction->getDescription(), newtransaction->transactionname->currentText(), accountid, account->getParentAccountID ( accountid ), 116 transaction->addTransaction ( newtransaction->getDescription(), newtransaction->transactionname->currentText(), accountid, account->getParentAccountID ( accountid ),
117 newtransaction->transactionnumber->text().toInt(), newtransaction->getDay(), newtransaction->getMonth(), newtransaction->getYear(), amount, cleared, newtransaction->getCurrentBudget(), 117 newtransaction->transactionnumber->text().toInt(), newtransaction->getDay(), newtransaction->getMonth(), newtransaction->getYear(), amount, cleared, newtransaction->getCurrentBudget(),
118 newtransaction->getCurrentLineItem() ); 118 newtransaction->getCurrentLineItem() );
119 else 119 else
120 transaction->addTransaction ( newtransaction->getDescription(), newtransaction->transactionname->currentText(), accountid, account->getParentAccountID ( accountid ), 120 transaction->addTransaction ( newtransaction->getDescription(), newtransaction->transactionname->currentText(), accountid, account->getParentAccountID ( accountid ),
121 newtransaction->transactionnumber->text().toInt(), defaultday, defaultmonth, defaultyear, amount, cleared, newtransaction->getCurrentBudget(), newtransaction->getCurrentLineItem() ); 121 newtransaction->transactionnumber->text().toInt(), defaultday, defaultmonth, defaultyear, amount, cleared, newtransaction->getCurrentBudget(), newtransaction->getCurrentLineItem() );
122 122
123 // redisplay transactions 123 // redisplay transactions
124 listview->clear(); 124 listview->clear();
125 QString displaytext = "%"; 125 QString displaytext = "%";
126 displaytext.prepend ( limitbox->text() ); 126 displaytext.prepend ( limitbox->text() );
127 setTransactionDisplayDate (); 127 setTransactionDisplayDate ();
128 if ( transaction->getNumberOfTransactions() > 0 ) 128 if ( transaction->getNumberOfTransactions() > 0 )
129 transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); 129 transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate );
130 130
@@ -152,129 +152,129 @@ void TransactionDisplay::checkListViewEdit ()
152 else 152 else
153 editTransaction(); 153 editTransaction();
154 } 154 }
155 155
156void TransactionDisplay::showCalculator () 156void TransactionDisplay::showCalculator ()
157 { 157 {
158 Calculator *calculator = new Calculator ( this ); 158 Calculator *calculator = new Calculator ( this );
159 if ( calculator->exec () == QDialog::Accepted ) 159 if ( calculator->exec () == QDialog::Accepted )
160 amount->setText ( calculator->display->text() ); 160 amount->setText ( calculator->display->text() );
161 } 161 }
162 162
163void TransactionDisplay::showCalendar () 163void TransactionDisplay::showCalendar ()
164 { 164 {
165 QDate newDate = QDate::currentDate (); 165 QDate newDate = QDate::currentDate ();
166 DatePicker *dp = new DatePicker ( newDate ); 166 DatePicker *dp = new DatePicker ( newDate );
167 if ( dp->exec () == QDialog::Accepted ) 167 if ( dp->exec () == QDialog::Accepted )
168 { 168 {
169 year = dp->getYear(); 169 year = dp->getYear();
170 month = dp->getMonth(); 170 month = dp->getMonth();
171 day = dp->getDay(); 171 day = dp->getDay();
172 date->setText ( preferences->getDate ( year, month, day ) ); 172 date->setText ( preferences->getDate ( year, month, day ) );
173 } 173 }
174 } 174 }
175 175
176void TransactionDisplay::editTransfer () 176void TransactionDisplay::editTransfer ()
177 { 177 {
178 transferid = listview->currentItem()->text ( getIDColumn() ).toInt(); 178 transferid = listview->currentItem()->text ( getIDColumn() ).toInt();
179 fromaccount = transfer->getFromAccountID ( transferid ); 179 fromaccount = transfer->getFromAccountID ( transferid );
180 toaccount = transfer->getToAccountID ( transferid ); 180 toaccount = transfer->getToAccountID ( transferid );
181 year = transfer->getYear ( transferid ); 181 year = transfer->getYear ( transferid );
182 month = transfer->getMonth ( transferid ); 182 month = transfer->getMonth ( transferid );
183 day = transfer->getDay ( transferid ); 183 day = transfer->getDay ( transferid );
184 184
185 QDialog *editransfer = new QDialog ( this, "edittransfer", TRUE ); 185 QDialog *editransfer = new QDialog ( this, "edittransfer", TRUE );
186 editransfer->setCaption ( "Transfer" ); 186 editransfer->setCaption ( "Transfer" );
187 187
188 QStringList accountnames = account->getAccountNames(); 188 QStringList accountnames = account->getAccountNames();
189 QStringList accountids = account->getAccountIDs(); 189 QStringList accountids = account->getAccountIDs();
190 190
191 QLabel *fromaccountlabel = new QLabel ( "From Account:", editransfer ); 191 QLabel *fromaccountlabel = new QLabel ( "From Account:", editransfer );
192 QFont f = this->font(); 192 QFont f = this->font();
193 f.setWeight ( QFont::Bold ); 193 f.setWeight ( QFont::Bold );
194 fromaccountlabel->setFont ( f ); 194 fromaccountlabel->setFont ( f );
195 195
196 QComboBox *fromaccountbox = new QComboBox ( editransfer ); 196 QComboBox *fromaccountbox = new QComboBox ( editransfer );
197 fromaccountbox->insertStringList ( accountnames ); 197 fromaccountbox->insertStringList ( accountnames );
198 fromaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( fromaccount ) ) ); 198 fromaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( fromaccount ) ) );
199 199
200 QLabel *toaccountlabel = new QLabel ( "To Account:", editransfer ); 200 QLabel *toaccountlabel = new QLabel ( "To Account:", editransfer );
201 toaccountlabel->setFont ( f ); 201 toaccountlabel->setFont ( f );
202 202
203 QComboBox *toaccountbox = new QComboBox ( editransfer ); 203 QComboBox *toaccountbox = new QComboBox ( editransfer );
204 toaccountbox->insertStringList ( accountnames ); 204 toaccountbox->insertStringList ( accountnames );
205 toaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( toaccount ) ) ); 205 toaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( toaccount ) ) );
206 206
207 QLabel *datelabel = new QLabel ( "Date", editransfer ); 207 QLabel *datelabel = new QLabel ( "Date", editransfer );
208 QHBox *datebox = new QHBox ( editransfer ); 208 QHBox *datebox = new QHBox ( editransfer );
209 datebox->setSpacing ( 2 ); 209 datebox->setSpacing ( 2 );
210 date = new QLineEdit ( datebox ); 210 date = new QLineEdit ( datebox );
211 date->setAlignment ( Qt::AlignRight ); 211 date->setAlignment ( Qt::AlignRight );
212 date->setDisabled ( TRUE ); 212 date->setDisabled ( TRUE );
213 date->setText ( preferences->getDate ( year, month, day ) ); 213 date->setText ( preferences->getDate ( year, month, day ) );
214 QPushButton *datebutton = new QPushButton ( datebox ); 214 QPushButton *datebutton = new QPushButton ( datebox );
215 datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); 215 datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) );
216 connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); 216 connect ( datebutton, SIGNAL ( released() ), this, SLOT ( showCalendar() ) );
217 217
218 QLabel *amounttlabel = new QLabel ( "Amount", editransfer ); 218 QLabel *amounttlabel = new QLabel ( "Amount", editransfer );
219 219
220 QHBox *amountbox = new QHBox ( editransfer ); 220 QHBox *amountbox = new QHBox ( editransfer );
221 amountbox->setSpacing ( 2 ); 221 amountbox->setSpacing ( 2 );
222 amount = new QLineEdit ( amountbox ); 222 amount = new QLineEdit ( amountbox );
223 amount->setAlignment ( Qt::AlignRight ); 223 amount->setAlignment ( Qt::AlignRight );
224 amount->setText ( transfer->getAmount ( transferid ) ); 224 amount->setText ( transfer->getAmount ( transferid ) );
225 QPushButton *calculatorbutton = new QPushButton( amountbox ); 225 QPushButton *calculatorbutton = new QPushButton( amountbox );
226 calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); 226 calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) );
227 connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); 227 connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) );
228 228
229 QCheckBox *clearedcheckbox = new QCheckBox ( "Cleared", editransfer ); 229 QCheckBox *clearedcheckbox = new QCheckBox ( "Cleared", editransfer );
230 230
231 QBoxLayout *layout = new QVBoxLayout ( editransfer, 4, 2 ); 231 QBoxLayout *layout = new QVBoxLayout ( editransfer, 4, 2 );
232 layout->addWidget ( fromaccountlabel, Qt::AlignLeft ); 232 layout->addWidget ( fromaccountlabel, Qt::AlignLeft );
233 layout->addWidget ( fromaccountbox, Qt::AlignLeft ); 233 layout->addWidget ( fromaccountbox, Qt::AlignLeft );
234 layout->addWidget ( toaccountlabel, Qt::AlignLeft ); 234 layout->addWidget ( toaccountlabel, Qt::AlignLeft );
235 layout->addWidget ( toaccountbox, Qt::AlignLeft ); 235 layout->addWidget ( toaccountbox, Qt::AlignLeft );
236 layout->addSpacing ( 5 ); 236 layout->addSpacing ( 5 );
237 layout->addWidget ( datelabel, Qt::AlignLeft ); 237 layout->addWidget ( datelabel, Qt::AlignLeft );
238 layout->addWidget ( datebox, Qt::AlignLeft ); 238 layout->addWidget ( datebox, Qt::AlignLeft );
239 layout->addWidget ( amounttlabel, Qt::AlignLeft ); 239 layout->addWidget ( amounttlabel, Qt::AlignLeft );
240 layout->addWidget ( amountbox, Qt::AlignLeft ); 240 layout->addWidget ( amountbox, Qt::AlignLeft );
241 layout->addWidget ( clearedcheckbox, Qt::AlignLeft ); 241 layout->addWidget ( clearedcheckbox, Qt::AlignLeft );
242 242
243 if ( editransfer->exec() == QDialog::Accepted ) 243 if ( editransfer->exec() == QDialog::Accepted )
244 { 244 {
245 //get fromaccount 245 //get fromaccount
246 fromaccount = ( accountids.operator[] ( fromaccountbox->currentItem() ) ).toInt(); 246 fromaccount = ( accountids.operator[] ( fromaccountbox->currentItem() ) ).toInt();
247 247
248 //get to account 248 //get to account
249 toaccount = ( accountids.operator[] ( toaccountbox->currentItem() ) ).toInt(); 249 toaccount = ( accountids.operator[] ( toaccountbox->currentItem() ) ).toInt();
250 250
251 //set cleared flag 251 //set cleared flag
252 int cleared = 0; 252 int cleared = 0;
253 if ( clearedcheckbox->isChecked() == TRUE ) 253 if ( clearedcheckbox->isChecked() == TRUE )
254 cleared = 1; 254 cleared = 1;
255 255
256 //update transfer 256 //update transfer
257 transfer->updateTransfer ( fromaccount, account->getParentAccountID ( fromaccount ), toaccount, account->getParentAccountID ( toaccount ), 257 transfer->updateTransfer ( fromaccount, account->getParentAccountID ( fromaccount ), toaccount, account->getParentAccountID ( toaccount ),
258 day, month, year, amount->text().toFloat(), cleared, transferid ); 258 day, month, year, amount->text().toFloat(), cleared, transferid );
259 259
260 account->updateAccountBalance ( fromaccount ); 260 account->updateAccountBalance ( fromaccount );
261 if ( account->getParentAccountID ( fromaccount ) != -1 ) 261 if ( account->getParentAccountID ( fromaccount ) != -1 )
262 account->changeParentAccountBalance ( account->getParentAccountID ( fromaccount ) ); 262 account->changeParentAccountBalance ( account->getParentAccountID ( fromaccount ) );
263 263
264 updateAndDisplay ( toaccount ); 264 updateAndDisplay ( toaccount );
265 } 265 }
266 } 266 }
267 267
268void TransactionDisplay::editTransaction () 268void TransactionDisplay::editTransaction ()
269 { 269 {
270 int cleared; 270 int cleared;
271 271
272 // set the transaction id and budgetid 272 // set the transaction id and budgetid
273 int transactionid = listview->currentItem()->text ( getIDColumn() ).toInt(); 273 int transactionid = listview->currentItem()->text ( getIDColumn() ).toInt();
274 int budgetid = transaction->getBudgetID ( transactionid ); 274 int budgetid = transaction->getBudgetID ( transactionid );
275 int lineitemid = transaction->getLineItemID ( transactionid ); 275 int lineitemid = transaction->getLineItemID ( transactionid );
276 276
277 // create edit transaction window 277 // create edit transaction window
278 NewTransaction *newtransaction = new NewTransaction ( this ); 278 NewTransaction *newtransaction = new NewTransaction ( this );
279 int width = this->width(); 279 int width = this->width();
280 newtransaction->transactionname->setMaximumWidth ( ( int ) ( width * 0.45 ) ); 280 newtransaction->transactionname->setMaximumWidth ( ( int ) ( width * 0.45 ) );
diff --git a/noncore/apps/qashmoney/transferdialog.cpp b/noncore/apps/qashmoney/transferdialog.cpp
index 558abec..7a12fbf 100755
--- a/noncore/apps/qashmoney/transferdialog.cpp
+++ b/noncore/apps/qashmoney/transferdialog.cpp
@@ -1,97 +1,97 @@
1#include "transferdialog.h" 1#include "transferdialog.h"
2#include "datepicker.h" 2#include "datepicker.h"
3#include "calculator.h" 3#include "calculator.h"
4 4
5 5
6extern Preferences *preferences; 6extern Preferences *preferences;
7extern Account *account; 7extern Account *account;
8 8
9TransferDialog::TransferDialog ( QWidget *parent, int fromaccountid, int toaccountid ) : QDialog ( parent, 0, TRUE ) 9TransferDialog::TransferDialog ( QWidget *parent, int fromaccountid, int toaccountid ) : QDialog ( parent, 0, TRUE )
10 { 10 {
11 dateedited = FALSE; 11 dateedited = FALSE;
12 setCaption ( "Transfer" ); 12 setCaption ( "Transfer" );
13 13
14 fromaccountlabel = new QLabel ( "From account:", this ); 14 fromaccountlabel = new QLabel ( "From account:", this );
15 QFont f = this->font(); 15 QFont f = this->font();
16 f.setWeight ( QFont::Bold ); 16 f.setWeight ( QFont::Bold );
17 fromaccountlabel->setFont ( f ); 17 fromaccountlabel->setFont ( f );
18 fromaccount = new QLabel ( account->getAccountName ( fromaccountid ), this ); 18 fromaccount = new QLabel ( account->getAccountName ( fromaccountid ), this );
19 19
20 toaccountlabel = new QLabel ( "To Account:", this ); 20 toaccountlabel = new QLabel ( "To Account:", this );
21 toaccountlabel->setFont ( f ); 21 toaccountlabel->setFont ( f );
22 toaccount = new QLabel ( account->getAccountName ( toaccountid ), this ); 22 toaccount = new QLabel ( account->getAccountName ( toaccountid ), this );
23 23
24 datelabel = new QLabel ( "Date", this ); 24 datelabel = new QLabel ( "Date", this );
25 25
26 datebox = new QHBox ( this ); 26 datebox = new QHBox ( this );
27 datebox->setSpacing ( 2 ); 27 datebox->setSpacing ( 2 );
28 date = new QLineEdit ( datebox ); 28 date = new QLineEdit ( datebox );
29 date->setAlignment ( Qt::AlignRight ); 29 date->setAlignment ( Qt::AlignRight );
30 date->setDisabled ( TRUE ); 30 date->setDisabled ( TRUE );
31 datebutton = new QPushButton ( datebox ); 31 datebutton = new QPushButton ( datebox );
32 datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); 32 datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) );
33 connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); 33 connect ( datebutton, SIGNAL ( released() ), this, SLOT ( showCalendar() ) );
34 34
35 amounttlabel = new QLabel ( "Amount", this ); 35 amounttlabel = new QLabel ( "Amount", this );
36 36
37 amountbox = new QHBox ( this ); 37 amountbox = new QHBox ( this );
38 amountbox->setSpacing ( 2 ); 38 amountbox->setSpacing ( 2 );
39 amount = new QLineEdit ( amountbox ); 39 amount = new QLineEdit ( amountbox );
40 amount->setAlignment ( Qt::AlignRight ); 40 amount->setAlignment ( Qt::AlignRight );
41 calculatorbutton = new QPushButton( amountbox ); 41 calculatorbutton = new QPushButton( amountbox );
42 calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); 42 calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) );
43 connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); 43 connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) );
44 44
45 clearedcheckbox = new QCheckBox ( "Cleared", this ); 45 clearedcheckbox = new QCheckBox ( "Cleared", this );
46 46
47 layout = new QVBoxLayout ( this, 4, 2 ); 47 layout = new QVBoxLayout ( this, 4, 2 );
48 layout->addWidget ( fromaccountlabel, Qt::AlignLeft ); 48 layout->addWidget ( fromaccountlabel, Qt::AlignLeft );
49 layout->addWidget ( fromaccount, Qt::AlignLeft ); 49 layout->addWidget ( fromaccount, Qt::AlignLeft );
50 layout->addWidget ( toaccountlabel, Qt::AlignLeft ); 50 layout->addWidget ( toaccountlabel, Qt::AlignLeft );
51 layout->addWidget ( toaccount, Qt::AlignLeft ); 51 layout->addWidget ( toaccount, Qt::AlignLeft );
52 layout->addSpacing ( 5 ); 52 layout->addSpacing ( 5 );
53 layout->addWidget ( datelabel, Qt::AlignLeft ); 53 layout->addWidget ( datelabel, Qt::AlignLeft );
54 layout->addWidget ( datebox, Qt::AlignLeft ); 54 layout->addWidget ( datebox, Qt::AlignLeft );
55 layout->addWidget ( amounttlabel, Qt::AlignLeft ); 55 layout->addWidget ( amounttlabel, Qt::AlignLeft );
56 layout->addWidget ( amountbox, Qt::AlignLeft ); 56 layout->addWidget ( amountbox, Qt::AlignLeft );
57 layout->addWidget ( clearedcheckbox, Qt::AlignLeft ); 57 layout->addWidget ( clearedcheckbox, Qt::AlignLeft );
58 } 58 }
59 59
60bool TransferDialog::getDateEdited () 60bool TransferDialog::getDateEdited ()
61 { 61 {
62 return dateedited; 62 return dateedited;
63 } 63 }
64 64
65void TransferDialog::showCalendar () 65void TransferDialog::showCalendar ()
66 { 66 {
67 QDate newDate = QDate::currentDate (); 67 QDate newDate = QDate::currentDate ();
68 DatePicker *dp = new DatePicker ( newDate ); 68 DatePicker *dp = new DatePicker ( newDate );
69 if ( dp->exec () == QDialog::Accepted ) 69 if ( dp->exec () == QDialog::Accepted )
70 { 70 {
71 // Set date integers 71 // Set date integers
72 year = dp->getYear(); 72 year = dp->getYear();
73 month = dp->getMonth(); 73 month = dp->getMonth();
74 day = dp->getDay(); 74 day = dp->getDay();
75 75
76 // Set dateedited to TRUE 76 // Set dateedited to TRUE
77 // This tells the accountdisplay object that the user edited an account 77 // This tells the accountdisplay object that the user edited an account
78 // and did change the date 78 // and did change the date
79 dateedited = TRUE; 79 dateedited = TRUE;
80 80
81 // Display date with our selected format 81 // Display date with our selected format
82 date->setText ( preferences->getDate ( year, month, day ) ); 82 date->setText ( preferences->getDate ( year, month, day ) );
83 } 83 }
84 } 84 }
85 85
86int TransferDialog::getDay () 86int TransferDialog::getDay ()
87 { 87 {
88 return day; 88 return day;
89 } 89 }
90 90
91int TransferDialog::getMonth () 91int TransferDialog::getMonth ()
92 { 92 {
93 return month; 93 return month;
94 } 94 }
95 95
96int TransferDialog::getYear () 96int TransferDialog::getYear ()
97 { 97 {
diff --git a/noncore/apps/tableviewer/tableviewer.cpp b/noncore/apps/tableviewer/tableviewer.cpp
index f35dfcd..4c6d809 100644
--- a/noncore/apps/tableviewer/tableviewer.cpp
+++ b/noncore/apps/tableviewer/tableviewer.cpp
@@ -94,136 +94,136 @@ TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f
94 navigation = new QToolBar(this, "navigation"); 94 navigation = new QToolBar(this, "navigation");
95 QToolButton *newItemButton = new QToolButton( 95 QToolButton *newItemButton = new QToolButton(
96 QIconSet(Resource::loadPixmap("new")), "New Item", QString::null, 96 QIconSet(Resource::loadPixmap("new")), "New Item", QString::null,
97 this, SLOT(newItemSlot()), navigation, "New Item"); 97 this, SLOT(newItemSlot()), navigation, "New Item");
98 QToolButton *editItemButton = new QToolButton( 98 QToolButton *editItemButton = new QToolButton(
99 QIconSet(Resource::loadPixmap("edit")), "Edit Item", QString::null, 99 QIconSet(Resource::loadPixmap("edit")), "Edit Item", QString::null,
100 this, SLOT(editItemSlot()), navigation, "Edit Item"); 100 this, SLOT(editItemSlot()), navigation, "Edit Item");
101 QToolButton *deleteItemButton = new QToolButton( 101 QToolButton *deleteItemButton = new QToolButton(
102 QIconSet(Resource::loadPixmap("trash")), "Delete Item", 102 QIconSet(Resource::loadPixmap("trash")), "Delete Item",
103 QString::null, this, 103 QString::null, this,
104 SLOT(deleteItemSlot()), navigation, "Delete Item"); 104 SLOT(deleteItemSlot()), navigation, "Delete Item");
105 105
106 navigation->addSeparator(); 106 navigation->addSeparator();
107 107
108 QToolButton *firstItemButton = new QToolButton( 108 QToolButton *firstItemButton = new QToolButton(
109 QIconSet(Resource::loadPixmap("fastback")), "First Item", 109 QIconSet(Resource::loadPixmap("fastback")), "First Item",
110 QString::null, this, 110 QString::null, this,
111 SLOT(firstItem()), navigation, "First Item"); 111 SLOT(firstItem()), navigation, "First Item");
112 QToolButton *previousItemButton = new QToolButton( 112 QToolButton *previousItemButton = new QToolButton(
113 QIconSet(Resource::loadPixmap("back")), "Previous Item", 113 QIconSet(Resource::loadPixmap("back")), "Previous Item",
114 QString::null, this, 114 QString::null, this,
115 SLOT(previousItem()), navigation, "Previous Item"); 115 SLOT(previousItem()), navigation, "Previous Item");
116 QToolButton *nextItemButton = new QToolButton( 116 QToolButton *nextItemButton = new QToolButton(
117 QIconSet(Resource::loadPixmap("forward")), "Next Item", 117 QIconSet(Resource::loadPixmap("forward")), "Next Item",
118 QString::null, this, 118 QString::null, this,
119 SLOT(nextItem()), navigation, "Next Item"); 119 SLOT(nextItem()), navigation, "Next Item");
120 QToolButton *lastItemButton = new QToolButton( 120 QToolButton *lastItemButton = new QToolButton(
121 QIconSet(Resource::loadPixmap("fastforward")), "Last Item", 121 QIconSet(Resource::loadPixmap("fastforward")), "Last Item",
122 QString::null, this, 122 QString::null, this,
123 SLOT(lastItem()), navigation, "Last Item"); 123 SLOT(lastItem()), navigation, "Last Item");
124 124
125 navigation->addSeparator(); 125 navigation->addSeparator();
126 QToolButton *browseButton = new QToolButton( 126 QToolButton *browseButton = new QToolButton(
127 QIconSet(Resource::loadPixmap("day")), "View Single Item", 127 QIconSet(Resource::loadPixmap("day")), "View Single Item",
128 QString::null, this, 128 QString::null, this,
129 SLOT(browseViewSlot()), navigation, "View Single Item"); 129 SLOT(browseViewSlot()), navigation, "View Single Item");
130 QToolButton *listButton = new QToolButton( 130 QToolButton *listButton = new QToolButton(
131 QIconSet(Resource::loadPixmap("month")), "View Multiple Items", 131 QIconSet(Resource::loadPixmap("month")), "View Multiple Items",
132 QString::null, this, 132 QString::null, this,
133 SLOT(listViewSlot()), navigation, "View Multiple Items"); 133 SLOT(listViewSlot()), navigation, "View Multiple Items");
134 134
135 setToolBarsMovable(FALSE); 135 setToolBarsMovable(FALSE);
136 setToolBarsMovable(FALSE); 136 setToolBarsMovable(FALSE);
137 setToolBarsMovable(FALSE); 137 setToolBarsMovable(FALSE);
138 138
139/* Build widgets */ 139/* Build widgets */
140 browseView = new TVBrowseView(&ts, this, 0); 140 browseView = new TVBrowseView(&ts, this, 0);
141 listView = new TVListView(&ts, this, 0); 141 listView = new TVListView(&ts, this, 0);
142 filterView = new TVFilterView(&ts, this, 0); 142 filterView = new TVFilterView(&ts, this, 0);
143 fileSelector = new FileSelector("text/csv;text/x-xml-tableviewer", 143 fileSelector = new FileSelector("text/csv;text/x-xml-tableviewer",
144 this, "fileselector"); 144 this, "fileselector");
145 fileSelector->setNewVisible(FALSE); 145 fileSelector->setNewVisible(FALSE);
146 fileSelector->setCloseVisible(FALSE); 146 fileSelector->setCloseVisible(FALSE);
147 147
148 cw = new QWidgetStack(this, 0); 148 cw = new QWidgetStack(this, 0);
149 cw->addWidget(listView, ListState); 149 cw->addWidget(listView, ListState);
150 cw->addWidget(browseView, BrowseState); 150 cw->addWidget(browseView, BrowseState);
151 cw->addWidget(filterView, FilterState); 151 cw->addWidget(filterView, FilterState);
152 cw->addWidget(fileSelector, FileState); 152 cw->addWidget(fileSelector, FileState);
153 153
154 current_view = FileState; 154 current_view = FileState;
155 cw->raiseWidget(current_view); 155 cw->raiseWidget(current_view);
156 fileSelector->reread(); 156 fileSelector->reread();
157 157
158 connect(browseView, SIGNAL(searchOnKey(int, TVVariant)), 158 connect(browseView, SIGNAL(searchOnKey(int,TVVariant)),
159 this, SLOT(searchOnKey(int, TVVariant))); 159 this, SLOT(searchOnKey(int,TVVariant)));
160 connect(browseView, SIGNAL(sortChanged(int)), 160 connect(browseView, SIGNAL(sortChanged(int)),
161 this, SLOT(setPrimaryKey(int))); 161 this, SLOT(setPrimaryKey(int)));
162 162
163 connect(fileSelector, SIGNAL(closeMe()), this, SLOT(browseViewSlot())); 163 connect(fileSelector, SIGNAL(closeMe()), this, SLOT(browseViewSlot()));
164 connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), 164 connect(fileSelector, SIGNAL(fileSelected(const DocLnk&)),
165 this, SLOT(openDocument(const DocLnk &))); 165 this, SLOT(openDocument(const DocLnk&)));
166 166
167 main_layout->addWidget(menu); 167 main_layout->addWidget(menu);
168 main_layout->addWidget(cw); 168 main_layout->addWidget(cw);
169 169
170 setCentralWidget(cw); 170 setCentralWidget(cw);
171 171
172} 172}
173 173
174/*! 174/*!
175 Destroys the TableViewerWindow 175 Destroys the TableViewerWindow
176*/ 176*/
177TableViewerWindow::~TableViewerWindow() 177TableViewerWindow::~TableViewerWindow()
178{ 178{
179 if(dirty) 179 if(dirty)
180 saveDocument(); 180 saveDocument();
181} 181}
182 182
183/*! 183/*!
184 Opens a file dialog and loads the file specified by the dialog 184 Opens a file dialog and loads the file specified by the dialog
185*/ 185*/
186void TableViewerWindow::selectDocument() 186void TableViewerWindow::selectDocument()
187{ 187{
188 if(dirty) 188 if(dirty)
189 saveDocument(); 189 saveDocument();
190 current_view = FileState; 190 current_view = FileState;
191 cw->raiseWidget(current_view); 191 cw->raiseWidget(current_view);
192 fileSelector->reread(); 192 fileSelector->reread();
193} 193}
194 194
195void TableViewerWindow::saveDocument() 195void TableViewerWindow::saveDocument()
196{ 196{
197 if(!dirty) 197 if(!dirty)
198 return; 198 return;
199 199
200 FileManager fm; 200 FileManager fm;
201 QIODevice *dev = fm.saveFile(doc); 201 QIODevice *dev = fm.saveFile(doc);
202 202
203 if(!ds->saveSource(dev, doc.type())){ 203 if(!ds->saveSource(dev, doc.type())){
204 qWarning("Save unsuccessful"); 204 qWarning("Save unsuccessful");
205 return; 205 return;
206 } 206 }
207 dev->close(); 207 dev->close();
208 dirty = FALSE; 208 dirty = FALSE;
209} 209}
210 210
211void TableViewerWindow::newDocument() 211void TableViewerWindow::newDocument()
212{ 212{
213 DocLnk nf; 213 DocLnk nf;
214 nf.setType("text/x-xml-tableviewer"); 214 nf.setType("text/x-xml-tableviewer");
215 nf.setName("table"); 215 nf.setName("table");
216 216
217 delete ds; 217 delete ds;
218 ds = new DBStore(); 218 ds = new DBStore();
219 219
220 ts.current_column = 0; 220 ts.current_column = 0;
221 ts.kRep = ds->getKeys(); 221 ts.kRep = ds->getKeys();
222 browseView->reset(); 222 browseView->reset();
223 listView->reset(); 223 listView->reset();
224 filterView->reset(); 224 filterView->reset();
225 225
226 doc = nf; 226 doc = nf;
227 dirty = FALSE; 227 dirty = FALSE;
228 228
229 current_view = BrowseState; 229 current_view = BrowseState;
diff --git a/noncore/apps/tableviewer/ui/commonwidgets.cpp b/noncore/apps/tableviewer/ui/commonwidgets.cpp
index 4c47951..e82018c 100644
--- a/noncore/apps/tableviewer/ui/commonwidgets.cpp
+++ b/noncore/apps/tableviewer/ui/commonwidgets.cpp
@@ -1,104 +1,104 @@
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 <qlineedit.h> 21#include <qlineedit.h>
22#include <qlayout.h> 22#include <qlayout.h>
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qcombobox.h> 24#include <qcombobox.h>
25 25
26#include <qpe/datebookmonth.h> 26#include <qpe/datebookmonth.h>
27#include <qpopupmenu.h> 27#include <qpopupmenu.h>
28#include <qspinbox.h> 28#include <qspinbox.h>
29#include "commonwidgets.h" 29#include "commonwidgets.h"
30 30
31DateEdit::DateEdit( QWidget *parent, const char *name, WFlags f ) 31DateEdit::DateEdit( QWidget *parent, const char *name, WFlags f )
32 : QToolButton(parent, name) 32 : QToolButton(parent, name)
33{ 33{
34 QPopupMenu *m1 = new QPopupMenu(this); 34 QPopupMenu *m1 = new QPopupMenu(this);
35 dateSelector = new DateBookMonth(m1, 0, TRUE); 35 dateSelector = new DateBookMonth(m1, 0, TRUE);
36 m1->insertItem(dateSelector); 36 m1->insertItem(dateSelector);
37 setPopup(m1); 37 setPopup(m1);
38 setPopupDelay(0); 38 setPopupDelay(0);
39 39
40 connect(dateSelector, SIGNAL(dateClicked(int, int, int)), 40 connect(dateSelector, SIGNAL(dateClicked(int,int,int)),
41 this, SLOT(subValueChanged())); 41 this, SLOT(subValueChanged()));
42 42
43 setText(dateSelector->selectedDate().toString()); 43 setText(dateSelector->selectedDate().toString());
44} 44}
45 45
46 46
47DateEdit::~DateEdit() {} 47DateEdit::~DateEdit() {}
48 48
49QDate DateEdit::date() const 49QDate DateEdit::date() const
50{ 50{
51 return dateSelector->selectedDate(); 51 return dateSelector->selectedDate();
52} 52}
53 53
54void DateEdit::setDate(QDate d) 54void DateEdit::setDate(QDate d)
55{ 55{
56 dateSelector->setDate(d.year(), d.month(), d.day()); 56 dateSelector->setDate(d.year(), d.month(), d.day());
57 setText(d.toString()); 57 setText(d.toString());
58} 58}
59 59
60QSizePolicy DateEdit::sizePolicy() const 60QSizePolicy DateEdit::sizePolicy() const
61{ 61{
62 QSizePolicy sp; 62 QSizePolicy sp;
63 sp.setHorData(QToolButton::sizePolicy().horData()); 63 sp.setHorData(QToolButton::sizePolicy().horData());
64 sp.setVerData(QSizePolicy::Fixed); 64 sp.setVerData(QSizePolicy::Fixed);
65 65
66 return sp; 66 return sp;
67} 67}
68 68
69void DateEdit::clear() 69void DateEdit::clear()
70{ 70{
71 QDate today = QDate::currentDate(); 71 QDate today = QDate::currentDate();
72 72
73 dateSelector->setDate(today.year(), today.month(), today.day()); 73 dateSelector->setDate(today.year(), today.month(), today.day());
74 setText(today.toString()); 74 setText(today.toString());
75} 75}
76 76
77void DateEdit::subValueChanged() 77void DateEdit::subValueChanged()
78{ 78{
79 QDate current = dateSelector->selectedDate(); 79 QDate current = dateSelector->selectedDate();
80 80
81 setText(current.toString()); 81 setText(current.toString());
82 emit valueChanged(current); 82 emit valueChanged(current);
83} 83}
84 84
85TimeEdit::TimeEdit( QWidget *parent, const char *name, WFlags f ) 85TimeEdit::TimeEdit( QWidget *parent, const char *name, WFlags f )
86 : QWidget(parent, name, f) 86 : QWidget(parent, name, f)
87{ 87{
88 QHBoxLayout *layout = new QHBoxLayout(this, 0); 88 QHBoxLayout *layout = new QHBoxLayout(this, 0);
89 89
90 layout->addWidget(hourKey = new QSpinBox(1, 12, 1, this)); 90 layout->addWidget(hourKey = new QSpinBox(1, 12, 1, this));
91 hourKey->setWrapping(true); 91 hourKey->setWrapping(true);
92 hourKey->setMinimumWidth(30); 92 hourKey->setMinimumWidth(30);
93 hourKey->setMaximumWidth(35); 93 hourKey->setMaximumWidth(35);
94 94
95 layout->addWidget(new QLabel(" : ", this)); 95 layout->addWidget(new QLabel(" : ", this));
96 layout->addWidget(minuteKey = new QSpinBox(0, 59, 1, this)); 96 layout->addWidget(minuteKey = new QSpinBox(0, 59, 1, this));
97 minuteKey->setWrapping(true); 97 minuteKey->setWrapping(true);
98 minuteKey->setMinimumWidth(30); 98 minuteKey->setMinimumWidth(30);
99 minuteKey->setMaximumWidth(35); 99 minuteKey->setMaximumWidth(35);
100 100
101 layout->addWidget(new QLabel(" : ", this)); 101 layout->addWidget(new QLabel(" : ", this));
102 layout->addWidget(secondKey = new QSpinBox(0, 59, 1, this, 0)); 102 layout->addWidget(secondKey = new QSpinBox(0, 59, 1, this, 0));
103 secondKey->setWrapping(true); 103 secondKey->setWrapping(true);
104 secondKey->setMinimumWidth(30); 104 secondKey->setMinimumWidth(30);
diff --git a/noncore/apps/tableviewer/ui/tvbrowseview.cpp b/noncore/apps/tableviewer/ui/tvbrowseview.cpp
index 22bac55..8a65ed1 100644
--- a/noncore/apps/tableviewer/ui/tvbrowseview.cpp
+++ b/noncore/apps/tableviewer/ui/tvbrowseview.cpp
@@ -1,122 +1,122 @@
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#include "tvbrowseview.h" 20#include "tvbrowseview.h"
21#include "browsekeyentry.h" 21#include "browsekeyentry.h"
22#include <qtoolbutton.h> 22#include <qtoolbutton.h>
23#include <qtextview.h> 23#include <qtextview.h>
24#include <qtextbrowser.h> 24#include <qtextbrowser.h>
25#include <qlayout.h> 25#include <qlayout.h>
26#include "../xmlencodeattr.h" 26#include "../xmlencodeattr.h"
27 27
28/*! 28/*!
29 \class TVBrowseView 29 \class TVBrowseView
30 \brief The widget describing how to draw the browse view user interface 30 \brief The widget describing how to draw the browse view user interface
31 31
32 This widget allows for the user to browse through the table, one element 32 This widget allows for the user to browse through the table, one element
33 at a time, or search on a single key. Its main goal is to show a 33 at a time, or search on a single key. Its main goal is to show a
34 single element in a readable format and make it easy for the user to 34 single element in a readable format and make it easy for the user to
35 rapidly find specific elements in the table. 35 rapidly find specific elements in the table.
36*/ 36*/
37 37
38/*! 38/*!
39 Constructs a new TVBrowseView widget 39 Constructs a new TVBrowseView widget
40*/ 40*/
41TVBrowseView::TVBrowseView(TableState *t, QWidget* parent, const char *name, 41TVBrowseView::TVBrowseView(TableState *t, QWidget* parent, const char *name,
42 WFlags fl ) 42 WFlags fl )
43{ 43{
44 if (!name) 44 if (!name)
45 setName("BrowseView"); 45 setName("BrowseView");
46 46
47// setSizePolicy(QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding, 0, 0, sizePolicy().hasHeightForWidth() ) ); 47// setSizePolicy(QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding, 0, 0, sizePolicy().hasHeightForWidth() ) );
48 QVBoxLayout *vlayout = new QVBoxLayout(this); 48 QVBoxLayout *vlayout = new QVBoxLayout(this);
49 textViewDisplay = new QTextBrowser(this, "textViewDisplay"); 49 textViewDisplay = new QTextBrowser(this, "textViewDisplay");
50 vlayout->addWidget( textViewDisplay ); 50 vlayout->addWidget( textViewDisplay );
51 51
52 keyEntry = new TVBrowseKeyEntry(this, "keyEntry"); 52 keyEntry = new TVBrowseKeyEntry(this, "keyEntry");
53 vlayout->addWidget( keyEntry ); 53 vlayout->addWidget( keyEntry );
54 54
55 /* connect the signals down */ 55 /* connect the signals down */
56 56
57 connect(keyEntry, SIGNAL(searchOnKey(int, TVVariant)), 57 connect(keyEntry, SIGNAL(searchOnKey(int,TVVariant)),
58 this, SIGNAL(searchOnKey(int, TVVariant))); 58 this, SIGNAL(searchOnKey(int,TVVariant)));
59 connect(keyEntry, SIGNAL(sortChanged(int)), 59 connect(keyEntry, SIGNAL(sortChanged(int)),
60 this, SIGNAL(sortChanged(int))); 60 this, SIGNAL(sortChanged(int)));
61 61
62 ts = t; 62 ts = t;
63 keyEntry->setTableState(t); 63 keyEntry->setTableState(t);
64} 64}
65 65
66/*! 66/*!
67 Destroys the TVBrowseView widget 67 Destroys the TVBrowseView widget
68*/ 68*/
69TVBrowseView::~TVBrowseView() 69TVBrowseView::~TVBrowseView()
70{ 70{
71} 71}
72 72
73void TVBrowseView::rebuildData() 73void TVBrowseView::rebuildData()
74{ 74{
75 if(!ts) 75 if(!ts)
76 return; 76 return;
77 if(!ts->current_elem) { 77 if(!ts->current_elem) {
78 /* also disable buttons */ 78 /* also disable buttons */
79 textViewDisplay->setText(""); 79 textViewDisplay->setText("");
80 return; 80 return;
81 } 81 }
82 82
83 setDisplayText(ts->current_elem); 83 setDisplayText(ts->current_elem);
84} 84}
85 85
86/* Reset to initial state */ 86/* Reset to initial state */
87void TVBrowseView::reset() 87void TVBrowseView::reset()
88{ 88{
89 textViewDisplay->setText(""); 89 textViewDisplay->setText("");
90 keyEntry->reset(); 90 keyEntry->reset();
91} 91}
92 92
93/*! 93/*!
94 sets the data element to be displayed to element 94 sets the data element to be displayed to element
95*/ 95*/
96void TVBrowseView::setDisplayText(const DataElem *element) 96void TVBrowseView::setDisplayText(const DataElem *element)
97{ 97{
98 QString rep = ""; 98 QString rep = "";
99 99
100 KeyListIterator it(*ts->kRep); 100 KeyListIterator it(*ts->kRep);
101 101
102 while (it.current()) { 102 while (it.current()) {
103 if (element->hasValidValue(it.currentKey())) { 103 if (element->hasValidValue(it.currentKey())) {
104 if(it.currentKey() == ts->current_column) { 104 if(it.currentKey() == ts->current_column) {
105 rep += "<A name=\"ckey\"></A><B><FONT COLOR=#FF0000>" 105 rep += "<A name=\"ckey\"></A><B><FONT COLOR=#FF0000>"
106 + encodeAttr(it.current()->name()) 106 + encodeAttr(it.current()->name())
107 + ":</FONT></B> "; 107 + ":</FONT></B> ";
108 } else { 108 } else {
109 rep += "<B>" + encodeAttr(it.current()->name()) + ":</B> "; 109 rep += "<B>" + encodeAttr(it.current()->name()) + ":</B> ";
110 } 110 }
111 rep += encodeAttr(element->toQString(it.currentKey())) + "<BR>"; 111 rep += encodeAttr(element->toQString(it.currentKey())) + "<BR>";
112 } 112 }
113 ++it; 113 ++it;
114 } 114 }
115 115
116 textViewDisplay->setText(rep); 116 textViewDisplay->setText(rep);
117 textViewDisplay->scrollToAnchor("ckey"); 117 textViewDisplay->scrollToAnchor("ckey");
118} 118}
119 119
120void TVBrowseView::rebuildKeys() 120void TVBrowseView::rebuildKeys()
121{ 121{
122 keyEntry->rebuildKeys(); 122 keyEntry->rebuildKeys();
diff --git a/noncore/apps/tableviewer/ui/tvfilterview.cpp b/noncore/apps/tableviewer/ui/tvfilterview.cpp
index b03e846..22f1fb7 100644
--- a/noncore/apps/tableviewer/ui/tvfilterview.cpp
+++ b/noncore/apps/tableviewer/ui/tvfilterview.cpp
@@ -28,129 +28,129 @@
28 28
29#include <qpe/qpeapplication.h> 29#include <qpe/qpeapplication.h>
30 30
31TVFilterView::TVFilterView(TableState *t, QWidget* parent, 31TVFilterView::TVFilterView(TableState *t, QWidget* parent,
32 const char *name, WFlags fl ) : QDialog(parent, name, TRUE, fl) 32 const char *name, WFlags fl ) : QDialog(parent, name, TRUE, fl)
33{ 33{
34 if ( !name ) 34 if ( !name )
35 setName( "Filter View" ); 35 setName( "Filter View" );
36 36
37 QVBoxLayout *vlayout = new QVBoxLayout(this); 37 QVBoxLayout *vlayout = new QVBoxLayout(this);
38 38
39 display = new QListView(this, "display"); 39 display = new QListView(this, "display");
40 display->addColumn("Key"); 40 display->addColumn("Key");
41 display->addColumn("Constraint"); 41 display->addColumn("Constraint");
42 display->addColumn("Value"); 42 display->addColumn("Value");
43 display->header()->setClickEnabled(FALSE); 43 display->header()->setClickEnabled(FALSE);
44 display->header()->setResizeEnabled(FALSE); 44 display->header()->setResizeEnabled(FALSE);
45 45
46 vlayout->addWidget(display); 46 vlayout->addWidget(display);
47 47
48 QHBoxLayout *hlayout = new QHBoxLayout; 48 QHBoxLayout *hlayout = new QHBoxLayout;
49 hlayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum)); 49 hlayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
50 50
51 newFilterButton = new QPushButton(this, "new Filter"); 51 newFilterButton = new QPushButton(this, "new Filter");
52 newFilterButton->setMaximumSize(QSize(50, 32767)); 52 newFilterButton->setMaximumSize(QSize(50, 32767));
53 newFilterButton->setText("New"); 53 newFilterButton->setText("New");
54 hlayout->addWidget(newFilterButton); 54 hlayout->addWidget(newFilterButton);
55 55
56 deleteFilterButton = new QPushButton(this, "delete Filter"); 56 deleteFilterButton = new QPushButton(this, "delete Filter");
57 deleteFilterButton->setMaximumSize(QSize(50, 32767)); 57 deleteFilterButton->setMaximumSize(QSize(50, 32767));
58 deleteFilterButton->setText("Delete"); 58 deleteFilterButton->setText("Delete");
59 hlayout->addWidget(deleteFilterButton); 59 hlayout->addWidget(deleteFilterButton);
60 60
61 clearFilterButton = new QPushButton(this, "delete Filter"); 61 clearFilterButton = new QPushButton(this, "delete Filter");
62 clearFilterButton->setMaximumSize(QSize(60, 32767)); 62 clearFilterButton->setMaximumSize(QSize(60, 32767));
63 clearFilterButton->setText("Clear All"); 63 clearFilterButton->setText("Clear All");
64 hlayout->addWidget(clearFilterButton); 64 hlayout->addWidget(clearFilterButton);
65 65
66 vlayout->addLayout(hlayout); 66 vlayout->addLayout(hlayout);
67 67
68 QHBoxLayout *hlayout2 = new QHBoxLayout; 68 QHBoxLayout *hlayout2 = new QHBoxLayout;
69 69
70 keyNameCombo = new QComboBox(FALSE, this, "key name"); 70 keyNameCombo = new QComboBox(FALSE, this, "key name");
71 keyNameCombo->setEnabled(FALSE); 71 keyNameCombo->setEnabled(FALSE);
72 hlayout2->addWidget(keyNameCombo); 72 hlayout2->addWidget(keyNameCombo);
73 73
74 QLabel *label = new QLabel(this); 74 QLabel *label = new QLabel(this);
75 label->setText("has value"); 75 label->setText("has value");
76 hlayout2->addWidget(label); 76 hlayout2->addWidget(label);
77 77
78 keyEntry = new TVFilterKeyEntry(this, "key entry"); 78 keyEntry = new TVFilterKeyEntry(this, "key entry");
79 keyEntry->setEnabled(FALSE); 79 keyEntry->setEnabled(FALSE);
80 80
81 vlayout->addLayout(hlayout2); 81 vlayout->addLayout(hlayout2);
82 vlayout->addWidget(keyEntry); 82 vlayout->addWidget(keyEntry);
83 83
84 connect(newFilterButton, SIGNAL( clicked() ), this, SLOT( newTerm() )); 84 connect(newFilterButton, SIGNAL( clicked() ), this, SLOT( newTerm() ));
85 connect(deleteFilterButton, SIGNAL( clicked() ), this, SLOT( deleteTerm())); 85 connect(deleteFilterButton, SIGNAL( clicked() ), this, SLOT( deleteTerm()));
86 connect(clearFilterButton, SIGNAL( clicked() ), this, SLOT( clearTerms())); 86 connect(clearFilterButton, SIGNAL( clicked() ), this, SLOT( clearTerms()));
87 87
88 connect(keyEntry, SIGNAL(valueChanged()), this, SLOT( updateTerm() )); 88 connect(keyEntry, SIGNAL(valueChanged()), this, SLOT( updateTerm() ));
89 connect(keyNameCombo, SIGNAL(activated(int)), this, SLOT( updateTerm() )); 89 connect(keyNameCombo, SIGNAL(activated(int)), this, SLOT( updateTerm() ));
90 90
91 connect(display, SIGNAL(selectionChanged(QListViewItem*)), this, 91 connect(display, SIGNAL(selectionChanged(QListViewItem*)), this,
92 SLOT(setTerm(QListViewItem *))); 92 SLOT(setTerm(QListViewItem*)));
93 93
94 ts = t; 94 ts = t;
95 current = 0; 95 current = 0;
96 terms.setAutoDelete(true); 96 terms.setAutoDelete(true);
97 do_filter = false; 97 do_filter = false;
98 98
99#ifdef Q_WS_QWS 99#ifdef Q_WS_QWS
100 QPEApplication::showDialog( this ); 100 QPEApplication::showDialog( this );
101#endif 101#endif
102} 102}
103 103
104/*! 104/*!
105 Destroys the TVFilterView widget 105 Destroys the TVFilterView widget
106*/ 106*/
107TVFilterView::~TVFilterView() 107TVFilterView::~TVFilterView()
108{ 108{
109} 109}
110 110
111void TVFilterView::rebuildData() 111void TVFilterView::rebuildData()
112{ 112{
113} 113}
114 114
115void TVFilterView::reset() 115void TVFilterView::reset()
116{ 116{
117 keyNameCombo->clear(); 117 keyNameCombo->clear();
118 keyIds.clear(); 118 keyIds.clear();
119} 119}
120 120
121void TVFilterView::rebuildKeys() 121void TVFilterView::rebuildKeys()
122{ 122{
123 int i; 123 int i;
124 124
125 if (!ts) return; 125 if (!ts) return;
126 if(!ts->kRep) return; 126 if(!ts->kRep) return;
127 keyEntry->setTableState(ts); 127 keyEntry->setTableState(ts);
128 128
129 /* set up the list of keys that can be compared on */ 129 /* set up the list of keys that can be compared on */
130 keyNameCombo->clear(); 130 keyNameCombo->clear();
131 KeyListIterator it(*ts->kRep); 131 KeyListIterator it(*ts->kRep);
132 132
133 i = 0; 133 i = 0;
134 while(it.current()) { 134 while(it.current()) {
135 if(ts->kRep->validIndex(it.currentKey())) { 135 if(ts->kRep->validIndex(it.currentKey())) {
136 keyNameCombo->insertItem(it.current()->name()); 136 keyNameCombo->insertItem(it.current()->name());
137 keyIds.insert(i, it.currentKey()); 137 keyIds.insert(i, it.currentKey());
138 ++i; 138 ++i;
139 } 139 }
140 ++it; 140 ++it;
141 } 141 }
142} 142}
143 143
144bool TVFilterView::passesFilter(DataElem *d) { 144bool TVFilterView::passesFilter(DataElem *d) {
145 if (!filterActive()) return true; 145 if (!filterActive()) return true;
146 146
147 147
148 FilterTerm *t; 148 FilterTerm *t;
149 149
150 for (t = terms.first(); t != 0; t = terms.next() ) { 150 for (t = terms.first(); t != 0; t = terms.next() ) {
151 /* check against filter */ 151 /* check against filter */
152 switch(t->ct) { 152 switch(t->ct) {
153 case ct_less: 153 case ct_less:
154 if (!d->lessThan(t->keyIndex, t->value)) 154 if (!d->lessThan(t->keyIndex, t->value))
155 return false; 155 return false;
156 break; 156 break;
diff --git a/noncore/apps/tableviewer/ui/tvlistview.cpp b/noncore/apps/tableviewer/ui/tvlistview.cpp
index b25e813..b10ff1d 100644
--- a/noncore/apps/tableviewer/ui/tvlistview.cpp
+++ b/noncore/apps/tableviewer/ui/tvlistview.cpp
@@ -43,130 +43,130 @@ TVListViewPrivate::TVListViewPrivate(QWidget *parent, const char* name,
43class TVListViewItem : public QListViewItem 43class TVListViewItem : public QListViewItem
44{ 44{
45public: 45public:
46 46
47 TVListViewItem(QListView *parent, DataElem *d); 47 TVListViewItem(QListView *parent, DataElem *d);
48 ~TVListViewItem(); 48 ~TVListViewItem();
49 49
50 QString text(int i) const 50 QString text(int i) const
51 { 51 {
52 return data_reference->toQString(i); 52 return data_reference->toQString(i);
53 } 53 }
54 54
55 /* Do nothing... all data for this item should be generated */ 55 /* Do nothing... all data for this item should be generated */
56 void setText(int i, const QString &) 56 void setText(int i, const QString &)
57 { 57 {
58 ; 58 ;
59 } 59 }
60 QString key(int i, bool a) const 60 QString key(int i, bool a) const
61 { 61 {
62 return data_reference->toSortableQString(i); 62 return data_reference->toSortableQString(i);
63 } 63 }
64 64
65 void setDataElem(DataElem *d) 65 void setDataElem(DataElem *d)
66 { 66 {
67 data_reference = d; 67 data_reference = d;
68 } 68 }
69 69
70 DataElem *getDataElem() { 70 DataElem *getDataElem() {
71 return data_reference; 71 return data_reference;
72 } 72 }
73private: 73private:
74 DataElem *data_reference; 74 DataElem *data_reference;
75}; 75};
76 76
77TVListViewItem::TVListViewItem(QListView *parent, DataElem *d) 77TVListViewItem::TVListViewItem(QListView *parent, DataElem *d)
78 : QListViewItem(parent) 78 : QListViewItem(parent)
79{ 79{
80 data_reference = d; 80 data_reference = d;
81} 81}
82 82
83TVListViewItem::~TVListViewItem() 83TVListViewItem::~TVListViewItem()
84{ 84{
85 data_reference = 0; 85 data_reference = 0;
86} 86}
87 87
88TVListView::TVListView(TableState *t, QWidget* parent, 88TVListView::TVListView(TableState *t, QWidget* parent,
89 const char *name, WFlags fl ) : QWidget(parent, name, fl) 89 const char *name, WFlags fl ) : QWidget(parent, name, fl)
90{ 90{
91 if (!name) 91 if (!name)
92 setName("TVListView"); 92 setName("TVListView");
93 93
94 // the next two lines need to be rationalized. 94 // the next two lines need to be rationalized.
95 resize(318,457); 95 resize(318,457);
96 setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7, 96 setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7,
97 (QSizePolicy::SizeType)7, sizePolicy().hasHeightForWidth())); 97 (QSizePolicy::SizeType)7, sizePolicy().hasHeightForWidth()));
98 setCaption(tr("List View")); 98 setCaption(tr("List View"));
99 99
100 QVBoxLayout *layout = new QVBoxLayout(this); 100 QVBoxLayout *layout = new QVBoxLayout(this);
101 layout->setSpacing(0); 101 layout->setSpacing(0);
102 layout->setMargin(0); 102 layout->setMargin(0);
103 103
104 listViewDisplay = new TVListViewPrivate(this, "listViewDisplay"); 104 listViewDisplay = new TVListViewPrivate(this, "listViewDisplay");
105 layout->addWidget(listViewDisplay); 105 layout->addWidget(listViewDisplay);
106 106
107 connect(listViewDisplay, SIGNAL(currentChanged(QListViewItem *)), this, 107 connect(listViewDisplay, SIGNAL(currentChanged(QListViewItem*)), this,
108 SLOT(setCurrent(QListViewItem *))); 108 SLOT(setCurrent(QListViewItem*)));
109 connect(listViewDisplay, SIGNAL(sortChanged(int)), this, 109 connect(listViewDisplay, SIGNAL(sortChanged(int)), this,
110 SLOT(setSorting(int))); 110 SLOT(setSorting(int)));
111 111
112 listViewDisplay->setShowSortIndicator(true); 112 listViewDisplay->setShowSortIndicator(true);
113 113
114 it = new QListViewItemIterator(listViewDisplay); 114 it = new QListViewItemIterator(listViewDisplay);
115 ts = t; 115 ts = t;
116} 116}
117 117
118TVListView::~TVListView() 118TVListView::~TVListView()
119{ 119{
120} 120}
121 121
122void TVListView::addItem(DataElem *d) 122void TVListView::addItem(DataElem *d)
123{ 123{
124 TVListViewItem *i = new TVListViewItem(listViewDisplay, d); 124 TVListViewItem *i = new TVListViewItem(listViewDisplay, d);
125 125
126 delete it; 126 delete it;
127 it = new QListViewItemIterator(i); 127 it = new QListViewItemIterator(i);
128} 128}
129 129
130/* remove current (it) item */ 130/* remove current (it) item */
131void TVListView::removeItem() 131void TVListView::removeItem()
132{ 132{
133 QListViewItemIterator other(*it); 133 QListViewItemIterator other(*it);
134 134
135 QListViewItemIterator tmp = *it; 135 QListViewItemIterator tmp = *it;
136 (*it)++; 136 (*it)++;
137 if (!it->current()) { 137 if (!it->current()) {
138 *it = tmp; 138 *it = tmp;
139 (*it)--; 139 (*it)--;
140 if (!it->current()) { 140 if (!it->current()) {
141 delete it; 141 delete it;
142 it = 0; 142 it = 0;
143 } 143 }
144 } 144 }
145 145
146 delete other.current(); 146 delete other.current();
147} 147}
148 148
149void TVListView::clearItems() 149void TVListView::clearItems()
150{ 150{
151 /* This is ok since the destructor for TVListItem does not know about 151 /* This is ok since the destructor for TVListItem does not know about
152 the data_reference pointer.. and hence will leave it alone */ 152 the data_reference pointer.. and hence will leave it alone */
153 listViewDisplay->clear(); 153 listViewDisplay->clear();
154 delete it; 154 delete it;
155 it = new QListViewItemIterator(listViewDisplay); 155 it = new QListViewItemIterator(listViewDisplay);
156} 156}
157 157
158void TVListView::first() 158void TVListView::first()
159{ 159{
160 delete it; 160 delete it;
161 it = new QListViewItemIterator(listViewDisplay); 161 it = new QListViewItemIterator(listViewDisplay);
162} 162}
163 163
164void TVListView::last() 164void TVListView::last()
165{ 165{
166 qWarning("TVListView::last not yet implemented"); 166 qWarning("TVListView::last not yet implemented");
167} 167}
168 168
169void TVListView::next() 169void TVListView::next()
170{ 170{
171 QListViewItemIterator tmp = *it; 171 QListViewItemIterator tmp = *it;
172 (*it)++; 172 (*it)++;
diff --git a/noncore/apps/tinykate/libkate/document/katedialogs.cpp b/noncore/apps/tinykate/libkate/document/katedialogs.cpp
index 2f0ed7b..f4edd7e 100644
--- a/noncore/apps/tinykate/libkate/document/katedialogs.cpp
+++ b/noncore/apps/tinykate/libkate/document/katedialogs.cpp
@@ -1,130 +1,130 @@
1/*************************************************************************** 1/***************************************************************************
2 katedialogs.cpp - description 2 katedialogs.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#include "katedialogs.h" 19#include "katedialogs.h"
20#include <klocale.h> 20#include <klocale.h>
21#include <kdebug.h> 21#include <kdebug.h>
22#include <qgroupbox.h> 22#include <qgroupbox.h>
23#include <qvgroupbox.h> 23#include <qvgroupbox.h>
24#include <qhgroupbox.h> 24#include <qhgroupbox.h>
25#include <qhbox.h> 25#include <qhbox.h>
26#include <qvbox.h> 26#include <qvbox.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qwidgetstack.h> 29#include <qwidgetstack.h>
30#include <qlabel.h> 30#include <qlabel.h>
31#include <qlistview.h> 31#include <qlistview.h>
32#include <qlineedit.h> 32#include <qlineedit.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qcheckbox.h> 34#include <qcheckbox.h>
35//FIXME #include <kcharsets.h> 35//FIXME #include <kcharsets.h>
36#include <kglobal.h> 36#include <kglobal.h>
37#include <qmap.h> 37#include <qmap.h>
38#include <kmessagebox.h> 38#include <kmessagebox.h>
39#include <kstddirs.h> 39#include <kstddirs.h>
40 40
41 41
42/******************************************************************************************************************* 42/*******************************************************************************************************************
43* Context Editor * 43* Context Editor *
44*******************************************************************************************************************/ 44*******************************************************************************************************************/
45 45
46StyleChanger::StyleChanger( QWidget *parent ) 46StyleChanger::StyleChanger( QWidget *parent )
47 : QWidget(parent) 47 : QWidget(parent)
48{ 48{
49 QLabel *label; 49 QLabel *label;
50 50
51 QGridLayout *glay = new QGridLayout( this, 4, 3, 0, KDialog::spacingHint() ); 51 QGridLayout *glay = new QGridLayout( this, 4, 3, 0, KDialog::spacingHint() );
52 CHECK_PTR(glay); 52 CHECK_PTR(glay);
53 glay->addColSpacing( 1, KDialog::spacingHint() ); // Looks better 53 glay->addColSpacing( 1, KDialog::spacingHint() ); // Looks better
54 glay->setColStretch( 2, 10 ); 54 glay->setColStretch( 2, 10 );
55 55
56 col = new KColorButton(this); 56 col = new KColorButton(this);
57 CHECK_PTR(col); 57 CHECK_PTR(col);
58 connect(col,SIGNAL(changed(const QColor &)),this,SLOT(changed())); 58 connect(col,SIGNAL(changed(const QColor&)),this,SLOT(changed()));
59 label = new QLabel(col,i18n("Normal:"),this); 59 label = new QLabel(col,i18n("Normal:"),this);
60 CHECK_PTR(label); 60 CHECK_PTR(label);
61 glay->addWidget(label,0,0); 61 glay->addWidget(label,0,0);
62 glay->addWidget(col,1,0); 62 glay->addWidget(col,1,0);
63 63
64 selCol = new KColorButton(this); 64 selCol = new KColorButton(this);
65 CHECK_PTR(selCol); 65 CHECK_PTR(selCol);
66 connect(selCol,SIGNAL(changed(const QColor &)),this,SLOT(changed())); 66 connect(selCol,SIGNAL(changed(const QColor&)),this,SLOT(changed()));
67 label = new QLabel(selCol,i18n("Selected:"),this); 67 label = new QLabel(selCol,i18n("Selected:"),this);
68 CHECK_PTR(label); 68 CHECK_PTR(label);
69 glay->addWidget(label,2,0); 69 glay->addWidget(label,2,0);
70 glay->addWidget(selCol,3,0); 70 glay->addWidget(selCol,3,0);
71 71
72 bold = new QCheckBox(i18n("Bold"),this); 72 bold = new QCheckBox(i18n("Bold"),this);
73 CHECK_PTR(bold); 73 CHECK_PTR(bold);
74 connect(bold,SIGNAL(clicked()),SLOT(changed())); 74 connect(bold,SIGNAL(clicked()),SLOT(changed()));
75 glay->addWidget(bold,1,2); 75 glay->addWidget(bold,1,2);
76 76
77 italic = new QCheckBox(i18n("Italic"),this); 77 italic = new QCheckBox(i18n("Italic"),this);
78 CHECK_PTR(italic); 78 CHECK_PTR(italic);
79 connect(italic,SIGNAL(clicked()),SLOT(changed())); 79 connect(italic,SIGNAL(clicked()),SLOT(changed()));
80 glay->addWidget(italic,2,2); 80 glay->addWidget(italic,2,2);
81} 81}
82 82
83void StyleChanger::setRef(ItemStyle *s) { 83void StyleChanger::setRef(ItemStyle *s) {
84 84
85 style = s; 85 style = s;
86 col->setColor(style->col); 86 col->setColor(style->col);
87 selCol->setColor(style->selCol); 87 selCol->setColor(style->selCol);
88 bold->setChecked(style->bold); 88 bold->setChecked(style->bold);
89 italic->setChecked(style->italic); 89 italic->setChecked(style->italic);
90 90
91} 91}
92 92
93void StyleChanger::setEnabled(bool enable) { 93void StyleChanger::setEnabled(bool enable) {
94 94
95 col->setEnabled(enable); 95 col->setEnabled(enable);
96 selCol->setEnabled(enable); 96 selCol->setEnabled(enable);
97 bold->setEnabled(enable); 97 bold->setEnabled(enable);
98 italic->setEnabled(enable); 98 italic->setEnabled(enable);
99} 99}
100 100
101void StyleChanger::changed() { 101void StyleChanger::changed() {
102 102
103 if (style) { 103 if (style) {
104 style->col = col->color(); 104 style->col = col->color();
105 style->selCol = selCol->color(); 105 style->selCol = selCol->color();
106 style->bold = bold->isChecked(); 106 style->bold = bold->isChecked();
107 style->italic = italic->isChecked(); 107 style->italic = italic->isChecked();
108 } 108 }
109} 109}
110 110
111HighlightDialog::HighlightDialog( HlManager *hlManager, ItemStyleList *styleList, 111HighlightDialog::HighlightDialog( HlManager *hlManager, ItemStyleList *styleList,
112 HlDataList *highlightDataList, 112 HlDataList *highlightDataList,
113 int hlNumber, QWidget *parent, 113 int hlNumber, QWidget *parent,
114 const char *name, bool modal ) 114 const char *name, bool modal )
115 :KDialogBase(parent,name,modal,i18n("Highlight Settings"), Ok|Cancel, Ok) 115 :KDialogBase(parent,name,modal,i18n("Highlight Settings"), Ok|Cancel, Ok)
116{ 116{
117// QVBox *page = makeVBoxMainWidget(); 117// QVBox *page = makeVBoxMainWidget();
118 QFrame *page=addPage("FIXME"); 118 QFrame *page=addPage("FIXME");
119 (new QVBoxLayout(page))->setAutoAdd(true); 119 (new QVBoxLayout(page))->setAutoAdd(true);
120 content=new HighlightDialogPage(hlManager,styleList,highlightDataList,hlNumber,page); 120 content=new HighlightDialogPage(hlManager,styleList,highlightDataList,hlNumber,page);
121} 121}
122 122
123void HighlightDialog::done(int r) 123void HighlightDialog::done(int r)
124{ 124{
125 kdDebug(13010)<<"HighlightDialod done"<<endl; 125 kdDebug(13010)<<"HighlightDialod done"<<endl;
126 content->saveData(); 126 content->saveData();
127 KDialogBase::done(r); 127 KDialogBase::done(r);
128} 128}
129 129
130HighlightDialogPage::HighlightDialogPage(HlManager *hlManager, ItemStyleList *styleList, 130HighlightDialogPage::HighlightDialogPage(HlManager *hlManager, ItemStyleList *styleList,
@@ -225,129 +225,129 @@ void HighlightDialogPage::hlChanged(int z)
225 itemChanged(0); 225 itemChanged(0);
226} 226}
227 227
228void HighlightDialogPage::itemChanged(int z) 228void HighlightDialogPage::itemChanged(int z)
229{ 229{
230 itemData = hlData->itemDataList.at(z); 230 itemData = hlData->itemDataList.at(z);
231 231
232 styleDefault->setChecked(itemData->defStyle); 232 styleDefault->setChecked(itemData->defStyle);
233 styleChanger->setRef(itemData); 233 styleChanger->setRef(itemData);
234} 234}
235 235
236void HighlightDialogPage::changed() 236void HighlightDialogPage::changed()
237{ 237{
238 itemData->defStyle = styleDefault->isChecked(); 238 itemData->defStyle = styleDefault->isChecked();
239} 239}
240 240
241void HighlightDialogPage::writeback() { 241void HighlightDialogPage::writeback() {
242 if (hlData) { 242 if (hlData) {
243 hlData->wildcards = wildcards->text(); 243 hlData->wildcards = wildcards->text();
244 hlData->mimetypes = mimetypes->text(); 244 hlData->mimetypes = mimetypes->text();
245 } 245 }
246} 246}
247 247
248void HighlightDialogPage::saveData() { 248void HighlightDialogPage::saveData() {
249 kdDebug(13010)<<"HighlightDialogPage::saveData()"<<endl; 249 kdDebug(13010)<<"HighlightDialogPage::saveData()"<<endl;
250 writeback(); 250 writeback();
251} 251}
252 252
253 253
254void HighlightDialogPage::hlEdit() { 254void HighlightDialogPage::hlEdit() {
255 HlEditDialog diag(0,0,"hlEdit", true,hlData); 255 HlEditDialog diag(0,0,"hlEdit", true,hlData);
256 diag.show(); 256 diag.show();
257} 257}
258 258
259void HighlightDialogPage::hlNew() { 259void HighlightDialogPage::hlNew() {
260 HlEditDialog diag(0,0,"hlEdit",true,0); 260 HlEditDialog diag(0,0,"hlEdit",true,0);
261 diag.show(); 261 diag.show();
262} 262}
263 263
264 264
265HlEditDialog::HlEditDialog(HlManager *,QWidget *parent, const char *name, bool modal,HlData *data) 265HlEditDialog::HlEditDialog(HlManager *,QWidget *parent, const char *name, bool modal,HlData *data)
266 :KDialogBase(KDialogBase::Swallow, i18n("Highlight Conditions"), Ok|Cancel, Ok, parent, name, modal) 266 :KDialogBase(KDialogBase::Swallow, i18n("Highlight Conditions"), Ok|Cancel, Ok, parent, name, modal)
267{ 267{
268 currentItem=0; 268 currentItem=0;
269 transTableCnt=0; 269 transTableCnt=0;
270 QHBox *wid=new QHBox(this); 270 QHBox *wid=new QHBox(this);
271 QVBox *lbox=new QVBox(wid); 271 QVBox *lbox=new QVBox(wid);
272 contextList=new KListView(lbox); 272 contextList=new KListView(lbox);
273 contextList->setRootIsDecorated(true); 273 contextList->setRootIsDecorated(true);
274 contextList->addColumn(i18n("Syntax structure")); 274 contextList->addColumn(i18n("Syntax structure"));
275 contextList->setSorting(-1); 275 contextList->setSorting(-1);
276 QHBox *bbox=new QHBox(lbox); 276 QHBox *bbox=new QHBox(lbox);
277 QPushButton *addContext=new QPushButton(i18n("New Context"),bbox); 277 QPushButton *addContext=new QPushButton(i18n("New Context"),bbox);
278 QPushButton *addItem=new QPushButton(i18n("New Item"),bbox); 278 QPushButton *addItem=new QPushButton(i18n("New Item"),bbox);
279 QVGroupBox *opt = new QVGroupBox( i18n("Options"), wid); 279 QVGroupBox *opt = new QVGroupBox( i18n("Options"), wid);
280 stack=new QWidgetStack(opt); 280 stack=new QWidgetStack(opt);
281 initContextOptions(contextOptions=new QVBox(stack)); 281 initContextOptions(contextOptions=new QVBox(stack));
282 stack->addWidget(contextOptions,HlEContext); 282 stack->addWidget(contextOptions,HlEContext);
283 initItemOptions(itemOptions=new QVBox(stack)); 283 initItemOptions(itemOptions=new QVBox(stack));
284 stack->addWidget(itemOptions,HlEItem); 284 stack->addWidget(itemOptions,HlEItem);
285 stack->raiseWidget(HlEContext); 285 stack->raiseWidget(HlEContext);
286 setMainWidget(wid); 286 setMainWidget(wid);
287 if (data!=0) loadFromDocument(data); 287 if (data!=0) loadFromDocument(data);
288 else newDocument(); 288 else newDocument();
289 connect(contextList,SIGNAL(currentChanged( QListViewItem*)),this,SLOT(currentSelectionChanged ( QListViewItem * ))); 289 connect(contextList,SIGNAL(currentChanged(QListViewItem*)),this,SLOT(currentSelectionChanged(QListViewItem*)));
290 connect(addContext,SIGNAL(clicked()),this,SLOT(contextAddNew())); 290 connect(addContext,SIGNAL(clicked()),this,SLOT(contextAddNew()));
291 connect(addItem,SIGNAL(clicked()),this,SLOT(ItemAddNew())); 291 connect(addItem,SIGNAL(clicked()),this,SLOT(ItemAddNew()));
292 } 292 }
293 293
294void HlEditDialog::newDocument() 294void HlEditDialog::newDocument()
295{ 295{
296 KStandardDirs *dirs = KGlobal::dirs(); 296 KStandardDirs *dirs = KGlobal::dirs();
297 QStringList list=dirs->findAllResources("data","kate/syntax/syntax.template",false,true); 297 QStringList list=dirs->findAllResources("data","kate/syntax/syntax.template",false,true);
298 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) 298 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
299 { 299 {
300 HlData data("","",*it); 300 HlData data("","",*it);
301 loadFromDocument(&data); 301 loadFromDocument(&data);
302 return; 302 return;
303 } 303 }
304 KMessageBox::error(this,i18n("Can't find template file")); 304 KMessageBox::error(this,i18n("Can't find template file"));
305} 305}
306 306
307 307
308void HlEditDialog::initContextOptions(QVBox *co) 308void HlEditDialog::initContextOptions(QVBox *co)
309{ 309{
310 if( co!=0) 310 if( co!=0)
311 { 311 {
312 QHBox *tmp = new QHBox(co); 312 QHBox *tmp = new QHBox(co);
313 (void) new QLabel(i18n("Description:"),tmp); 313 (void) new QLabel(i18n("Description:"),tmp);
314 ContextDescr=new QLineEdit(tmp); 314 ContextDescr=new QLineEdit(tmp);
315 tmp= new QHBox(co); 315 tmp= new QHBox(co);
316 (void) new QLabel(i18n("Attribute:"),tmp); 316 (void) new QLabel(i18n("Attribute:"),tmp);
317 ContextAttribute=new QComboBox(tmp); 317 ContextAttribute=new QComboBox(tmp);
318 tmp= new QHBox(co); 318 tmp= new QHBox(co);
319 (void) new QLabel(i18n("LineEnd:"),tmp); 319 (void) new QLabel(i18n("LineEnd:"),tmp);
320 ContextLineEnd = new QComboBox(tmp); 320 ContextLineEnd = new QComboBox(tmp);
321 connect(ContextDescr,SIGNAL(textChanged(const QString&)),this,SLOT(contextDescrChanged(const QString&))); 321 connect(ContextDescr,SIGNAL(textChanged(const QString&)),this,SLOT(contextDescrChanged(const QString&)));
322 connect(ContextLineEnd,SIGNAL(activated(int)),this,SLOT(contextLineEndChanged(int))); 322 connect(ContextLineEnd,SIGNAL(activated(int)),this,SLOT(contextLineEndChanged(int)));
323 connect(ContextAttribute,SIGNAL(activated(int)),this,SLOT(contextAttributeChanged(int))); 323 connect(ContextAttribute,SIGNAL(activated(int)),this,SLOT(contextAttributeChanged(int)));
324 } 324 }
325 else 325 else
326 kdDebug(13010)<<"initContextOptions: Widget is 0"<<endl; 326 kdDebug(13010)<<"initContextOptions: Widget is 0"<<endl;
327} 327}
328 328
329 329
330void HlEditDialog::insertTranslationList(QString tag, QString trans,int length) 330void HlEditDialog::insertTranslationList(QString tag, QString trans,int length)
331 { 331 {
332 ItemInfo data(trans,length); 332 ItemInfo data(trans,length);
333 id2tag.insert(transTableCnt,tag); 333 id2tag.insert(transTableCnt,tag);
334 id2info.insert(transTableCnt,data); 334 id2info.insert(transTableCnt,data);
335 tag2id.insert(tag,transTableCnt); 335 tag2id.insert(tag,transTableCnt);
336 transTableCnt++; 336 transTableCnt++;
337 } 337 }
338 338
339 339
340void HlEditDialog::initItemOptions(QVBox *co) 340void HlEditDialog::initItemOptions(QVBox *co)
341{ 341{
342 if (co!=0) 342 if (co!=0)
343 { 343 {
344 QHBox *tmp = new QHBox(co); 344 QHBox *tmp = new QHBox(co);
345 (void) new QLabel(i18n("Type:"),tmp); 345 (void) new QLabel(i18n("Type:"),tmp);
346 ItemType = new QComboBox(tmp); 346 ItemType = new QComboBox(tmp);
347 tmp= new QHBox(co); 347 tmp= new QHBox(co);
348 (void) new QLabel(i18n("Parameter:"),tmp); 348 (void) new QLabel(i18n("Parameter:"),tmp);
349 ItemParameter= new QLineEdit(tmp); 349 ItemParameter= new QLineEdit(tmp);
350 tmp= new QHBox(co); 350 tmp= new QHBox(co);
351 (void) new QLabel(i18n("Attribute:"),tmp); 351 (void) new QLabel(i18n("Attribute:"),tmp);
352 ItemAttribute= new QComboBox(tmp); 352 ItemAttribute= new QComboBox(tmp);
353 (void) new QLabel(i18n("Context switch:"),tmp); 353 (void) new QLabel(i18n("Context switch:"),tmp);
diff --git a/noncore/apps/tinykate/libkate/document/katedocument.cpp b/noncore/apps/tinykate/libkate/document/katedocument.cpp
index f05e21a..0c742d7 100644
--- a/noncore/apps/tinykate/libkate/document/katedocument.cpp
+++ b/noncore/apps/tinykate/libkate/document/katedocument.cpp
@@ -107,129 +107,129 @@ const char * KateActionGroup::typeName(int type)
107 // 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
108 // 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
109 switch (type) { 109 switch (type) {
110 case ugPaste : return "Paste Text"; 110 case ugPaste : return "Paste Text";
111 case ugDelBlock : return "Selection Overwrite"; 111 case ugDelBlock : return "Selection Overwrite";
112 case ugIndent : return "Indent"; 112 case ugIndent : return "Indent";
113 case ugUnindent : return "Unindent"; 113 case ugUnindent : return "Unindent";
114 case ugComment : return "Comment"; 114 case ugComment : return "Comment";
115 case ugUncomment : return "Uncomment"; 115 case ugUncomment : return "Uncomment";
116 case ugReplace : return "Text Replace"; 116 case ugReplace : return "Text Replace";
117 case ugSpell : return "Spell Check"; 117 case ugSpell : return "Spell Check";
118 case ugInsChar : return "Typing"; 118 case ugInsChar : return "Typing";
119 case ugDelChar : return "Delete Text"; 119 case ugDelChar : return "Delete Text";
120 case ugInsLine : return "New Line"; 120 case ugInsLine : return "New Line";
121 case ugDelLine : return "Delete Line"; 121 case ugDelLine : return "Delete Line";
122 } 122 }
123 return ""; 123 return "";
124} 124}
125 125
126const int KateDocument::maxAttribs = 32; 126const int KateDocument::maxAttribs = 32;
127 127
128QStringList KateDocument::searchForList = QStringList(); 128QStringList KateDocument::searchForList = QStringList();
129QStringList KateDocument::replaceWithList = QStringList(); 129QStringList KateDocument::replaceWithList = QStringList();
130 130
131uint KateDocument::uniqueID = 0; 131uint KateDocument::uniqueID = 0;
132 132
133QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0; 133QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0;
134 134
135 135
136KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView, 136KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView,
137 QWidget *parentWidget, const char *widgetName, 137 QWidget *parentWidget, const char *widgetName,
138 QObject *, const char *) 138 QObject *, const char *)
139 : Kate::Document (), 139 : Kate::Document (),
140 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()),
141 myFontMetrics (myFont), myFontMetricsBold (myFontBold), myFontMetricsItalic (myFontItalic), myFontMetricsBI (myFontBI), 141 myFontMetrics (myFont), myFontMetricsBold (myFontBold), myFontMetricsItalic (myFontItalic), myFontMetricsBI (myFontBI),
142 hlManager(HlManager::self ()) 142 hlManager(HlManager::self ())
143{ 143{
144 144
145 d(this)->hlSetByUser = false; 145 d(this)->hlSetByUser = false;
146 PreHighlightedTill=0; 146 PreHighlightedTill=0;
147 RequestPreHighlightTill=0; 147 RequestPreHighlightTill=0;
148 148
149 m_bSingleViewMode=bSingleViewMode; 149 m_bSingleViewMode=bSingleViewMode;
150 m_bBrowserView = bBrowserView; 150 m_bBrowserView = bBrowserView;
151 151
152 m_url = QString::null; 152 m_url = QString::null;
153 153
154 // NOTE: QFont::CharSet doesn't provide all the charsets KDE supports 154 // NOTE: QFont::CharSet doesn't provide all the charsets KDE supports
155 // (esp. it doesn't distinguish between UTF-8 and iso10646-1) 155 // (esp. it doesn't distinguish between UTF-8 and iso10646-1)
156 156
157 myEncoding = QString::fromLatin1(QTextCodec::codecForLocale()->name()); 157 myEncoding = QString::fromLatin1(QTextCodec::codecForLocale()->name());
158 158
159 maxLength = -1; 159 maxLength = -1;
160 160
161 setFont (KGlobalSettings::generalFont()); 161 setFont (KGlobalSettings::generalFont());
162 162
163 myDocID = uniqueID; 163 myDocID = uniqueID;
164 uniqueID++; 164 uniqueID++;
165 165
166 myDocName = QString (""); 166 myDocName = QString ("");
167 fileInfo = new QFileInfo (); 167 fileInfo = new QFileInfo ();
168 168
169 myCmd = new KateCmd (this); 169 myCmd = new KateCmd (this);
170 170
171 connect(this,SIGNAL(modifiedChanged ()),this,SLOT(slotModChanged ())); 171 connect(this,SIGNAL(modifiedChanged()),this,SLOT(slotModChanged()));
172 172
173 buffer = new KWBuffer; 173 buffer = new KWBuffer;
174 connect(buffer, SIGNAL(linesChanged(int)), this, SLOT(slotBufferChanged())); 174 connect(buffer, SIGNAL(linesChanged(int)), this, SLOT(slotBufferChanged()));
175// connect(buffer, SIGNAL(textChanged()), this, SIGNAL(textChanged())); 175// connect(buffer, SIGNAL(textChanged()), this, SIGNAL(textChanged()));
176 connect(buffer, SIGNAL(needHighlight(long,long)),this,SLOT(slotBufferHighlight(long,long))); 176 connect(buffer, SIGNAL(needHighlight(long,long)),this,SLOT(slotBufferHighlight(long,long)));
177 177
178 colors[0] = KGlobalSettings::baseColor(); 178 colors[0] = KGlobalSettings::baseColor();
179 colors[1] = KGlobalSettings::highlightColor(); 179 colors[1] = KGlobalSettings::highlightColor();
180 180
181 m_attribs = new Attribute[maxAttribs]; 181 m_attribs = new Attribute[maxAttribs];
182 182
183 m_highlight = 0L; 183 m_highlight = 0L;
184 tabChars = 8; 184 tabChars = 8;
185 185
186 m_singleSelection = false; 186 m_singleSelection = false;
187 187
188 newDocGeometry = false; 188 newDocGeometry = false;
189 readOnly = false; 189 readOnly = false;
190 newDoc = false; 190 newDoc = false;
191 191
192 modified = false; 192 modified = false;
193 193
194 undoList.setAutoDelete(true); 194 undoList.setAutoDelete(true);
195 undoState = 0; 195 undoState = 0;
196 undoSteps = 50; 196 undoSteps = 50;
197 197
198 pseudoModal = 0L; 198 pseudoModal = 0L;
199 clear(); 199 clear();
200 200
201 setHighlight(0); //calls updateFontData() 201 setHighlight(0); //calls updateFontData()
202 // if the user changes the highlight with the dialog, notify the doc 202 // if the user changes the highlight with the dialog, notify the doc
203 connect(hlManager,SIGNAL(changed()),SLOT(hlChanged())); 203 connect(hlManager,SIGNAL(changed()),SLOT(hlChanged()));
204 204
205 newDocGeometry = false; 205 newDocGeometry = false;
206 206
207 readConfig(); 207 readConfig();
208 208
209 setReadOnly(false); 209 setReadOnly(false);
210} 210}
211 211
212void KateDocument::setDontChangeHlOnSave() 212void KateDocument::setDontChangeHlOnSave()
213{ 213{
214 d(this)->hlSetByUser = true; 214 d(this)->hlSetByUser = true;
215} 215}
216 216
217void KateDocument::setFont (QFont font) 217void KateDocument::setFont (QFont font)
218{ 218{
219 kdDebug()<<"Kate:: setFont"<<endl; 219 kdDebug()<<"Kate:: setFont"<<endl;
220 int oldwidth=myFontMetrics.width('W'); //Quick & Dirty Hack (by JoWenn) //Remove in KDE 3.0 220 int oldwidth=myFontMetrics.width('W'); //Quick & Dirty Hack (by JoWenn) //Remove in KDE 3.0
221 myFont = font; 221 myFont = font;
222 myFontBold = QFont (font); 222 myFontBold = QFont (font);
223 myFontBold.setBold (true); 223 myFontBold.setBold (true);
224 224
225 myFontItalic = QFont (font); 225 myFontItalic = QFont (font);
226 myFontItalic.setItalic (true); 226 myFontItalic.setItalic (true);
227 227
228 myFontBI = QFont (font); 228 myFontBI = QFont (font);
229 myFontBI.setBold (true); 229 myFontBI.setBold (true);
230 myFontBI.setItalic (true); 230 myFontBI.setItalic (true);
231 231
232 myFontMetrics = CachedFontMetrics (myFont); 232 myFontMetrics = CachedFontMetrics (myFont);
233 myFontMetricsBold = CachedFontMetrics (myFontBold); 233 myFontMetricsBold = CachedFontMetrics (myFontBold);
234 myFontMetricsItalic = CachedFontMetrics (myFontItalic); 234 myFontMetricsItalic = CachedFontMetrics (myFontItalic);
235 myFontMetricsBI = CachedFontMetrics (myFontBI); 235 myFontMetricsBI = CachedFontMetrics (myFontBI);
diff --git a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp
index a85fb87..8e68262 100644
--- a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp
+++ b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp
@@ -474,98 +474,98 @@ void EditConfigTab::getData(KateView *view)
474 view->doc()->setWordWrapAt(e1->value()); 474 view->doc()->setWordWrapAt(e1->value());
475 view->doc()->setWordWrap (opt[0]->isChecked()); 475 view->doc()->setWordWrap (opt[0]->isChecked());
476 view->setTabWidth(e2->value()); 476 view->setTabWidth(e2->value());
477 view->setUndoSteps(e3->value()); 477 view->setUndoSteps(e3->value());
478} 478}
479 479
480ColorConfig::ColorConfig( QWidget *parent, char *name ) 480ColorConfig::ColorConfig( QWidget *parent, char *name )
481 : QWidget( parent, name ) 481 : QWidget( parent, name )
482{ 482{
483 QGridLayout *glay = new QGridLayout( this, 6, 2, 0, KDialog::spacingHint()); 483 QGridLayout *glay = new QGridLayout( this, 6, 2, 0, KDialog::spacingHint());
484 glay->setColStretch(1,1); 484 glay->setColStretch(1,1);
485 glay->setRowStretch(5,1); 485 glay->setRowStretch(5,1);
486 486
487 QLabel *label; 487 QLabel *label;
488 488
489 label = new QLabel( i18n("Background:"), this); 489 label = new QLabel( i18n("Background:"), this);
490 label->setAlignment( AlignRight|AlignVCenter ); 490 label->setAlignment( AlignRight|AlignVCenter );
491 m_back = new KColorButton( this ); 491 m_back = new KColorButton( this );
492 glay->addWidget( label, 0, 0 ); 492 glay->addWidget( label, 0, 0 );
493 glay->addWidget( m_back, 0, 1 ); 493 glay->addWidget( m_back, 0, 1 );
494 494
495 label = new QLabel( i18n("Selected:"), this); 495 label = new QLabel( i18n("Selected:"), this);
496 label->setAlignment( AlignRight|AlignVCenter ); 496 label->setAlignment( AlignRight|AlignVCenter );
497 m_selected = new KColorButton( this ); 497 m_selected = new KColorButton( this );
498 glay->addWidget( label, 2, 0 ); 498 glay->addWidget( label, 2, 0 );
499 glay->addWidget( m_selected, 2, 1 ); 499 glay->addWidget( m_selected, 2, 1 );
500 500
501 // QWhatsThis help 501 // QWhatsThis help
502 QWhatsThis::add(m_back, i18n("Sets the background color of the editing area")); 502 QWhatsThis::add(m_back, i18n("Sets the background color of the editing area"));
503 QWhatsThis::add(m_selected, i18n("Sets the background color of the selection. To set the text color for selected text, use the &quot;<b>Configure Highlighting</b>&quot; dialog.")); 503 QWhatsThis::add(m_selected, i18n("Sets the background color of the selection. To set the text color for selected text, use the &quot;<b>Configure Highlighting</b>&quot; dialog."));
504} 504}
505 505
506 506
507ColorConfig::~ColorConfig() 507ColorConfig::~ColorConfig()
508{ 508{
509} 509}
510 510
511void ColorConfig::setColors(QColor *colors) 511void ColorConfig::setColors(QColor *colors)
512{ 512{
513 m_back->setColor( colors[0] ); 513 m_back->setColor( colors[0] );
514 m_selected->setColor( colors[1] ); 514 m_selected->setColor( colors[1] );
515} 515}
516 516
517void ColorConfig::getColors(QColor *colors) 517void ColorConfig::getColors(QColor *colors)
518{ 518{
519 colors[0] = m_back->color(); 519 colors[0] = m_back->color();
520 colors[1] = m_selected->color(); 520 colors[1] = m_selected->color();
521} 521}
522 522
523FontConfig::FontConfig( QWidget *parent, char *name ) 523FontConfig::FontConfig( QWidget *parent, char *name )
524 : QWidget( parent, name ) 524 : QWidget( parent, name )
525{ 525{
526 // sizemanagment 526 // sizemanagment
527 QGridLayout *grid = new QGridLayout( this, 1, 1 ); 527 QGridLayout *grid = new QGridLayout( this, 1, 1 );
528// QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); 528// QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" );
529// QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); 529// QString styleStr = cfg. readEntry ( "FontStyle", "Regular" );
530// int size = cfg. readNumEntry ( "FontSize", 10 ); 530// int size = cfg. readNumEntry ( "FontSize", 10 );
531// OFontSelector *m_fontselect; 531// OFontSelector *m_fontselect;
532 532
533 m_fontselect = new Opie::OFontSelector ( false, this, "FontTab" ); 533 m_fontselect = new Opie::OFontSelector ( false, this, "FontTab" );
534// m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); 534// m_fontselect-> setSelectedFont ( familyStr, styleStr, size );
535// QWhatsThis::add( m_fontselect, 535// QWhatsThis::add( m_fontselect,
536// tr( "Select the desired name, style and size of the default font applications will use." ) ); 536// tr( "Select the desired name, style and size of the default font applications will use." ) );
537 537
538 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), 538 connect( m_fontselect, SIGNAL( fontSelected(const QFont&)),
539 this, SLOT( slotFontSelected( const QFont & ))); 539 this, SLOT( slotFontSelected(const QFont&)));
540 grid->addWidget( m_fontselect, 0, 0); 540 grid->addWidget( m_fontselect, 0, 0);
541 541
542 542
543// #if 0 543// #if 0
544// m_fontchooser = new KFontChooser ( this ); 544// m_fontchooser = new KFontChooser ( this );
545// m_fontchooser->enableColumn(KFontChooser::StyleList, false); 545// m_fontchooser->enableColumn(KFontChooser::StyleList, false);
546// grid->addWidget( m_fontchooser, 0, 0); 546// grid->addWidget( m_fontchooser, 0, 0);
547 547
548// connect (m_fontchooser, SIGNAL (fontSelected( const QFont & )), this, SLOT (slotFontSelected( const QFont & ))); 548// connect (m_fontchooser, SIGNAL (fontSelected(const QFont&)), this, SLOT (slotFontSelected(const QFont&)));
549// #endif 549// #endif
550} 550}
551 551
552FontConfig::~FontConfig() 552FontConfig::~FontConfig()
553{ 553{
554} 554}
555 555
556void FontConfig::setFont ( const QFont &font ) 556void FontConfig::setFont ( const QFont &font )
557{ 557{
558//#if 0 558//#if 0
559m_fontselect->setFont (font); 559m_fontselect->setFont (font);
560 myFont = font; 560 myFont = font;
561//#endif 561//#endif
562} 562}
563 563
564void FontConfig::slotFontSelected( const QFont &font ) 564void FontConfig::slotFontSelected( const QFont &font )
565{ 565{
566 myFont = font; 566 myFont = font;
567} 567}
568 568
569 569
570 570
571 571
diff --git a/noncore/apps/tinykate/tinykate.cpp b/noncore/apps/tinykate/tinykate.cpp
index 19a0127..32c1eab 100644
--- a/noncore/apps/tinykate/tinykate.cpp
+++ b/noncore/apps/tinykate/tinykate.cpp
@@ -1,109 +1,109 @@
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 <qaction.h> 17#include <qaction.h>
18#include <qtoolbutton.h> 18#include <qtoolbutton.h>
19#include <qmenubar.h> 19#include <qmenubar.h>
20#include <qpe/resource.h> 20#include <qpe/resource.h>
21#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
22 22
23#include <opie2/ofiledialog.h> 23#include <opie2/ofiledialog.h>
24 24
25#include "tinykate.h" 25#include "tinykate.h"
26 26
27#include <katedocument.h> 27#include <katedocument.h>
28#include <kglobal.h> 28#include <kglobal.h>
29 29
30TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : 30TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) :
31 QMainWindow( parent, name, f ) 31 QMainWindow( parent, name, f )
32{ 32{
33 shutDown=false; 33 shutDown=false;
34 nextUnnamed=0; 34 nextUnnamed=0;
35 currentView=0; 35 currentView=0;
36 viewCount=0; 36 viewCount=0;
37 setCaption(tr("TinyKATE")); 37 setCaption(tr("TinyKATE"));
38 KGlobal::setAppName("TinyKATE"); 38 KGlobal::setAppName("TinyKATE");
39 39
40 QMenuBar *mb = new QMenuBar( this ); 40 QMenuBar *mb = new QMenuBar( this );
41 mb->setMargin( 0 ); 41 mb->setMargin( 0 );
42 42
43 tabwidget=new OTabWidget(this); 43 tabwidget=new OTabWidget(this);
44 setCentralWidget(tabwidget); 44 setCentralWidget(tabwidget);
45 connect(tabwidget,SIGNAL(currentChanged( QWidget *)),this,SLOT(slotCurrentChanged(QWidget *))); 45 connect(tabwidget,SIGNAL(currentChanged(QWidget*)),this,SLOT(slotCurrentChanged(QWidget*)));
46 46
47//FILE ACTIONS 47//FILE ACTIONS
48 QPopupMenu *popup = new QPopupMenu( this ); 48 QPopupMenu *popup = new QPopupMenu( this );
49 49
50 // Action for creating a new document 50 // Action for creating a new document
51 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 );
52 a->addTo( popup ); 52 a->addTo( popup );
53 connect(a, SIGNAL(activated()), this, SLOT(slotNew())); 53 connect(a, SIGNAL(activated()), this, SLOT(slotNew()));
54 54
55 // Action for opening an exisiting document 55 // Action for opening an exisiting document
56 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 );
57 a->addTo(popup); 57 a->addTo(popup);
58 connect(a, SIGNAL(activated()), this, SLOT(slotOpen())); 58 connect(a, SIGNAL(activated()), this, SLOT(slotOpen()));
59 59
60 60
61 // Action for saving document 61 // Action for saving document
62 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 );
63 a->addTo(popup); 63 a->addTo(popup);
64 connect(a, SIGNAL(activated()), this, SLOT(slotSave())); 64 connect(a, SIGNAL(activated()), this, SLOT(slotSave()));
65 65
66 // Action for saving document to a new name 66 // Action for saving document to a new name
67 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 );
68 a->addTo(popup); 68 a->addTo(popup);
69 connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); 69 connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs()));
70 70
71 // Action for closing the currently active document 71 // Action for closing the currently active document
72 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 );
73 a->addTo(popup); 73 a->addTo(popup);
74 connect(a, SIGNAL(activated()), this, SLOT(slotClose())); 74 connect(a, SIGNAL(activated()), this, SLOT(slotClose()));
75 75
76 76
77 mb->insertItem(tr("File"),popup); 77 mb->insertItem(tr("File"),popup);
78 78
79//EDIT ACTIONS 79//EDIT ACTIONS
80 80
81 // Action for cutting text 81 // Action for cutting text
82 editCut = new QToolButton( 0 ); 82 editCut = new QToolButton( 0 );
83 editCut->setAutoRaise( true ); 83 editCut->setAutoRaise( true );
84 editCut->setIconSet( Resource::loadPixmap( "cut" ) ); 84 editCut->setIconSet( Resource::loadPixmap( "cut" ) );
85 85
86 // Action for Copying text 86 // Action for Copying text
87 editCopy = new QToolButton( 0 ); 87 editCopy = new QToolButton( 0 );
88 editCopy->setAutoRaise( true ); 88 editCopy->setAutoRaise( true );
89 editCopy->setIconSet( Resource::loadPixmap( "copy" ) ); 89 editCopy->setIconSet( Resource::loadPixmap( "copy" ) );
90 90
91 // Action for pasting text 91 // Action for pasting text
92 editPaste = new QToolButton( 0 ); 92 editPaste = new QToolButton( 0 );
93 editPaste->setAutoRaise( true ); 93 editPaste->setAutoRaise( true );
94 editPaste->setIconSet( Resource::loadPixmap( "paste" ) ); 94 editPaste->setIconSet( Resource::loadPixmap( "paste" ) );
95 95
96 // Action for finding / replacing text 96 // Action for finding / replacing text
97 editFindReplace = new QToolButton( 0 ); 97 editFindReplace = new QToolButton( 0 );
98 editFindReplace->setAutoRaise( true ); 98 editFindReplace->setAutoRaise( true );
99 editFindReplace->setIconSet( Resource::loadPixmap("find") ); 99 editFindReplace->setIconSet( Resource::loadPixmap("find") );
100 100
101 // Action for undo 101 // Action for undo
102 editUndo = new QToolButton( 0 ); 102 editUndo = new QToolButton( 0 );
103 editUndo->setAutoRaise( true ); 103 editUndo->setAutoRaise( true );
104 editUndo->setIconSet( Resource::loadPixmap( "undo" ) ); 104 editUndo->setIconSet( Resource::loadPixmap( "undo" ) );
105 105
106 // Action for redo 106 // Action for redo
107 editRedo = new QToolButton( 0 ); 107 editRedo = new QToolButton( 0 );
108 editRedo->setAutoRaise( true ); 108 editRedo->setAutoRaise( true );
109 editRedo->setIconSet( Resource::loadPixmap( "redo" ) ); 109 editRedo->setIconSet( Resource::loadPixmap( "redo" ) );
diff --git a/noncore/apps/zsafe/scqtfiledlg.cpp b/noncore/apps/zsafe/scqtfiledlg.cpp
index dd72fdf..52b8d0d 100644
--- a/noncore/apps/zsafe/scqtfiledlg.cpp
+++ b/noncore/apps/zsafe/scqtfiledlg.cpp
@@ -134,123 +134,123 @@ ScQtFileDlg::ScQtFileDlg( QWidget* parent, const char* name, bool modal, WFlags
134 Layout3->addItem( spacer ); 134 Layout3->addItem( spacer );
135 135
136 OkButton = new QToolButton( this, "OkButton" ); 136 OkButton = new QToolButton( this, "OkButton" );
137 OkButton->setText( tr( "" ) ); 137 OkButton->setText( tr( "" ) );
138 OkButton->setPixmap( image0 ); 138 OkButton->setPixmap( image0 );
139 OkButton->setUsesBigPixmap( FALSE ); 139 OkButton->setUsesBigPixmap( FALSE );
140 QToolTip::add( OkButton, tr( "confirms the selection and closes the form" ) ); 140 QToolTip::add( OkButton, tr( "confirms the selection and closes the form" ) );
141 QWhatsThis::add( OkButton, tr( "OKButton" ) ); 141 QWhatsThis::add( OkButton, tr( "OKButton" ) );
142 Layout3->addWidget( OkButton ); 142 Layout3->addWidget( OkButton );
143 143
144 CancelButton = new QToolButton( this, "CancelButton" ); 144 CancelButton = new QToolButton( this, "CancelButton" );
145 CancelButton->setText( tr( "" ) ); 145 CancelButton->setText( tr( "" ) );
146 CancelButton->setPixmap( image1 ); 146 CancelButton->setPixmap( image1 );
147 CancelButton->setUsesBigPixmap( FALSE ); 147 CancelButton->setUsesBigPixmap( FALSE );
148 QToolTip::add( CancelButton, tr( "cancels the selection and closes the form" ) ); 148 QToolTip::add( CancelButton, tr( "cancels the selection and closes the form" ) );
149 QWhatsThis::add( CancelButton, tr( "CancelButton" ) ); 149 QWhatsThis::add( CancelButton, tr( "CancelButton" ) );
150 Layout3->addWidget( CancelButton ); 150 Layout3->addWidget( CancelButton );
151 Layout4->addLayout( Layout3 ); 151 Layout4->addLayout( Layout3 );
152 152
153 Layout3_2 = new QHBoxLayout; 153 Layout3_2 = new QHBoxLayout;
154 Layout3_2->setSpacing( 6 ); 154 Layout3_2->setSpacing( 6 );
155 Layout3_2->setMargin( 0 ); 155 Layout3_2->setMargin( 0 );
156 156
157 FNameLineEdit = new QLineEdit( this, "FNameLineEdit" ); 157 FNameLineEdit = new QLineEdit( this, "FNameLineEdit" );
158 QToolTip::add( FNameLineEdit, tr( "shows the selected filename" ) ); 158 QToolTip::add( FNameLineEdit, tr( "shows the selected filename" ) );
159 QWhatsThis::add( FNameLineEdit, tr( "Filename LineEdit\n" 159 QWhatsThis::add( FNameLineEdit, tr( "Filename LineEdit\n"
160"\n" 160"\n"
161"shows the selected file\n" 161"shows the selected file\n"
162"and allows the direct filename\n" 162"and allows the direct filename\n"
163"edit" ) ); 163"edit" ) );
164 Layout3_2->addWidget( FNameLineEdit ); 164 Layout3_2->addWidget( FNameLineEdit );
165 165
166 MkDirButton = new QToolButton( this, "MkDirButton" ); 166 MkDirButton = new QToolButton( this, "MkDirButton" );
167 MkDirButton->setText( tr( "" ) ); 167 MkDirButton->setText( tr( "" ) );
168 MkDirButton->setPixmap( image2 ); 168 MkDirButton->setPixmap( image2 );
169 MkDirButton->setUsesBigPixmap( FALSE ); 169 MkDirButton->setUsesBigPixmap( FALSE );
170 QToolTip::add( MkDirButton, tr( "confirms the selection and closes the form" ) ); 170 QToolTip::add( MkDirButton, tr( "confirms the selection and closes the form" ) );
171 QWhatsThis::add( MkDirButton, tr( "OKButton" ) ); 171 QWhatsThis::add( MkDirButton, tr( "OKButton" ) );
172 Layout3_2->addWidget( MkDirButton ); 172 Layout3_2->addWidget( MkDirButton );
173 Layout4->addLayout( Layout3_2 ); 173 Layout4->addLayout( Layout3_2 );
174 174
175 DirComboBox = new QComboBox( FALSE, this, "DirComboBox" ); 175 DirComboBox = new QComboBox( FALSE, this, "DirComboBox" );
176 DirComboBox->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, DirComboBox->sizePolicy().hasHeightForWidth() ) ); 176 DirComboBox->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, DirComboBox->sizePolicy().hasHeightForWidth() ) );
177 DirComboBox->setEditable( TRUE ); 177 DirComboBox->setEditable( TRUE );
178 DirComboBox->setDuplicatesEnabled( FALSE ); 178 DirComboBox->setDuplicatesEnabled( FALSE );
179 QWhatsThis::add( DirComboBox, tr( "ComboBox Directory \n" 179 QWhatsThis::add( DirComboBox, tr( "ComboBox Directory \n"
180"edit or select the directories name" ) ); 180"edit or select the directories name" ) );
181 Layout4->addWidget( DirComboBox ); 181 Layout4->addWidget( DirComboBox );
182 Layout5->addLayout( Layout4 ); 182 Layout5->addLayout( Layout4 );
183 183
184 ListView = new QListView( this, "ListView" ); 184 ListView = new QListView( this, "ListView" );
185 ListView->addColumn( tr( "Name" ) ); 185 ListView->addColumn( tr( "Name" ) );
186 ListView->addColumn( tr( "size" ) ); 186 ListView->addColumn( tr( "size" ) );
187 ListView->addColumn( tr( "type" ) ); 187 ListView->addColumn( tr( "type" ) );
188 ListView->setRootIsDecorated( TRUE ); 188 ListView->setRootIsDecorated( TRUE );
189 QToolTip::add( ListView, tr( "directory listview" ) ); 189 QToolTip::add( ListView, tr( "directory listview" ) );
190 QWhatsThis::add( ListView, tr( "Directory ListView\n" 190 QWhatsThis::add( ListView, tr( "Directory ListView\n"
191"\n" 191"\n"
192"shows the list of dirs and files" ) ); 192"shows the list of dirs and files" ) );
193 Layout5->addWidget( ListView ); 193 Layout5->addWidget( ListView );
194 ScQtFileDlgLayout->addLayout( Layout5 ); 194 ScQtFileDlgLayout->addLayout( Layout5 );
195 195
196 // signals and slots connections 196 // signals and slots connections
197 connect( OkButton, SIGNAL( clicked() ), this, SLOT( slotOK() ) ); 197 connect( OkButton, SIGNAL( clicked() ), this, SLOT( slotOK() ) );
198 connect( DirComboBox, SIGNAL( activated(int) ), this, SLOT( slotDirComboBoxChanged( int ) ) ); 198 connect( DirComboBox, SIGNAL( activated(int) ), this, SLOT( slotDirComboBoxChanged(int) ) );
199 connect( TypeComboBox, SIGNAL( activated(int) ), this, SLOT( slotTypeComboBoxChanged( int ) ) ); 199 connect( TypeComboBox, SIGNAL( activated(int) ), this, SLOT( slotTypeComboBoxChanged(int) ) );
200 connect( CancelButton, SIGNAL( clicked() ), this, SLOT( slotCancel() ) ); 200 connect( CancelButton, SIGNAL( clicked() ), this, SLOT( slotCancel() ) );
201 connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem *) ) ); 201 connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem*) ) );
202 connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem *) ) ); 202 connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem*) ) );
203 connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( slotDoubleClicked(QListViewItem *) ) ); 203 connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( slotDoubleClicked(QListViewItem*) ) );
204 connect( FNameLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotFileTextChanged( const QString & ) ) ); 204 connect( FNameLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotFileTextChanged(const QString&) ) );
205 connect( FNameLineEdit, SIGNAL( returnPressed() ), this, SLOT( slotOK() ) ); 205 connect( FNameLineEdit, SIGNAL( returnPressed() ), this, SLOT( slotOK() ) );
206 connect( MkDirButton, SIGNAL( clicked() ), this, SLOT( slotMkDir() ) ); 206 connect( MkDirButton, SIGNAL( clicked() ), this, SLOT( slotMkDir() ) );
207} 207}
208 208
209/* 209/*
210 * Destroys the object and frees any allocated resources 210 * Destroys the object and frees any allocated resources
211 */ 211 */
212ScQtFileDlg::~ScQtFileDlg() 212ScQtFileDlg::~ScQtFileDlg()
213{ 213{
214 // no need to delete child widgets, Qt does it all for us 214 // no need to delete child widgets, Qt does it all for us
215} 215}
216 216
217void ScQtFileDlg::slotCancel() 217void ScQtFileDlg::slotCancel()
218{ 218{
219 qWarning( "ScQtFileDlg::slotCancel(): Not implemented yet!" ); 219 qWarning( "ScQtFileDlg::slotCancel(): Not implemented yet!" );
220} 220}
221 221
222void ScQtFileDlg::slotDirComboBoxChanged( int ) 222void ScQtFileDlg::slotDirComboBoxChanged( int )
223{ 223{
224 qWarning( "ScQtFileDlg::slotDirComboBoxChanged( int ): Not implemented yet!" ); 224 qWarning( "ScQtFileDlg::slotDirComboBoxChanged( int ): Not implemented yet!" );
225} 225}
226 226
227void ScQtFileDlg::slotDoubleClicked(QListViewItem *) 227void ScQtFileDlg::slotDoubleClicked(QListViewItem *)
228{ 228{
229 qWarning( "ScQtFileDlg::slotDoubleClicked(QListViewItem *): Not implemented yet!" ); 229 qWarning( "ScQtFileDlg::slotDoubleClicked(QListViewItem *): Not implemented yet!" );
230} 230}
231 231
232void ScQtFileDlg::slotFileTextChanged( const QString & ) 232void ScQtFileDlg::slotFileTextChanged( const QString & )
233{ 233{
234 qWarning( "ScQtFileDlg::slotFileTextChanged( const QString & ): Not implemented yet!" ); 234 qWarning( "ScQtFileDlg::slotFileTextChanged( const QString & ): Not implemented yet!" );
235} 235}
236 236
237void ScQtFileDlg::slotMkDir() 237void ScQtFileDlg::slotMkDir()
238{ 238{
239 qWarning( "ScQtFileDlg::slotMkDir(): Not implemented yet!" ); 239 qWarning( "ScQtFileDlg::slotMkDir(): Not implemented yet!" );
240} 240}
241 241
242void ScQtFileDlg::slotOK() 242void ScQtFileDlg::slotOK()
243{ 243{
244 qWarning( "ScQtFileDlg::slotOK(): Not implemented yet!" ); 244 qWarning( "ScQtFileDlg::slotOK(): Not implemented yet!" );
245} 245}
246 246
247void ScQtFileDlg::slotSelectionChanged(QListViewItem *) 247void ScQtFileDlg::slotSelectionChanged(QListViewItem *)
248{ 248{
249 qWarning( "ScQtFileDlg::slotSelectionChanged(QListViewItem *): Not implemented yet!" ); 249 qWarning( "ScQtFileDlg::slotSelectionChanged(QListViewItem *): Not implemented yet!" );
250} 250}
251 251
252void ScQtFileDlg::slotTypeComboBoxChanged( int ) 252void ScQtFileDlg::slotTypeComboBoxChanged( int )
253{ 253{
254 qWarning( "ScQtFileDlg::slotTypeComboBoxChanged( int ): Not implemented yet!" ); 254 qWarning( "ScQtFileDlg::slotTypeComboBoxChanged( int ): Not implemented yet!" );
255} 255}
256 256
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index a3e805e..a3467e5 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -629,134 +629,134 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
629 QToolTip::add( Edit, tr( "Edit category or entry" ) ); 629 QToolTip::add( Edit, tr( "Edit category or entry" ) );
630 630
631 Delete = new QToolButton( menu, "Delete" ); 631 Delete = new QToolButton( menu, "Delete" );
632 Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) ); 632 Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) );
633 Delete->setText( tr( "" ) ); 633 Delete->setText( tr( "" ) );
634 Delete->setPixmap( trash_img ); 634 Delete->setPixmap( trash_img );
635 QToolTip::add( Delete, tr( "Delete category or entry" ) ); 635 QToolTip::add( Delete, tr( "Delete category or entry" ) );
636 636
637 Find = new QToolButton( menu, "Find" ); 637 Find = new QToolButton( menu, "Find" );
638 Find->setGeometry( QRect( DeskW-24, 2, 20, 20 ) ); 638 Find->setGeometry( QRect( DeskW-24, 2, 20, 20 ) );
639 Find->setText( tr( "" ) ); 639 Find->setText( tr( "" ) );
640 Find->setPixmap( find_img ); 640 Find->setPixmap( find_img );
641 QToolTip::add( Find, tr( "Find entry" ) ); 641 QToolTip::add( Find, tr( "Find entry" ) );
642 642
643/* 643/*
644 QBoxLayout * h = new QHBoxLayout( this ); 644 QBoxLayout * h = new QHBoxLayout( this );
645 h->addWidget (menu); 645 h->addWidget (menu);
646 h->addWidget (New); 646 h->addWidget (New);
647 h->addWidget (Edit); 647 h->addWidget (Edit);
648 h->addWidget (Delete); 648 h->addWidget (Delete);
649 h->addWidget (Find); 649 h->addWidget (Find);
650*/ 650*/
651 651
652 ListView = new ZListView( this, "ListView" ); 652 ListView = new ZListView( this, "ListView" );
653 ListView->addColumn( tr( "Name" ) ); 653 ListView->addColumn( tr( "Name" ) );
654 ListView->addColumn( tr( "Field 2" ) ); 654 ListView->addColumn( tr( "Field 2" ) );
655 ListView->addColumn( tr( "Field 3" ) ); 655 ListView->addColumn( tr( "Field 3" ) );
656 ListView->addColumn( tr( "Comment" ) ); 656 ListView->addColumn( tr( "Comment" ) );
657 ListView->addColumn( tr( "Field 4" ) ); 657 ListView->addColumn( tr( "Field 4" ) );
658 ListView->addColumn( tr( "Field 5" ) ); 658 ListView->addColumn( tr( "Field 5" ) );
659 ListView->setAllColumnsShowFocus(TRUE); 659 ListView->setAllColumnsShowFocus(TRUE);
660 660
661#ifdef DESKTOP 661#ifdef DESKTOP
662 ListView->setResizePolicy(QScrollView::AutoOneFit); 662 ListView->setResizePolicy(QScrollView::AutoOneFit);
663 // ListView->setGeometry( QRect( 0, 22, this->width(), this->height() - 30 ) ); 663 // ListView->setGeometry( QRect( 0, 22, this->width(), this->height() - 30 ) );
664#else 664#else
665 ListView->setResizePolicy(QScrollView::AutoOneFit); 665 ListView->setResizePolicy(QScrollView::AutoOneFit);
666 // ListView->setGeometry( QRect( 0, 22, 666 // ListView->setGeometry( QRect( 0, 22,
667 // this->width(), this->height() - 30 ) ); 667 // this->width(), this->height() - 30 ) );
668 // ListView->setMaximumSize( QSize( 440, 290 ) ); 668 // ListView->setMaximumSize( QSize( 440, 290 ) );
669#endif 669#endif
670 ListView->setVScrollBarMode( QListView::Auto ); 670 ListView->setVScrollBarMode( QListView::Auto );
671 671
672 QBoxLayout * l = new QVBoxLayout( this ); 672 QBoxLayout * l = new QVBoxLayout( this );
673 l->addWidget (menu); 673 l->addWidget (menu);
674 l->addWidget (ListView); 674 l->addWidget (ListView);
675 675
676#ifndef DESKTOP 676#ifndef DESKTOP
677 // start a timer (100 ms) to load the default document 677 // start a timer (100 ms) to load the default document
678 docuTimer.start( 100, true ); 678 docuTimer.start( 100, true );
679 connect( &docuTimer, SIGNAL(timeout()), SLOT( slotLoadDocu() ) ); 679 connect( &docuTimer, SIGNAL(timeout()), SLOT( slotLoadDocu() ) );
680 raiseFlag = true; 680 raiseFlag = true;
681 connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) ); 681 connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) );
682#else 682#else
683 // open the default document 683 // open the default document
684 openDocument(filename); 684 openDocument(filename);
685#endif 685#endif
686 686
687 // signals and slots connections for QTollButton 687 // signals and slots connections for QTollButton
688 connect( New, SIGNAL( clicked() ), this, SLOT( newPwd() ) ); 688 connect( New, SIGNAL( clicked() ), this, SLOT( newPwd() ) );
689 connect( Edit, SIGNAL( clicked() ), this, SLOT( editPwd() ) ); 689 connect( Edit, SIGNAL( clicked() ), this, SLOT( editPwd() ) );
690 connect( Delete, SIGNAL( clicked() ), this, SLOT( deletePwd() ) ); 690 connect( Delete, SIGNAL( clicked() ), this, SLOT( deletePwd() ) );
691 connect( Find, SIGNAL( clicked() ), this, SLOT( findPwd() ) ); 691 connect( Find, SIGNAL( clicked() ), this, SLOT( findPwd() ) );
692 // signals and slots connections for QListView 692 // signals and slots connections for QListView
693 connect( ListView, SIGNAL( selectionChanged( QListViewItem* ) ), 693 connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ),
694 this, SLOT( listViewSelected( QListViewItem* ) ) ); 694 this, SLOT( listViewSelected(QListViewItem*) ) );
695 connect( ListView, SIGNAL( doubleClicked( QListViewItem* ) ), 695 connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ),
696 this, SLOT( showInfo( QListViewItem* ) ) ); 696 this, SLOT( showInfo(QListViewItem*) ) );
697 connect( ListView, SIGNAL( returnPressed( QListViewItem* ) ), 697 connect( ListView, SIGNAL( returnPressed(QListViewItem*) ),
698 this, SLOT( showInfo( QListViewItem* ) ) ); 698 this, SLOT( showInfo(QListViewItem*) ) );
699 699
700} 700}
701 701
702const QColor *ZSafe::evenRowColor = &Qt::white; 702const QColor *ZSafe::evenRowColor = &Qt::white;
703// const QColor *ZSafe::oddRowColor = &Qt::lightGray; 703// const QColor *ZSafe::oddRowColor = &Qt::lightGray;
704const QColor *ZSafe::oddRowColor = new QColor(216,240,255); 704const QColor *ZSafe::oddRowColor = new QColor(216,240,255);
705 705
706/* 706/*
707 * Destroys the object and frees any allocated resources 707 * Destroys the object and frees any allocated resources
708 */ 708 */
709ZSafe::~ZSafe() 709ZSafe::~ZSafe()
710{ 710{
711 // no need to delete child widgets, Qt does it all for us 711 // no need to delete child widgets, Qt does it all for us
712 quitMe(); 712 quitMe();
713} 713}
714 714
715// load the default document 715// load the default document
716void ZSafe::slotLoadDocu() 716void ZSafe::slotLoadDocu()
717{ 717{
718 openDocument (filename); 718 openDocument (filename);
719} 719}
720 720
721void ZSafe::deletePwd() 721void ZSafe::deletePwd()
722{ 722{
723 723
724 if (!selectedItem) 724 if (!selectedItem)
725 return; 725 return;
726 if (!isCategory(selectedItem)) 726 if (!isCategory(selectedItem))
727 { 727 {
728 switch( QMessageBox::information( this, tr("ZSafe"), 728 switch( QMessageBox::information( this, tr("ZSafe"),
729 tr("Do you want to delete?"), 729 tr("Do you want to delete?"),
730 tr("&Delete"), tr("D&on't Delete"), 730 tr("&Delete"), tr("D&on't Delete"),
731 0 // Enter == button 0 731 0 // Enter == button 0
732 ) ) { // Escape == button 2 732 ) ) { // Escape == button 2
733 case 0: // Delete clicked, Alt-S or Enter pressed. 733 case 0: // Delete clicked, Alt-S or Enter pressed.
734 // Delete 734 // Delete
735 modified = true; 735 modified = true;
736 selectedItem->parent()->takeItem(selectedItem); 736 selectedItem->parent()->takeItem(selectedItem);
737 selectedItem = NULL; 737 selectedItem = NULL;
738 break; 738 break;
739 case 1: // Don't delete 739 case 1: // Don't delete
740 break; 740 break;
741 } 741 }
742 } 742 }
743 else 743 else
744 { 744 {
745 delCategory(); 745 delCategory();
746 } 746 }
747} 747}
748 748
749void ZSafe::editPwd() 749void ZSafe::editPwd()
750{ 750{
751 if (!selectedItem) 751 if (!selectedItem)
752 return; 752 return;
753 if (!isCategory(selectedItem)) 753 if (!isCategory(selectedItem))
754 { 754 {
755 // open the 'New Entry' dialog 755 // open the 'New Entry' dialog
756 NewDialog *dialog = new NewDialog(this, tr("Edit Entry"), TRUE); 756 NewDialog *dialog = new NewDialog(this, tr("Edit Entry"), TRUE);
757#ifdef WIN32 757#ifdef WIN32
758 dialog->setCaption ("Qt " + tr("Edit Entry")); 758 dialog->setCaption ("Qt " + tr("Edit Entry"));
759 dialog->setGeometry(200, 250, 220, 310 ); 759 dialog->setGeometry(200, 250, 220, 310 );
760#endif 760#endif
761 761
762 // set the labels 762 // set the labels
@@ -2518,130 +2518,130 @@ void ZSafe::quitMe ()
2518 if (modified) 2518 if (modified)
2519 { 2519 {
2520 switch( QMessageBox::information( this, tr("ZSafe"), 2520 switch( QMessageBox::information( this, tr("ZSafe"),
2521 tr("Do you want to save\nbefore exiting?"), 2521 tr("Do you want to save\nbefore exiting?"),
2522 tr("&Save"), 2522 tr("&Save"),
2523 tr("S&ave with\nnew\npassword"), 2523 tr("S&ave with\nnew\npassword"),
2524 tr("&Don't Save"), 2524 tr("&Don't Save"),
2525 0 // Enter == button 0 2525 0 // Enter == button 0
2526 ) ) 2526 ) )
2527 { // Escape == button 2 2527 { // Escape == button 2
2528 case 0: // Save clicked, Alt-S or Enter pressed. 2528 case 0: // Save clicked, Alt-S or Enter pressed.
2529 // save 2529 // save
2530 modified = false; 2530 modified = false;
2531 saveDocument(filename, FALSE); 2531 saveDocument(filename, FALSE);
2532 exitZs (1); 2532 exitZs (1);
2533 break; 2533 break;
2534 case 1: // 2534 case 1: //
2535 // Save with new password 2535 // Save with new password
2536 modified = false; 2536 modified = false;
2537 saveDocument(filename, TRUE); 2537 saveDocument(filename, TRUE);
2538 exitZs (1); 2538 exitZs (1);
2539 break; 2539 break;
2540 case 2: // Don't Save clicked or Alt-D pressed 2540 case 2: // Don't Save clicked or Alt-D pressed
2541 // don't save but exitZs 2541 // don't save but exitZs
2542 exitZs (1); 2542 exitZs (1);
2543 break; 2543 break;
2544 } 2544 }
2545 } 2545 }
2546 exitZs (1); 2546 exitZs (1);
2547 2547
2548} 2548}
2549 2549
2550void ZSafe::categoryFieldActivated( const QString& category) 2550void ZSafe::categoryFieldActivated( const QString& category)
2551{ 2551{
2552 if (categoryDialog) 2552 if (categoryDialog)
2553 setCategoryDialogFields(categoryDialog, category); 2553 setCategoryDialogFields(categoryDialog, category);
2554} 2554}
2555 2555
2556void ZSafe::addCategory() 2556void ZSafe::addCategory()
2557{ 2557{
2558 if (filename.isEmpty()) 2558 if (filename.isEmpty())
2559 { 2559 {
2560 QMessageBox::critical( 0, tr("ZSafe"), 2560 QMessageBox::critical( 0, tr("ZSafe"),
2561 tr("No document defined.\nYou have to create a new document")); 2561 tr("No document defined.\nYou have to create a new document"));
2562 return; 2562 return;
2563 } 2563 }
2564 else 2564 else
2565 { 2565 {
2566 // open the 'Category' dialog 2566 // open the 'Category' dialog
2567 bool initIcons = false; 2567 bool initIcons = false;
2568 // open the 'Category' dialog 2568 // open the 'Category' dialog
2569 CategoryDialog *dialog; 2569 CategoryDialog *dialog;
2570 if (categoryDialog) 2570 if (categoryDialog)
2571 { 2571 {
2572 dialog = categoryDialog; 2572 dialog = categoryDialog;
2573 } 2573 }
2574 else 2574 else
2575 { 2575 {
2576 categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); 2576 categoryDialog = new CategoryDialog(this, tr("Category"), TRUE);
2577#ifdef WIN32 2577#ifdef WIN32
2578 categoryDialog->setCaption ("Qt " + tr("Category")); 2578 categoryDialog->setCaption ("Qt " + tr("Category"));
2579#endif 2579#endif
2580 dialog = categoryDialog; 2580 dialog = categoryDialog;
2581 connect( dialog->CategoryField, 2581 connect( dialog->CategoryField,
2582 SIGNAL( activated ( const QString &)), 2582 SIGNAL( activated(const QString&)),
2583 this, SLOT( categoryFieldActivated( const QString & ) ) ); 2583 this, SLOT( categoryFieldActivated(const QString&) ) );
2584 initIcons = true; 2584 initIcons = true;
2585 } 2585 }
2586 2586
2587#ifdef DESKTOP 2587#ifdef DESKTOP
2588#ifndef WIN32 2588#ifndef WIN32
2589 QStringList list = conf->entryList( APP_KEY+"/fieldDefs" ); 2589 QStringList list = conf->entryList( APP_KEY+"/fieldDefs" );
2590#else 2590#else
2591 // read all categories from the config file and store 2591 // read all categories from the config file and store
2592 // into a list 2592 // into a list
2593 QFile f (cfgFile); 2593 QFile f (cfgFile);
2594 QStringList list; 2594 QStringList list;
2595 if ( f.open(IO_ReadOnly) ) { // file opened successfully 2595 if ( f.open(IO_ReadOnly) ) { // file opened successfully
2596 QTextStream t( &f ); // use a text stream 2596 QTextStream t( &f ); // use a text stream
2597 QString s; 2597 QString s;
2598 int n = 1; 2598 int n = 1;
2599 while ( !t.eof() ) { // until end of file... 2599 while ( !t.eof() ) { // until end of file...
2600 s = t.readLine(); // line of text excluding '\n' 2600 s = t.readLine(); // line of text excluding '\n'
2601 list.append(s); 2601 list.append(s);
2602 } 2602 }
2603 f.close(); 2603 f.close();
2604 } 2604 }
2605#endif 2605#endif
2606#else 2606#else
2607 // read all categories from the config file and store 2607 // read all categories from the config file and store
2608 // into a list 2608 // into a list
2609 QFile f (cfgFile); 2609 QFile f (cfgFile);
2610 QStringList list; 2610 QStringList list;
2611 if ( f.open(IO_ReadOnly) ) { // file opened successfully 2611 if ( f.open(IO_ReadOnly) ) { // file opened successfully
2612 QTextStream t( &f ); // use a text stream 2612 QTextStream t( &f ); // use a text stream
2613 QString s; 2613 QString s;
2614 while ( !t.eof() ) { // until end of file... 2614 while ( !t.eof() ) { // until end of file...
2615 s = t.readLine(); // line of text excluding '\n' 2615 s = t.readLine(); // line of text excluding '\n'
2616 list.append(s); 2616 list.append(s);
2617 } 2617 }
2618 f.close(); 2618 f.close();
2619 } 2619 }
2620#endif 2620#endif
2621 QStringList::Iterator it = list.begin(); 2621 QStringList::Iterator it = list.begin();
2622 QString categ; 2622 QString categ;
2623 QString firstCategory; 2623 QString firstCategory;
2624 dialog->CategoryField->clear(); // remove all items 2624 dialog->CategoryField->clear(); // remove all items
2625 while( it != list.end() ) 2625 while( it != list.end() )
2626 { 2626 {
2627 QString *cat = new QString (*it); 2627 QString *cat = new QString (*it);
2628 if (cat->contains("-field1", FALSE)) 2628 if (cat->contains("-field1", FALSE))
2629 { 2629 {
2630#ifdef DESKTOP 2630#ifdef DESKTOP
2631#ifndef WIN32 2631#ifndef WIN32
2632 categ = cat->section ("-field1", 0, 0); 2632 categ = cat->section ("-field1", 0, 0);
2633#else 2633#else
2634 int pos = cat->find ("-field1"); 2634 int pos = cat->find ("-field1");
2635 categ = cat->left (pos); 2635 categ = cat->left (pos);
2636#endif 2636#endif
2637#else 2637#else
2638 int pos = cat->find ("-field1"); 2638 int pos = cat->find ("-field1");
2639 cat->truncate(pos); 2639 cat->truncate(pos);
2640 categ = *cat; 2640 categ = *cat;
2641#endif 2641#endif
2642 if (!categ.isEmpty()) 2642 if (!categ.isEmpty())
2643 { 2643 {
2644 dialog->CategoryField->insertItem (categ, -1); 2644 dialog->CategoryField->insertItem (categ, -1);
2645 if (firstCategory.isEmpty()) 2645 if (firstCategory.isEmpty())
2646 firstCategory = categ; 2646 firstCategory = categ;
2647 } 2647 }
@@ -2925,130 +2925,130 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category)
2925 QString fileName = fi->fileName(); 2925 QString fileName = fi->fileName();
2926 if(fileName.right(4) == ".png") 2926 if(fileName.right(4) == ".png")
2927 { 2927 {
2928 fileName = fileName.mid(0,fileName.length()-4); 2928 fileName = fileName.mid(0,fileName.length()-4);
2929 2929
2930 if(fileName+".png"==icon) 2930 if(fileName+".png"==icon)
2931 { 2931 {
2932 dialog->IconField->setCurrentItem(i+1); 2932 dialog->IconField->setCurrentItem(i+1);
2933 break; 2933 break;
2934 } 2934 }
2935 ++i; 2935 ++i;
2936 } 2936 }
2937 ++it; 2937 ++it;
2938 } 2938 }
2939 } 2939 }
2940} 2940}
2941 2941
2942void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog) 2942void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog)
2943{ 2943{
2944 QString app_key = APP_KEY; 2944 QString app_key = APP_KEY;
2945#ifndef DESKTOP 2945#ifndef DESKTOP
2946 conf->setGroup ("fieldDefs"); 2946 conf->setGroup ("fieldDefs");
2947#else 2947#else
2948#ifndef WIN32 2948#ifndef WIN32
2949 app_key += "/fieldDefs/"; 2949 app_key += "/fieldDefs/";
2950#endif 2950#endif
2951#endif 2951#endif
2952 QString category = dialog->CategoryField->currentText(); 2952 QString category = dialog->CategoryField->currentText();
2953// #ifndef WIN32 2953// #ifndef WIN32
2954 conf->writeEntry(app_key+category+"-field1", dialog->Field1->text()); 2954 conf->writeEntry(app_key+category+"-field1", dialog->Field1->text());
2955 conf->writeEntry(app_key+category+"-field2", dialog->Field2->text()); 2955 conf->writeEntry(app_key+category+"-field2", dialog->Field2->text());
2956 conf->writeEntry(app_key+category+"-field3", dialog->Field3->text()); 2956 conf->writeEntry(app_key+category+"-field3", dialog->Field3->text());
2957 conf->writeEntry(app_key+category+"-field4", dialog->Field4->text()); 2957 conf->writeEntry(app_key+category+"-field4", dialog->Field4->text());
2958 conf->writeEntry(app_key+category+"-field5", dialog->Field5->text()); 2958 conf->writeEntry(app_key+category+"-field5", dialog->Field5->text());
2959 conf->writeEntry(app_key+category+"-field6", dialog->Field6->text()); 2959 conf->writeEntry(app_key+category+"-field6", dialog->Field6->text());
2960// #endif 2960// #endif
2961 saveConf(); 2961 saveConf();
2962#ifndef DESKTOP 2962#ifndef DESKTOP
2963 conf->setGroup ("zsafe"); 2963 conf->setGroup ("zsafe");
2964#endif 2964#endif
2965} 2965}
2966 2966
2967void ZSafe::editCategory() 2967void ZSafe::editCategory()
2968{ 2968{
2969 if (!selectedItem) 2969 if (!selectedItem)
2970 return; 2970 return;
2971 if (isCategory(selectedItem)) 2971 if (isCategory(selectedItem))
2972 { 2972 {
2973 QString category = selectedItem->text(0); 2973 QString category = selectedItem->text(0);
2974 bool initIcons = false; 2974 bool initIcons = false;
2975 // open the 'Category' dialog 2975 // open the 'Category' dialog
2976 CategoryDialog *dialog; 2976 CategoryDialog *dialog;
2977 if (categoryDialog) 2977 if (categoryDialog)
2978 { 2978 {
2979 dialog = categoryDialog; 2979 dialog = categoryDialog;
2980 } 2980 }
2981 else 2981 else
2982 { 2982 {
2983 categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); 2983 categoryDialog = new CategoryDialog(this, tr("Category"), TRUE);
2984#ifdef WIN32 2984#ifdef WIN32
2985 categoryDialog->setCaption ("Qt " + tr("Category")); 2985 categoryDialog->setCaption ("Qt " + tr("Category"));
2986#endif 2986#endif
2987 dialog = categoryDialog; 2987 dialog = categoryDialog;
2988 connect( dialog->CategoryField, 2988 connect( dialog->CategoryField,
2989 SIGNAL( activated ( const QString &)), 2989 SIGNAL( activated(const QString&)),
2990 this, SLOT( categoryFieldActivated( const QString & ) ) ); 2990 this, SLOT( categoryFieldActivated(const QString&) ) );
2991 initIcons = true; 2991 initIcons = true;
2992 } 2992 }
2993 setCategoryDialogFields(dialog); 2993 setCategoryDialogFields(dialog);
2994 2994
2995#ifdef DESKTOP 2995#ifdef DESKTOP
2996#ifndef WIN32 2996#ifndef WIN32
2997 QStringList list = conf->entryList( APP_KEY+"/fieldDefs" ); 2997 QStringList list = conf->entryList( APP_KEY+"/fieldDefs" );
2998#else 2998#else
2999 // read all categories from the config file and store 2999 // read all categories from the config file and store
3000 // into a list 3000 // into a list
3001 QFile f (cfgFile); 3001 QFile f (cfgFile);
3002 QStringList list; 3002 QStringList list;
3003 if ( f.open(IO_ReadOnly) ) { // file opened successfully 3003 if ( f.open(IO_ReadOnly) ) { // file opened successfully
3004 QTextStream t( &f ); // use a text stream 3004 QTextStream t( &f ); // use a text stream
3005 QString s; 3005 QString s;
3006 int n = 1; 3006 int n = 1;
3007 while ( !t.eof() ) { // until end of file... 3007 while ( !t.eof() ) { // until end of file...
3008 s = t.readLine(); // line of text excluding '\n' 3008 s = t.readLine(); // line of text excluding '\n'
3009 list.append(s); 3009 list.append(s);
3010 } 3010 }
3011 f.close(); 3011 f.close();
3012 } 3012 }
3013#endif 3013#endif
3014#else 3014#else
3015 // read all categories from the config file and store 3015 // read all categories from the config file and store
3016 // into a list 3016 // into a list
3017 QFile f (cfgFile); 3017 QFile f (cfgFile);
3018 QStringList list; 3018 QStringList list;
3019 if ( f.open(IO_ReadOnly) ) { // file opened successfully 3019 if ( f.open(IO_ReadOnly) ) { // file opened successfully
3020 QTextStream t( &f ); // use a text stream 3020 QTextStream t( &f ); // use a text stream
3021 QString s; 3021 QString s;
3022 while ( !t.eof() ) { // until end of file... 3022 while ( !t.eof() ) { // until end of file...
3023 s = t.readLine(); // line of text excluding '\n' 3023 s = t.readLine(); // line of text excluding '\n'
3024 list.append(s); 3024 list.append(s);
3025 } 3025 }
3026 f.close(); 3026 f.close();
3027 } 3027 }
3028#endif 3028#endif
3029 QStringList::Iterator it = list.begin(); 3029 QStringList::Iterator it = list.begin();
3030 QString categ; 3030 QString categ;
3031 dialog->CategoryField->clear(); // remove all items 3031 dialog->CategoryField->clear(); // remove all items
3032 int i=0; 3032 int i=0;
3033 bool foundCategory = false; 3033 bool foundCategory = false;
3034 while( it != list.end() ) 3034 while( it != list.end() )
3035 { 3035 {
3036 QString *cat = new QString (*it); 3036 QString *cat = new QString (*it);
3037 if (cat->contains("-field1", FALSE)) 3037 if (cat->contains("-field1", FALSE))
3038 { 3038 {
3039#ifdef DESKTOP 3039#ifdef DESKTOP
3040#ifndef WIN32 3040#ifndef WIN32
3041 categ = cat->section ("-field1", 0, 0); 3041 categ = cat->section ("-field1", 0, 0);
3042#else 3042#else
3043 int pos = cat->find ("-field1"); 3043 int pos = cat->find ("-field1");
3044 categ = cat->left (pos); 3044 categ = cat->left (pos);
3045#endif 3045#endif
3046#else 3046#else
3047 int pos = cat->find ("-field1"); 3047 int pos = cat->find ("-field1");
3048 cat->truncate(pos); 3048 cat->truncate(pos);
3049 categ = *cat; 3049 categ = *cat;
3050#endif 3050#endif
3051 if (!categ.isEmpty()) 3051 if (!categ.isEmpty())
3052 { 3052 {
3053 dialog->CategoryField->insertItem (categ, i); 3053 dialog->CategoryField->insertItem (categ, i);
3054 if (category.compare(categ) == 0) 3054 if (category.compare(categ) == 0)
diff --git a/noncore/comm/keypebble/krfbcanvas.cpp b/noncore/comm/keypebble/krfbcanvas.cpp
index 75cba68..cd1fda0 100644
--- a/noncore/comm/keypebble/krfbcanvas.cpp
+++ b/noncore/comm/keypebble/krfbcanvas.cpp
@@ -24,131 +24,131 @@ KRFBCanvas::KRFBCanvas( QWidget *parent, const char *name )
24 nextDoubleClick=0; 24 nextDoubleClick=0;
25} 25}
26 26
27KRFBCanvas::~KRFBCanvas() 27KRFBCanvas::~KRFBCanvas()
28{ 28{
29} 29}
30 30
31 31
32void KRFBCanvas::openConnection(KRFBServer server) 32void KRFBCanvas::openConnection(KRFBServer server)
33{ 33{
34 34
35 35
36 QCString host = server.hostname.latin1(); 36 QCString host = server.hostname.latin1();
37 password=server.password; 37 password=server.password;
38 connection_->connectTo( server); 38 connection_->connectTo( server);
39} 39}
40 40
41 41
42void KRFBCanvas::openURL( const QUrl &url ) 42void KRFBCanvas::openURL( const QUrl &url )
43{ 43{
44 if ( loggedIn_ ) { 44 if ( loggedIn_ ) {
45 qWarning( "openURL invoked when logged in\n" ); 45 qWarning( "openURL invoked when logged in\n" );
46 return; 46 return;
47 } 47 }
48 48
49 QCString host = url.host().latin1(); 49 QCString host = url.host().latin1();
50 int display = url.port(); 50 int display = url.port();
51 51
52// connection_->connectTo( host, display ); 52// connection_->connectTo( host, display );
53} 53}
54 54
55void KRFBCanvas::closeConnection() 55void KRFBCanvas::closeConnection()
56{ 56{
57 loggedIn_ = false; 57 loggedIn_ = false;
58 connection_->disconnect(); 58 connection_->disconnect();
59 59
60 viewport()->setMouseTracking( false ); 60 viewport()->setMouseTracking( false );
61 viewport()->setBackgroundMode( PaletteDark ); 61 viewport()->setBackgroundMode( PaletteDark );
62 setBackgroundMode( PaletteDark ); 62 setBackgroundMode( PaletteDark );
63 update(); 63 update();
64} 64}
65 65
66 66
67void KRFBCanvas::bell() 67void KRFBCanvas::bell()
68{ 68{
69 if ( connection_->options()->deIconify ) { 69 if ( connection_->options()->deIconify ) {
70 topLevelWidget()->raise(); 70 topLevelWidget()->raise();
71 topLevelWidget()->show(); 71 topLevelWidget()->show();
72 } 72 }
73} 73}
74 74
75void KRFBCanvas::loggedIn() 75void KRFBCanvas::loggedIn()
76{ 76{
77 qWarning( "Ok, we're logged in" ); 77 qWarning( "Ok, we're logged in" );
78 78
79 // 79 //
80 // Get ready for action 80 // Get ready for action
81 // 81 //
82 loggedIn_ = true; 82 loggedIn_ = true;
83 viewport()->setMouseTracking( true ); 83 viewport()->setMouseTracking( true );
84 viewport()->setBackgroundMode( NoBackground ); 84 viewport()->setBackgroundMode( NoBackground );
85 setBackgroundMode( NoBackground ); 85 setBackgroundMode( NoBackground );
86 86
87 // Start using the buffer 87 // Start using the buffer
88 connect( connection_->buffer(), SIGNAL( sizeChanged( int, int ) ), 88 connect( connection_->buffer(), SIGNAL( sizeChanged(int,int) ),
89 this, SLOT( resizeContents(int,int) ) ); 89 this, SLOT( resizeContents(int,int) ) );
90 connect( connection_->buffer(), SIGNAL( updated( int, int, int, int ) ), 90 connect( connection_->buffer(), SIGNAL( updated(int,int,int,int) ),
91 this, SLOT( viewportUpdate(int,int,int,int) ) ); 91 this, SLOT( viewportUpdate(int,int,int,int) ) );
92 connect( connection_->buffer(), SIGNAL( bell() ), 92 connect( connection_->buffer(), SIGNAL( bell() ),
93 this, SLOT( bell() ) ); 93 this, SLOT( bell() ) );
94 connect( qApp->clipboard(), SIGNAL( dataChanged() ), 94 connect( qApp->clipboard(), SIGNAL( dataChanged() ),
95 this, SLOT( clipboardChanged() ) ); 95 this, SLOT( clipboardChanged() ) );
96} 96}
97 97
98void KRFBCanvas::viewportPaintEvent( QPaintEvent *e ) 98void KRFBCanvas::viewportPaintEvent( QPaintEvent *e )
99{ 99{
100 QRect r = e->rect(); 100 QRect r = e->rect();
101 101
102 if ( loggedIn_ ) { 102 if ( loggedIn_ ) {
103 QPixmap p; 103 QPixmap p;
104 104
105 bitBlt( viewport(), r.x(), r.y(), 105 bitBlt( viewport(), r.x(), r.y(),
106 connection_->buffer()->pixmap(), 106 connection_->buffer()->pixmap(),
107 r.x() + contentsX(), r.y() + contentsY(), 107 r.x() + contentsX(), r.y() + contentsY(),
108 r.width(), r.height() ); 108 r.width(), r.height() );
109 } 109 }
110 else { 110 else {
111 QScrollView::viewportPaintEvent( e ); 111 QScrollView::viewportPaintEvent( e );
112 } 112 }
113} 113}
114 114
115void KRFBCanvas::viewportUpdate( int x, int y, int w, int h ) 115void KRFBCanvas::viewportUpdate( int x, int y, int w, int h )
116{ 116{
117 updateContents( x, y, w, h ); 117 updateContents( x, y, w, h );
118} 118}
119 119
120void KRFBCanvas::contentsMousePressEvent( QMouseEvent *e ) 120void KRFBCanvas::contentsMousePressEvent( QMouseEvent *e )
121{ 121{
122 122
123 if (nextDoubleClick) { 123 if (nextDoubleClick) {
124 connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),LeftButton,LeftButton)); 124 connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),LeftButton,LeftButton));
125 connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0)); 125 connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0));
126 connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0)); 126 connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0));
127 connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton)); 127 connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton));
128 connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0)); 128 connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0));
129 } if (nextRightClick) { 129 } if (nextRightClick) {
130 connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),RightButton,RightButton)); 130 connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),RightButton,RightButton));
131 connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),RightButton,0)); 131 connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),RightButton,0));
132 connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton)); 132 connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton));
133 connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0)); 133 connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0));
134 } else if ( loggedIn_ ) 134 } else if ( loggedIn_ )
135 connection_->buffer()->mouseEvent( e ); 135 connection_->buffer()->mouseEvent( e );
136 136
137} 137}
138 138
139void KRFBCanvas::contentsMouseReleaseEvent( QMouseEvent *e ) 139void KRFBCanvas::contentsMouseReleaseEvent( QMouseEvent *e )
140{ 140{
141 if ( loggedIn_ && !nextRightClick && !nextDoubleClick) { 141 if ( loggedIn_ && !nextRightClick && !nextDoubleClick) {
142 connection_->buffer()->mouseEvent( e ); 142 connection_->buffer()->mouseEvent( e );
143 } 143 }
144 144
145 nextRightClick=0; 145 nextRightClick=0;
146 nextDoubleClick=0; 146 nextDoubleClick=0;
147} 147}
148 148
149void KRFBCanvas::contentsMouseMoveEvent( QMouseEvent *e ) 149void KRFBCanvas::contentsMouseMoveEvent( QMouseEvent *e )
150{ 150{
151 if ( loggedIn_ ) 151 if ( loggedIn_ )
152 connection_->buffer()->mouseEvent( e ); 152 connection_->buffer()->mouseEvent( e );
153} 153}
154 154
diff --git a/noncore/comm/keypebble/krfbconnection.cpp b/noncore/comm/keypebble/krfbconnection.cpp
index e6c33c6..b447046 100644
--- a/noncore/comm/keypebble/krfbconnection.cpp
+++ b/noncore/comm/keypebble/krfbconnection.cpp
@@ -1,174 +1,174 @@
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 "krfbdecoder.h" 8#include "krfbdecoder.h"
9#include "krfbbuffer.h" 9#include "krfbbuffer.h"
10 10
11KRFBConnection::KRFBConnection( QObject *parent ) 11KRFBConnection::KRFBConnection( QObject *parent )
12 : QObject( parent, "KRFBConnection" ) 12 : QObject( parent, "KRFBConnection" )
13{ 13{
14 portBase_ = 5900; 14 portBase_ = 5900;
15 currentState_ = Disconnected; 15 currentState_ = Disconnected;
16 sock = 0; 16 sock = 0;
17 minData_ = 0; 17 minData_ = 0;
18 options_ = new KRFBServer(); 18 options_ = new KRFBServer();
19 updater = 0; 19 updater = 0;
20 decoder_ = 0; 20 decoder_ = 0;
21 buffer_ = 0; 21 buffer_ = 0;
22} 22}
23 23
24KRFBConnection::~KRFBConnection() 24KRFBConnection::~KRFBConnection()
25{ 25{
26 if ( ( currentState_ != Disconnected ) && ( currentState_ != Disconnecting ) && sock ) { 26 if ( ( currentState_ != Disconnected ) && ( currentState_ != Disconnecting ) && sock ) {
27 disconnectDone(); 27 disconnectDone();
28 } 28 }
29 delete options_; 29 delete options_;
30} 30}
31 31
32void KRFBConnection::connectTo( KRFBServer server) 32void KRFBConnection::connectTo( KRFBServer server)
33{ 33{
34 if ( currentState_ != Disconnected ) 34 if ( currentState_ != Disconnected )
35 disconnect(); 35 disconnect();
36 36
37 (*options_)=server; 37 (*options_)=server;
38 38
39 sock = new QSocket( this, "rfbSocket" ); 39 sock = new QSocket( this, "rfbSocket" );
40 CHECK_PTR( sock ); 40 CHECK_PTR( sock );
41 41
42 // Connect to something to notice connection or error 42 // Connect to something to notice connection or error
43 connect( sock, SIGNAL( error( int ) ), SLOT( gotSocketError( int ) ) ); 43 connect( sock, SIGNAL( error(int) ), SLOT( gotSocketError(int) ) );
44 connect( sock, SIGNAL( connected() ), SLOT( gotSocketConnection() ) ); 44 connect( sock, SIGNAL( connected() ), SLOT( gotSocketConnection() ) );
45 45
46 qWarning( "Connecting..." ); 46 qWarning( "Connecting..." );
47 47
48 currentState_ = Connecting; 48 currentState_ = Connecting;
49 sock->connectToHost( options_->hostname.latin1(), portBase_ + options_->display ); 49 sock->connectToHost( options_->hostname.latin1(), portBase_ + options_->display );
50} 50}
51 51
52void KRFBConnection::disconnect() 52void KRFBConnection::disconnect()
53{ 53{
54 qWarning( "Disconnecting from server" ); 54 qWarning( "Disconnecting from server" );
55 55
56 if ( ( currentState_ != Disconnected ) 56 if ( ( currentState_ != Disconnected )
57 && ( currentState_ != Disconnecting ) 57 && ( currentState_ != Disconnecting )
58 && sock ) { 58 && sock ) {
59 currentState_ = Disconnecting; 59 currentState_ = Disconnecting;
60 60
61 connect( sock, SIGNAL( delayedCloseFinished() ), SLOT( disconnectDone() ) ); 61 connect( sock, SIGNAL( delayedCloseFinished() ), SLOT( disconnectDone() ) );
62 sock->close(); 62 sock->close();
63 63
64 if ( sock->state() != QSocket::Closing ) 64 if ( sock->state() != QSocket::Closing )
65 disconnectDone(); 65 disconnectDone();
66 } 66 }
67} 67}
68 68
69void KRFBConnection::disconnectDone() 69void KRFBConnection::disconnectDone()
70{ 70{
71 currentState_ = Disconnected; 71 currentState_ = Disconnected;
72 delete sock; 72 delete sock;
73 sock = 0; 73 sock = 0;
74 minData_ = 0; 74 minData_ = 0;
75 delete updater; 75 delete updater;
76 delete decoder_; 76 delete decoder_;
77 delete buffer_; 77 delete buffer_;
78 emit disconnected(); 78 emit disconnected();
79} 79}
80 80
81void KRFBConnection::gotSocketConnection() 81void KRFBConnection::gotSocketConnection()
82{ 82{
83 currentState_ = LoggingIn; 83 currentState_ = LoggingIn;
84 84
85 qWarning( "Connected, logging in..." ); 85 qWarning( "Connected, logging in..." );
86 86
87 static QString statusMsg = tr( "Connected" ); 87 static QString statusMsg = tr( "Connected" );
88 emit statusChanged( statusMsg ); 88 emit statusChanged( statusMsg );
89 89
90 // Do some login stuff 90 // Do some login stuff
91 login = new KRFBLogin( this ); 91 login = new KRFBLogin( this );
92} 92}
93 93
94void KRFBConnection::gotRFBConnection() 94void KRFBConnection::gotRFBConnection()
95{ 95{
96 qWarning( "Logged into server" ); 96 qWarning( "Logged into server" );
97 97
98 currentState_ = Connected; 98 currentState_ = Connected;
99 emit connected(); 99 emit connected();
100 100
101 // Create the decoder and start doing stuff 101 // Create the decoder and start doing stuff
102 decoder_ = new KRFBDecoder( this ); 102 decoder_ = new KRFBDecoder( this );
103 CHECK_PTR( decoder_ ); 103 CHECK_PTR( decoder_ );
104 104
105 buffer_ = new KRFBBuffer( decoder_, this, "RFB Buffer" ); 105 buffer_ = new KRFBBuffer( decoder_, this, "RFB Buffer" );
106 CHECK_PTR( buffer_ ); 106 CHECK_PTR( buffer_ );
107 decoder_->setBuffer( buffer_ ); 107 decoder_->setBuffer( buffer_ );
108 108
109 connect( decoder_, SIGNAL( status( const QString & ) ), 109 connect( decoder_, SIGNAL( status(const QString&) ),
110 this, SIGNAL( statusChanged( const QString & ) ) ); 110 this, SIGNAL( statusChanged(const QString&) ) );
111 emit loggedIn(); 111 emit loggedIn();
112 112
113 decoder_->start(); 113 decoder_->start();
114 114
115 updater = new QTimer; 115 updater = new QTimer;
116 connect( updater, SIGNAL( timeout() ), SLOT( updateTimer() ) ); 116 connect( updater, SIGNAL( timeout() ), SLOT( updateTimer() ) );
117 updater->start( options_->updateRate ); 117 updater->start( options_->updateRate );
118} 118}
119 119
120void KRFBConnection::gotSocketError( int err ) 120void KRFBConnection::gotSocketError( int err )
121{ 121{
122 currentState_ = Error; 122 currentState_ = Error;
123 123
124 // Do some error handling stuff 124 // Do some error handling stuff
125 qWarning( "KRFBConnection: Socket error %d", err ); 125 qWarning( "KRFBConnection: Socket error %d", err );
126 126
127 static QString refused = tr( "Connection Refused" ); 127 static QString refused = tr( "Connection Refused" );
128 static QString host = tr( "Host not found" ); 128 static QString host = tr( "Host not found" );
129 static QString read = tr( "Read Error: QSocket reported an error reading\n" 129 static QString read = tr( "Read Error: QSocket reported an error reading\n"
130 "data, the remote host has probably dropped the\n" 130 "data, the remote host has probably dropped the\n"
131 "connection." ); 131 "connection." );
132 static QString confused = tr( "QSocket reported an invalid error code" ); 132 static QString confused = tr( "QSocket reported an invalid error code" );
133 133
134 QString msg; 134 QString msg;
135 switch ( err ) { 135 switch ( err ) {
136 case QSocket::ErrConnectionRefused: 136 case QSocket::ErrConnectionRefused:
137 msg = refused; 137 msg = refused;
138 break; 138 break;
139 case QSocket::ErrHostNotFound: 139 case QSocket::ErrHostNotFound:
140 msg = host; 140 msg = host;
141 break; 141 break;
142 case QSocket::ErrSocketRead: 142 case QSocket::ErrSocketRead:
143 msg = read; 143 msg = read;
144 break; 144 break;
145 default: 145 default:
146 msg = confused; 146 msg = confused;
147 }; 147 };
148 148
149 QObject::disconnect( sock, SIGNAL( readyRead() ), this, SLOT( gotMoreData() ) ); 149 QObject::disconnect( sock, SIGNAL( readyRead() ), this, SLOT( gotMoreData() ) );
150 delete sock; 150 delete sock;
151 sock = 0; 151 sock = 0;
152 currentState_ = Disconnected; 152 currentState_ = Disconnected;
153 153
154 emit error( msg ); 154 emit error( msg );
155} 155}
156 156
157void KRFBConnection::gotMoreData() 157void KRFBConnection::gotMoreData()
158{ 158{
159 assert( minData_ > 0 ); 159 assert( minData_ > 0 );
160 160
161 if ( sock->size() >= minData_ ) { 161 if ( sock->size() >= minData_ ) {
162 minData_ = 0; 162 minData_ = 0;
163 QObject::disconnect( sock, SIGNAL( readyRead() ), this, SLOT( gotMoreData() ) ); 163 QObject::disconnect( sock, SIGNAL( readyRead() ), this, SLOT( gotMoreData() ) );
164 emit gotEnoughData(); 164 emit gotEnoughData();
165 } 165 }
166} 166}
167 167
168void KRFBConnection::waitForData( unsigned int sz ) 168void KRFBConnection::waitForData( unsigned int sz )
169{ 169{
170 assert( minData_ == 0 ); 170 assert( minData_ == 0 );
171 assert( sz > 0 ); 171 assert( sz > 0 );
172 assert( currentState_ != Error ); 172 assert( currentState_ != Error );
173 173
174 if ( sock->size() >= sz ) { 174 if ( sock->size() >= sz ) {
diff --git a/noncore/comm/keypebble/krfblogin.cpp b/noncore/comm/keypebble/krfblogin.cpp
index 0b4a757..2bbd110 100644
--- a/noncore/comm/keypebble/krfblogin.cpp
+++ b/noncore/comm/keypebble/krfblogin.cpp
@@ -1,116 +1,116 @@
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 11
12// 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
13// wait for). 13// wait for).
14const int ServerVersionLength = 12; 14const int ServerVersionLength = 12;
15const int ClientVersionLength = 12; 15const int ClientVersionLength = 12;
16const int AuthSchemeLength = 4; 16const int AuthSchemeLength = 4;
17const int FailureReasonSizeLength = 4; 17const int FailureReasonSizeLength = 4;
18const int ChallengeLength = 16; 18const int ChallengeLength = 16;
19const int AuthResultLength = 4; 19const int AuthResultLength = 4;
20 20
21// Authentication results 21// Authentication results
22enum AuthResult { 22enum AuthResult {
23 AuthOk, 23 AuthOk,
24 AuthFailed, 24 AuthFailed,
25 AuthTooMany 25 AuthTooMany
26}; 26};
27 27
28typedef unsigned char CARD8; 28typedef unsigned char CARD8;
29typedef unsigned short CARD16; 29typedef unsigned short CARD16;
30typedef unsigned long CARD32; 30typedef unsigned long CARD32;
31 31
32const int endianTest = 1; 32const int endianTest = 1;
33 33
34// Endian stuff 34// Endian stuff
35#define Swap16IfLE(s) \ 35#define Swap16IfLE(s) \
36 (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s)) 36 (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s))
37 37
38#define Swap32IfLE(l) \ 38#define Swap32IfLE(l) \
39 (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \ 39 (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \
40 (((l) & 0x00ff0000) >> 8) | \ 40 (((l) & 0x00ff0000) >> 8) | \
41 (((l) & 0x0000ff00) << 8) | \ 41 (((l) & 0x0000ff00) << 8) | \
42 (((l) & 0x000000ff) << 24)) : (l)) 42 (((l) & 0x000000ff) << 24)) : (l))
43 43
44KRFBLogin::KRFBLogin( KRFBConnection *con ) 44KRFBLogin::KRFBLogin( KRFBConnection *con )
45 : QObject( con, "RFB login manager" ) 45 : QObject( con, "RFB login manager" )
46{ 46{
47 assert( con ); 47 assert( con );
48 this->con = con; 48 this->con = con;
49 currentState = AwaitingServerVersion; 49 currentState = AwaitingServerVersion;
50 50
51 connect( this, SIGNAL( error( const QString & ) ), 51 connect( this, SIGNAL( error(const QString&) ),
52 con, SIGNAL( error( const QString & ) ) ); 52 con, SIGNAL( error(const QString&) ) );
53 53
54 54
55 qWarning( "Waiting for server version..." ); 55 qWarning( "Waiting for server version..." );
56 56
57 static QString statusMsg = tr( "Waiting for server version..." ); 57 static QString statusMsg = tr( "Waiting for server version..." );
58 emit status( statusMsg ); 58 emit status( statusMsg );
59 59
60 // Kick off the state machine 60 // Kick off the state machine
61 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerVersion() ) ); 61 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerVersion() ) );
62 con->waitForData( ServerVersionLength ); 62 con->waitForData( ServerVersionLength );
63} 63}
64 64
65KRFBLogin::~KRFBLogin() 65KRFBLogin::~KRFBLogin()
66{ 66{
67 67
68} 68}
69 69
70KRFBLogin::State KRFBLogin::state() const 70KRFBLogin::State KRFBLogin::state() const
71{ 71{
72 return currentState; 72 return currentState;
73} 73}
74 74
75void KRFBLogin::gotServerVersion() 75void KRFBLogin::gotServerVersion()
76{ 76{
77 qWarning( "Got server version" ); 77 qWarning( "Got server version" );
78 78
79 disconnect( con, SIGNAL( gotEnoughData() ), 79 disconnect( con, SIGNAL( gotEnoughData() ),
80 this, SLOT( gotServerVersion() ) ); 80 this, SLOT( gotServerVersion() ) );
81 81
82 // Read the server's version message 82 // Read the server's version message
83 char serverVersion[ ServerVersionLength + 1 ]; 83 char serverVersion[ ServerVersionLength + 1 ];
84 con->read( serverVersion, ServerVersionLength ); 84 con->read( serverVersion, ServerVersionLength );
85 serverVersion[ ServerVersionLength ] = '\0'; 85 serverVersion[ ServerVersionLength ] = '\0';
86 86
87 QCString rfbString( serverVersion, ServerVersionLength + 1 ); 87 QCString rfbString( serverVersion, ServerVersionLength + 1 );
88 versionString = rfbString; 88 versionString = rfbString;
89 89
90 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" );
91 91
92 if ( rfbString.find( regexp ) == -1 ) { 92 if ( rfbString.find( regexp ) == -1 ) {
93 static QString msg = tr( "Error: Invalid server version, %1" ).arg( rfbString ); 93 static QString msg = tr( "Error: Invalid server version, %1" ).arg( rfbString );
94 94
95 qWarning( msg ); 95 qWarning( msg );
96 emit error( msg ); 96 emit error( msg );
97 currentState = Error; 97 currentState = Error;
98 return; 98 return;
99 } 99 }
100 100
101 // Calculate the actual version number 101 // Calculate the actual version number
102 serverMajor = (serverVersion[4] - '0') * 100 102 serverMajor = (serverVersion[4] - '0') * 100
103 + (serverVersion[5] - '0') * 10 103 + (serverVersion[5] - '0') * 10
104 + (serverVersion[6] - '0'); 104 + (serverVersion[6] - '0');
105 serverMinor = (serverVersion[8] - '0') * 100 105 serverMinor = (serverVersion[8] - '0') * 100
106 + (serverVersion[9] - '0') * 10 106 + (serverVersion[9] - '0') * 10
107 + (serverVersion[10] - '0'); 107 + (serverVersion[10] - '0');
108 108
109 qWarning("Server Version: %03d.%03d", serverMajor, serverMinor ); 109 qWarning("Server Version: %03d.%03d", serverMajor, serverMinor );
110 110
111 if ( serverMajor != 3 ) { 111 if ( serverMajor != 3 ) {
112 QString msg = tr( "Error: Unsupported server version, %1" ) 112 QString msg = tr( "Error: Unsupported server version, %1" )
113 .arg( rfbString ); 113 .arg( rfbString );
114 114
115 qWarning( msg ); 115 qWarning( msg );
116 emit error( msg ); 116 emit error( msg );
diff --git a/noncore/comm/keypebble/kvnc.cpp b/noncore/comm/keypebble/kvnc.cpp
index c678edf..88cb50b 100644
--- a/noncore/comm/keypebble/kvnc.cpp
+++ b/noncore/comm/keypebble/kvnc.cpp
@@ -1,132 +1,132 @@
1#include <qaction.h> 1#include <qaction.h>
2#include <qpopupmenu.h> 2#include <qpopupmenu.h>
3#include <qpushbutton.h> 3#include <qpushbutton.h>
4#include <qmessagebox.h> 4#include <qmessagebox.h>
5#include <qlistbox.h> 5#include <qlistbox.h>
6#include <qpe/qpeapplication.h> 6#include <qpe/qpeapplication.h>
7#include <qpe/resource.h> 7#include <qpe/resource.h>
8 8
9#include <assert.h> 9#include <assert.h>
10 10
11#include "kvnc.h" 11#include "kvnc.h"
12#include "krfbcanvas.h" 12#include "krfbcanvas.h"
13#include "krfbconnection.h" 13#include "krfbconnection.h"
14#include "kvncconndlg.h" 14#include "kvncconndlg.h"
15 15
16static int u_id = 1; 16static int u_id = 1;
17static int get_unique_id() 17static int get_unique_id()
18{ 18{
19 return u_id++; 19 return u_id++;
20} 20}
21 21
22 22
23/* XPM */ 23/* XPM */
24static char * menu_xpm[] = { 24static char * menu_xpm[] = {
25"12 12 5 1", 25"12 12 5 1",
26 " c None", 26 " c None",
27 ".c #000000", 27 ".c #000000",
28 "+c #FFFDAD", 28 "+c #FFFDAD",
29 "@c #FFFF00", 29 "@c #FFFF00",
30 "#c #E5E100", 30 "#c #E5E100",
31" ", 31" ",
32" ", 32" ",
33" ......... ", 33" ......... ",
34" .+++++++. ", 34" .+++++++. ",
35" .+@@@@#. ", 35" .+@@@@#. ",
36" .+@@@#. ", 36" .+@@@#. ",
37" .+@@#. ", 37" .+@@#. ",
38" .+@#. ", 38" .+@#. ",
39" .+#. ", 39" .+#. ",
40" .+. ", 40" .+. ",
41" .. ", 41" .. ",
42" "}; 42" "};
43 43
44const int StatusTextId = 0; 44const int StatusTextId = 0;
45 45
46KVNC::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)
47{ 47{
48 setCaption( tr("VNC Viewer") ); 48 setCaption( tr("VNC Viewer") );
49 fullscreen = false; 49 fullscreen = false;
50 50
51 stack = new QWidgetStack( this ); 51 stack = new QWidgetStack( this );
52 setCentralWidget( stack ); 52 setCentralWidget( stack );
53 53
54 bookmarkSelector=new KVNCBookmarkDlg(); 54 bookmarkSelector=new KVNCBookmarkDlg();
55 stack->addWidget(bookmarkSelector,get_unique_id()); 55 stack->addWidget(bookmarkSelector,get_unique_id());
56 stack->raiseWidget( bookmarkSelector ); 56 stack->raiseWidget( bookmarkSelector );
57 57
58 canvas = new KRFBCanvas( stack, "canvas" ); 58 canvas = new KRFBCanvas( stack, "canvas" );
59 stack->addWidget(canvas,get_unique_id()); 59 stack->addWidget(canvas,get_unique_id());
60 setCentralWidget( stack ); 60 setCentralWidget( stack );
61 61
62 62
63 connect( bookmarkSelector->bookmarkList, SIGNAL(clicked(QListBoxItem *)), 63 connect( bookmarkSelector->bookmarkList, SIGNAL(clicked(QListBoxItem*)),
64 this, SLOT(openConnection(QListBoxItem *)) ); 64 this, SLOT(openConnection(QListBoxItem*)) );
65 connect( canvas->connection(), SIGNAL(statusChanged(const QString &)), 65 connect( canvas->connection(), SIGNAL(statusChanged(const QString&)),
66 this, SLOT(statusMessage(const QString &)) ); 66 this, SLOT(statusMessage(const QString&)) );
67 connect( canvas->connection(), SIGNAL(error(const QString &)), 67 connect( canvas->connection(), SIGNAL(error(const QString&)),
68 this, SLOT(error(const QString &)) ); 68 this, SLOT(error(const QString&)) );
69 connect( canvas->connection(), SIGNAL(connected()), this, SLOT(connected()) ); 69 connect( canvas->connection(), SIGNAL(connected()), this, SLOT(connected()) );
70 connect( canvas->connection(), SIGNAL(loggedIn()), this, SLOT(loggedIn()) ); 70 connect( canvas->connection(), SIGNAL(loggedIn()), this, SLOT(loggedIn()) );
71 connect( canvas->connection(), SIGNAL(disconnected()), this, SLOT(disconnected()) ); 71 connect( canvas->connection(), SIGNAL(disconnected()), this, SLOT(disconnected()) );
72 72
73 setupActions(); 73 setupActions();
74 74
75 cornerButton = new QPushButton( this ); 75 cornerButton = new QPushButton( this );
76 cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); 76 cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) );
77 connect( cornerButton, SIGNAL(pressed()), this, SLOT(showMenu()) ); 77 connect( cornerButton, SIGNAL(pressed()), this, SLOT(showMenu()) );
78 canvas->setCornerWidget( cornerButton ); 78 canvas->setCornerWidget( cornerButton );
79 79
80 stack->raiseWidget( bookmarkSelector ); 80 stack->raiseWidget( bookmarkSelector );
81 81
82 82
83 bar= new QToolBar( this ); 83 bar= new QToolBar( this );
84 setToolBarsMovable( false ); 84 setToolBarsMovable( false );
85 setRightJustification(false); 85 setRightJustification(false);
86 86
87 87
88 QAction *n = new QAction( tr( "New Connection" ), Resource::loadPixmap( "new" ), 88 QAction *n = new QAction( tr( "New Connection" ), Resource::loadPixmap( "new" ),
89 QString::null, 0, this, 0 ); 89 QString::null, 0, this, 0 );
90 connect( n, SIGNAL( activated() ), 90 connect( n, SIGNAL( activated() ),
91 this, SLOT( newConnection() ) ); 91 this, SLOT( newConnection() ) );
92 n->addTo( bar ); 92 n->addTo( bar );
93 93
94 QAction *o = new QAction( tr( "Open Bookmark" ), Resource::loadPixmap( "fileopen" ), 94 QAction *o = new QAction( tr( "Open Bookmark" ), Resource::loadPixmap( "fileopen" ),
95 QString::null, 0, this, 0 ); 95 QString::null, 0, this, 0 );
96 connect( o, SIGNAL( activated() ), 96 connect( o, SIGNAL( activated() ),
97 this, SLOT( openConnection() ) ); 97 this, SLOT( openConnection() ) );
98 o->addTo( bar ); 98 o->addTo( bar );
99 99
100 QAction *d = new QAction( tr( "Delete Bookmark" ), Resource::loadPixmap( "trash" ), 100 QAction *d = new QAction( tr( "Delete Bookmark" ), Resource::loadPixmap( "trash" ),
101 QString::null, 0, this, 0 ); 101 QString::null, 0, this, 0 );
102 connect( d, SIGNAL( activated() ), 102 connect( d, SIGNAL( activated() ),
103 this, SLOT( deleteBookmark() ) ); 103 this, SLOT( deleteBookmark() ) );
104 d->addTo( bar ); 104 d->addTo( bar );
105} 105}
106 106
107KVNC::~KVNC() 107KVNC::~KVNC()
108{ 108{
109 109
110} 110}
111 111
112void KVNC::newConnection() 112void KVNC::newConnection()
113{ 113{
114 curServer=new KRFBServer; 114 curServer=new KRFBServer;
115 115
116 KVNCConnDlg dlg( curServer,this); 116 KVNCConnDlg dlg( curServer,this);
117 if ( QPEApplication::execDialog( &dlg )) { 117 if ( QPEApplication::execDialog( &dlg )) {
118 if (!curServer->name.isEmpty()) 118 if (!curServer->name.isEmpty())
119 bookmarkSelector->addBookmark(curServer); 119 bookmarkSelector->addBookmark(curServer);
120 canvas->openConnection(*curServer); 120 canvas->openConnection(*curServer);
121 } else 121 } else
122 curServer=0; 122 curServer=0;
123} 123}
124 124
125void KVNC::openConnection( QString name) 125void KVNC::openConnection( QString name)
126{ 126{
127 curServer=bookmarkSelector->getServer(name); 127 curServer=bookmarkSelector->getServer(name);
128 128
129 if (curServer) { 129 if (curServer) {
130 KVNCConnDlg dlg( curServer,this); 130 KVNCConnDlg dlg( curServer,this);
131 if ( QPEApplication::execDialog( &dlg ) ) { 131 if ( QPEApplication::execDialog( &dlg ) ) {
132 canvas->openConnection(*curServer); 132 canvas->openConnection(*curServer);
diff --git a/noncore/games/bounce/game.cpp b/noncore/games/bounce/game.cpp
index c07f453..1f1f8cd 100644
--- a/noncore/games/bounce/game.cpp
+++ b/noncore/games/bounce/game.cpp
@@ -260,135 +260,135 @@ JezzView::JezzView(QCanvas* viewing, QWidget* parent, const char* name, WFlags f
260{ 260{
261 setResizePolicy( AutoOne ); 261 setResizePolicy( AutoOne );
262 setHScrollBarMode( AlwaysOff ); 262 setHScrollBarMode( AlwaysOff );
263 setVScrollBarMode( AlwaysOff ); 263 setVScrollBarMode( AlwaysOff );
264 264
265 setCursor( sizeHorCursor ); 265 setCursor( sizeHorCursor );
266} 266}
267 267
268void JezzView::viewportMouseReleaseEvent( QMouseEvent *ev ) 268void JezzView::viewportMouseReleaseEvent( QMouseEvent *ev )
269{ 269{
270 if ( ev->button() & LeftButton ) 270 if ( ev->button() & LeftButton )
271 { 271 {
272 emit buildWall( ev->x()/TILE_SIZE, ev->y()/TILE_SIZE, m_vertical ); 272 emit buildWall( ev->x()/TILE_SIZE, ev->y()/TILE_SIZE, m_vertical );
273 } 273 }
274} 274}
275 275
276void JezzView::changeCursor() 276void JezzView::changeCursor()
277{ 277{
278 m_vertical = !m_vertical; 278 m_vertical = !m_vertical;
279 if ( m_vertical ) 279 if ( m_vertical )
280 { 280 {
281 setCursor( sizeVerCursor ); 281 setCursor( sizeVerCursor );
282 } 282 }
283 else 283 else
284 { 284 {
285 setCursor( sizeHorCursor ); 285 setCursor( sizeHorCursor );
286 } 286 }
287} 287}
288 288
289/*************************************************************************/ 289/*************************************************************************/
290 290
291JezzGame::JezzGame( int ballNum, QWidget *parent, const char *name ) 291JezzGame::JezzGame( int ballNum, QWidget *parent, const char *name )
292 : QWidget( parent, name ), m_wall1( 0 ), m_wall2( 0 ), 292 : QWidget( parent, name ), m_wall1( 0 ), m_wall2( 0 ),
293 m_text( 0 ), m_running( false ), m_percent( 0 ), m_pictured( false ) 293 m_text( 0 ), m_running( false ), m_percent( 0 ), m_pictured( false )
294{ 294{
295 QString path = QPEApplication::qpeDir()+"pics/bounce/"; 295 QString path = QPEApplication::qpeDir()+"pics/bounce/";
296 296
297 // load gfx 297 // load gfx
298 m_ballPixmaps = new QCanvasPixmapArray( path + "ball%1.png", 25 ); 298 m_ballPixmaps = new QCanvasPixmapArray( path + "ball%1.png", 25 );
299 for ( unsigned n=0; n < m_ballPixmaps->count(); n++ ) 299 for ( unsigned n=0; n < m_ballPixmaps->count(); n++ )
300 m_ballPixmaps->image(n)->setOffset( 0, 0 ); 300 m_ballPixmaps->image(n)->setOffset( 0, 0 );
301 301
302 m_arrowPixmaps = new QCanvasPixmapArray( path + "arrow%1.png", 2 ); 302 m_arrowPixmaps = new QCanvasPixmapArray( path + "arrow%1.png", 2 );
303 for ( unsigned n=0; n < m_arrowPixmaps->count(); n++ ) 303 for ( unsigned n=0; n < m_arrowPixmaps->count(); n++ )
304 m_arrowPixmaps->image(n)->setOffset( 0, 0 ); 304 m_arrowPixmaps->image(n)->setOffset( 0, 0 );
305 305
306 QPixmap tiles( path + "tiles.png" ); 306 QPixmap tiles( path + "tiles.png" );
307 307
308 // create field 308 // create field
309 m_field = new JezzField( tiles, this, "m_field" ); 309 m_field = new JezzField( tiles, this, "m_field" );
310 m_field->resize( TILE_SIZE*FIELD_WIDTH, TILE_SIZE*FIELD_HEIGHT ); 310 m_field->resize( TILE_SIZE*FIELD_WIDTH, TILE_SIZE*FIELD_HEIGHT );
311 311
312 for ( int x=0; x<FIELD_WIDTH; x++ ) 312 for ( int x=0; x<FIELD_WIDTH; x++ )
313 m_field->setTile( x, 0, TILE_BORDER ); 313 m_field->setTile( x, 0, TILE_BORDER );
314 for ( int y=1; y<FIELD_HEIGHT-1; y++ ) 314 for ( int y=1; y<FIELD_HEIGHT-1; y++ )
315 { 315 {
316 m_field->setTile( 0, y, TILE_BORDER ); 316 m_field->setTile( 0, y, TILE_BORDER );
317 for ( int x=1; x<FIELD_WIDTH-1; x++ ) 317 for ( int x=1; x<FIELD_WIDTH-1; x++ )
318 m_field->setTile( x, y, TILE_FREE ); 318 m_field->setTile( x, y, TILE_FREE );
319 m_field->setTile( FIELD_WIDTH-1, y, TILE_BORDER ); 319 m_field->setTile( FIELD_WIDTH-1, y, TILE_BORDER );
320 } 320 }
321 for ( int x=0; x<FIELD_WIDTH; x++ ) 321 for ( int x=0; x<FIELD_WIDTH; x++ )
322 m_field->setTile( x, FIELD_HEIGHT-1, TILE_BORDER ); 322 m_field->setTile( x, FIELD_HEIGHT-1, TILE_BORDER );
323 323
324 connect( m_field, SIGNAL(ballCollision(Ball *, int, int, int)), this, SLOT(ballCollision(Ball *, int, int, int)) ); 324 connect( m_field, SIGNAL(ballCollision(Ball*,int,int,int)), this, SLOT(ballCollision(Ball*,int,int,int)) );
325 325
326 // create view 326 // create view
327 m_view = new JezzView( m_field, this, "m_view" ); 327 m_view = new JezzView( m_field, this, "m_view" );
328 m_view->move( 0, 0 ); 328 m_view->move( 0, 0 );
329 m_view->adjustSize(); 329 m_view->adjustSize();
330 connect( m_view, SIGNAL(buildWall(int, int, bool)), this, SLOT(buildWall(int, int, bool)) ); 330 connect( m_view, SIGNAL(buildWall(int,int,bool)), this, SLOT(buildWall(int,int,bool)) );
331 331
332 // create balls 332 // create balls
333 for ( int n=0; n<ballNum; n++ ) 333 for ( int n=0; n<ballNum; n++ )
334 { 334 {
335 Ball *ball = new Ball( m_ballPixmaps, m_field ); 335 Ball *ball = new Ball( m_ballPixmaps, m_field );
336 m_balls.append( ball ); 336 m_balls.append( ball );
337 ball->setVelocity( ((rand() & 1)*2-1)*2, ((rand() & 1)*2-1)*2 ); 337 ball->setVelocity( ((rand() & 1)*2-1)*2, ((rand() & 1)*2-1)*2 );
338 ball->setFrame( rand() % 25 ); 338 ball->setFrame( rand() % 25 );
339 ball->move( 4*TILE_SIZE + ( rand() - 50 ) % ( (FIELD_WIDTH-8)*TILE_SIZE ), 339 ball->move( 4*TILE_SIZE + ( rand() - 50 ) % ( (FIELD_WIDTH-8)*TILE_SIZE ),
340 4*TILE_SIZE + rand() % ( (FIELD_HEIGHT-8)*TILE_SIZE ) ); 340 4*TILE_SIZE + rand() % ( (FIELD_HEIGHT-8)*TILE_SIZE ) );
341 ball->show(); 341 ball->show();
342 } 342 }
343 343
344 // create arrow 344 // create arrow
345 arrow = new Arrow( m_arrowPixmaps, m_field ); 345 arrow = new Arrow( m_arrowPixmaps, m_field );
346 arrow->show(); 346 arrow->show();
347 347
348 // create text label 348 // create text label
349 m_text = new QCanvasText( m_field ); 349 m_text = new QCanvasText( m_field );
350 350
351 // create game clock 351 // create game clock
352 m_clock = new QTimer( this ); 352 m_clock = new QTimer( this );
353 connect( m_clock, SIGNAL(timeout()), this, SLOT(tick()) ); 353 connect( m_clock, SIGNAL(timeout()), this, SLOT(tick()) );
354 m_clock->start( GAME_DELAY ); 354 m_clock->start( GAME_DELAY );
355 355
356 // setup geometry 356 // setup geometry
357 setFixedSize( m_view->size() ); 357 setFixedSize( m_view->size() );
358} 358}
359 359
360JezzGame::~JezzGame() 360JezzGame::~JezzGame()
361{ 361{
362 m_balls.clear(); 362 m_balls.clear();
363 delete m_view; 363 delete m_view;
364 delete m_field; 364 delete m_field;
365 delete m_ballPixmaps; 365 delete m_ballPixmaps;
366} 366}
367 367
368void JezzGame::display( QString text, int size ) 368void JezzGame::display( QString text, int size )
369{ 369{
370 qDebug("This function \"display\" shouldn't be called!!!"); 370 qDebug("This function \"display\" shouldn't be called!!!");
371 if ( !text.isEmpty() ) 371 if ( !text.isEmpty() )
372 { 372 {
373 QFont font( "Helvetica", size, QFont::Bold ); 373 QFont font( "Helvetica", size, QFont::Bold );
374 font.setStyleHint( QFont::Helvetica ); 374 font.setStyleHint( QFont::Helvetica );
375 m_text->setFont( font ); 375 m_text->setFont( font );
376 m_text->setText( text ); 376 m_text->setText( text );
377 377
378 QRect size = m_text->boundingRect(); 378 QRect size = m_text->boundingRect();
379 m_text->move( ( FIELD_WIDTH*TILE_SIZE - size.width() ) / 2, 379 m_text->move( ( FIELD_WIDTH*TILE_SIZE - size.width() ) / 2,
380 ( FIELD_HEIGHT*TILE_SIZE - size.height() ) / 2 ); 380 ( FIELD_HEIGHT*TILE_SIZE - size.height() ) / 2 );
381 381
382 m_text->show(); 382 m_text->show();
383 } else 383 } else
384 { 384 {
385 m_text->hide(); 385 m_text->hide();
386 } 386 }
387} 387}
388 388
389void JezzGame::start() 389void JezzGame::start()
390{ 390{
391 m_running = true; 391 m_running = true;
392} 392}
393 393
394void JezzGame::stop() 394void JezzGame::stop()
@@ -464,139 +464,139 @@ void JezzGame::fill( int x, int y )
464 m_buf[_x][y] = TILE_BORDER; 464 m_buf[_x][y] = TILE_BORDER;
465 stopx = _x; 465 stopx = _x;
466 466
467 // fill above 467 // fill above
468 for ( _x=x+1; _x<stopx; _x++ ) 468 for ( _x=x+1; _x<stopx; _x++ )
469 if ( m_buf[_x][y-1]==TILE_FREE ) fill( _x, y-1 ); 469 if ( m_buf[_x][y-1]==TILE_FREE ) fill( _x, y-1 );
470 470
471 // fill below; 471 // fill below;
472 for ( _x=x+1; _x<stopx; _x++ ) 472 for ( _x=x+1; _x<stopx; _x++ )
473 if ( m_buf[_x][y+1]==TILE_FREE ) fill( _x, y+1 ); 473 if ( m_buf[_x][y+1]==TILE_FREE ) fill( _x, y+1 );
474} 474}
475 475
476void JezzGame::ballCollision( Ball*, int, int, int tile ) 476void JezzGame::ballCollision( Ball*, int, int, int tile )
477{ 477{
478 if ( tile!=TILE_BORDER && tile>TILE_FREE && tile!=TILE_WALLEND ) 478 if ( tile!=TILE_BORDER && tile>TILE_FREE && tile!=TILE_WALLEND )
479 { 479 {
480 // stop walls 480 // stop walls
481 if ( (tile==TILE_WALLUP || tile==TILE_WALLLEFT) && m_wall1 ) 481 if ( (tile==TILE_WALLUP || tile==TILE_WALLLEFT) && m_wall1 )
482 { 482 {
483 m_wall1->finish(); 483 m_wall1->finish();
484 m_wall1->fill( false ); 484 m_wall1->fill( false );
485 delete m_wall1; 485 delete m_wall1;
486 m_wall1 = 0; 486 m_wall1 = 0;
487 } 487 }
488 488
489 if ( (tile==TILE_WALLDOWN || tile==TILE_WALLRIGHT) && m_wall2 ) 489 if ( (tile==TILE_WALLDOWN || tile==TILE_WALLRIGHT) && m_wall2 )
490 { 490 {
491 m_wall2->finish(); 491 m_wall2->finish();
492 m_wall2->fill( false ); 492 m_wall2->fill( false );
493 delete m_wall2; 493 delete m_wall2;
494 m_wall2 = 0; 494 m_wall2 = 0;
495 } 495 }
496 496
497 // update view 497 // update view
498 m_field->update(); 498 m_field->update();
499 m_view->repaint(); 499 m_view->repaint();
500 500
501 // send death msg 501 // send death msg
502 emit died(); 502 emit died();
503 } 503 }
504} 504}
505 505
506void JezzGame::buildWall( int x, int y, bool vertical ) 506void JezzGame::buildWall( int x, int y, bool vertical )
507{ 507{
508 if ( !m_running ) return; 508 if ( !m_running ) return;
509 509
510 if ( m_field->tile(x, y)==TILE_FREE ) 510 if ( m_field->tile(x, y)==TILE_FREE )
511 { 511 {
512 // check whether there is a ball at the moment 512 // check whether there is a ball at the moment
513 QCanvasItemList cols = m_field->collisions( QRect(x*TILE_SIZE, y*TILE_SIZE, TILE_SIZE, TILE_SIZE) ); 513 QCanvasItemList cols = m_field->collisions( QRect(x*TILE_SIZE, y*TILE_SIZE, TILE_SIZE, TILE_SIZE) );
514 if ( cols.count()>0 ) 514 if ( cols.count()>0 )
515 { 515 {
516 //kdDebug() << "Direct collision" << endl; 516 //kdDebug() << "Direct collision" << endl;
517 emit ballCollision( (Ball*)cols.first(), x, y, TILE_WALLUP ); 517 emit ballCollision( (Ball*)cols.first(), x, y, TILE_WALLUP );
518 return; 518 return;
519 } 519 }
520 520
521 // start walls 521 // start walls
522 if ( !m_wall1 ) 522 if ( !m_wall1 )
523 { 523 {
524 m_wall1 = new Wall( m_field, x, y, 524 m_wall1 = new Wall( m_field, x, y,
525 vertical? Wall::Up : Wall::Left, 525 vertical? Wall::Up : Wall::Left,
526 vertical? TILE_WALLUP : TILE_WALLLEFT, 526 vertical? TILE_WALLUP : TILE_WALLLEFT,
527 this, "m_wall1" ); 527 this, "m_wall1" );
528 connect( m_wall1, SIGNAL(finished(Wall *, int)), 528 connect( m_wall1, SIGNAL(finished(Wall*,int)),
529 this, SLOT(wallFinished(Wall *, int)) ); } 529 this, SLOT(wallFinished(Wall*,int)) ); }
530 530
531 if ( !m_wall2 ) 531 if ( !m_wall2 )
532 { 532 {
533 m_wall2 = new Wall( m_field, x, y, 533 m_wall2 = new Wall( m_field, x, y,
534 vertical? Wall::Down: Wall::Right, 534 vertical? Wall::Down: Wall::Right,
535 vertical? TILE_WALLDOWN : TILE_WALLRIGHT, 535 vertical? TILE_WALLDOWN : TILE_WALLRIGHT,
536 this, "m_wall2" ); 536 this, "m_wall2" );
537 connect( m_wall2, SIGNAL(finished(Wall *, int)), 537 connect( m_wall2, SIGNAL(finished(Wall*,int)),
538 this, SLOT(wallFinished(Wall *, int)) ); 538 this, SLOT(wallFinished(Wall*,int)) );
539 } 539 }
540 } 540 }
541} 541}
542 542
543void JezzGame::wallFinished( Wall *wall, int tile ) 543void JezzGame::wallFinished( Wall *wall, int tile )
544{ 544{
545 if ( tile==TILE_WALLEND ) 545 if ( tile==TILE_WALLEND )
546 { 546 {
547 if ( m_wall1 ) 547 if ( m_wall1 )
548 { 548 {
549 m_wall1->fill( false ); 549 m_wall1->fill( false );
550 delete m_wall1; 550 delete m_wall1;
551 m_wall1 = 0; 551 m_wall1 = 0;
552 } 552 }
553 553
554 if ( m_wall2 ) 554 if ( m_wall2 )
555 { 555 {
556 m_wall2->fill( false ); 556 m_wall2->fill( false );
557 delete m_wall2; 557 delete m_wall2;
558 m_wall2 = 0; 558 m_wall2 = 0;
559 } 559 }
560 } else 560 } else
561 { 561 {
562 if ( m_wall1==wall && m_wall1 ) 562 if ( m_wall1==wall && m_wall1 )
563 { 563 {
564 m_wall1->fill( true ); 564 m_wall1->fill( true );
565 delete m_wall1; 565 delete m_wall1;
566 m_wall1 = 0; 566 m_wall1 = 0;
567 } 567 }
568 568
569 if ( m_wall2==wall && m_wall2 ) 569 if ( m_wall2==wall && m_wall2 )
570 { 570 {
571 m_wall2->fill( true ); 571 m_wall2->fill( true );
572 delete m_wall2; 572 delete m_wall2;
573 m_wall2 = 0; 573 m_wall2 = 0;
574 } 574 }
575 } 575 }
576 576
577 m_field->update(); 577 m_field->update();
578 m_view->repaint(); 578 m_view->repaint();
579 579
580 makeBlack(); 580 makeBlack();
581} 581}
582 582
583void JezzGame::tick() 583void JezzGame::tick()
584{ 584{
585 if ( m_running ) 585 if ( m_running )
586 { 586 {
587 if ( m_field ) m_field->advance(); 587 if ( m_field ) m_field->advance();
588 if ( m_wall1 ) m_wall1->advance(); 588 if ( m_wall1 ) m_wall1->advance();
589 if ( m_wall2 ) m_wall2->advance(); 589 if ( m_wall2 ) m_wall2->advance();
590 } else 590 } else
591 { 591 {
592 for ( Ball *ball=m_balls.first(); ball!=0; ball=m_balls.next() ) 592 for ( Ball *ball=m_balls.first(); ball!=0; ball=m_balls.next() )
593 ball->update(); 593 ball->update();
594 594
595 if ( m_field ) m_field->update(); 595 if ( m_field ) m_field->update();
596 if ( m_wall1 ) m_wall1->update(); 596 if ( m_wall1 ) m_wall1->update();
597 if ( m_wall2 ) m_wall2->update(); 597 if ( m_wall2 ) m_wall2->update();
598 } 598 }
599} 599}
600 600
601void JezzGame::changeCursor() 601void JezzGame::changeCursor()
602{ 602{
diff --git a/noncore/games/buzzword/buzzword.cpp b/noncore/games/buzzword/buzzword.cpp
index 13eb481..b7f2573 100644
--- a/noncore/games/buzzword/buzzword.cpp
+++ b/noncore/games/buzzword/buzzword.cpp
@@ -50,129 +50,129 @@ void BuzzLabel::mousePressEvent(QMouseEvent *e)
50 50
51BuzzItem::BuzzItem( int row, int column, QString text, QWidget *parent, const char *name ) 51BuzzItem::BuzzItem( int row, int column, QString text, QWidget *parent, const char *name )
52: QVBox( parent, name ), _row(row), _column(column) 52: QVBox( parent, name ), _row(row), _column(column)
53{ 53{
54 setFrameStyle( QFrame::Panel | QFrame::Raised ); 54 setFrameStyle( QFrame::Panel | QFrame::Raised );
55 setLineWidth( 1 ); 55 setLineWidth( 1 );
56 label = new BuzzLabel(this, "label"); 56 label = new BuzzLabel(this, "label");
57 label->setText(text); 57 label->setText(text);
58 label->setAlignment( int( QLabel::AlignCenter ) ); 58 label->setAlignment( int( QLabel::AlignCenter ) );
59 59
60 connect( label, SIGNAL(clicked()), this, SLOT(flip()) ); 60 connect( label, SIGNAL(clicked()), this, SLOT(flip()) );
61} 61}
62 62
63void BuzzItem::flip() 63void BuzzItem::flip()
64{ 64{
65 setLineWidth( 1 ); 65 setLineWidth( 1 );
66 label->setBackgroundColor(label->colorGroup().highlight()); 66 label->setBackgroundColor(label->colorGroup().highlight());
67 emit clicked(_row, _column); 67 emit clicked(_row, _column);
68} 68}
69 69
70BuzzWord::BuzzWord(QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) 70BuzzWord::BuzzWord(QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl )
71{ 71{
72 setCaption(tr("buZzword")); 72 setCaption(tr("buZzword"));
73 73
74 menu = menuBar(); 74 menu = menuBar();
75 game = new QPopupMenu; 75 game = new QPopupMenu;
76 game->insertItem(tr("&New game"), this, SLOT(newGame()), Key_N ); 76 game->insertItem(tr("&New game"), this, SLOT(newGame()), Key_N );
77 menu->insertItem( tr("&Game"), game ); 77 menu->insertItem( tr("&Game"), game );
78 78
79 gridVal = 4; 79 gridVal = 4;
80 grid = NULL; 80 grid = NULL;
81 gameOver = false; 81 gameOver = false;
82 newGame(); 82 newGame();
83} 83}
84 84
85void BuzzWord::drawGrid() 85void BuzzWord::drawGrid()
86{ 86{
87 QStringList l; 87 QStringList l;
88 88
89 QString path = QPEApplication::qpeDir()+"share/buzzword/"; 89 QString path = QPEApplication::qpeDir()+"share/buzzword/";
90 QFile f( path + "buzzwords" ); 90 QFile f( path + "buzzwords" );
91 if ( !f.open( IO_ReadOnly ) ) 91 if ( !f.open( IO_ReadOnly ) )
92 return; 92 return;
93 93
94 QTextStream t( &f ); 94 QTextStream t( &f );
95 95
96 while (!t.atEnd()) 96 while (!t.atEnd())
97 { 97 {
98 l << t.readLine(); 98 l << t.readLine();
99 } 99 }
100 100
101 f.close(); 101 f.close();
102 102
103 grid = new QGrid(gridVal, this); 103 grid = new QGrid(gridVal, this);
104 //grid->setFixedSize( 480, 480 ); 104 //grid->setFixedSize( 480, 480 );
105 105
106 for( int c = 0 ; c < gridVal ; c++ ) 106 for( int c = 0 ; c < gridVal ; c++ )
107 { 107 {
108 for( int r = 0 ; r < gridVal ; r++ ) 108 for( int r = 0 ; r < gridVal ; r++ )
109 { 109 {
110 uint pos = rand() % l. count(); 110 uint pos = rand() % l. count();
111 111
112 QString word = QStringList::split(" ", l[pos]).join("\n"); 112 QString word = QStringList::split(" ", l[pos]).join("\n");
113 BuzzItem* bi = new BuzzItem( c, r, word, grid ); 113 BuzzItem* bi = new BuzzItem( c, r, word, grid );
114 connect( bi, SIGNAL(clicked(int, int)), this, SLOT(clicked(int,int)) ); 114 connect( bi, SIGNAL(clicked(int,int)), this, SLOT(clicked(int,int)) );
115 map[c][r] = 0; 115 map[c][r] = 0;
116 116
117 l.remove( l.at( pos )); 117 l.remove( l.at( pos ));
118 } 118 }
119 } 119 }
120} 120}
121 121
122void BuzzWord::clicked(int row, int column) 122void BuzzWord::clicked(int row, int column)
123{ 123{
124 if ( ! gameOver ) 124 if ( ! gameOver )
125 { 125 {
126 int rowTotal = 0; 126 int rowTotal = 0;
127 int columnTotal = 0; 127 int columnTotal = 0;
128 128
129 map[column][row] = 1; 129 map[column][row] = 1;
130 130
131 for( int c = 0 ; c < gridVal ; c++ ) 131 for( int c = 0 ; c < gridVal ; c++ )
132 { 132 {
133 for( int r = 0 ; r < gridVal ; r++ ) 133 for( int r = 0 ; r < gridVal ; r++ )
134 { 134 {
135 if ( map[c][r] == 1 ) 135 if ( map[c][r] == 1 )
136 rowTotal++; 136 rowTotal++;
137 137
138 if ( rowTotal == 4 ) 138 if ( rowTotal == 4 )
139 { 139 {
140 bingo(); 140 bingo();
141 } 141 }
142 } 142 }
143 rowTotal = 0; 143 rowTotal = 0;
144 } 144 }
145 145
146 for( int r = 0 ; r < gridVal ; r++ ) 146 for( int r = 0 ; r < gridVal ; r++ )
147 { 147 {
148 for( int c = 0 ; c < gridVal ; c++ ) 148 for( int c = 0 ; c < gridVal ; c++ )
149 { 149 {
150 if ( map[c][r] == 1 ) 150 if ( map[c][r] == 1 )
151 columnTotal++; 151 columnTotal++;
152 152
153 if ( columnTotal == 4 ) 153 if ( columnTotal == 4 )
154 { 154 {
155 bingo(); 155 bingo();
156 } 156 }
157 } 157 }
158 columnTotal = 0; 158 columnTotal = 0;
159 } 159 }
160 160
161 if ( map[0][0] && map[1][1] && map[2][2] && map[3][3] ) 161 if ( map[0][0] && map[1][1] && map[2][2] && map[3][3] )
162 bingo(); 162 bingo();
163 163
164 if ( map[0][3] && map[1][2] && map[2][1] && map[3][0] ) 164 if ( map[0][3] && map[1][2] && map[2][1] && map[3][0] )
165 bingo(); 165 bingo();
166 } 166 }
167} 167}
168 168
169void BuzzWord::bingo() 169void BuzzWord::bingo()
170{ 170{
171 gameOver = true; 171 gameOver = true;
172 QMessageBox::information( this, "BUZZWORD", tr("<h1><b>BINGO !</b></h1>")); 172 QMessageBox::information( this, "BUZZWORD", tr("<h1><b>BINGO !</b></h1>"));
173} 173}
174 174
175void BuzzWord::newGame() 175void BuzzWord::newGame()
176{ 176{
177 gameOver = false; 177 gameOver = false;
178 delete grid; 178 delete grid;
diff --git a/noncore/games/kpacman/kpacman.cpp b/noncore/games/kpacman/kpacman.cpp
index be2e46d..9820e5a 100644
--- a/noncore/games/kpacman/kpacman.cpp
+++ b/noncore/games/kpacman/kpacman.cpp
@@ -1,101 +1,101 @@
1 1
2#include "portable.h" 2#include "portable.h"
3 3
4#if defined( KDE2_PORT ) 4#if defined( KDE2_PORT )
5#include <kpacman.h> 5#include <kpacman.h>
6#include <kpacman.moc> 6#include <kpacman.moc>
7#include <kcolordlg.h> 7#include <kcolordlg.h>
8#elif defined( QPE_PORT ) 8#elif defined( QPE_PORT )
9#include <qmenubar.h> 9#include <qmenubar.h>
10#include <qpe/config.h> 10#include <qpe/config.h>
11#include <qapplication.h> 11#include <qapplication.h>
12#include "kpacman.h" 12#include "kpacman.h"
13#endif 13#endif
14 14
15 15
16Kpacman::Kpacman(QWidget *parent, const char *name) 16Kpacman::Kpacman(QWidget *parent, const char *name)
17 : KTMainWindow(parent, name) 17 : KTMainWindow(parent, name)
18{ 18{
19 schemesPopup = new QList<QPopupMenu>; 19 schemesPopup = new QList<QPopupMenu>;
20 schemesPopup->setAutoDelete(TRUE); 20 schemesPopup->setAutoDelete(TRUE);
21 21
22 menu(); 22 menu();
23 23
24 m_view = new QWidget( this, "m_view" ); 24 m_view = new QWidget( this, "m_view" );
25 m_view->setBackgroundColor( black ); 25 m_view->setBackgroundColor( black );
26 m_layout = new QGridLayout( m_view ); 26 m_layout = new QGridLayout( m_view );
27 m_layout->setMargin( 7 ); 27 m_layout->setMargin( 7 );
28 28
29 view = new KpacmanWidget( this, QString(name)+"widget"); 29 view = new KpacmanWidget( this, QString(name)+"widget");
30 m_layout->addWidget( view, 0, 0 ); 30 m_layout->addWidget( view, 0, 0 );
31 31
32 setCaption( tr("KPacman") ); 32 setCaption( tr("KPacman") );
33 33
34 view->referee->setFocus(); 34 view->referee->setFocus();
35 35
36 connect(view->referee, SIGNAL(setScore(int, int)), 36 connect(view->referee, SIGNAL(setScore(int,int)),
37 view->score, SLOT(setScore(int, int))); 37 view->score, SLOT(setScore(int,int)));
38 connect(view->referee, SIGNAL(setPoints(int)), 38 connect(view->referee, SIGNAL(setPoints(int)),
39 view->score, SLOT(set(int))); 39 view->score, SLOT(set(int)));
40 connect(view->referee, SIGNAL(setLifes(int)), 40 connect(view->referee, SIGNAL(setLifes(int)),
41 view->status, SLOT(setLifes(int))); 41 view->status, SLOT(setLifes(int)));
42 connect(view->referee, SIGNAL(setLevel(int)), 42 connect(view->referee, SIGNAL(setLevel(int)),
43 view->status, SLOT(setLevel(int))); 43 view->status, SLOT(setLevel(int)));
44 connect(view->referee, SIGNAL(forcedHallOfFame(bool)), 44 connect(view->referee, SIGNAL(forcedHallOfFame(bool)),
45 this, SLOT(forcedHallOfFame(bool))); 45 this, SLOT(forcedHallOfFame(bool)));
46 connect(view->referee, SIGNAL(togglePaused()), this, SLOT(togglePaused())); 46 connect(view->referee, SIGNAL(togglePaused()), this, SLOT(togglePaused()));
47 connect(view->referee, SIGNAL(toggleNew()), this, SLOT(toggleNew())); 47 connect(view->referee, SIGNAL(toggleNew()), this, SLOT(toggleNew()));
48 48
49 connect(view->score, SIGNAL(toggleNew()), this, SLOT(toggleNew())); 49 connect(view->score, SIGNAL(toggleNew()), this, SLOT(toggleNew()));
50 connect(view->score, SIGNAL(forcedHallOfFame(bool)), 50 connect(view->score, SIGNAL(forcedHallOfFame(bool)),
51 this, SLOT(forcedHallOfFame(bool))); 51 this, SLOT(forcedHallOfFame(bool)));
52 52
53 APP_CONFIG_BEGIN( cfg ); 53 APP_CONFIG_BEGIN( cfg );
54 focusOutPause = !cfg->readBoolEntry("FocusOutPause", TRUE); 54 focusOutPause = !cfg->readBoolEntry("FocusOutPause", TRUE);
55 focusInContinue = !cfg->readBoolEntry("FocusInContinue", TRUE); 55 focusInContinue = !cfg->readBoolEntry("FocusInContinue", TRUE);
56 hideMouseCursor = !cfg->readBoolEntry("HideMouseCursor", TRUE); 56 hideMouseCursor = !cfg->readBoolEntry("HideMouseCursor", TRUE);
57 APP_CONFIG_END( cfg ); 57 APP_CONFIG_END( cfg );
58 58
59 toggleFocusOutPause(); 59 toggleFocusOutPause();
60 toggleFocusInContinue(); 60 toggleFocusInContinue();
61 toggleHideMouseCursor(); 61 toggleHideMouseCursor();
62 62
63 setCentralWidget( m_view ); 63 setCentralWidget( m_view );
64} 64}
65 65
66Kpacman::~Kpacman() 66Kpacman::~Kpacman()
67{ 67{
68 /* APP_CONFIG_BEGIN( cfg ); 68 /* APP_CONFIG_BEGIN( cfg );
69 cfg->writeEntry("FocusOutPause", focusOutPause); 69 cfg->writeEntry("FocusOutPause", focusOutPause);
70 cfg->writeEntry("FocusInContinue", focusInContinue); 70 cfg->writeEntry("FocusInContinue", focusInContinue);
71 cfg->writeEntry("HideMouseCursor", hideMouseCursor); 71 cfg->writeEntry("HideMouseCursor", hideMouseCursor);
72 APP_CONFIG_END( cfg ); 72 APP_CONFIG_END( cfg );
73 */ 73 */
74 delete _menuBar; 74 delete _menuBar;
75} 75}
76 76
77void Kpacman::menu() 77void Kpacman::menu()
78{ 78{
79 gamePopup = new QPopupMenu(); 79 gamePopup = new QPopupMenu();
80 CHECK_PTR( gamePopup ); 80 CHECK_PTR( gamePopup );
81 newID = gamePopup->insertItem(tr("&New"), this, SLOT(newKpacman()),Key_F2); 81 newID = gamePopup->insertItem(tr("&New"), this, SLOT(newKpacman()),Key_F2);
82 pauseID = gamePopup->insertItem(tr("&Pause"), 82 pauseID = gamePopup->insertItem(tr("&Pause"),
83 this, SLOT(pauseKpacman()), Key_F3); 83 this, SLOT(pauseKpacman()), Key_F3);
84 hofID = gamePopup->insertItem(tr("&Hall of fame"), 84 hofID = gamePopup->insertItem(tr("&Hall of fame"),
85 this, SLOT(toggleHallOfFame()), Key_F4); 85 this, SLOT(toggleHallOfFame()), Key_F4);
86 gamePopup->insertSeparator(); 86 gamePopup->insertSeparator();
87 gamePopup->insertItem(tr("&Quit"), this, SLOT(quitKpacman()), CTRL+Key_Q); 87 gamePopup->insertItem(tr("&Quit"), this, SLOT(quitKpacman()), CTRL+Key_Q);
88 gamePopup->setCheckable(TRUE); 88 gamePopup->setCheckable(TRUE);
89 89
90 optionsPopup = new QPopupMenu(); 90 optionsPopup = new QPopupMenu();
91 CHECK_PTR(optionsPopup); 91 CHECK_PTR(optionsPopup);
92 92
93 modesPopup = new QPopupMenu(); 93 modesPopup = new QPopupMenu();
94 CHECK_PTR(modesPopup); 94 CHECK_PTR(modesPopup);
95 95
96 hideMouseCursorID = optionsPopup->insertItem(tr("&Hide Mousecursor"), 96 hideMouseCursorID = optionsPopup->insertItem(tr("&Hide Mousecursor"),
97 this, SLOT(toggleHideMouseCursor()), 97 this, SLOT(toggleHideMouseCursor()),
98 CTRL+Key_H); 98 CTRL+Key_H);
99 optionsPopup->insertSeparator(); 99 optionsPopup->insertSeparator();
100 100
101 if (lookupSchemes() > 0) { 101 if (lookupSchemes() > 0) {
diff --git a/noncore/games/oyatzee/oyatzee.cpp b/noncore/games/oyatzee/oyatzee.cpp
index 86318db..a55aa73 100644
--- a/noncore/games/oyatzee/oyatzee.cpp
+++ b/noncore/games/oyatzee/oyatzee.cpp
@@ -1,96 +1,96 @@
1#include "oyatzee.h" 1#include "oyatzee.h"
2 2
3#include <qmessagebox.h> 3#include <qmessagebox.h>
4#include <qpushbutton.h> 4#include <qpushbutton.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qlayout.h> 6#include <qlayout.h>
7 7
8#include <stdlib.h> 8#include <stdlib.h>
9 9
10OYatzee::OYatzee( QWidget *parent , const char *name, WFlags fl ) : QMainWindow( parent , name , fl ) 10OYatzee::OYatzee( QWidget *parent , const char *name, WFlags fl ) : QMainWindow( parent , name , fl )
11{ 11{
12 QWidget *thing = new QWidget( this ); 12 QWidget *thing = new QWidget( this );
13 setCentralWidget( thing ); 13 setCentralWidget( thing );
14 14
15 setCaption( tr( "OYatzee" ) ); 15 setCaption( tr( "OYatzee" ) );
16 16
17 setPlayerNumber( 4 ); 17 setPlayerNumber( 4 );
18 setRoundsNumber( 1 ); 18 setRoundsNumber( 1 );
19 19
20 lastPlayerFinished = false; 20 lastPlayerFinished = false;
21 currentPlayer = 1; 21 currentPlayer = 1;
22 22
23 ps.append( new Player( "Carsten" ) ); 23 ps.append( new Player( "Carsten" ) );
24 ps.append( new Player( "Julia" ) ); 24 ps.append( new Player( "Julia" ) );
25 ps.append( new Player( "Christine" ) ); 25 ps.append( new Player( "Christine" ) );
26 ps.append( new Player( "Stephan" ) ); 26 ps.append( new Player( "Stephan" ) );
27 27
28 28
29 QVBoxLayout *vbox = new QVBoxLayout( thing ); 29 QVBoxLayout *vbox = new QVBoxLayout( thing );
30 30
31 sb = new Scoreboard( ps, thing , "sb" ); 31 sb = new Scoreboard( ps, thing , "sb" );
32 connect( sb->pb , SIGNAL( item( int ) ), this , SLOT( slotEndRound( int ) ) ); 32 connect( sb->pb , SIGNAL( item(int) ), this , SLOT( slotEndRound(int) ) );
33 33
34 dw = new DiceWidget( thing , "dw" ); 34 dw = new DiceWidget( thing , "dw" );
35 dw->setMaximumHeight( this->height()/4 ); 35 dw->setMaximumHeight( this->height()/4 );
36 connect( dw->rollButton, SIGNAL( clicked() ), this , SLOT( slotRollDices() ) ); 36 connect( dw->rollButton, SIGNAL( clicked() ), this , SLOT( slotRollDices() ) );
37 37
38 vbox->addWidget( sb ); 38 vbox->addWidget( sb );
39 vbox->addWidget( dw ); 39 vbox->addWidget( dw );
40} 40}
41 41
42void OYatzee::slotEndRound( int item ) 42void OYatzee::slotEndRound( int item )
43{ 43{
44 qDebug( "Der User hat Nummer %d ausgewählt" , item ); 44 qDebug( "Der User hat Nummer %d ausgewählt" , item );
45 45
46 /* 46 /*
47 * if the user clicked on Total, Bonus or Score and thus not on a 47 * if the user clicked on Total, Bonus or Score and thus not on a
48 * selectable item return and do nothing 48 * selectable item return and do nothing
49 */ 49 */
50 if ( item == 7 || item == 8 || item == 16 ) return; 50 if ( item == 7 || item == 8 || item == 16 ) return;
51 51
52 /* 52 /*
53 * check if the user can really click on that item 53 * check if the user can really click on that item
54 */ 54 */
55 if ( posibilities.find( item ) == posibilities.end() ) return; 55 if ( posibilities.find( item ) == posibilities.end() ) return;
56 56
57 QValueListInt numbers; 57 QValueListInt numbers;
58 58
59 Dice *d = dw->diceList.first(); 59 Dice *d = dw->diceList.first();
60 for ( ; d != 0 ; d = dw->diceList.next() ) 60 for ( ; d != 0 ; d = dw->diceList.next() )
61 { 61 {
62 numbers.append( d->hasValue() ); 62 numbers.append( d->hasValue() );
63 } 63 }
64 64
65 int points = 0; 65 int points = 0;
66 66
67 switch ( item ) 67 switch ( item )
68 { 68 {
69 case Ones: 69 case Ones:
70 points = getPoints( 1 , numbers ); 70 points = getPoints( 1 , numbers );
71 break; 71 break;
72 case Twos: 72 case Twos:
73 points = getPoints( 2 , numbers ); 73 points = getPoints( 2 , numbers );
74 break; 74 break;
75 case Threes: 75 case Threes:
76 points = getPoints( 3 , numbers ); 76 points = getPoints( 3 , numbers );
77 break; 77 break;
78 case Fours: 78 case Fours:
79 points = getPoints( 4 , numbers ); 79 points = getPoints( 4 , numbers );
80 break; 80 break;
81 case Fives: 81 case Fives:
82 points = getPoints( 5 , numbers ); 82 points = getPoints( 5 , numbers );
83 break; 83 break;
84 case Sixes: 84 case Sixes:
85 points = getPoints( 6 , numbers ); 85 points = getPoints( 6 , numbers );
86 break; 86 break;
87 case ThreeOfAKind: 87 case ThreeOfAKind:
88 points = oakPoints; 88 points = oakPoints;
89 break; 89 break;
90 case FourOfAKind: 90 case FourOfAKind:
91 points = oakPoints; 91 points = oakPoints;
92 break; 92 break;
93 case FullHouse: 93 case FullHouse:
94 points = 25; 94 points = 25;
95 break; 95 break;
96 case SStraight: 96 case SStraight:
@@ -585,103 +585,103 @@ Board::Board( QWidget *parent , const char* name ) : QWidget ( parent , name )
585void Board::mousePressEvent( QMouseEvent *e ) 585void Board::mousePressEvent( QMouseEvent *e )
586{ 586{
587 emit clicked( e->pos() ); 587 emit clicked( e->pos() );
588} 588}
589 589
590/* 590/*
591 * Resultboard 591 * Resultboard
592 */ 592 */
593 593
594Resultboard::Resultboard( QString playerName , QWidget *parent , const char* name ) : Board ( parent , name ) 594Resultboard::Resultboard( QString playerName , QWidget *parent , const char* name ) : Board ( parent , name )
595{ 595{
596 pName = playerName; 596 pName = playerName;
597} 597}
598 598
599void Resultboard::paintEvent( QPaintEvent* ) 599void Resultboard::paintEvent( QPaintEvent* )
600{ 600{
601 QPainter p; 601 QPainter p;
602 p.begin( this ); 602 p.begin( this );
603 603
604 const int cell_width = this->width(); 604 const int cell_width = this->width();
605 const int cell_height = this->height()/17; 605 const int cell_height = this->height()/17;
606 606
607 pointMap::Iterator it = pMap.begin(); 607 pointMap::Iterator it = pMap.begin();
608 for ( ; it != pMap.end() ; ++it ) 608 for ( ; it != pMap.end() ; ++it )
609 { 609 {
610 int i = it.key(); 610 int i = it.key();
611 qDebug( "ok: %d , %d" , i , it.data() ); 611 qDebug( "ok: %d , %d" , i , it.data() );
612 p.drawText( 0, i*cell_height , cell_width , cell_height , Qt::AlignCenter , QString::number( it.data() ) ); 612 p.drawText( 0, i*cell_height , cell_width , cell_height , Qt::AlignCenter , QString::number( it.data() ) );
613 } 613 }
614 614
615 p.drawText( 0,0,cell_width,cell_height, Qt::AlignCenter , pName ); //Playername 615 p.drawText( 0,0,cell_width,cell_height, Qt::AlignCenter , pName ); //Playername
616} 616}
617 617
618 618
619void Resultboard::updateMap( int item , int points ) 619void Resultboard::updateMap( int item , int points )
620{ 620{
621 pMap.insert( item , points ); 621 pMap.insert( item , points );
622 622
623 update(); 623 update();
624} 624}
625 625
626/* 626/*
627 * Possibilityboard 627 * Possibilityboard
628 */ 628 */
629 629
630Possibilityboard::Possibilityboard( QWidget *parent , const char* name ) : Board ( parent , name ) 630Possibilityboard::Possibilityboard( QWidget *parent , const char* name ) : Board ( parent , name )
631{ 631{
632 begriffe.append( "1er" ); 632 begriffe.append( "1er" );
633 begriffe.append( "2er" ); 633 begriffe.append( "2er" );
634 begriffe.append( "3er" ); 634 begriffe.append( "3er" );
635 begriffe.append( "4er" ); 635 begriffe.append( "4er" );
636 begriffe.append( "5er" ); 636 begriffe.append( "5er" );
637 begriffe.append( "6er" ); 637 begriffe.append( "6er" );
638 begriffe.append( "Total" ); 638 begriffe.append( "Total" );
639 begriffe.append( "Bonus" ); 639 begriffe.append( "Bonus" );
640 begriffe.append( "3oaK" ); 640 begriffe.append( "3oaK" );
641 begriffe.append( "4oaK" ); 641 begriffe.append( "4oaK" );
642 begriffe.append( "Full House" ); 642 begriffe.append( "Full House" );
643 begriffe.append( "Short S" ); 643 begriffe.append( "Short S" );
644 begriffe.append( "Long S" ); 644 begriffe.append( "Long S" );
645 begriffe.append( "Yatzee!" ); 645 begriffe.append( "Yatzee!" );
646 begriffe.append( "Chance" ); 646 begriffe.append( "Chance" );
647 begriffe.append( "Score" ); 647 begriffe.append( "Score" );
648 648
649 connect( this , SIGNAL( clicked( QPoint ) ), this , SLOT( slotClicked( QPoint ) ) ); 649 connect( this , SIGNAL( clicked(QPoint) ), this , SLOT( slotClicked(QPoint) ) );
650} 650}
651 651
652void Possibilityboard::slotClicked( QPoint p) 652void Possibilityboard::slotClicked( QPoint p)
653{ 653{
654 emit item( p.y()/(this->height()/17) ); 654 emit item( p.y()/(this->height()/17) );
655} 655}
656 656
657void Possibilityboard::paintEvent( QPaintEvent* ) 657void Possibilityboard::paintEvent( QPaintEvent* )
658{ 658{
659 QPainter p; 659 QPainter p;
660 p.begin( this ); 660 p.begin( this );
661 661
662 const int cell_width = this->width(); 662 const int cell_width = this->width();
663 const int cell_height = this->height()/17; 663 const int cell_height = this->height()/17;
664 664
665 p.setBrush( Qt::blue ); 665 p.setBrush( Qt::blue );
666 666
667 QValueListInt::Iterator listIt = list.begin(); 667 QValueListInt::Iterator listIt = list.begin();
668 for ( ; listIt != list.end() ; ++listIt ) 668 for ( ; listIt != list.end() ; ++listIt )
669 { 669 {
670 p.drawRect( 0 , (*listIt) * cell_height , cell_width , cell_height ); 670 p.drawRect( 0 , (*listIt) * cell_height , cell_width , cell_height );
671 } 671 }
672 672
673 p.setBrush( Qt::black ); 673 p.setBrush( Qt::black );
674 p.setBrush( Qt::NoBrush ); 674 p.setBrush( Qt::NoBrush );
675 QStringList::Iterator begriffeIt = begriffe.begin(); 675 QStringList::Iterator begriffeIt = begriffe.begin();
676 for ( int i = 1 ; i < 18 ; ++i ) 676 for ( int i = 1 ; i < 18 ; ++i )
677 { 677 {
678 p.drawText( 0 , i*cell_height , cell_width , cell_height , Qt::AlignCenter , *begriffeIt ); 678 p.drawText( 0 , i*cell_height , cell_width , cell_height , Qt::AlignCenter , *begriffeIt );
679 ++begriffeIt; 679 ++begriffeIt;
680 } 680 }
681} 681}
682 682
683void Possibilityboard::setIntlist( QValueListInt &l ) 683void Possibilityboard::setIntlist( QValueListInt &l )
684{ 684{
685 list = l; 685 list = l;
686} 686}
687 687
diff --git a/noncore/multimedia/camera/gui/mainwindow.cpp b/noncore/multimedia/camera/gui/mainwindow.cpp
index 2f42049..e4e1b6c 100644
--- a/noncore/multimedia/camera/gui/mainwindow.cpp
+++ b/noncore/multimedia/camera/gui/mainwindow.cpp
@@ -37,130 +37,130 @@ using namespace Opie;
37#include <qcombobox.h> 37#include <qcombobox.h>
38#include <qcursor.h> 38#include <qcursor.h>
39#include <qdatastream.h> 39#include <qdatastream.h>
40#include <qdir.h> 40#include <qdir.h>
41#include <qfile.h> 41#include <qfile.h>
42#include <qimage.h> 42#include <qimage.h>
43#include <qlabel.h> 43#include <qlabel.h>
44#include <qlineedit.h> 44#include <qlineedit.h>
45#include <qpopupmenu.h> 45#include <qpopupmenu.h>
46#include <qprogressbar.h> 46#include <qprogressbar.h>
47#include <qpushbutton.h> 47#include <qpushbutton.h>
48#include <qmessagebox.h> 48#include <qmessagebox.h>
49#include <qlayout.h> 49#include <qlayout.h>
50#include <qdirectpainter_qws.h> 50#include <qdirectpainter_qws.h>
51 51
52/* STD */ 52/* STD */
53#include <assert.h> 53#include <assert.h>
54#include <sys/types.h> 54#include <sys/types.h>
55#include <sys/stat.h> 55#include <sys/stat.h>
56#include <fcntl.h> 56#include <fcntl.h>
57#include <string.h> 57#include <string.h>
58#include <errno.h> 58#include <errno.h>
59#include <unistd.h> 59#include <unistd.h>
60 60
61#define CAPTUREFILE "/tmp/capture.dat" 61#define CAPTUREFILE "/tmp/capture.dat"
62#define OUTPUTFILE "/tmp/output.avi" 62#define OUTPUTFILE "/tmp/output.avi"
63 63
64#define OUTPUT_TO_CUSTOM 250 64#define OUTPUT_TO_CUSTOM 250
65#define OUTPUT_TO_DOCFOLDER 251 65#define OUTPUT_TO_DOCFOLDER 251
66 66
67CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f ) 67CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f )
68 :QMainWindow( parent, name, f ), 68 :QMainWindow( parent, name, f ),
69 _rotation( 270 ), // FIXME: get this from current settings (ODevice?) 69 _rotation( 270 ), // FIXME: get this from current settings (ODevice?)
70 _capturing( false ), 70 _capturing( false ),
71 _pics( 1 ), _videos( 1 ) 71 _pics( 1 ), _videos( 1 )
72{ 72{
73 #ifdef QT_NO_DEBUG 73 #ifdef QT_NO_DEBUG
74 if ( !ZCameraIO::instance()->isOpen() ) 74 if ( !ZCameraIO::instance()->isOpen() )
75 { 75 {
76 QVBox* v = new QVBox( this ); 76 QVBox* v = new QVBox( this );
77 v->setMargin( 10 ); 77 v->setMargin( 10 );
78 QLabel* l1 = new QLabel( v ); 78 QLabel* l1 = new QLabel( v );
79 l1->setPixmap( Resource::loadPixmap( "camera/error" ) ); 79 l1->setPixmap( Resource::loadPixmap( "camera/error" ) );
80 QLabel* l2 = new QLabel( v ); 80 QLabel* l2 = new QLabel( v );
81 l2->setText( "<b>Sorry. could not detect your camera :-(</b><p>" 81 l2->setText( "<b>Sorry. could not detect your camera :-(</b><p>"
82 "* Is the sharpzdc_cs module loaded ?<br>" 82 "* Is the sharpzdc_cs module loaded ?<br>"
83 "* Is /dev/sharpzdc read/writable ?<p>" ); 83 "* Is /dev/sharpzdc read/writable ?<p>" );
84 connect( new QPushButton( "Exit", v ), SIGNAL( clicked() ), this, SLOT( close() ) ); 84 connect( new QPushButton( "Exit", v ), SIGNAL( clicked() ), this, SLOT( close() ) );
85 setCentralWidget( v ); 85 setCentralWidget( v );
86 return; 86 return;
87 } 87 }
88 #endif 88 #endif
89 89
90 init(); 90 init();
91 91
92 _rotation = 270; //TODO: grab these from the actual settings 92 _rotation = 270; //TODO: grab these from the actual settings
93 93
94 preview = new PreviewWidget( this, "camera preview widget" ); 94 preview = new PreviewWidget( this, "camera preview widget" );
95 //setCentralWidget( preview ); <--- don't do this! 95 //setCentralWidget( preview ); <--- don't do this!
96 preview->resize( QSize( 240, 288 ) ); 96 preview->resize( QSize( 240, 288 ) );
97 preview->show(); 97 preview->show();
98 98
99 // construct a System Channel to receive setRotation messages 99 // construct a System Channel to receive setRotation messages
100 _sysChannel = new QCopChannel( "QPE/System", this ); 100 _sysChannel = new QCopChannel( "QPE/System", this );
101 connect( _sysChannel, SIGNAL( received( const QCString&, const QByteArray& ) ), 101 connect( _sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
102 this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); 102 this, SLOT( systemMessage(const QCString&,const QByteArray&) ) );
103 103
104 connect( preview, SIGNAL( contextMenuRequested() ), this, SLOT( showContextMenu() ) ); 104 connect( preview, SIGNAL( contextMenuRequested() ), this, SLOT( showContextMenu() ) );
105 105
106 connect( ZCameraIO::instance(), SIGNAL( shutterClicked() ), this, SLOT( shutterClicked() ) ); 106 connect( ZCameraIO::instance(), SIGNAL( shutterClicked() ), this, SLOT( shutterClicked() ) );
107 107
108 updateCaption(); 108 updateCaption();
109 109
110}; 110};
111 111
112 112
113CameraMainWindow::~CameraMainWindow() 113CameraMainWindow::~CameraMainWindow()
114{ 114{
115 // write back configuration 115 // write back configuration
116 OConfigGroupSaver cgs( oApp->config(), "General" ); 116 OConfigGroupSaver cgs( oApp->config(), "General" );
117 cgs.config()->writeEntry( "flip", flip ); 117 cgs.config()->writeEntry( "flip", flip );
118 cgs.config()->writeEntry( "quality", quality ); 118 cgs.config()->writeEntry( "quality", quality );
119 cgs.config()->writeEntry( "zoom", zoom ); 119 cgs.config()->writeEntry( "zoom", zoom );
120 cgs.config()->writeEntry( "captureX", captureX ); 120 cgs.config()->writeEntry( "captureX", captureX );
121 cgs.config()->writeEntry( "captureY", captureY ); 121 cgs.config()->writeEntry( "captureY", captureY );
122 cgs.config()->writeEntry( "captureFormat", captureFormat ); 122 cgs.config()->writeEntry( "captureFormat", captureFormat );
123 cgs.config()->writeEntry( "outputTo", outputTo ); 123 cgs.config()->writeEntry( "outputTo", outputTo );
124 cgs.config()->writeEntry( "prefix", prefix ); 124 cgs.config()->writeEntry( "prefix", prefix );
125 cgs.config()->writeEntry( "appendSettings", appendSettings ); 125 cgs.config()->writeEntry( "appendSettings", appendSettings );
126} 126}
127 127
128 128
129void CameraMainWindow::init() 129void CameraMainWindow::init()
130{ 130{
131 // get values from configuration 131 // get values from configuration
132 OConfigGroupSaver cgs( oApp->config(), "General" ); 132 OConfigGroupSaver cgs( oApp->config(), "General" );
133 flip = cgs.config()->readEntry( "flip", "A" ); 133 flip = cgs.config()->readEntry( "flip", "A" );
134 quality = cgs.config()->readNumEntry( "quality", 50 ); 134 quality = cgs.config()->readNumEntry( "quality", 50 );
135 zoom = cgs.config()->readNumEntry( "zoom", 1 ); 135 zoom = cgs.config()->readNumEntry( "zoom", 1 );
136 captureX = cgs.config()->readNumEntry( "captureX", 480 ); 136 captureX = cgs.config()->readNumEntry( "captureX", 480 );
137 captureY = cgs.config()->readNumEntry( "captureY", 640 ); 137 captureY = cgs.config()->readNumEntry( "captureY", 640 );
138 captureFormat = cgs.config()->readEntry( "captureFormat", "JPEG" ); 138 captureFormat = cgs.config()->readEntry( "captureFormat", "JPEG" );
139 outputTo = cgs.config()->readEntry( "outputTo", "Documents Folder" ); 139 outputTo = cgs.config()->readEntry( "outputTo", "Documents Folder" );
140 prefix = cgs.config()->readEntry( "prefix", "Untitled" ); 140 prefix = cgs.config()->readEntry( "prefix", "Untitled" );
141 appendSettings = cgs.config()->readBoolEntry( "appendSettings", true ); 141 appendSettings = cgs.config()->readBoolEntry( "appendSettings", true );
142 142
143 // create action groups 143 // create action groups
144 QAction* a; 144 QAction* a;
145 resog = new QActionGroup( 0, "reso", true ); 145 resog = new QActionGroup( 0, "reso", true );
146 resog->setToggleAction( true ); 146 resog->setToggleAction( true );
147 new QAction( " 64 x 48", 0, 0, resog, "64x48", true ); 147 new QAction( " 64 x 48", 0, 0, resog, "64x48", true );
148 new QAction( "128 x 96", 0, 0, resog, "128x96", true ); 148 new QAction( "128 x 96", 0, 0, resog, "128x96", true );
149 new QAction( "192 x 144", 0, 0, resog, "192x144", true ); 149 new QAction( "192 x 144", 0, 0, resog, "192x144", true );
150 new QAction( "256 x 192", 0, 0, resog, "256x192", true ); 150 new QAction( "256 x 192", 0, 0, resog, "256x192", true );
151 new QAction( "320 x 240", 0, 0, resog, "320x240", true ); 151 new QAction( "320 x 240", 0, 0, resog, "320x240", true );
152 new QAction( "384 x 288", 0, 0, resog, "384x288", true ); 152 new QAction( "384 x 288", 0, 0, resog, "384x288", true );
153 new QAction( "448 x 336", 0, 0, resog, "448x336", true ); 153 new QAction( "448 x 336", 0, 0, resog, "448x336", true );
154 new QAction( "512 x 384", 0, 0, resog, "512x384", true ); 154 new QAction( "512 x 384", 0, 0, resog, "512x384", true );
155 new QAction( "576 x 432", 0, 0, resog, "576x432", true ); 155 new QAction( "576 x 432", 0, 0, resog, "576x432", true );
156 new QAction( "640 x 480", 0, 0, resog, "640x480", true ); 156 new QAction( "640 x 480", 0, 0, resog, "640x480", true );
157 a = (QAction*) resog->child( QString().sprintf( "%dx%d", captureX>captureY ? captureX:captureY, captureX>captureY ? captureY:captureX ) ); 157 a = (QAction*) resog->child( QString().sprintf( "%dx%d", captureX>captureY ? captureX:captureY, captureX>captureY ? captureY:captureX ) );
158 if ( a ) a->setOn( true ); 158 if ( a ) a->setOn( true );
159 else owarn << "can't set resolution" << oendl; 159 else owarn << "can't set resolution" << oendl;
160 160
161 qualityg = new QActionGroup( 0, "quality", true ); 161 qualityg = new QActionGroup( 0, "quality", true );
162 qualityg->setToggleAction( true ); 162 qualityg->setToggleAction( true );
163 new QAction( " 0 (&minimal)", 0, 0, qualityg, "0", true ); 163 new QAction( " 0 (&minimal)", 0, 0, qualityg, "0", true );
164 new QAction( " 25 (&low)", 0, 0, qualityg, "25", true ); 164 new QAction( " 25 (&low)", 0, 0, qualityg, "25", true );
165 new QAction( " 50 (&good)", 0, 0, qualityg, "50", true ); 165 new QAction( " 50 (&good)", 0, 0, qualityg, "50", true );
166 new QAction( " 75 (&better)", 0, 0, qualityg, "75", true ); 166 new QAction( " 75 (&better)", 0, 0, qualityg, "75", true );
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 870b4f3..f3eafab 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -18,129 +18,129 @@
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34 34
35#include "audiowidget.h" 35#include "audiowidget.h"
36#include "mediaplayerstate.h" 36#include "mediaplayerstate.h"
37#include "playlistwidget.h" 37#include "playlistwidget.h"
38 38
39#include <qpe/qpeapplication.h> 39#include <qpe/qpeapplication.h>
40 40
41namespace 41namespace
42{ 42{
43 43
44const int xo = -2; // movable x offset 44const int xo = -2; // movable x offset
45const int yo = 22; // movable y offset 45const int yo = 22; // movable y offset
46 46
47const MediaWidget::SkinButtonInfo skinInfo[] = 47const MediaWidget::SkinButtonInfo skinInfo[] =
48{ 48{
49 { MediaWidget::Play, "play", MediaWidget::ToggleButton }, 49 { MediaWidget::Play, "play", MediaWidget::ToggleButton },
50 { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, 50 { MediaWidget::Stop, "stop", MediaWidget::NormalButton },
51 { MediaWidget::Next, "next", MediaWidget::NormalButton }, 51 { MediaWidget::Next, "next", MediaWidget::NormalButton },
52 { MediaWidget::Previous, "prev", MediaWidget::NormalButton }, 52 { MediaWidget::Previous, "prev", MediaWidget::NormalButton },
53 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, 53 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton },
54 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, 54 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton },
55 { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, 55 { MediaWidget::Loop, "loop", MediaWidget::ToggleButton },
56 { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, 56 { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton },
57 { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, 57 { MediaWidget::Forward, "forward", MediaWidget::NormalButton },
58 { MediaWidget::Back, "back", MediaWidget::NormalButton } 58 { MediaWidget::Back, "back", MediaWidget::NormalButton }
59}; 59};
60 60
61const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); 61const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] );
62 62
63void changeTextColor( QWidget * w) { 63void changeTextColor( QWidget * w) {
64 QPalette p = w->palette(); 64 QPalette p = w->palette();
65 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); 65 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
66 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); 66 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
67 w->setPalette( p ); 67 w->setPalette( p );
68} 68}
69 69
70} 70}
71 71
72AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : 72AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) :
73 73
74 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), 74 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ),
75 audioSliderBeingMoved( false ) 75 audioSliderBeingMoved( false )
76{ 76{
77 setCaption( tr("OpiePlayer") ); 77 setCaption( tr("OpiePlayer") );
78 78
79 loadSkin(); 79 loadSkin();
80 80
81 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 81 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
82 connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); 82 connect( &mediaPlayerState, SIGNAL( isSeekableToggled(bool) ), this, SLOT( setSeekable(bool) ) );
83 83
84 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); 84 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) );
85 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); 85 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) );
86 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); 86 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) );
87 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); 87 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) );
88 88
89 // Intialise state 89 // Intialise state
90 setLength( mediaPlayerState.length() ); 90 setLength( mediaPlayerState.length() );
91 setPosition( mediaPlayerState.position() ); 91 setPosition( mediaPlayerState.position() );
92 setLooping( mediaPlayerState.isFullscreen() ); 92 setLooping( mediaPlayerState.isFullscreen() );
93 // setPaused( mediaPlayerState->paused() ); 93 // setPaused( mediaPlayerState->paused() );
94 setPlaying( mediaPlayerState.isPlaying() ); 94 setPlaying( mediaPlayerState.isPlaying() );
95} 95}
96 96
97AudioWidget::~AudioWidget() { 97AudioWidget::~AudioWidget() {
98 98
99// mediaPlayerState->setPlaying(false); 99// mediaPlayerState->setPlaying(false);
100} 100}
101 101
102MediaWidget::GUIInfo AudioWidget::guiInfo() 102MediaWidget::GUIInfo AudioWidget::guiInfo()
103{ 103{
104 return GUIInfo( QString::null /* infix */, ::skinInfo, ::buttonCount ); 104 return GUIInfo( QString::null /* infix */, ::skinInfo, ::buttonCount );
105} 105}
106 106
107void AudioWidget::resizeEvent( QResizeEvent *e ) { 107void AudioWidget::resizeEvent( QResizeEvent *e ) {
108 int h = height(); 108 int h = height();
109 int w = width(); 109 int w = width();
110 110
111 songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); 111 songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) );
112 slider.setFixedWidth( w - 110 ); 112 slider.setFixedWidth( w - 110 );
113 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 113 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
114 slider.setBackgroundOrigin( QWidget::ParentOrigin ); 114 slider.setBackgroundOrigin( QWidget::ParentOrigin );
115 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); 115 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
116 116
117 upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2; 117 upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2;
118 upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10; 118 upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10;
119 119
120 MediaWidget::resizeEvent( e ); 120 MediaWidget::resizeEvent( e );
121} 121}
122 122
123void AudioWidget::sliderPressed() { 123void AudioWidget::sliderPressed() {
124 audioSliderBeingMoved = TRUE; 124 audioSliderBeingMoved = TRUE;
125} 125}
126 126
127 127
128void AudioWidget::sliderReleased() { 128void AudioWidget::sliderReleased() {
129 audioSliderBeingMoved = FALSE; 129 audioSliderBeingMoved = FALSE;
130 if ( slider.width() == 0 ) 130 if ( slider.width() == 0 )
131 return; 131 return;
132 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); 132 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width());
133 mediaPlayerState.setPosition( val ); 133 mediaPlayerState.setPosition( val );
134} 134}
135 135
136void AudioWidget::setPosition( long i ) { 136void AudioWidget::setPosition( long i ) {
137 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); 137 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
138 updateSlider( i, mediaPlayerState.length() ); 138 updateSlider( i, mediaPlayerState.length() );
139} 139}
140 140
141 141
142void AudioWidget::setLength( long max ) { 142void AudioWidget::setLength( long max ) {
143 updateSlider( mediaPlayerState.position(), max ); 143 updateSlider( mediaPlayerState.position(), max );
144} 144}
145 145
146 146
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 9f51006..1e6bc4d 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,109 +1,109 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <qpe/config.h> 2#include <qpe/config.h>
3#include <qpe/qcopenvelope_qws.h> 3#include <qpe/qcopenvelope_qws.h>
4#include <qfileinfo.h> 4#include <qfileinfo.h>
5 5
6#include "mediaplayer.h" 6#include "mediaplayer.h"
7#include "playlistwidget.h" 7#include "playlistwidget.h"
8#include "audiowidget.h" 8#include "audiowidget.h"
9#include "videowidget.h" 9#include "videowidget.h"
10#include "volumecontrol.h" 10#include "volumecontrol.h"
11#include "lib.h" 11#include "lib.h"
12 12
13#include "mediaplayerstate.h" 13#include "mediaplayerstate.h"
14 14
15 // for setBacklight() 15 // for setBacklight()
16#include <linux/fb.h> 16#include <linux/fb.h>
17#include <sys/file.h> 17#include <sys/file.h>
18#include <sys/ioctl.h> 18#include <sys/ioctl.h>
19 19
20 20
21#define FBIOBLANK 0x4611 21#define FBIOBLANK 0x4611
22 22
23MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) 23MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name )
24 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { 24 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) {
25 25
26 m_audioUI = 0; 26 m_audioUI = 0;
27 m_videoUI = 0; 27 m_videoUI = 0;
28 m_xineControl = 0; 28 m_xineControl = 0;
29 xine = new XINE::Lib( XINE::Lib::InitializeInThread ); 29 xine = new XINE::Lib( XINE::Lib::InitializeInThread );
30 30
31 fd=-1;fl=-1; 31 fd=-1;fl=-1;
32 playList.setCaption( tr( "OpiePlayer: Initializating" ) ); 32 playList.setCaption( tr( "OpiePlayer: Initializating" ) );
33 33
34 qApp->processEvents(); 34 qApp->processEvents();
35 // QPEApplication::grabKeyboard(); // EVIL 35 // QPEApplication::grabKeyboard(); // EVIL
36 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 36 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
37 37
38 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 38 connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
39 39
40// What is pauseCheck good for? (Simon) 40// What is pauseCheck good for? (Simon)
41// connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 41// connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pauseCheck(bool) ) );
42 42
43 connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 43 connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
44 connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 44 connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
45 connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); 45 connect( &mediaPlayerState, SIGNAL( blankToggled(bool) ), this, SLOT ( blank(bool) ) );
46 46
47 volControl = new VolumeControl; 47 volControl = new VolumeControl;
48 Config cfg( "OpiePlayer" ); 48 Config cfg( "OpiePlayer" );
49 cfg.setGroup("PlayList"); 49 cfg.setGroup("PlayList");
50 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 50 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
51 playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); 51 playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() );
52 52
53 m_skinLoader = new SkinLoader; 53 m_skinLoader = new SkinLoader;
54 m_skinLoader->schedule( AudioWidget::guiInfo() ); 54 m_skinLoader->schedule( AudioWidget::guiInfo() );
55 m_skinLoader->schedule( VideoWidget::guiInfo() ); 55 m_skinLoader->schedule( VideoWidget::guiInfo() );
56 m_skinLoader->start(); 56 m_skinLoader->start();
57} 57}
58 58
59MediaPlayer::~MediaPlayer() { 59MediaPlayer::~MediaPlayer() {
60 // this shold never happen, but one never knows... 60 // this shold never happen, but one never knows...
61 if ( xine ) { 61 if ( xine ) {
62 xine->ensureInitialized(); 62 xine->ensureInitialized();
63 delete xine; 63 delete xine;
64 } 64 }
65 delete m_xineControl; 65 delete m_xineControl;
66 delete m_audioUI; 66 delete m_audioUI;
67 delete m_videoUI; 67 delete m_videoUI;
68 delete volControl; 68 delete volControl;
69} 69}
70 70
71void MediaPlayer::pauseCheck( bool b ) { 71void MediaPlayer::pauseCheck( bool b ) {
72 if ( b && !mediaPlayerState.isPlaying() ) { 72 if ( b && !mediaPlayerState.isPlaying() ) {
73 mediaPlayerState.setPaused( FALSE ); 73 mediaPlayerState.setPaused( FALSE );
74 } 74 }
75} 75}
76 76
77void MediaPlayer::play() { 77void MediaPlayer::play() {
78 mediaPlayerState.setPlaying( FALSE ); 78 mediaPlayerState.setPlaying( FALSE );
79 mediaPlayerState.setPlaying( TRUE ); 79 mediaPlayerState.setPlaying( TRUE );
80} 80}
81 81
82void MediaPlayer::setPlaying( bool play ) { 82void MediaPlayer::setPlaying( bool play ) {
83 if ( !play ) { 83 if ( !play ) {
84 return; 84 return;
85 } 85 }
86 86
87 if ( mediaPlayerState.isPaused() ) { 87 if ( mediaPlayerState.isPaused() ) {
88 mediaPlayerState.setPaused( FALSE ); 88 mediaPlayerState.setPaused( FALSE );
89 return; 89 return;
90 } 90 }
91 91
92 QString tickerText, time, fileName; 92 QString tickerText, time, fileName;
93 if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) { 93 if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) {
94 //if playing in file list.. play in a different way 94 //if playing in file list.. play in a different way
95 // random and looping settings enabled causes problems here, 95 // random and looping settings enabled causes problems here,
96 // since there is no selected file in the playlist, but a selected file in the file list, 96 // since there is no selected file in the playlist, but a selected file in the file list,
97 // so we remember and shutoff 97 // so we remember and shutoff
98 l = mediaPlayerState.isLooping(); 98 l = mediaPlayerState.isLooping();
99 if(l) { 99 if(l) {
100 mediaPlayerState.setLooping( false ); 100 mediaPlayerState.setLooping( false );
101 } 101 }
102 r = mediaPlayerState.isShuffled(); 102 r = mediaPlayerState.isShuffled();
103 mediaPlayerState.setShuffled( false ); 103 mediaPlayerState.setShuffled( false );
104 } 104 }
105 105
106 PlayListWidget::Entry playListEntry = playList.currentEntry(); 106 PlayListWidget::Entry playListEntry = playList.currentEntry();
107 fileName = playListEntry.name; 107 fileName = playListEntry.name;
108 xineControl()->play( playListEntry.file ); 108 xineControl()->play( playListEntry.file );
109 109
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index f193001..08c62a2 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -1,101 +1,101 @@
1/* 1/*
2 Copyright (C) 2002 Simon Hausmann <simon@lst.de> 2 Copyright (C) 2002 Simon Hausmann <simon@lst.de>
3 (C) 2002 Max Reiss <harlekin@handhelds.org> 3 (C) 2002 Max Reiss <harlekin@handhelds.org>
4 (C) 2002 L. Potter <ljp@llornkcor.com> 4 (C) 2002 L. Potter <ljp@llornkcor.com>
5 (C) 2002 Holger Freyther <zecke@handhelds.org> 5 (C) 2002 Holger Freyther <zecke@handhelds.org>
6 6
7 This program is free software; you can redistribute it and/or 7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public 8 modify it under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details. 15 General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to 18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23#include <assert.h> 23#include <assert.h>
24 24
25#include "mediawidget.h" 25#include "mediawidget.h"
26#include "playlistwidget.h" 26#include "playlistwidget.h"
27#include "skin.h" 27#include "skin.h"
28 28
29MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) 29MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
30 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) 30 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList )
31{ 31{
32 connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), 32 connect( &mediaPlayerState, SIGNAL( displayTypeChanged(MediaPlayerState::DisplayType) ),
33 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); 33 this, SLOT( setDisplayType(MediaPlayerState::DisplayType) ) );
34 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), 34 connect( &mediaPlayerState, SIGNAL( lengthChanged(long) ),
35 this, SLOT( setLength( long ) ) ); 35 this, SLOT( setLength(long) ) );
36 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), 36 connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ),
37 this, SLOT( setPlaying( bool ) ) ); 37 this, SLOT( setPlaying(bool) ) );
38 38
39 setBackgroundMode( NoBackground ); 39 setBackgroundMode( NoBackground );
40} 40}
41 41
42MediaWidget::~MediaWidget() 42MediaWidget::~MediaWidget()
43{ 43{
44} 44}
45 45
46void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, 46void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
47 const Skin &skin ) 47 const Skin &skin )
48{ 48{
49 buttonMask = skin.buttonMask( skinInfo, buttonCount ); 49 buttonMask = skin.buttonMask( skinInfo, buttonCount );
50 50
51 buttons.clear(); 51 buttons.clear();
52 buttons.reserve( buttonCount ); 52 buttons.reserve( buttonCount );
53 53
54 for ( uint i = 0; i < buttonCount; ++i ) { 54 for ( uint i = 0; i < buttonCount; ++i ) {
55 Button button = setupButton( skinInfo[ i ], skin ); 55 Button button = setupButton( skinInfo[ i ], skin );
56 buttons.push_back( button ); 56 buttons.push_back( button );
57 } 57 }
58} 58}
59 59
60MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) 60MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin )
61{ 61{
62 Button button; 62 Button button;
63 button.command = buttonInfo.command; 63 button.command = buttonInfo.command;
64 button.type = buttonInfo.type; 64 button.type = buttonInfo.type;
65 button.mask = skin.buttonMaskImage( buttonInfo.fileName ); 65 button.mask = skin.buttonMaskImage( buttonInfo.fileName );
66 66
67 return button; 67 return button;
68} 68}
69 69
70void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo ) 70void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo )
71{ 71{
72 Skin skin( guiInfo.fileNameInfix ); 72 Skin skin( guiInfo.fileNameInfix );
73 skin.setCachable( false ); 73 skin.setCachable( false );
74 loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin ); 74 loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin );
75} 75}
76 76
77void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) 77void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin )
78{ 78{
79 backgroundPixmap = skin.backgroundPixmap(); 79 backgroundPixmap = skin.backgroundPixmap();
80 buttonUpImage = skin.buttonUpImage(); 80 buttonUpImage = skin.buttonUpImage();
81 buttonDownImage = skin.buttonDownImage(); 81 buttonDownImage = skin.buttonDownImage();
82 82
83 setupButtons( skinInfo, buttonCount, skin ); 83 setupButtons( skinInfo, buttonCount, skin );
84} 84}
85 85
86void MediaWidget::closeEvent( QCloseEvent * ) 86void MediaWidget::closeEvent( QCloseEvent * )
87{ 87{
88 mediaPlayerState.setList(); 88 mediaPlayerState.setList();
89} 89}
90 90
91void MediaWidget::paintEvent( QPaintEvent *pe ) 91void MediaWidget::paintEvent( QPaintEvent *pe )
92{ 92{
93 QPainter p( this ); 93 QPainter p( this );
94 94
95 if ( mediaPlayerState.isFullscreen() ) { 95 if ( mediaPlayerState.isFullscreen() ) {
96 // Clear the background 96 // Clear the background
97 p.setBrush( QBrush( Qt::black ) ); 97 p.setBrush( QBrush( Qt::black ) );
98 return; 98 return;
99 } 99 }
100 100
101 QPixmap buffer( size() ); 101 QPixmap buffer( size() );
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 9a9e1ec..0a84268 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -2,216 +2,216 @@
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#include <qtoolbar.h> 34#include <qtoolbar.h>
35 35
36#include <opie/ofiledialog.h> 36#include <opie/ofiledialog.h>
37 37
38#include <qmessagebox.h> 38#include <qmessagebox.h>
39 39
40#include "playlistselection.h" 40#include "playlistselection.h"
41#include "playlistwidget.h" 41#include "playlistwidget.h"
42#include "mediaplayer.h" 42#include "mediaplayer.h"
43#include "mediaplayerstate.h" 43#include "mediaplayerstate.h"
44#include "inputDialog.h" 44#include "inputDialog.h"
45#include "om3u.h" 45#include "om3u.h"
46#include "playlistfileview.h" 46#include "playlistfileview.h"
47 47
48//only needed for the random play 48//only needed for the random play
49#include <assert.h> 49#include <assert.h>
50 50
51PlayListWidget::PlayListWidget(QWidget* parent, const char* name, WFlags fl ) 51PlayListWidget::PlayListWidget(QWidget* parent, const char* name, WFlags fl )
52 : PlayListWidgetGui( parent, "playList" ) , currentFileListView( 0 ) 52 : PlayListWidgetGui( parent, "playList" ) , currentFileListView( 0 )
53{ 53{
54 mediaPlayerState = new MediaPlayerState(0, "mediaPlayerState" ); 54 mediaPlayerState = new MediaPlayerState(0, "mediaPlayerState" );
55 m_mp = new MediaPlayer(*this, *mediaPlayerState, 0, "mediaPlayer"); 55 m_mp = new MediaPlayer(*this, *mediaPlayerState, 0, "mediaPlayer");
56 56
57 57
58 58
59 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), 59 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
60 "opieplayer2/add_to_playlist", 60 "opieplayer2/add_to_playlist",
61 this , SLOT(addSelected() ) ); 61 this , SLOT(addSelected() ) );
62 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), 62 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
63 "opieplayer2/remove_from_playlist", 63 "opieplayer2/remove_from_playlist",
64 this , SLOT(removeSelected() ) ); 64 this , SLOT(removeSelected() ) );
65 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", 65 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
66 this , SLOT( btnPlay( bool) ), TRUE ); 66 this , SLOT( btnPlay(bool) ), TRUE );
67 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", 67 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
68 mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); 68 mediaPlayerState, SLOT( setShuffled(bool) ), TRUE );
69 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", 69 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
70 mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); 70 mediaPlayerState, SLOT( setLooping(bool) ), TRUE );
71 71
72 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 72 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
73 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), 73 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ),
74 this, SLOT( addAllMusicToList() ) ); 74 this, SLOT( addAllMusicToList() ) );
75 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), 75 (void)new MenuItem( pmPlayList, tr( "Add all video files" ),
76 this, SLOT( addAllVideoToList() ) ); 76 this, SLOT( addAllVideoToList() ) );
77 (void)new MenuItem( pmPlayList, tr( "Add all files" ), 77 (void)new MenuItem( pmPlayList, tr( "Add all files" ),
78 this, SLOT( addAllToList() ) ); 78 this, SLOT( addAllToList() ) );
79 pmPlayList->insertSeparator(-1); 79 pmPlayList->insertSeparator(-1);
80 (void)new MenuItem( pmPlayList, tr( "Add File" ), 80 (void)new MenuItem( pmPlayList, tr( "Add File" ),
81 this,SLOT( openFile() ) ); 81 this,SLOT( openFile() ) );
82 (void)new MenuItem( pmPlayList, tr("Add URL"), 82 (void)new MenuItem( pmPlayList, tr("Add URL"),
83 this,SLOT( openURL() ) ); 83 this,SLOT( openURL() ) );
84 pmPlayList->insertSeparator(-1); 84 pmPlayList->insertSeparator(-1);
85 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), 85 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ),
86 this, SLOT(writem3u() ) ); 86 this, SLOT(writem3u() ) );
87 pmPlayList->insertSeparator(-1); 87 pmPlayList->insertSeparator(-1);
88 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), 88 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ),
89 audioView, SLOT( scanFiles() ) ); 89 audioView, SLOT( scanFiles() ) );
90 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), 90 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ),
91 videoView, SLOT( scanFiles() ) ); 91 videoView, SLOT( scanFiles() ) );
92 92
93 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), 93 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"),
94 mediaPlayerState, SLOT( toggleFullscreen() ) ); 94 mediaPlayerState, SLOT( toggleFullscreen() ) );
95 95
96 Config cfg( "OpiePlayer" ); 96 Config cfg( "OpiePlayer" );
97 bool b= cfg.readBoolEntry("FullScreen", 0); 97 bool b= cfg.readBoolEntry("FullScreen", 0);
98 mediaPlayerState->setFullscreen( b ); 98 mediaPlayerState->setFullscreen( b );
99 pmView->setItemChecked( -16, b ); 99 pmView->setItemChecked( -16, b );
100 100
101 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", 101 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up",
102 d->selectedFiles, SLOT(moveSelectedUp() ) ); 102 d->selectedFiles, SLOT(moveSelectedUp() ) );
103 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", 103 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut",
104 d->selectedFiles, SLOT(removeSelected() ) ); 104 d->selectedFiles, SLOT(removeSelected() ) );
105 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", 105 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down",
106 d->selectedFiles, SLOT(moveSelectedDown() ) ); 106 d->selectedFiles, SLOT(moveSelectedDown() ) );
107 QVBox *stretch2 = new QVBox( vbox1 ); 107 QVBox *stretch2 = new QVBox( vbox1 );
108 108
109 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), 109 connect( tbDeletePlaylist, ( SIGNAL( released() ) ),
110 SLOT( deletePlaylist() ) ); 110 SLOT( deletePlaylist() ) );
111 connect( pmView, SIGNAL( activated( int ) ), 111 connect( pmView, SIGNAL( activated(int) ),
112 this, SLOT( pmViewActivated( int ) ) ); 112 this, SLOT( pmViewActivated(int) ) );
113 connect( skinsMenu, SIGNAL( activated( int ) ) , 113 connect( skinsMenu, SIGNAL( activated(int) ) ,
114 this, SLOT( skinsMenuActivated( int ) ) ); 114 this, SLOT( skinsMenuActivated(int) ) );
115 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 115 connect( d->selectedFiles, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
116 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 116 this,SLOT( playlistViewPressed(int,QListViewItem*,const QPoint&,int) ) );
117 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), 117 connect( audioView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
118 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 118 this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) );
119 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), 119 connect( audioView, SIGNAL( returnPressed(QListViewItem*) ),
120 this,SLOT( playIt( QListViewItem *) ) ); 120 this,SLOT( playIt(QListViewItem*) ) );
121 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), 121 connect( audioView, SIGNAL( doubleClicked(QListViewItem*) ),
122 this, SLOT( addToSelection( QListViewItem *) ) ); 122 this, SLOT( addToSelection(QListViewItem*) ) );
123 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 123 connect( videoView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
124 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); 124 this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) );
125 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), 125 connect( videoView, SIGNAL( returnPressed(QListViewItem*) ),
126 this,SLOT( playIt( QListViewItem *) ) ); 126 this,SLOT( playIt(QListViewItem*) ) );
127 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), 127 connect( videoView, SIGNAL( doubleClicked(QListViewItem*) ),
128 this, SLOT( addToSelection( QListViewItem *) ) ); 128 this, SLOT( addToSelection(QListViewItem*) ) );
129 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), 129 connect( playLists, SIGNAL( fileSelected(const DocLnk&) ),
130 this, SLOT( loadList( const DocLnk & ) ) ); 130 this, SLOT( loadList(const DocLnk&) ) );
131 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), 131 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ),
132 this, SLOT( tabChanged( QWidget* ) ) ); 132 this, SLOT( tabChanged(QWidget*) ) );
133 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), 133 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ),
134 d->tbPlay, SLOT( setOn( bool ) ) ); 134 d->tbPlay, SLOT( setOn(bool) ) );
135 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), 135 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ),
136 d->tbLoop, SLOT( setOn( bool ) ) ); 136 d->tbLoop, SLOT( setOn(bool) ) );
137 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), 137 connect( mediaPlayerState, SIGNAL( shuffledToggled(bool) ),
138 d->tbShuffle, SLOT( setOn( bool ) ) ); 138 d->tbShuffle, SLOT( setOn(bool) ) );
139 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), 139 connect( d->selectedFiles, SIGNAL( doubleClicked(QListViewItem*) ),
140 this, SLOT( playIt( QListViewItem *) ) ); 140 this, SLOT( playIt(QListViewItem*) ) );
141 connect ( gammaSlider, SIGNAL( valueChanged( int ) ), 141 connect ( gammaSlider, SIGNAL( valueChanged(int) ),
142 mediaPlayerState, SLOT( setVideoGamma( int ) ) ); 142 mediaPlayerState, SLOT( setVideoGamma(int) ) );
143 143
144 connect( this, SIGNAL(skinSelected() ), 144 connect( this, SIGNAL(skinSelected() ),
145 m_mp, SLOT( reloadSkins() ) ); 145 m_mp, SLOT( reloadSkins() ) );
146 146
147 // see which skins are installed 147 // see which skins are installed
148 populateSkinsMenu(); 148 populateSkinsMenu();
149 initializeStates(); 149 initializeStates();
150 150
151 channel = new QCopChannel( "QPE/Application/opieplayer2", this ); 151 channel = new QCopChannel( "QPE/Application/opieplayer2", this );
152 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 152 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
153 this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); 153 this, SLOT( qcopReceive(const QCString&,const QByteArray&)) );
154 154
155 155
156 cfg.setGroup("PlayList"); 156 cfg.setGroup("PlayList");
157 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 157 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
158 loadList(DocLnk( currentPlaylist ) ); 158 loadList(DocLnk( currentPlaylist ) );
159 159
160 tabWidget->showPage( playListTab ); 160 tabWidget->showPage( playListTab );
161} 161}
162 162
163 163
164PlayListWidget::~PlayListWidget() { 164PlayListWidget::~PlayListWidget() {
165 delete d; 165 delete d;
166 delete m_mp; 166 delete m_mp;
167} 167}
168 168
169 169
170void PlayListWidget::initializeStates() { 170void PlayListWidget::initializeStates() {
171 d->tbPlay->setOn( mediaPlayerState->isPlaying() ); 171 d->tbPlay->setOn( mediaPlayerState->isPlaying() );
172 d->tbLoop->setOn( mediaPlayerState->isLooping() ); 172 d->tbLoop->setOn( mediaPlayerState->isLooping() );
173 d->tbShuffle->setOn( mediaPlayerState->isShuffled() ); 173 d->tbShuffle->setOn( mediaPlayerState->isShuffled() );
174 d->playListFrame->show(); 174 d->playListFrame->show();
175} 175}
176 176
177void PlayListWidget::writeDefaultPlaylist() { 177void PlayListWidget::writeDefaultPlaylist() {
178 178
179 Config config( "OpiePlayer" ); 179 Config config( "OpiePlayer" );
180 config.setGroup( "PlayList" ); 180 config.setGroup( "PlayList" );
181 QString filename=QPEApplication::documentDir() + "/default.m3u"; 181 QString filename=QPEApplication::documentDir() + "/default.m3u";
182 QString currentString = config.readEntry( "CurrentPlaylist", filename); 182 QString currentString = config.readEntry( "CurrentPlaylist", filename);
183 if( currentString == filename) { 183 if( currentString == filename) {
184 Om3u *m3uList; 184 Om3u *m3uList;
185 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); 185 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>");
186 if( d->selectedFiles->first() ) { 186 if( d->selectedFiles->first() ) {
187 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); 187 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
188 do { 188 do {
189 // qDebug(d->selectedFiles->current()->file()); 189 // qDebug(d->selectedFiles->current()->file());
190 m3uList->add( d->selectedFiles->current()->file() ); 190 m3uList->add( d->selectedFiles->current()->file() );
191 } 191 }
192 while ( d->selectedFiles->next() ); 192 while ( d->selectedFiles->next() );
193 193
194 m3uList->write(); 194 m3uList->write();
195 m3uList->close(); 195 m3uList->close();
196 delete m3uList; 196 delete m3uList;
197 197
198 } 198 }
199 } 199 }
200} 200}
201 201
202void PlayListWidget::addToSelection( const DocLnk& lnk ) { 202void PlayListWidget::addToSelection( const DocLnk& lnk ) {
203 d->setDocumentUsed = FALSE; 203 d->setDocumentUsed = FALSE;
204 if( QFileInfo( lnk.file() ).exists() || 204 if( QFileInfo( lnk.file() ).exists() ||
205 lnk.file().left(4) == "http" ) { 205 lnk.file().left(4) == "http" ) {
206 d->selectedFiles->addToSelection( lnk ); 206 d->selectedFiles->addToSelection( lnk );
207 } 207 }
208// writeCurrentM3u(); 208// writeCurrentM3u();
209} 209}
210 210
211 211
212void PlayListWidget::clearList() { 212void PlayListWidget::clearList() {
213 while ( first() ) { 213 while ( first() ) {
214 d->selectedFiles->removeSelected(); 214 d->selectedFiles->removeSelected();
215 } 215 }
216 Config cfg( "OpiePlayer" ); 216 Config cfg( "OpiePlayer" );
217 cfg.setGroup("PlayList"); 217 cfg.setGroup("PlayList");
@@ -442,176 +442,176 @@ void PlayListWidget::loadList( const DocLnk & lnk) {
442 tabWidget->setCurrentPage(0); 442 tabWidget->setCurrentPage(0);
443 } 443 }
444} 444}
445 445
446void PlayListWidget::addSelected() { 446void PlayListWidget::addSelected() {
447 assert( inFileListMode() ); 447 assert( inFileListMode() );
448 448
449 QListViewItemIterator it( currentFileListView ); 449 QListViewItemIterator it( currentFileListView );
450 for ( ; it.current(); ++it ) 450 for ( ; it.current(); ++it )
451 if ( it.current()->isSelected() ) { 451 if ( it.current()->isSelected() ) {
452 QString filename = it.current()->text(3); 452 QString filename = it.current()->text(3);
453 453
454 DocLnk lnk; 454 DocLnk lnk;
455 lnk.setName( QFileInfo( filename ).baseName() ); //sets name 455 lnk.setName( QFileInfo( filename ).baseName() ); //sets name
456 lnk.setFile( filename ); //sets file name 456 lnk.setFile( filename ); //sets file name
457 457
458 d->selectedFiles->addToSelection( lnk ); 458 d->selectedFiles->addToSelection( lnk );
459 } 459 }
460 460
461 currentFileListView->clearSelection(); 461 currentFileListView->clearSelection();
462 462
463 writeCurrentM3u(); 463 writeCurrentM3u();
464} 464}
465 465
466 466
467void PlayListWidget::removeSelected() { 467void PlayListWidget::removeSelected() {
468 d->selectedFiles->removeSelected( ); 468 d->selectedFiles->removeSelected( );
469 writeCurrentM3u(); 469 writeCurrentM3u();
470} 470}
471 471
472 472
473void PlayListWidget::playIt( QListViewItem *it) { 473void PlayListWidget::playIt( QListViewItem *it) {
474 if(!it) return; 474 if(!it) return;
475 mediaPlayerState->setPlaying(FALSE); 475 mediaPlayerState->setPlaying(FALSE);
476 mediaPlayerState->setPlaying(TRUE); 476 mediaPlayerState->setPlaying(TRUE);
477 d->selectedFiles->unSelect(); 477 d->selectedFiles->unSelect();
478} 478}
479 479
480 480
481void PlayListWidget::addToSelection( QListViewItem *it) { 481void PlayListWidget::addToSelection( QListViewItem *it) {
482 d->setDocumentUsed = FALSE; 482 d->setDocumentUsed = FALSE;
483 483
484 if(it) { 484 if(it) {
485 if ( currentTab() == CurrentPlayList ) 485 if ( currentTab() == CurrentPlayList )
486 return; 486 return;
487 DocLnk lnk; 487 DocLnk lnk;
488 QString filename; 488 QString filename;
489 489
490 filename=it->text(3); 490 filename=it->text(3);
491 lnk.setName( QFileInfo(filename).baseName() ); //sets name 491 lnk.setName( QFileInfo(filename).baseName() ); //sets name
492 lnk.setFile( filename ); //sets file name 492 lnk.setFile( filename ); //sets file name
493 d->selectedFiles->addToSelection( lnk); 493 d->selectedFiles->addToSelection( lnk);
494 494
495 writeCurrentM3u(); 495 writeCurrentM3u();
496// tabWidget->setCurrentPage(0); 496// tabWidget->setCurrentPage(0);
497 497
498 } 498 }
499} 499}
500 500
501 501
502void PlayListWidget::tabChanged(QWidget *) { 502void PlayListWidget::tabChanged(QWidget *) {
503 503
504 d->tbPlay->setEnabled( true ); 504 d->tbPlay->setEnabled( true );
505 505
506 disconnect( audioView, SIGNAL( itemsSelected( bool ) ), 506 disconnect( audioView, SIGNAL( itemsSelected(bool) ),
507 d->tbPlay, SLOT( setEnabled( bool ) ) ); 507 d->tbPlay, SLOT( setEnabled(bool) ) );
508 disconnect( videoView, SIGNAL( itemsSelected( bool ) ), 508 disconnect( videoView, SIGNAL( itemsSelected(bool) ),
509 d->tbPlay, SLOT( setEnabled( bool ) ) ); 509 d->tbPlay, SLOT( setEnabled(bool) ) );
510 510
511 currentFileListView = 0; 511 currentFileListView = 0;
512 512
513 switch ( currentTab() ) { 513 switch ( currentTab() ) {
514 case CurrentPlayList: 514 case CurrentPlayList:
515 { 515 {
516 if( !tbDeletePlaylist->isHidden() ) { 516 if( !tbDeletePlaylist->isHidden() ) {
517 tbDeletePlaylist->hide(); 517 tbDeletePlaylist->hide();
518 } 518 }
519 d->tbRemoveFromList->setEnabled(TRUE); 519 d->tbRemoveFromList->setEnabled(TRUE);
520 d->tbAddToList->setEnabled(FALSE); 520 d->tbAddToList->setEnabled(FALSE);
521 521
522 d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() ); 522 d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() );
523 } 523 }
524 break; 524 break;
525 case AudioFiles: 525 case AudioFiles:
526 { 526 {
527 audioView->populateView(); 527 audioView->populateView();
528 528
529 if( !tbDeletePlaylist->isHidden() ) { 529 if( !tbDeletePlaylist->isHidden() ) {
530 tbDeletePlaylist->hide(); 530 tbDeletePlaylist->hide();
531 } 531 }
532 d->tbRemoveFromList->setEnabled(FALSE); 532 d->tbRemoveFromList->setEnabled(FALSE);
533 d->tbAddToList->setEnabled(TRUE); 533 d->tbAddToList->setEnabled(TRUE);
534 534
535 connect( audioView, SIGNAL( itemsSelected( bool ) ), 535 connect( audioView, SIGNAL( itemsSelected(bool) ),
536 d->tbPlay, SLOT( setEnabled( bool ) ) ); 536 d->tbPlay, SLOT( setEnabled(bool) ) );
537 537
538 d->tbPlay->setEnabled( audioView->hasSelection() ); 538 d->tbPlay->setEnabled( audioView->hasSelection() );
539 539
540 currentFileListView = audioView; 540 currentFileListView = audioView;
541 } 541 }
542 break; 542 break;
543 case VideoFiles: 543 case VideoFiles:
544 { 544 {
545 videoView->populateView(); 545 videoView->populateView();
546 if( !tbDeletePlaylist->isHidden() ) { 546 if( !tbDeletePlaylist->isHidden() ) {
547 tbDeletePlaylist->hide(); 547 tbDeletePlaylist->hide();
548 } 548 }
549 d->tbRemoveFromList->setEnabled(FALSE); 549 d->tbRemoveFromList->setEnabled(FALSE);
550 d->tbAddToList->setEnabled(TRUE); 550 d->tbAddToList->setEnabled(TRUE);
551 551
552 connect( videoView, SIGNAL( itemsSelected( bool ) ), 552 connect( videoView, SIGNAL( itemsSelected(bool) ),
553 d->tbPlay, SLOT( setEnabled( bool ) ) ); 553 d->tbPlay, SLOT( setEnabled(bool) ) );
554 554
555 d->tbPlay->setEnabled( videoView->hasSelection() ); 555 d->tbPlay->setEnabled( videoView->hasSelection() );
556 556
557 currentFileListView = videoView; 557 currentFileListView = videoView;
558 } 558 }
559 break; 559 break;
560 case PlayLists: 560 case PlayLists:
561 { 561 {
562 if( tbDeletePlaylist->isHidden() ) { 562 if( tbDeletePlaylist->isHidden() ) {
563 tbDeletePlaylist->show(); 563 tbDeletePlaylist->show();
564 } 564 }
565 playLists->reread(); 565 playLists->reread();
566 d->tbAddToList->setEnabled(FALSE); 566 d->tbAddToList->setEnabled(FALSE);
567 567
568 d->tbPlay->setEnabled( false ); 568 d->tbPlay->setEnabled( false );
569 } 569 }
570 break; 570 break;
571 }; 571 };
572} 572}
573 573
574 574
575void PlayListWidget::btnPlay(bool b) { 575void PlayListWidget::btnPlay(bool b) {
576// mediaPlayerState->setPlaying(false); 576// mediaPlayerState->setPlaying(false);
577 mediaPlayerState->setPlaying(b); 577 mediaPlayerState->setPlaying(b);
578 insanityBool=FALSE; 578 insanityBool=FALSE;
579} 579}
580 580
581void PlayListWidget::deletePlaylist() { 581void PlayListWidget::deletePlaylist() {
582 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 582 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
583 (tr("You really want to delete\nthis playlist?")), 583 (tr("You really want to delete\nthis playlist?")),
584 (tr("Yes")), (tr("No")), 0 )){ 584 (tr("Yes")), (tr("No")), 0 )){
585 case 0: // Yes clicked, 585 case 0: // Yes clicked,
586 QFile().remove(playLists->selectedDocument().file()); 586 QFile().remove(playLists->selectedDocument().file());
587 QFile().remove(playLists->selectedDocument().linkFile()); 587 QFile().remove(playLists->selectedDocument().linkFile());
588 playLists->reread(); 588 playLists->reread();
589 break; 589 break;
590 case 1: // Cancel 590 case 1: // Cancel
591 break; 591 break;
592 }; 592 };
593} 593}
594 594
595 595
596void PlayListWidget::playSelected() { 596void PlayListWidget::playSelected() {
597 btnPlay( TRUE); 597 btnPlay( TRUE);
598} 598}
599 599
600bool PlayListWidget::inFileListMode() const 600bool PlayListWidget::inFileListMode() const
601{ 601{
602 TabType tab = currentTab(); 602 TabType tab = currentTab();
603 return tab == AudioFiles || tab == VideoFiles; 603 return tab == AudioFiles || tab == VideoFiles;
604} 604}
605 605
606void PlayListWidget::openURL() { 606void PlayListWidget::openURL() {
607 // http://66.28.164.33:2080 607 // http://66.28.164.33:2080
608 // http://somafm.com/star0242.m3u 608 // http://somafm.com/star0242.m3u
609 QString filename, name; 609 QString filename, name;
610 InputDialog *fileDlg; 610 InputDialog *fileDlg;
611 fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0); 611 fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0);
612 fileDlg->exec(); 612 fileDlg->exec();
613 if( fileDlg->result() == 1 ) { 613 if( fileDlg->result() == 1 ) {
614 filename = fileDlg->text(); 614 filename = fileDlg->text();
615 qDebug( "Selected filename is " + filename ); 615 qDebug( "Selected filename is " + filename );
616 // Om3u *m3uList; 616 // Om3u *m3uList;
617 DocLnk lnk; 617 DocLnk lnk;
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index fec91ea..33fe188 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -40,129 +40,129 @@
40 40
41#include "playlistselection.h" 41#include "playlistselection.h"
42#include "playlistwidget.h" 42#include "playlistwidget.h"
43#include "mediaplayerstate.h" 43#include "mediaplayerstate.h"
44#include "inputDialog.h" 44#include "inputDialog.h"
45#include "playlistfileview.h" 45#include "playlistfileview.h"
46 46
47#include "mediaplayerstate.h" 47#include "mediaplayerstate.h"
48 48
49PlayListWidgetGui::PlayListWidgetGui(QWidget* parent, const char* name ) 49PlayListWidgetGui::PlayListWidgetGui(QWidget* parent, const char* name )
50 : QMainWindow( parent, name ) { 50 : QMainWindow( parent, name ) {
51 51
52 d = new PlayListWidgetPrivate; 52 d = new PlayListWidgetPrivate;
53 d->setDocumentUsed = FALSE; 53 d->setDocumentUsed = FALSE;
54 54
55 setBackgroundMode( PaletteButton ); 55 setBackgroundMode( PaletteButton );
56 setToolBarsMovable( FALSE ); 56 setToolBarsMovable( FALSE );
57 57
58 // Create Toolbar 58 // Create Toolbar
59 QToolBar *toolbar = new QToolBar( this ); 59 QToolBar *toolbar = new QToolBar( this );
60 toolbar->setHorizontalStretchable( TRUE ); 60 toolbar->setHorizontalStretchable( TRUE );
61 61
62 // Create Menubar 62 // Create Menubar
63 QMenuBar *menu = new QMenuBar( toolbar ); 63 QMenuBar *menu = new QMenuBar( toolbar );
64 menu->setMargin( 0 ); 64 menu->setMargin( 0 );
65 65
66 bar = new QToolBar( this ); 66 bar = new QToolBar( this );
67 bar->setLabel( tr( "Play Operations" ) ); 67 bar->setLabel( tr( "Play Operations" ) );
68 68
69 tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" ); 69 tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" );
70 tbDeletePlaylist->setFlat( TRUE ); 70 tbDeletePlaylist->setFlat( TRUE );
71 tbDeletePlaylist->setFixedSize( 20, 20 ); 71 tbDeletePlaylist->setFixedSize( 20, 20 );
72 72
73 tbDeletePlaylist->hide(); 73 tbDeletePlaylist->hide();
74 74
75 pmPlayList = new QPopupMenu( this ); 75 pmPlayList = new QPopupMenu( this );
76 menu->insertItem( tr( "File" ), pmPlayList ); 76 menu->insertItem( tr( "File" ), pmPlayList );
77 77
78 pmView = new QPopupMenu( this ); 78 pmView = new QPopupMenu( this );
79 menu->insertItem( tr( "View" ), pmView ); 79 menu->insertItem( tr( "View" ), pmView );
80 pmView->isCheckable(); 80 pmView->isCheckable();
81 81
82 skinsMenu = new QPopupMenu( this ); 82 skinsMenu = new QPopupMenu( this );
83 pmView->insertItem( tr( "Skins" ), skinsMenu ); 83 pmView->insertItem( tr( "Skins" ), skinsMenu );
84 skinsMenu->isCheckable(); 84 skinsMenu->isCheckable();
85 85
86 gammaMenu = new QPopupMenu( this ); 86 gammaMenu = new QPopupMenu( this );
87 pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu ); 87 pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu );
88 88
89 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu ); 89 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu );
90 gammaSlider->setRange( -40, 40 ); 90 gammaSlider->setRange( -40, 40 );
91 gammaSlider->setTickmarks( QSlider::Left ); 91 gammaSlider->setTickmarks( QSlider::Left );
92 gammaSlider->setTickInterval( 20 ); 92 gammaSlider->setTickInterval( 20 );
93 gammaSlider->setFocusPolicy( QWidget::StrongFocus ); 93 gammaSlider->setFocusPolicy( QWidget::StrongFocus );
94 gammaSlider->setValue( 0 ); 94 gammaSlider->setValue( 0 );
95 gammaSlider->setMinimumHeight( 50 ); 95 gammaSlider->setMinimumHeight( 50 );
96 96
97 gammaLCD = new QLCDNumber( 3, gammaMenu ); 97 gammaLCD = new QLCDNumber( 3, gammaMenu );
98 gammaLCD-> setFrameShape ( QFrame::NoFrame ); 98 gammaLCD-> setFrameShape ( QFrame::NoFrame );
99 gammaLCD-> setSegmentStyle ( QLCDNumber::Flat ); 99 gammaLCD-> setSegmentStyle ( QLCDNumber::Flat );
100 100
101 gammaMenu->insertItem( gammaSlider ); 101 gammaMenu->insertItem( gammaSlider );
102 gammaMenu->insertItem( gammaLCD ); 102 gammaMenu->insertItem( gammaLCD );
103 103
104 connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) ); 104 connect( gammaSlider, SIGNAL( valueChanged(int) ), gammaLCD, SLOT( display(int) ) );
105 105
106 vbox5 = new QVBox( this ); 106 vbox5 = new QVBox( this );
107 QVBox *vbox4 = new QVBox( vbox5 ); 107 QVBox *vbox4 = new QVBox( vbox5 );
108 QHBox *hbox6 = new QHBox( vbox4 ); 108 QHBox *hbox6 = new QHBox( vbox4 );
109 109
110 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 110 tabWidget = new QTabWidget( hbox6, "tabWidget" );
111 111
112 playListTab = new QWidget( tabWidget, "PlayListTab" ); 112 playListTab = new QWidget( tabWidget, "PlayListTab" );
113 tabWidget->insertTab( playListTab, "Playlist"); 113 tabWidget->insertTab( playListTab, "Playlist");
114 114
115 QGridLayout *Playout = new QGridLayout( playListTab ); 115 QGridLayout *Playout = new QGridLayout( playListTab );
116 Playout->setSpacing( 2); 116 Playout->setSpacing( 2);
117 Playout->setMargin( 2); 117 Playout->setMargin( 2);
118 118
119 // Add the playlist area 119 // Add the playlist area
120 QVBox *vbox3 = new QVBox( playListTab ); 120 QVBox *vbox3 = new QVBox( playListTab );
121 d->playListFrame = vbox3; 121 d->playListFrame = vbox3;
122 122
123 QHBox *hbox2 = new QHBox( vbox3 ); 123 QHBox *hbox2 = new QHBox( vbox3 );
124 d->selectedFiles = new PlayListSelection( hbox2 ); 124 d->selectedFiles = new PlayListSelection( hbox2 );
125 125
126 vbox1 = new QVBox( hbox2 ); 126 vbox1 = new QVBox( hbox2 );
127 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold ); 127 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold );
128 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch 128 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch
129 129
130 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); 130 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 );
131 131
132 QWidget *aTab; 132 QWidget *aTab;
133 aTab = new QWidget( tabWidget, "aTab" ); 133 aTab = new QWidget( tabWidget, "aTab" );
134 134
135 QGridLayout *Alayout = new QGridLayout( aTab ); 135 QGridLayout *Alayout = new QGridLayout( aTab );
136 Alayout->setSpacing( 2 ); 136 Alayout->setSpacing( 2 );
137 Alayout->setMargin( 2 ); 137 Alayout->setMargin( 2 );
138 // no m3u's here please 138 // no m3u's here please
139 audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;application/ogg", "opieplayer2/musicfile", aTab, "Audioview" ); 139 audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;application/ogg", "opieplayer2/musicfile", aTab, "Audioview" );
140 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); 140 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 );
141 tabWidget->insertTab( aTab, tr( "Audio" ) ); 141 tabWidget->insertTab( aTab, tr( "Audio" ) );
142 142
143 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); 143 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold );
144 144
145 QWidget *vTab; 145 QWidget *vTab;
146 vTab = new QWidget( tabWidget, "vTab" ); 146 vTab = new QWidget( tabWidget, "vTab" );
147 147
148 QGridLayout *Vlayout = new QGridLayout( vTab ); 148 QGridLayout *Vlayout = new QGridLayout( vTab );
149 Vlayout->setSpacing( 2 ); 149 Vlayout->setSpacing( 2 );
150 Vlayout->setMargin( 2 ); 150 Vlayout->setMargin( 2 );
151 videoView = new PlayListFileView( "video/*", "opieplayer2/videofile", vTab, "Videoview" ); 151 videoView = new PlayListFileView( "video/*", "opieplayer2/videofile", vTab, "Videoview" );
152 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); 152 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 );
153 153
154 QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); 154 QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold );
155 155
156 tabWidget->insertTab( vTab, tr( "Video" ) ); 156 tabWidget->insertTab( vTab, tr( "Video" ) );
157 157
158 //playlists list 158 //playlists list
159 QWidget *LTab; 159 QWidget *LTab;
160 LTab = new QWidget( tabWidget, "LTab" ); 160 LTab = new QWidget( tabWidget, "LTab" );
161 QGridLayout *Llayout = new QGridLayout( LTab ); 161 QGridLayout *Llayout = new QGridLayout( LTab );
162 Llayout->setSpacing( 2 ); 162 Llayout->setSpacing( 2 );
163 Llayout->setMargin( 2 ); 163 Llayout->setMargin( 2 );
164 164
165 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE ); 165 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE );
166 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); 166 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 );
167 167
168 tabWidget->insertTab( LTab, tr( "Lists" ) ); 168 tabWidget->insertTab( LTab, tr( "Lists" ) );
diff --git a/noncore/multimedia/opieplayer2/threadutil.cpp b/noncore/multimedia/opieplayer2/threadutil.cpp
index ff38b1e..fb951b4 100644
--- a/noncore/multimedia/opieplayer2/threadutil.cpp
+++ b/noncore/multimedia/opieplayer2/threadutil.cpp
@@ -179,129 +179,129 @@ Thread::Thread()
179Thread::~Thread() 179Thread::~Thread()
180{ 180{
181 assert( d->isRunning == false ); 181 assert( d->isRunning == false );
182 delete d; 182 delete d;
183} 183}
184 184
185void Thread::start() 185void Thread::start()
186{ 186{
187 AutoLock lock( d->guard ); 187 AutoLock lock( d->guard );
188 188
189 if ( d->isRunning ) { 189 if ( d->isRunning ) {
190 qDebug( "ThreadUtil::Thread::start() called for running thread." ); 190 qDebug( "ThreadUtil::Thread::start() called for running thread." );
191 return; 191 return;
192 } 192 }
193 193
194 pthread_attr_t attributes; 194 pthread_attr_t attributes;
195 pthread_attr_init( &attributes ); 195 pthread_attr_init( &attributes );
196 pthread_attr_setscope( &attributes, PTHREAD_SCOPE_SYSTEM ); 196 pthread_attr_setscope( &attributes, PTHREAD_SCOPE_SYSTEM );
197 int err = pthread_create( &d->self, &attributes, start_thread, ( void* )d ); 197 int err = pthread_create( &d->self, &attributes, start_thread, ( void* )d );
198 if ( err != 0 ) { 198 if ( err != 0 ) {
199 qDebug( "ThreadUtil::Thread::start() : can't create thread: %s", strerror( err ) ); 199 qDebug( "ThreadUtil::Thread::start() : can't create thread: %s", strerror( err ) );
200 pthread_attr_destroy( &attributes ); 200 pthread_attr_destroy( &attributes );
201 return; 201 return;
202 } 202 }
203 pthread_attr_destroy( &attributes ); 203 pthread_attr_destroy( &attributes );
204} 204}
205 205
206void Thread::terminate() 206void Thread::terminate()
207{ 207{
208 AutoLock lock( d->guard ); 208 AutoLock lock( d->guard );
209 if ( !d->isRunning ) 209 if ( !d->isRunning )
210 return; 210 return;
211 211
212 pthread_cancel( d->self ); 212 pthread_cancel( d->self );
213} 213}
214 214
215bool Thread::wait() 215bool Thread::wait()
216{ 216{
217 AutoLock lock( d->guard ); 217 AutoLock lock( d->guard );
218 if ( !d->isRunning ) 218 if ( !d->isRunning )
219 return true; 219 return true;
220 220
221 return d->finishCondition.wait( d->guard ); 221 return d->finishCondition.wait( d->guard );
222} 222}
223 223
224bool Thread::isRunning() const 224bool Thread::isRunning() const
225{ 225{
226 AutoLock lock( d->guard ); 226 AutoLock lock( d->guard );
227 return d->isRunning; 227 return d->isRunning;
228} 228}
229 229
230void Thread::exit() 230void Thread::exit()
231{ 231{
232 pthread_exit( 0 ); 232 pthread_exit( 0 );
233} 233}
234 234
235OnewayNotifier::OnewayNotifier() 235OnewayNotifier::OnewayNotifier()
236{ 236{
237 int fds[ 2 ]; 237 int fds[ 2 ];
238 pipe( fds ); 238 pipe( fds );
239 m_readFd = fds[ 0 ]; 239 m_readFd = fds[ 0 ];
240 m_writeFd = fds[ 1 ]; 240 m_writeFd = fds[ 1 ];
241 241
242 m_notifier = new QSocketNotifier( m_readFd, QSocketNotifier::Read ); 242 m_notifier = new QSocketNotifier( m_readFd, QSocketNotifier::Read );
243 connect( m_notifier, SIGNAL( activated( int ) ), 243 connect( m_notifier, SIGNAL( activated(int) ),
244 this, SLOT( wakeUp() ) ); 244 this, SLOT( wakeUp() ) );
245} 245}
246 246
247OnewayNotifier::~OnewayNotifier() 247OnewayNotifier::~OnewayNotifier()
248{ 248{
249 delete m_notifier; 249 delete m_notifier;
250 250
251 ::close( m_readFd ); 251 ::close( m_readFd );
252 ::close( m_writeFd ); 252 ::close( m_writeFd );
253} 253}
254 254
255void OnewayNotifier::notify() 255void OnewayNotifier::notify()
256{ 256{
257 const char c = 42; 257 const char c = 42;
258 ::write( m_writeFd, &c, 1 ); 258 ::write( m_writeFd, &c, 1 );
259} 259}
260 260
261void OnewayNotifier::wakeUp() 261void OnewayNotifier::wakeUp()
262{ 262{
263 char c = 0; 263 char c = 0;
264 264
265 if ( ::read( m_readFd, &c, 1 ) != 1 ) 265 if ( ::read( m_readFd, &c, 1 ) != 1 )
266 return; 266 return;
267 267
268 emit awake(); 268 emit awake();
269} 269}
270 270
271ChannelMessage::ChannelMessage( int type ) 271ChannelMessage::ChannelMessage( int type )
272 : m_type( type ), m_isCall( false ), m_replied( false ), 272 : m_type( type ), m_isCall( false ), m_replied( false ),
273 m_inEventHandler( false ) 273 m_inEventHandler( false )
274{ 274{
275} 275}
276 276
277ChannelMessage::~ChannelMessage() 277ChannelMessage::~ChannelMessage()
278{ 278{
279 if ( m_guard.isLocked() ) 279 if ( m_guard.isLocked() )
280 m_guard.unlock(); 280 m_guard.unlock();
281} 281}
282 282
283void ChannelMessage::reply() 283void ChannelMessage::reply()
284{ 284{
285 if ( !m_isCall ) 285 if ( !m_isCall )
286 { 286 {
287 qDebug( "ChannelMessage::reply() - can't reply oneway message!" ); 287 qDebug( "ChannelMessage::reply() - can't reply oneway message!" );
288 return; 288 return;
289 } 289 }
290 290
291 if ( m_inEventHandler ) 291 if ( m_inEventHandler )
292 { 292 {
293 m_replied = true; 293 m_replied = true;
294 return; 294 return;
295 } 295 }
296 296
297 m_condition.wakeOne(); 297 m_condition.wakeOne();
298 m_guard.unlock(); 298 m_guard.unlock();
299} 299}
300 300
301struct Channel::Private 301struct Channel::Private
302{ 302{
303 Private() 303 Private()
304 { 304 {
305 ownerThread = pthread_self(); 305 ownerThread = pthread_self();
306 } 306 }
307 307
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index c829e03..a4d09f5 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -10,130 +10,130 @@
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#include "videowidget.h" 34#include "videowidget.h"
35#include "mediaplayerstate.h" 35#include "mediaplayerstate.h"
36#include "playlistwidget.h" 36#include "playlistwidget.h"
37 37
38 38
39#ifdef Q_WS_QWS 39#ifdef Q_WS_QWS
40# define USE_DIRECT_PAINTER 40# define USE_DIRECT_PAINTER
41# include <qdirectpainter_qws.h> 41# include <qdirectpainter_qws.h>
42# include <qgfxraster_qws.h> 42# include <qgfxraster_qws.h>
43#endif 43#endif
44 44
45 45
46namespace 46namespace
47{ 47{
48 48
49const int xo = 2; // movable x offset 49const int xo = 2; // movable x offset
50const int yo = 0; // movable y offset 50const int yo = 0; // movable y offset
51 51
52const MediaWidget::SkinButtonInfo skinInfo[] = 52const MediaWidget::SkinButtonInfo skinInfo[] =
53{ 53{
54 { MediaWidget::Play, "play", MediaWidget::ToggleButton }, 54 { MediaWidget::Play, "play", MediaWidget::ToggleButton },
55 { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, 55 { MediaWidget::Stop, "stop", MediaWidget::NormalButton },
56 { MediaWidget::Next, "fwd", MediaWidget::NormalButton }, 56 { MediaWidget::Next, "fwd", MediaWidget::NormalButton },
57 { MediaWidget::Previous, "back", MediaWidget::NormalButton }, 57 { MediaWidget::Previous, "back", MediaWidget::NormalButton },
58 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, 58 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton },
59 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, 59 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton },
60 { MediaWidget::FullScreen, "full", MediaWidget::ToggleButton } 60 { MediaWidget::FullScreen, "full", MediaWidget::ToggleButton }
61}; 61};
62 62
63const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); 63const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] );
64 64
65} 65}
66 66
67VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) 67VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
68 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false ) 68 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false )
69{ 69{
70 setCaption( tr("OpiePlayer - Video") ); 70 setCaption( tr("OpiePlayer - Video") );
71 71
72 videoFrame = new XineVideoWidget ( this, "Video frame" ); 72 videoFrame = new XineVideoWidget ( this, "Video frame" );
73 73
74 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 74 connect ( videoFrame, SIGNAL( videoResized(const QSize&)), this, SIGNAL( videoResized(const QSize&)));
75 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); 75 connect ( videoFrame, SIGNAL( clicked() ), this, SLOT ( backToNormal() ) );
76 76
77 slider = 0; 77 slider = 0;
78 78
79 loadSkin(); 79 loadSkin();
80 80
81 setLength( mediaPlayerState.length() ); 81 setLength( mediaPlayerState.length() );
82 setPosition( mediaPlayerState.position() ); 82 setPosition( mediaPlayerState.position() );
83 setFullscreen( mediaPlayerState.isFullscreen() ); 83 setFullscreen( mediaPlayerState.isFullscreen() );
84 setPlaying( mediaPlayerState.isPlaying() ); 84 setPlaying( mediaPlayerState.isPlaying() );
85} 85}
86 86
87 87
88VideoWidget::~VideoWidget() 88VideoWidget::~VideoWidget()
89{ 89{
90} 90}
91 91
92MediaWidget::GUIInfo VideoWidget::guiInfo() 92MediaWidget::GUIInfo VideoWidget::guiInfo()
93{ 93{
94 return GUIInfo( "V" /* infix */, ::skinInfo, ::buttonCount ); 94 return GUIInfo( "V" /* infix */, ::skinInfo, ::buttonCount );
95} 95}
96 96
97void VideoWidget::resizeEvent( QResizeEvent *e ) { 97void VideoWidget::resizeEvent( QResizeEvent *e ) {
98 int h = height(); 98 int h = height();
99 int w = width(); 99 int w = width();
100 //int Vh = 160; 100 //int Vh = 160;
101 //int Vw = 220; 101 //int Vw = 220;
102 102
103 slider->setFixedWidth( w - 20 ); 103 slider->setFixedWidth( w - 20 );
104 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 104 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
105 slider->setBackgroundOrigin( QWidget::ParentOrigin ); 105 slider->setBackgroundOrigin( QWidget::ParentOrigin );
106 slider->setFocusPolicy( QWidget::NoFocus ); 106 slider->setFocusPolicy( QWidget::NoFocus );
107 slider->setBackgroundPixmap( backgroundPixmap ); 107 slider->setBackgroundPixmap( backgroundPixmap );
108 108
109 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; 109 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2;
110 if(w>h) 110 if(w>h)
111 upperLeftOfButtonMask.ry() = 0; 111 upperLeftOfButtonMask.ry() = 0;
112 else 112 else
113 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; 113 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10;
114 114
115 MediaWidget::resizeEvent( e ); 115 MediaWidget::resizeEvent( e );
116} 116}
117 117
118void VideoWidget::sliderPressed() { 118void VideoWidget::sliderPressed() {
119 videoSliderBeingMoved = TRUE; 119 videoSliderBeingMoved = TRUE;
120} 120}
121 121
122void VideoWidget::sliderReleased() { 122void VideoWidget::sliderReleased() {
123 videoSliderBeingMoved = FALSE; 123 videoSliderBeingMoved = FALSE;
124 if ( slider->width() == 0 ) { 124 if ( slider->width() == 0 ) {
125 return; 125 return;
126 } 126 }
127 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); 127 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width());
128 mediaPlayerState.setPosition( val ); 128 mediaPlayerState.setPosition( val );
129} 129}
130 130
131void VideoWidget::setPosition( long i ) { 131void VideoWidget::setPosition( long i ) {
132 updateSlider( i, mediaPlayerState.length() ); 132 updateSlider( i, mediaPlayerState.length() );
133} 133}
134 134
135 135
136void VideoWidget::setLength( long max ) { 136void VideoWidget::setLength( long max ) {
137 updateSlider( mediaPlayerState.position(), max ); 137 updateSlider( mediaPlayerState.position(), max );
138} 138}
139 139
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index a392f4a..70f2ffd 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -4,136 +4,136 @@
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34 34
35#include <qtimer.h> 35#include <qtimer.h>
36#include <qmessagebox.h> 36#include <qmessagebox.h>
37#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
38#include <qpe/qpeapplication.h> 38#include <qpe/qpeapplication.h>
39 39
40#include "xinecontrol.h" 40#include "xinecontrol.h"
41#include "mediaplayerstate.h" 41#include "mediaplayerstate.h"
42#include "xinevideowidget.h" 42#include "xinevideowidget.h"
43 43
44XineControl::XineControl( XineVideoWidget *xineWidget, 44XineControl::XineControl( XineVideoWidget *xineWidget,
45 MediaPlayerState &_mediaPlayerState, 45 MediaPlayerState &_mediaPlayerState,
46 QObject *parent, const char *name ) 46 QObject *parent, const char *name )
47 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) 47 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
48{ 48{
49 libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget ); 49 libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget );
50 50
51 init(); 51 init();
52} 52}
53 53
54XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, 54XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget,
55 MediaPlayerState &_mediaPlayerState, 55 MediaPlayerState &_mediaPlayerState,
56 QObject *parent, const char *name ) 56 QObject *parent, const char *name )
57 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) 57 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
58{ 58{
59 xine->ensureInitialized(); 59 xine->ensureInitialized();
60 60
61 xine->setWidget( xineWidget ); 61 xine->setWidget( xineWidget );
62 62
63 init(); 63 init();
64} 64}
65 65
66void XineControl::init() 66void XineControl::init()
67{ 67{
68 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); 68 connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) );
69 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); 69 connect( this, SIGNAL( positionChanged(long) ), &mediaPlayerState, SLOT( updatePosition(long) ) );
70 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); 70 connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( stop(bool) ) );
71 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); 71 connect( &mediaPlayerState, SIGNAL( fullscreenToggled(bool) ), this, SLOT( setFullscreen(bool) ) );
72 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); 72 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ), this, SLOT( seekTo(long) ) );
73 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); 73 connect( &mediaPlayerState, SIGNAL( videoGammaChanged(int) ), this, SLOT( setGamma(int) ) );
74 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 74 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
75 connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) ); 75 connect( xineVideoWidget, SIGNAL( videoResized(const QSize&) ), this, SLOT( videoResized(const QSize&) ) );
76 76
77 disabledSuspendScreenSaver = FALSE; 77 disabledSuspendScreenSaver = FALSE;
78} 78}
79 79
80XineControl::~XineControl() { 80XineControl::~XineControl() {
81#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 81#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
82 if ( disabledSuspendScreenSaver ) { 82 if ( disabledSuspendScreenSaver ) {
83 disabledSuspendScreenSaver = FALSE; 83 disabledSuspendScreenSaver = FALSE;
84 // Re-enable the suspend mode 84 // Re-enable the suspend mode
85 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 85 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
86 } 86 }
87#endif 87#endif
88 delete libXine; 88 delete libXine;
89} 89}
90 90
91void XineControl::play( const QString& fileName ) { 91void XineControl::play( const QString& fileName ) {
92 92
93 hasVideoChannel = FALSE; 93 hasVideoChannel = FALSE;
94 hasAudioChannel = FALSE; 94 hasAudioChannel = FALSE;
95 m_fileName = fileName; 95 m_fileName = fileName;
96 96
97 qDebug("<<FILENAME: " + fileName + ">>>>"); 97 qDebug("<<FILENAME: " + fileName + ">>>>");
98 98
99 if ( !libXine->play( fileName, 0, 0 ) ) { 99 if ( !libXine->play( fileName, 0, 0 ) ) {
100 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 100 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
101 // toggle stop so the the play button is reset 101 // toggle stop so the the play button is reset
102 mediaPlayerState.setPlaying( false ); 102 mediaPlayerState.setPlaying( false );
103 return; 103 return;
104 } 104 }
105 mediaPlayerState.setPlaying( true ); 105 mediaPlayerState.setPlaying( true );
106 106
107 MediaPlayerState::DisplayType displayType; 107 MediaPlayerState::DisplayType displayType;
108 if ( !libXine->hasVideo() ) { 108 if ( !libXine->hasVideo() ) {
109 displayType = MediaPlayerState::Audio; 109 displayType = MediaPlayerState::Audio;
110 qDebug("HAS AUDIO"); 110 qDebug("HAS AUDIO");
111 libXine->setShowVideo( false ); 111 libXine->setShowVideo( false );
112 hasAudioChannel = TRUE; 112 hasAudioChannel = TRUE;
113 } else { 113 } else {
114 displayType = MediaPlayerState::Video; 114 displayType = MediaPlayerState::Video;
115 qDebug("HAS VIDEO"); 115 qDebug("HAS VIDEO");
116 libXine->setShowVideo( true ); 116 libXine->setShowVideo( true );
117 hasVideoChannel = TRUE; 117 hasVideoChannel = TRUE;
118 } 118 }
119 // determine if slider is shown 119 // determine if slider is shown
120 mediaPlayerState.setIsSeekable( libXine->isSeekable() ); 120 mediaPlayerState.setIsSeekable( libXine->isSeekable() );
121 121
122 // which gui (video / audio) 122 // which gui (video / audio)
123 mediaPlayerState.setDisplayType( displayType ); 123 mediaPlayerState.setDisplayType( displayType );
124 124
125#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 125#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
126 if ( !disabledSuspendScreenSaver ) { 126 if ( !disabledSuspendScreenSaver ) {
127 disabledSuspendScreenSaver = TRUE; 127 disabledSuspendScreenSaver = TRUE;
128 // Stop the screen from blanking and power saving state 128 // Stop the screen from blanking and power saving state
129 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) 129 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" )
130 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 130 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend );
131 } 131 }
132#endif 132#endif
133 133
134 length(); 134 length();
135 position(); 135 position();
136} 136}
137 137
138void XineControl::nextMedia() { 138void XineControl::nextMedia() {
139 mediaPlayerState.setNext(); 139 mediaPlayerState.setNext();
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp
index 0a6e5ae..f2035ef 100644
--- a/noncore/multimedia/opierec/qtrec.cpp
+++ b/noncore/multimedia/opierec/qtrec.cpp
@@ -700,162 +700,162 @@ void QtRec::init() {
700 TabWidget->insertTab( tab_3, tr( "Options" ) ); 700 TabWidget->insertTab( tab_3, tr( "Options" ) );
701 701
702 TabWidget->insertTab( tab_5, tr( "Volume" ) ); 702 TabWidget->insertTab( tab_5, tr( "Volume" ) );
703 703
704 704
705 waveform = new Waveform( this, "waveform" ); 705 waveform = new Waveform( this, "waveform" );
706// waveform->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, waveform->sizePolicy().hasHeightForWidth() ) ); 706// waveform->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, waveform->sizePolicy().hasHeightForWidth() ) );
707 waveform->setMinimumSize( QSize( 0, 50 ) ); 707 waveform->setMinimumSize( QSize( 0, 50 ) );
708 708
709 layout->addMultiCellWidget( waveform, 8, 8, 0, 7 ); 709 layout->addMultiCellWidget( waveform, 8, 8, 0, 7 );
710 waveform->setBackgroundColor ( black ); 710 waveform->setBackgroundColor ( black );
711} 711}
712 712
713void QtRec::initIconView() { 713void QtRec::initIconView() {
714 714
715 ListView1->clear(); 715 ListView1->clear();
716 Config cfg("OpieRec"); 716 Config cfg("OpieRec");
717 cfg.setGroup("Sounds"); 717 cfg.setGroup("Sounds");
718 QString temp; 718 QString temp;
719 QPixmap image0( ( const char** ) image0_data ); 719 QPixmap image0( ( const char** ) image0_data );
720 720
721 int nFiles = cfg.readNumEntry("NumberofFiles",0); 721 int nFiles = cfg.readNumEntry("NumberofFiles",0);
722 // qDebug("init number of files %d", nFiles); 722 // qDebug("init number of files %d", nFiles);
723 723
724 for(int i=1;i<= nFiles;i++) { 724 for(int i=1;i<= nFiles;i++) {
725 725
726 QListViewItem * item; 726 QListViewItem * item;
727 QString fileS, mediaLocation, fileDate, filePath; 727 QString fileS, mediaLocation, fileDate, filePath;
728 728
729 temp.sprintf( "%d",i); 729 temp.sprintf( "%d",i);
730 temp = cfg.readEntry( temp,""); //reads currentFile 730 temp = cfg.readEntry( temp,""); //reads currentFile
731 filePath = cfg.readEntry( temp,""); //currentFileName 731 filePath = cfg.readEntry( temp,""); //currentFileName
732 732
733 QFileInfo info(filePath); 733 QFileInfo info(filePath);
734 fileDate = info.lastModified().toString(); 734 fileDate = info.lastModified().toString();
735 735
736 fileS = cfg.readEntry( filePath, "0" );// file length in seconds 736 fileS = cfg.readEntry( filePath, "0" );// file length in seconds
737 mediaLocation = getStorage( filePath); 737 mediaLocation = getStorage( filePath);
738 if( info.exists()) { 738 if( info.exists()) {
739 item = new QListViewItem( ListView1, temp, fileS, mediaLocation, fileDate); 739 item = new QListViewItem( ListView1, temp, fileS, mediaLocation, fileDate);
740 item->setPixmap( 0, image0); 740 item->setPixmap( 0, image0);
741 if( currentFileName == filePath) 741 if( currentFileName == filePath)
742 ListView1->setSelected( item, true); 742 ListView1->setSelected( item, true);
743 } 743 }
744 } 744 }
745} 745}
746 746
747void QtRec::initConnections() { 747void QtRec::initConnections() {
748 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 748 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
749 749
750 connect( toBeginningButton, SIGNAL( pressed()), 750 connect( toBeginningButton, SIGNAL( pressed()),
751 this, SLOT( rewindPressed() )); 751 this, SLOT( rewindPressed() ));
752 connect( toBeginningButton, SIGNAL( released()), 752 connect( toBeginningButton, SIGNAL( released()),
753 this, SLOT( rewindReleased() )); 753 this, SLOT( rewindReleased() ));
754 connect( toEndButton, SIGNAL( pressed()), 754 connect( toEndButton, SIGNAL( pressed()),
755 this, SLOT( FastforwardPressed() )); 755 this, SLOT( FastforwardPressed() ));
756 connect( toEndButton, SIGNAL( released()), 756 connect( toEndButton, SIGNAL( released()),
757 this, SLOT( FastforwardReleased() )); 757 this, SLOT( FastforwardReleased() ));
758 connect( deleteSoundButton, SIGNAL(released()), 758 connect( deleteSoundButton, SIGNAL(released()),
759 this, SLOT( deleteSound() )); 759 this, SLOT( deleteSound() ));
760 connect( Stop_PushButton, SIGNAL(released()), 760 connect( Stop_PushButton, SIGNAL(released()),
761 this, SLOT( doPlayBtn() )); 761 this, SLOT( doPlayBtn() ));
762 connect( Rec_PushButton, SIGNAL(released()), 762 connect( Rec_PushButton, SIGNAL(released()),
763 this, SLOT( newSound() ) ); 763 this, SLOT( newSound() ) );
764 connect( TabWidget, SIGNAL( currentChanged( QWidget*)), 764 connect( TabWidget, SIGNAL( currentChanged(QWidget*)),
765 this, SLOT(thisTab(QWidget*) )); 765 this, SLOT(thisTab(QWidget*) ));
766 connect( OutputSlider, SIGNAL(sliderReleased()), 766 connect( OutputSlider, SIGNAL(sliderReleased()),
767 this, SLOT( changedOutVolume()) ); 767 this, SLOT( changedOutVolume()) );
768 connect( InputSlider, SIGNAL(sliderReleased()), 768 connect( InputSlider, SIGNAL(sliderReleased()),
769 this, SLOT( changedInVolume()) ); 769 this, SLOT( changedInVolume()) );
770 770
771 connect( sampleRateComboBox, SIGNAL(activated( int)), 771 connect( sampleRateComboBox, SIGNAL(activated(int)),
772 this, SLOT( changesamplerateCombo(int)) ); 772 this, SLOT( changesamplerateCombo(int)) );
773 connect( bitRateComboBox, SIGNAL(activated( int)), 773 connect( bitRateComboBox, SIGNAL(activated(int)),
774 this, SLOT( changebitrateCombo(int)) ); 774 this, SLOT( changebitrateCombo(int)) );
775 775
776 connect( directoryComboBox, SIGNAL(activated( int)), 776 connect( directoryComboBox, SIGNAL(activated(int)),
777 this, SLOT( changeDirCombo(int)) ); 777 this, SLOT( changeDirCombo(int)) );
778 connect( sizeLimitCombo, SIGNAL(activated( int)), 778 connect( sizeLimitCombo, SIGNAL(activated(int)),
779 this, SLOT( changeSizeLimitCombo(int)) ); 779 this, SLOT( changeSizeLimitCombo(int)) );
780 780
781 connect( stereoCheckBox, SIGNAL(toggled( bool)), 781 connect( stereoCheckBox, SIGNAL(toggled(bool)),
782 this, SLOT( changeStereoCheck(bool)) ); 782 this, SLOT( changeStereoCheck(bool)) );
783 783
784 connect( outMuteCheckBox, SIGNAL(toggled( bool)), 784 connect( outMuteCheckBox, SIGNAL(toggled(bool)),
785 this, SLOT( doVolMuting(bool)) ); 785 this, SLOT( doVolMuting(bool)) );
786 connect( inMuteCheckBox , SIGNAL(toggled( bool)), 786 connect( inMuteCheckBox , SIGNAL(toggled(bool)),
787 this, SLOT( doMicMuting(bool)) ); 787 this, SLOT( doMicMuting(bool)) );
788 788
789 connect( ListView1,SIGNAL(doubleClicked( QListViewItem*)), 789 connect( ListView1,SIGNAL(doubleClicked(QListViewItem*)),
790 this,SLOT( itClick(QListViewItem*))); 790 this,SLOT( itClick(QListViewItem*)));
791 connect( ListView1, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 791 connect( ListView1, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
792 this,SLOT( listPressed(int, QListViewItem *, const QPoint&, int)) ); 792 this,SLOT( listPressed(int,QListViewItem*,const QPoint&,int)) );
793 connect( timeSlider, SIGNAL( sliderMoved( int)), 793 connect( timeSlider, SIGNAL( sliderMoved(int)),
794 this, SLOT( changeTimeSlider(int) )); 794 this, SLOT( changeTimeSlider(int) ));
795 connect( timeSlider, SIGNAL( sliderPressed( )), 795 connect( timeSlider, SIGNAL( sliderPressed()),
796 this, SLOT( timeSliderPressed() )); 796 this, SLOT( timeSliderPressed() ));
797 connect( timeSlider, SIGNAL( sliderReleased( )), 797 connect( timeSlider, SIGNAL( sliderReleased()),
798 this, SLOT( timeSliderReleased() )); 798 this, SLOT( timeSliderReleased() ));
799 connect( compressionCheckBox, SIGNAL( toggled(bool)), 799 connect( compressionCheckBox, SIGNAL( toggled(bool)),
800 this, SLOT( compressionSelected(bool))); 800 this, SLOT( compressionSelected(bool)));
801 connect( autoMuteCheckBox, SIGNAL( toggled(bool)), 801 connect( autoMuteCheckBox, SIGNAL( toggled(bool)),
802 this, SLOT( slotAutoMute(bool))); 802 this, SLOT( slotAutoMute(bool)));
803} 803}
804 804
805void QtRec::initConfig() { 805void QtRec::initConfig() {
806 int index, fred, i; 806 int index, fred, i;
807 Config cfg("OpieRec"); 807 Config cfg("OpieRec");
808 cfg.setGroup("Settings"); 808 cfg.setGroup("Settings");
809 809
810 index = cfg.readNumEntry("samplerate",22050); 810 index = cfg.readNumEntry("samplerate",22050);
811 bool ok; 811 bool ok;
812 812
813 for(int ws=0;ws<sampleRateComboBox->count();ws++) { 813 for(int ws=0;ws<sampleRateComboBox->count();ws++) {
814 fred = sampleRateComboBox->text(ws).toInt(&ok, 10); 814 fred = sampleRateComboBox->text(ws).toInt(&ok, 10);
815 if( index == fred) { 815 if( index == fred) {
816 filePara.sampleRate = fred; 816 filePara.sampleRate = fred;
817 sampleRateComboBox->setCurrentItem(ws); 817 sampleRateComboBox->setCurrentItem(ws);
818 } 818 }
819 } 819 }
820 820
821 i = cfg.readNumEntry("bitrate",16); 821 i = cfg.readNumEntry("bitrate",16);
822 if(i == 16) 822 if(i == 16)
823 bitRateComboBox->setCurrentItem( 1); 823 bitRateComboBox->setCurrentItem( 1);
824 elseif(i == 24) 824 elseif(i == 24)
825 bitRateComboBox->setCurrentItem( 2); 825 bitRateComboBox->setCurrentItem( 2);
826 elseif(i == 32) 826 elseif(i == 32)
827 bitRateComboBox->setCurrentItem( 3); 827 bitRateComboBox->setCurrentItem( 3);
828 else 828 else
829 bitRateComboBox->setCurrentItem( 0); 829 bitRateComboBox->setCurrentItem( 0);
830 830
831 filePara.resolution = i; 831 filePara.resolution = i;
832 832
833 i = cfg.readNumEntry("sizeLimit", 5 ); 833 i = cfg.readNumEntry("sizeLimit", 5 );
834 QString temp; 834 QString temp;
835 sizeLimitCombo->setCurrentItem((i/5)); 835 sizeLimitCombo->setCurrentItem((i/5));
836 836
837 stereoCheckBox->setChecked( cfg.readBoolEntry("stereo", 1)); 837 stereoCheckBox->setChecked( cfg.readBoolEntry("stereo", 1));
838 if( stereoCheckBox->isChecked()) { 838 if( stereoCheckBox->isChecked()) {
839 filePara.channels = 2; 839 filePara.channels = 2;
840 } else { 840 } else {
841 filePara.channels = 1; 841 filePara.channels = 1;
842 } 842 }
843 843
844 compressionCheckBox->setChecked( cfg.readBoolEntry("wavCompression",1)); 844 compressionCheckBox->setChecked( cfg.readBoolEntry("wavCompression",1));
845 if( compressionCheckBox->isChecked()) { 845 if( compressionCheckBox->isChecked()) {
846 bitRateComboBox->setEnabled(false); 846 bitRateComboBox->setEnabled(false);
847 bitRateComboBox->setCurrentItem(0); 847 bitRateComboBox->setCurrentItem(0);
848 filePara.resolution=16; 848 filePara.resolution=16;
849 } 849 }
850 850
851 autoMuteCheckBox->setChecked( cfg.readBoolEntry("useAutoMute",0)); 851 autoMuteCheckBox->setChecked( cfg.readBoolEntry("useAutoMute",0));
852 if( autoMuteCheckBox->isChecked()) 852 if( autoMuteCheckBox->isChecked())
853 slotAutoMute(true); 853 slotAutoMute(true);
854 else 854 else
855 slotAutoMute(false); 855 slotAutoMute(false);
856 856
857 Config cofg( "qpe"); 857 Config cofg( "qpe");
858 cofg.setGroup( "Volume"); 858 cofg.setGroup( "Volume");
859 outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); 859 outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0));
860 inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); 860 inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0));
861} 861}
@@ -1595,129 +1595,129 @@ bool QtRec::openPlayFile() {
1595 timeSlider->setRange(0, filePara.numberSamples ); 1595 timeSlider->setRange(0, filePara.numberSamples );
1596 } 1596 }
1597 1597
1598 return true; 1598 return true;
1599} 1599}
1600 1600
1601void QtRec::listPressed( int mouse, QListViewItem *item, const QPoint &, int ) { 1601void QtRec::listPressed( int mouse, QListViewItem *item, const QPoint &, int ) {
1602 if(item == NULL ) 1602 if(item == NULL )
1603 return; 1603 return;
1604 switch (mouse) { 1604 switch (mouse) {
1605 case 1: { 1605 case 1: {
1606 if( renameBox != 0 ) //tricky 1606 if( renameBox != 0 ) //tricky
1607 cancelRename(); 1607 cancelRename();
1608 1608
1609 currentFile = item->text(0); 1609 currentFile = item->text(0);
1610 setCaption( "OpieRecord " + currentFile); 1610 setCaption( "OpieRecord " + currentFile);
1611 } 1611 }
1612 break; 1612 break;
1613 case 2: 1613 case 2:
1614 showListMenu(item); 1614 showListMenu(item);
1615 ListView1->clearSelection(); 1615 ListView1->clearSelection();
1616 break; 1616 break;
1617 }; 1617 };
1618} 1618}
1619 1619
1620void QtRec::showListMenu(QListViewItem * item) { 1620void QtRec::showListMenu(QListViewItem * item) {
1621 if(item == NULL) 1621 if(item == NULL)
1622 return; 1622 return;
1623 QPopupMenu *m = new QPopupMenu(this); 1623 QPopupMenu *m = new QPopupMenu(this);
1624 m->insertItem( tr("Play"), this, SLOT( doMenuPlay() )); 1624 m->insertItem( tr("Play"), this, SLOT( doMenuPlay() ));
1625 if(Ir::supported()) m->insertItem( tr( "Send with Ir" ), this, SLOT( doBeam() )); 1625 if(Ir::supported()) m->insertItem( tr( "Send with Ir" ), this, SLOT( doBeam() ));
1626 m->insertItem( tr( "Rename" ), this, SLOT( doRename() )); 1626 m->insertItem( tr( "Rename" ), this, SLOT( doRename() ));
1627 // #if defined (QTOPIA_INTERNAL_FSLP) 1627 // #if defined (QTOPIA_INTERNAL_FSLP)
1628 // m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 1628 // m->insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
1629 // #endif 1629 // #endif
1630 m->insertSeparator(); 1630 m->insertSeparator();
1631 m->insertItem( tr("Delete"), this, SLOT( deleteSound() ) ); 1631 m->insertItem( tr("Delete"), this, SLOT( deleteSound() ) );
1632 m->exec( QCursor::pos() ); 1632 m->exec( QCursor::pos() );
1633 qApp->processEvents(); 1633 qApp->processEvents();
1634} 1634}
1635 1635
1636void QtRec::fileBeamFinished( Ir *ir) { 1636void QtRec::fileBeamFinished( Ir *ir) {
1637 if(ir) 1637 if(ir)
1638 QMessageBox::message( tr("Ir Beam out"), tr("Ir sent.") ,tr("Ok") ); 1638 QMessageBox::message( tr("Ir Beam out"), tr("Ir sent.") ,tr("Ok") );
1639 1639
1640} 1640}
1641 1641
1642void QtRec::doBeam() { 1642void QtRec::doBeam() {
1643 qApp->processEvents(); 1643 qApp->processEvents();
1644 if( ListView1->currentItem() == NULL) 1644 if( ListView1->currentItem() == NULL)
1645 return; 1645 return;
1646 Ir ir; 1646 Ir ir;
1647 if( ir.supported()) { 1647 if( ir.supported()) {
1648 QString file = ListView1->currentItem()->text(0); 1648 QString file = ListView1->currentItem()->text(0);
1649 Config cfg("OpieRec"); 1649 Config cfg("OpieRec");
1650 cfg.setGroup("Sounds"); 1650 cfg.setGroup("Sounds");
1651 1651
1652 int nFiles = cfg.readNumEntry("NumberofFiles",0); 1652 int nFiles = cfg.readNumEntry("NumberofFiles",0);
1653 1653
1654 for(int i=0;i<nFiles+1;i++) { 1654 for(int i=0;i<nFiles+1;i++) {
1655 if( cfg.readEntry( QString::number( i),"").find( file, 0, true) != -1) { 1655 if( cfg.readEntry( QString::number( i),"").find( file, 0, true) != -1) {
1656 QString filePath = cfg.readEntry(file,""); 1656 QString filePath = cfg.readEntry(file,"");
1657 Ir *file = new Ir(this, "IR"); 1657 Ir *file = new Ir(this, "IR");
1658 connect( file, SIGNAL( done(Ir*)), 1658 connect( file, SIGNAL( done(Ir*)),
1659 this, SLOT( fileBeamFinished( Ir * ))); 1659 this, SLOT( fileBeamFinished(Ir*)));
1660 file->send( filePath, "OPieRec audio file\n" + filePath ); 1660 file->send( filePath, "OPieRec audio file\n" + filePath );
1661 } 1661 }
1662 } 1662 }
1663 } 1663 }
1664} 1664}
1665 1665
1666void QtRec::doMenuPlay() { 1666void QtRec::doMenuPlay() {
1667 qApp->processEvents(); 1667 qApp->processEvents();
1668 currentFile = ListView1->currentItem()->text(0); 1668 currentFile = ListView1->currentItem()->text(0);
1669} 1669}
1670 1670
1671void QtRec::doRename() { 1671void QtRec::doRename() {
1672 QRect r = ListView1->itemRect( ListView1->currentItem( )); 1672 QRect r = ListView1->itemRect( ListView1->currentItem( ));
1673 r = QRect( ListView1->viewportToContents( r.topLeft() ), r.size() ); 1673 r = QRect( ListView1->viewportToContents( r.topLeft() ), r.size() );
1674 r.setX( ListView1->contentsX() ); 1674 r.setX( ListView1->contentsX() );
1675 if ( r.width() > ListView1->visibleWidth() ) 1675 if ( r.width() > ListView1->visibleWidth() )
1676 r.setWidth( ListView1->visibleWidth() ); 1676 r.setWidth( ListView1->visibleWidth() );
1677 1677
1678 renameBox = new QLineEdit( ListView1->viewport(), "qt_renamebox" ); 1678 renameBox = new QLineEdit( ListView1->viewport(), "qt_renamebox" );
1679 renameBox->setFrame(true); 1679 renameBox->setFrame(true);
1680 1680
1681 renameBox->setText( ListView1->currentItem()->text(0) ); 1681 renameBox->setText( ListView1->currentItem()->text(0) );
1682 1682
1683 renameBox->selectAll(); 1683 renameBox->selectAll();
1684 renameBox->installEventFilter( this ); 1684 renameBox->installEventFilter( this );
1685 ListView1->addChild( renameBox, r.x(), r.y() ); 1685 ListView1->addChild( renameBox, r.x(), r.y() );
1686 renameBox->resize( r.size() ); 1686 renameBox->resize( r.size() );
1687 ListView1->viewport()->setFocusProxy( renameBox ); 1687 ListView1->viewport()->setFocusProxy( renameBox );
1688 renameBox->setFocus(); 1688 renameBox->setFocus();
1689 renameBox->show(); 1689 renameBox->show();
1690 1690
1691} 1691}
1692 1692
1693void QtRec::okRename() { 1693void QtRec::okRename() {
1694 qDebug(renameBox->text()); 1694 qDebug(renameBox->text());
1695 QString filename = renameBox->text(); 1695 QString filename = renameBox->text();
1696 cancelRename(); 1696 cancelRename();
1697 1697
1698 if( ListView1->currentItem() == NULL) 1698 if( ListView1->currentItem() == NULL)
1699 return; 1699 return;
1700 1700
1701 Config cfg("OpieRec"); 1701 Config cfg("OpieRec");
1702 cfg.setGroup("Sounds"); 1702 cfg.setGroup("Sounds");
1703 1703
1704 QString file = ListView1->currentItem()->text(0); 1704 QString file = ListView1->currentItem()->text(0);
1705 1705
1706 qDebug("filename is " + filename); 1706 qDebug("filename is " + filename);
1707 1707
1708 int nFiles = cfg.readNumEntry("NumberofFiles",0); 1708 int nFiles = cfg.readNumEntry("NumberofFiles",0);
1709 1709
1710 for(int i=0;i<nFiles+1;i++) { //look for file 1710 for(int i=0;i<nFiles+1;i++) { //look for file
1711 if( cfg.readEntry( QString::number(i),"").find(file,0,true) != -1) { 1711 if( cfg.readEntry( QString::number(i),"").find(file,0,true) != -1) {
1712 1712
1713 QString filePath = cfg.readEntry(file,""); 1713 QString filePath = cfg.readEntry(file,"");
1714 1714
1715 cfg.writeEntry( QString::number(i), filename ); 1715 cfg.writeEntry( QString::number(i), filename );
1716 cfg.writeEntry( filename, filePath ); 1716 cfg.writeEntry( filename, filePath );
1717 cfg.removeEntry( file); 1717 cfg.removeEntry( file);
1718 cfg.write(); 1718 cfg.write();
1719 } 1719 }
1720 } 1720 }
1721 1721
1722 ListView1->takeItem( ListView1->currentItem() ); 1722 ListView1->takeItem( ListView1->currentItem() );
1723 delete ListView1->currentItem(); 1723 delete ListView1->currentItem();
diff --git a/noncore/multimedia/powerchord/powerchordbase.cpp b/noncore/multimedia/powerchord/powerchordbase.cpp
index 0b97984..7978426 100644
--- a/noncore/multimedia/powerchord/powerchordbase.cpp
+++ b/noncore/multimedia/powerchord/powerchordbase.cpp
@@ -323,135 +323,135 @@ PowerchordBase::PowerchordBase( QWidget* parent, const char* name, WFlags fl )
323 tuner_lab1 = new QLabel( Tuner, "tuner_lab1" ); 323 tuner_lab1 = new QLabel( Tuner, "tuner_lab1" );
324 tuner_lab1->setGeometry( QRect( 10, 130, 100, 21 ) ); 324 tuner_lab1->setGeometry( QRect( 10, 130, 100, 21 ) );
325 tuner_lab1->setText( tr( "Tuner operation" ) ); 325 tuner_lab1->setText( tr( "Tuner operation" ) );
326 326
327 tuner_lab2 = new QLabel( Tuner, "tuner_lab2" ); 327 tuner_lab2 = new QLabel( Tuner, "tuner_lab2" );
328 tuner_lab2->setGeometry( QRect( 10, 200, 100, 16 ) ); 328 tuner_lab2->setGeometry( QRect( 10, 200, 100, 16 ) );
329 tuner_lab2->setText( tr( "Pitch calibration" ) ); 329 tuner_lab2->setText( tr( "Pitch calibration" ) );
330 330
331 tuner_calib_note = new QComboBox( FALSE, Tuner, "tuner_calib_note" ); 331 tuner_calib_note = new QComboBox( FALSE, Tuner, "tuner_calib_note" );
332 tuner_calib_note->insertItem( tr( "A" ) ); 332 tuner_calib_note->insertItem( tr( "A" ) );
333 tuner_calib_note->insertItem( tr( "C" ) ); 333 tuner_calib_note->insertItem( tr( "C" ) );
334 tuner_calib_note->setGeometry( QRect( 5, 225, 90, 21 ) ); 334 tuner_calib_note->setGeometry( QRect( 5, 225, 90, 21 ) );
335 335
336 tuner_calib_freq = new QSpinBox( Tuner, "tuner_calib_freq" ); 336 tuner_calib_freq = new QSpinBox( Tuner, "tuner_calib_freq" );
337 tuner_calib_freq->setGeometry( QRect( 105, 225, 71, 21 ) ); 337 tuner_calib_freq->setGeometry( QRect( 105, 225, 71, 21 ) );
338 tuner_calib_freq->setSuffix( tr( "Hz" ) ); 338 tuner_calib_freq->setSuffix( tr( "Hz" ) );
339 tuner_calib_freq->setWrapping( TRUE ); 339 tuner_calib_freq->setWrapping( TRUE );
340 tuner_calib_freq->setMaxValue( 500 ); 340 tuner_calib_freq->setMaxValue( 500 );
341 tuner_calib_freq->setMinValue( 300 ); 341 tuner_calib_freq->setMinValue( 300 );
342 tuner_calib_freq->setValue( 440 ); 342 tuner_calib_freq->setValue( 440 );
343 343
344 tuner_lab3 = new QLabel( Tuner, "tuner_lab3" ); 344 tuner_lab3 = new QLabel( Tuner, "tuner_lab3" );
345 tuner_lab3->setGeometry( QRect( 185, 225, 40, 21 ) ); 345 tuner_lab3->setGeometry( QRect( 185, 225, 40, 21 ) );
346 tuner_lab3->setText( tr( "Pitch" ) ); 346 tuner_lab3->setText( tr( "Pitch" ) );
347 347
348 tuner_pic1 = new QLabel( Tuner, "tuner_pic1" ); 348 tuner_pic1 = new QLabel( Tuner, "tuner_pic1" );
349 tuner_pic1->setGeometry( QRect( 195, 155, 31, 31 ) ); 349 tuner_pic1->setGeometry( QRect( 195, 155, 31, 31 ) );
350 tuner_pic1->setFrameShape( QLabel::NoFrame ); 350 tuner_pic1->setFrameShape( QLabel::NoFrame );
351 tuner_pic1->setPixmap( image6 ); 351 tuner_pic1->setPixmap( image6 );
352 tuner_pic1->setScaledContents( TRUE ); 352 tuner_pic1->setScaledContents( TRUE );
353 tabs->insertTab( Tuner, tr( "Tuner" ) ); 353 tabs->insertTab( Tuner, tr( "Tuner" ) );
354 354
355 tab_3 = new QWidget( tabs, "tab_3" ); 355 tab_3 = new QWidget( tabs, "tab_3" );
356 356
357 chordlistlab1 = new QLabel( tab_3, "chordlistlab1" ); 357 chordlistlab1 = new QLabel( tab_3, "chordlistlab1" );
358 chordlistlab1->setGeometry( QRect( 5, 5, 216, 16 ) ); 358 chordlistlab1->setGeometry( QRect( 5, 5, 216, 16 ) );
359 chordlistlab1->setText( tr( "Chord list" ) ); 359 chordlistlab1->setText( tr( "Chord list" ) );
360 360
361 chordlist = new QListBox( tab_3, "chordlist" ); 361 chordlist = new QListBox( tab_3, "chordlist" );
362 chordlist->setGeometry( QRect( 5, 25, 220, 200 ) ); 362 chordlist->setGeometry( QRect( 5, 25, 220, 200 ) );
363 363
364 list_remove_btn = new QPushButton( tab_3, "list_remove_btn" ); 364 list_remove_btn = new QPushButton( tab_3, "list_remove_btn" );
365 list_remove_btn->setGeometry( QRect( 150, 230, 71, 25 ) ); 365 list_remove_btn->setGeometry( QRect( 150, 230, 71, 25 ) );
366 list_remove_btn->setText( tr( "Remove" ) ); 366 list_remove_btn->setText( tr( "Remove" ) );
367 tabs->insertTab( tab_3, tr( "Chords" ) ); 367 tabs->insertTab( tab_3, tr( "Chords" ) );
368 368
369 // hope this does what it's supposed to!! 369 // hope this does what it's supposed to!!
370 // setPalette( QPalette( QColor( 232, 227, 215) ) ); 370 // setPalette( QPalette( QColor( 232, 227, 215) ) );
371 371
372 // signals and slots connections 372 // signals and slots connections
373 373
374 //cxm 374 //cxm
375 connect( tuning, SIGNAL( activated(int) ), frets, SLOT( Tune(int) ) ); 375 connect( tuning, SIGNAL( activated(int) ), frets, SLOT( Tune(int) ) );
376 connect( span, SIGNAL( activated(int) ), frets, SLOT( Span(int) ) ); 376 connect( span, SIGNAL( activated(int) ), frets, SLOT( Span(int) ) );
377 connect( transport_rec, SIGNAL( clicked() ), this, SLOT( transport_rec_cb() )); 377 connect( transport_rec, SIGNAL( clicked() ), this, SLOT( transport_rec_cb() ));
378 connect( play_sound, SIGNAL( clicked() ), this, SLOT( play_chord_cb() )); 378 connect( play_sound, SIGNAL( clicked() ), this, SLOT( play_chord_cb() ));
379 connect( tuner_start, SIGNAL( clicked() ), this, SLOT( tuner_start_cb() )); 379 connect( tuner_start, SIGNAL( clicked() ), this, SLOT( tuner_start_cb() ));
380 connect( tuner_note, SIGNAL( textChanged(const QString&) ), vu, SLOT( AnnotL(const QString&) )); 380 connect( tuner_note, SIGNAL( textChanged(const QString&) ), vu, SLOT( AnnotL(const QString&) ));
381 connect( this, SIGNAL( frequency_change(int) ), vu, SLOT( Value(int) )); 381 connect( this, SIGNAL( frequency_change(int) ), vu, SLOT( Value(int) ));
382 382
383 connect( chordnote, SIGNAL( activated(int) ), frets, SLOT( Base(int) ) ); 383 connect( chordnote, SIGNAL( activated(int) ), frets, SLOT( Base(int) ) );
384 connect( chordkey, SIGNAL( activated(int) ), frets, SLOT( Chord(int) ) ); 384 connect( chordkey, SIGNAL( activated(int) ), frets, SLOT( Chord(int) ) );
385 connect( chordfret, SIGNAL( activated(int) ), frets, SLOT( Fret(int) ) ); 385 connect( chordfret, SIGNAL( activated(int) ), frets, SLOT( Fret(int) ) );
386 connect( list_remove_btn, SIGNAL( clicked() ), this, SLOT( list_remove_cb() ) ); 386 connect( list_remove_btn, SIGNAL( clicked() ), this, SLOT( list_remove_cb() ) );
387 connect( frets, SIGNAL( s1nameChanged(const QString &) ), s1_1, SLOT( setText(const QString&) ) ); 387 connect( frets, SIGNAL( s1nameChanged(const QString&) ), s1_1, SLOT( setText(const QString&) ) );
388 connect( frets, SIGNAL( s2nameChanged(const QString &) ), s1_2, SLOT( setText(const QString&) ) ); 388 connect( frets, SIGNAL( s2nameChanged(const QString&) ), s1_2, SLOT( setText(const QString&) ) );
389 connect( frets, SIGNAL( s3nameChanged(const QString &) ), s1_3, SLOT( setText(const QString&) ) ); 389 connect( frets, SIGNAL( s3nameChanged(const QString&) ), s1_3, SLOT( setText(const QString&) ) );
390 connect( frets, SIGNAL( s4nameChanged(const QString &) ), s1_4, SLOT( setText(const QString&) ) ); 390 connect( frets, SIGNAL( s4nameChanged(const QString&) ), s1_4, SLOT( setText(const QString&) ) );
391 connect( frets, SIGNAL( s5nameChanged(const QString &) ), s1_5, SLOT( setText(const QString&) ) ); 391 connect( frets, SIGNAL( s5nameChanged(const QString&) ), s1_5, SLOT( setText(const QString&) ) );
392 connect( frets, SIGNAL( s6nameChanged(const QString &) ), s1_6, SLOT( setText(const QString&) ) ); 392 connect( frets, SIGNAL( s6nameChanged(const QString&) ), s1_6, SLOT( setText(const QString&) ) );
393 connect( frets, SIGNAL( nameChanged(const QString &) ), chordname, SLOT( setText(const QString&) ) ); 393 connect( frets, SIGNAL( nameChanged(const QString&) ), chordname, SLOT( setText(const QString&) ) );
394} 394}
395 395
396 396
397static int known=0; 397static int known=0;
398#include <qmessagebox.h> 398#include <qmessagebox.h>
399void PowerchordBase::transport_rec_cb(){ 399void PowerchordBase::transport_rec_cb(){
400 chordlist->insertItem(chordname->text(),-1); 400 chordlist->insertItem(chordname->text(),-1);
401 if (!known){ 401 if (!known){
402 QMessageBox::information(this, "Powerchord", "This chord has been saved\ninto the list of chords,\nfor later playback."); 402 QMessageBox::information(this, "Powerchord", "This chord has been saved\ninto the list of chords,\nfor later playback.");
403 known = 1; 403 known = 1;
404 } 404 }
405} 405}
406void PowerchordBase::list_remove_cb(){ 406void PowerchordBase::list_remove_cb(){
407 if (chordlist->count() > 0){ 407 if (chordlist->count() > 0){
408 chordlist->removeItem(0); 408 chordlist->removeItem(0);
409 } 409 }
410} 410}
411void PowerchordBase::play_chord_cb(){ 411void PowerchordBase::play_chord_cb(){
412 // QMessageBox::information(this, "Coming soon!", "This button plays\nthe chord by synthesizing\nthe sound of the notes."); 412 // QMessageBox::information(this, "Coming soon!", "This button plays\nthe chord by synthesizing\nthe sound of the notes.");
413 413
414 414
415 if (audio_timer){ 415 if (audio_timer){
416 audio_timer->stop(); 416 audio_timer->stop();
417 // set pixmap? 417 // set pixmap?
418 synth->Stop(); 418 synth->Stop();
419 delete(audio_timer); 419 delete(audio_timer);
420 audio_timer = 0; 420 audio_timer = 0;
421 }else{ 421 }else{
422 // get notes from chord engine 422 // get notes from chord engine
423 423
424 int note; 424 int note;
425 int base; 425 int base;
426 int octave; 426 int octave;
427 note = frets->ce.noteindex(0); 427 note = frets->ce.noteindex(0);
428 if (note >= 0){ 428 if (note >= 0){
429 //fprintf(stderr, "Note was %d\n", note); 429 //fprintf(stderr, "Note was %d\n", note);
430 base = note % 12; 430 base = note % 12;
431 octave = note / 12; 431 octave = note / 12;
432 synth->note_start(0, base, octave); 432 synth->note_start(0, base, octave);
433 }else{ 433 }else{
434 // subtle bug here - replay second note if 1st one muted 434 // subtle bug here - replay second note if 1st one muted
435 note = frets->ce.noteindex(1); 435 note = frets->ce.noteindex(1);
436 base = note % 12; 436 base = note % 12;
437 octave = note / 12; 437 octave = note / 12;
438 synth->note_start(1, base, octave); 438 synth->note_start(1, base, octave);
439 439
440 } 440 }
441 441
442 // init synth 442 // init synth
443 if (synth->Play()){ 443 if (synth->Play()){
444 // error 444 // error
445 QMessageBox::information(this, "Powerchord", "Unable to open device for sound playback - check that no other application is using it."); 445 QMessageBox::information(this, "Powerchord", "Unable to open device for sound playback - check that no other application is using it.");
446 return; 446 return;
447 } 447 }
448 synth->fill_buffer(); 448 synth->fill_buffer();
449 449
450 // start timer 450 // start timer
451 audio_timer = new QTimer(); 451 audio_timer = new QTimer();
452 connect(audio_timer, SIGNAL( timeout() ), this, SLOT( audio_cb() )); 452 connect(audio_timer, SIGNAL( timeout() ), this, SLOT( audio_cb() ));
453 // set pixmap on player? 453 // set pixmap on player?
454 audio_timer->start(19); // 19 msec (fudge factor!!) 454 audio_timer->start(19); // 19 msec (fudge factor!!)
455 } 455 }
456} 456}
457 457
diff --git a/noncore/multimedia/showimg/ImageFileSelector.cpp b/noncore/multimedia/showimg/ImageFileSelector.cpp
index 7872c09..d2b65a9 100644
--- a/noncore/multimedia/showimg/ImageFileSelector.cpp
+++ b/noncore/multimedia/showimg/ImageFileSelector.cpp
@@ -38,234 +38,234 @@ ThumbWidget::ThumbWidget(QPixmap p,QString text,const DocLnk& f,QWidget *parent,
38 38
39void ThumbWidget::resizeEvent(QResizeEvent *) 39void ThumbWidget::resizeEvent(QResizeEvent *)
40{ 40{
41 description->setGeometry(0,height()-24,width(),24); 41 description->setGeometry(0,height()-24,width(),24);
42} 42}
43 43
44void ThumbWidget::paintEvent( QPaintEvent *e ) 44void ThumbWidget::paintEvent( QPaintEvent *e )
45{ 45{
46 QPainter painter(this); 46 QPainter painter(this);
47 47
48 painter.setClipRect(e->rect()); 48 painter.setClipRect(e->rect());
49 painter.fillRect(0,0,width(),height(),QColor(255,255,255)); 49 painter.fillRect(0,0,width(),height(),QColor(255,255,255));
50 painter.drawPixmap((width() - pixmap.width()) / 2,0, pixmap); 50 painter.drawPixmap((width() - pixmap.width()) / 2,0, pixmap);
51 51
52} 52}
53 53
54void ThumbWidget::mouseReleaseEvent(QMouseEvent* ) 54void ThumbWidget::mouseReleaseEvent(QMouseEvent* )
55{ 55{
56 emit clicked(fl); 56 emit clicked(fl);
57} 57}
58 58
59 59
60 60
61ImageFileSelectorItem::ImageFileSelectorItem( QListView *parent, const DocLnk &f) 61ImageFileSelectorItem::ImageFileSelectorItem( QListView *parent, const DocLnk &f)
62 : QListViewItem( parent ), fl( f ) 62 : QListViewItem( parent ), fl( f )
63{ 63{
64 setText( 0, f.name() ); 64 setText( 0, f.name() );
65 QFileInfo fi(f.file()); 65 QFileInfo fi(f.file());
66 setText( 1, (fi.extension()).upper() ); 66 setText( 1, (fi.extension()).upper() );
67 setPixmap( 0, f.pixmap() ); 67 setPixmap( 0, f.pixmap() );
68 68
69 69
70} 70}
71 71
72 72
73ImageFileSelectorItem::~ImageFileSelectorItem() 73ImageFileSelectorItem::~ImageFileSelectorItem()
74{ 74{
75 75
76} 76}
77 77
78 78
79ImageFileSelector::ImageFileSelector( CURRENT_VIEW scv,QWidget *parent,const char * ) 79ImageFileSelector::ImageFileSelector( CURRENT_VIEW scv,QWidget *parent,const char * )
80 : QWidgetStack(parent) 80 : QWidgetStack(parent)
81{ 81{
82 82
83 detailed=new QListView(this); 83 detailed=new QListView(this);
84 84
85 detailed->addColumn (tr("Title")); 85 detailed->addColumn (tr("Title"));
86 detailed->addColumn (tr("Type")); 86 detailed->addColumn (tr("Type"));
87 detailed->setAllColumnsShowFocus( true ); 87 detailed->setAllColumnsShowFocus( true );
88 88
89 tList.setAutoDelete(true); 89 tList.setAutoDelete(true);
90 90
91 thumb =new QScrollView(this); 91 thumb =new QScrollView(this);
92 thumb->setVScrollBarMode (QScrollView::Auto ); 92 thumb->setVScrollBarMode (QScrollView::Auto );
93 thumb->viewport()->setBackgroundColor(colorGroup().base()); 93 thumb->viewport()->setBackgroundColor(colorGroup().base());
94 94
95 background=new QWidget(0); 95 background=new QWidget(0);
96 background->setBackgroundColor(colorGroup().base()); 96 background->setBackgroundColor(colorGroup().base());
97 thumb->addChild(background); 97 thumb->addChild(background);
98 gl = new QGridLayout(background,1,2,4,4); 98 gl = new QGridLayout(background,1,2,4,4);
99 99
100 100
101 101
102 connect( detailed, SIGNAL( mouseButtonClicked( int, QListViewItem *, const QPoint &, int ) ), 102 connect( detailed, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),
103 this, SLOT( fileClicked( int, QListViewItem *, const QPoint &, int ) ) ); 103 this, SLOT( fileClicked(int,QListViewItem*,const QPoint&,int) ) );
104 connect( detailed, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint &, int ) ), 104 connect( detailed, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
105 this, SLOT( filePressed( int, QListViewItem *, const QPoint &, int ) ) ); 105 this, SLOT( filePressed(int,QListViewItem*,const QPoint&,int) ) );
106 connect( detailed, SIGNAL( returnPressed( QListViewItem * ) ), 106 connect( detailed, SIGNAL( returnPressed(QListViewItem*) ),
107 this, SLOT( fileClicked( QListViewItem * ) ) ); 107 this, SLOT( fileClicked(QListViewItem*) ) );
108 108
109 cView=UNKNOWN; 109 cView=UNKNOWN;
110 setView(scv); 110 setView(scv);
111 reread(); 111 reread();
112 112
113} 113}
114ImageFileSelector::~ImageFileSelector() 114ImageFileSelector::~ImageFileSelector()
115{ 115{
116 116
117} 117}
118 118
119 119
120void ImageFileSelector::switchView() 120void ImageFileSelector::switchView()
121{ 121{
122 CURRENT_VIEW v=cView; 122 CURRENT_VIEW v=cView;
123 123
124 if ( v==DETAILED ) 124 if ( v==DETAILED )
125 v=THUMBNAIL; 125 v=THUMBNAIL;
126 else 126 else
127 v=DETAILED; 127 v=DETAILED;
128 setView(v); 128 setView(v);
129} 129}
130 130
131void ImageFileSelector::setView(CURRENT_VIEW v) 131void ImageFileSelector::setView(CURRENT_VIEW v)
132{ 132{
133 133
134 if ( v==cView ) 134 if ( v==cView )
135 return; 135 return;
136 cView=v; 136 cView=v;
137 137
138 if ( cView!=DETAILED ) 138 if ( cView!=DETAILED )
139 { 139 {
140 raiseWidget(thumb); 140 raiseWidget(thumb);
141 updateSizes(); 141 updateSizes();
142 } 142 }
143 else 143 else
144 { 144 {
145 raiseWidget(detailed); 145 raiseWidget(detailed);
146 updateSizes(); 146 updateSizes();
147 } 147 }
148 148
149 149
150} 150}
151 151
152void ImageFileSelector::resizeEvent(QResizeEvent *) 152void ImageFileSelector::resizeEvent(QResizeEvent *)
153{ 153{
154 updateSizes(); 154 updateSizes();
155} 155}
156 156
157void ImageFileSelector::updateSizes() 157void ImageFileSelector::updateSizes()
158{ 158{
159 int ww=(detailed->width()-detailed->frameWidth()*2); 159 int ww=(detailed->width()-detailed->frameWidth()*2);
160 double w=(double)ww*0.70; 160 double w=(double)ww*0.70;
161 detailed->setColumnWidth(0,(int)w); 161 detailed->setColumnWidth(0,(int)w);
162 detailed->setColumnWidth(1,ww-(int)w); 162 detailed->setColumnWidth(1,ww-(int)w);
163 background->setMinimumWidth(thumb->visibleWidth()); 163 background->setMinimumWidth(thumb->visibleWidth());
164 thumb->updateScrollBars(); 164 thumb->updateScrollBars();
165} 165}
166 166
167void ImageFileSelector::reread(bool) 167void ImageFileSelector::reread(bool)
168{ 168{
169// qDebug("reread"); 169// qDebug("reread");
170 ImageFileSelectorItem *item = (ImageFileSelectorItem *)detailed->selectedItem(); 170 ImageFileSelectorItem *item = (ImageFileSelectorItem *)detailed->selectedItem();
171 QString oldFile; 171 QString oldFile;
172 if ( item ) 172 if ( item )
173 oldFile = item->file().file(); 173 oldFile = item->file().file();
174 detailed->clear(); 174 detailed->clear();
175 tList.clear(); 175 tList.clear();
176 DocLnkSet files; 176 DocLnkSet files;
177 Global::findDocuments(&files, "image/*"); 177 Global::findDocuments(&files, "image/*");
178 count = files.children().count(); 178 count = files.children().count();
179 QListIterator<DocLnk> dit( files.children() ); 179 QListIterator<DocLnk> dit( files.children() );
180// int y=0; 180// int y=0;
181// int x=4; 181// int x=4;
182// int totalHeight=4; 182// int totalHeight=4;
183 ThumbWidget *l=0; 183 ThumbWidget *l=0;
184 int width=80; 184 int width=80;
185 gl->expand(dit.count()/2,2); 185 gl->expand(dit.count()/2,2);
186 int i,j; 186 int i,j;
187 i=j=0; 187 i=j=0;
188 detailed->setUpdatesEnabled(false); 188 detailed->setUpdatesEnabled(false);
189 thumb->setUpdatesEnabled(false); 189 thumb->setUpdatesEnabled(false);
190 190
191 for ( ; dit.current(); ++dit ) { 191 for ( ; dit.current(); ++dit ) {
192 item = new ImageFileSelectorItem( detailed, **dit ); 192 item = new ImageFileSelectorItem( detailed, **dit );
193 if ( item->file().file() == oldFile ) 193 if ( item->file().file() == oldFile )
194 detailed->setCurrentItem( item ); 194 detailed->setCurrentItem( item );
195 } 195 }
196 196
197 QListViewItemIterator it( detailed ); 197 QListViewItemIterator it( detailed );
198 ImageFileSelectorItem *ii; 198 ImageFileSelectorItem *ii;
199 // iterate through all items of the listview 199 // iterate through all items of the listview
200 for ( ; it.current(); ++it ) { 200 for ( ; it.current(); ++it ) {
201 ii=(ImageFileSelectorItem *)it.current(); 201 ii=(ImageFileSelectorItem *)it.current();
202 QImage img( ii->file().file() ); 202 QImage img( ii->file().file() );
203 if( !img.isNull()) { 203 if( !img.isNull()) {
204 img=img.smoothScale(64,64); 204 img=img.smoothScale(64,64);
205 QPixmap pix; 205 QPixmap pix;
206 pix.convertFromImage(img); 206 pix.convertFromImage(img);
207 l=new ThumbWidget(pix,ii->file().name(),ii->file(),background,width); 207 l=new ThumbWidget(pix,ii->file().name(),ii->file(),background,width);
208 l->setBackgroundColor(colorGroup().base()); 208 l->setBackgroundColor(colorGroup().base());
209 gl->addWidget(l,j,i); 209 gl->addWidget(l,j,i);
210 i++; 210 i++;
211 if ( i==2 ) { 211 if ( i==2 ) {
212 i=0; 212 i=0;
213 j++; 213 j++;
214 } 214 }
215 tList.append(l); 215 tList.append(l);
216 connect(l,SIGNAL(clicked(const DocLnk &)),this,SLOT(thumbClicked(const DocLnk &))); 216 connect(l,SIGNAL(clicked(const DocLnk&)),this,SLOT(thumbClicked(const DocLnk&)));
217 } 217 }
218 } 218 }
219 219
220 if ( !detailed->selectedItem() ) 220 if ( !detailed->selectedItem() )
221 detailed->setCurrentItem( detailed->firstChild() ); 221 detailed->setCurrentItem( detailed->firstChild() );
222 222
223 detailed->setUpdatesEnabled(true); 223 detailed->setUpdatesEnabled(true);
224 thumb->setUpdatesEnabled(true); 224 thumb->setUpdatesEnabled(true);
225 detailed->update(); 225 detailed->update();
226 thumb->update(); 226 thumb->update();
227} 227}
228 228
229int ImageFileSelector::fileCount() 229int ImageFileSelector::fileCount()
230{ 230{
231 return count; 231 return count;
232} 232}
233const DocLnk * ImageFileSelector::selected() 233const DocLnk * ImageFileSelector::selected()
234{ 234{
235 qDebug("image selected"); 235 qDebug("image selected");
236 ImageFileSelectorItem *item = (ImageFileSelectorItem *) detailed->selectedItem(); 236 ImageFileSelectorItem *item = (ImageFileSelectorItem *) detailed->selectedItem();
237 if ( item ) 237 if ( item )
238 return new DocLnk( item->file() ); 238 return new DocLnk( item->file() );
239 return 0; 239 return 0;
240} 240}
241 241
242 242
243 243
244void ImageFileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, int ) 244void ImageFileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, int )
245{ 245{
246 if ( !i ) 246 if ( !i )
247 return; 247 return;
248 if ( button == Qt::LeftButton ) 248 if ( button == Qt::LeftButton )
249 { 249 {
250 fileClicked( i ); 250 fileClicked( i );
251 } 251 }
252} 252}
253 // pressed to get 'right down' 253 // pressed to get 'right down'
254void ImageFileSelector::filePressed( int, QListViewItem *, const QPoint &, int ) 254void ImageFileSelector::filePressed( int, QListViewItem *, const QPoint &, int )
255{ 255{
256 256
257} 257}
258void ImageFileSelector::fileClicked( QListViewItem *i) 258void ImageFileSelector::fileClicked( QListViewItem *i)
259{ 259{
260 if ( !i ) 260 if ( !i )
261 return; 261 return;
262 emit fileSelected( ( (ImageFileSelectorItem*)i )->file() ); 262 emit fileSelected( ( (ImageFileSelectorItem*)i )->file() );
263 emit closeMe(); 263 emit closeMe();
264} 264}
265 265
266void ImageFileSelector::thumbClicked(const DocLnk &f) 266void ImageFileSelector::thumbClicked(const DocLnk &f)
267{ 267{
268 emit fileSelected( f ); 268 emit fileSelected( f );
269 emit closeMe(); 269 emit closeMe();
270} 270}
271 271
diff --git a/noncore/multimedia/showimg/showimg.cpp b/noncore/multimedia/showimg/showimg.cpp
index ba76e57..02a1d91 100644
--- a/noncore/multimedia/showimg/showimg.cpp
+++ b/noncore/multimedia/showimg/showimg.cpp
@@ -247,130 +247,130 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags )
247 viewMenuFile->insertItem( tr("Thumbnail View"), 247 viewMenuFile->insertItem( tr("Thumbnail View"),
248 this, SLOT(switchThumbView()), 0, SHOW_THUMBNAILS ); 248 this, SLOT(switchThumbView()), 0, SHOW_THUMBNAILS );
249 249
250 viewMenuFile->setItemChecked ( SHOW_THUMBNAILS, showThumbView ); 250 viewMenuFile->setItemChecked ( SHOW_THUMBNAILS, showThumbView );
251 251
252 252
253 253
254 254
255 optionsMenuFile = new QPopupMenu( this); 255 optionsMenuFile = new QPopupMenu( this);
256 //menubarFile->insertItem( tr("Options"),optionsMenu ); 256 //menubarFile->insertItem( tr("Options"),optionsMenu );
257 slideAction = new QAction( tr( "Slide show" ), Resource::loadIconSet( "slideshow" ), 257 slideAction = new QAction( tr( "Slide show" ), Resource::loadIconSet( "slideshow" ),
258 QString::null, 0, this, 0 ); 258 QString::null, 0, this, 0 );
259 slideAction->setToggleAction( TRUE ); 259 slideAction->setToggleAction( TRUE );
260 connect( slideAction, SIGNAL( toggled(bool) ), this, SLOT( slideShow(bool) ) ); 260 connect( slideAction, SIGNAL( toggled(bool) ), this, SLOT( slideShow(bool) ) );
261 slideAction->addTo( optionsMenuFile); 261 slideAction->addTo( optionsMenuFile);
262// slideAction->addTo( toolBar ); 262// slideAction->addTo( toolBar );
263 263
264 264
265// optionsMenuFile->insertItem( tr("Slideshow") ); 265// optionsMenuFile->insertItem( tr("Slideshow") );
266 optionsMenuFile->insertSeparator(); 266 optionsMenuFile->insertSeparator();
267 optionsMenuFile->insertItem( tr("Preferences.."), this, SLOT(settings()), 0); 267 optionsMenuFile->insertItem( tr("Preferences.."), this, SLOT(settings()), 0);
268// optionsMenuFile->insertItem( tr("Help"), this, SLOT(help()), 0); 268// optionsMenuFile->insertItem( tr("Help"), this, SLOT(help()), 0);
269 269
270 QStrList fmt = QImage::outputFormats(); 270 QStrList fmt = QImage::outputFormats();
271 271
272 272
273 fileMenuView = new QPopupMenu( this ); 273 fileMenuView = new QPopupMenu( this );
274 //menubarView->insertItem( tr("File"),fileMenu ); 274 //menubarView->insertItem( tr("File"),fileMenu );
275 fileMenuView->insertItem( tr("Image Info ..."),this, SLOT(displayInfoDialog()),0 ); 275 fileMenuView->insertItem( tr("Image Info ..."),this, SLOT(displayInfoDialog()),0 );
276 fileMenuView->insertSeparator(); 276 fileMenuView->insertSeparator();
277 277
278 viewMenuView = new QPopupMenu(this ); 278 viewMenuView = new QPopupMenu(this );
279 viewMenuView->setCheckable ( true ); 279 viewMenuView->setCheckable ( true );
280 280
281 //menubarView->insertItem( tr("View"),viewMenu ); 281 //menubarView->insertItem( tr("View"),viewMenu );
282 viewMenuView->insertItem(tr("Horizontal flip"), this, SLOT(hFlip()), 0); 282 viewMenuView->insertItem(tr("Horizontal flip"), this, SLOT(hFlip()), 0);
283 viewMenuView->insertItem(tr("Vertical flip"), this, SLOT(vFlip()), 0); 283 viewMenuView->insertItem(tr("Vertical flip"), this, SLOT(vFlip()), 0);
284 284
285 stack = new QWidgetStack( this ); 285 stack = new QWidgetStack( this );
286 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); 286 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
287 setCentralWidget( stack ); 287 setCentralWidget( stack );
288 288
289 289
290 imagePanel = new ImagePane( stack ); 290 imagePanel = new ImagePane( stack );
291 connect(imagePanel, SIGNAL(clicked()), this, SLOT(normalView())); 291 connect(imagePanel, SIGNAL(clicked()), this, SLOT(normalView()));
292 292
293 293
294 ImageFileSelector::CURRENT_VIEW cv; 294 ImageFileSelector::CURRENT_VIEW cv;
295 if(showThumbView) 295 if(showThumbView)
296 cv=ImageFileSelector::THUMBNAIL; 296 cv=ImageFileSelector::THUMBNAIL;
297 else 297 else
298 cv=ImageFileSelector::DETAILED; 298 cv=ImageFileSelector::DETAILED;
299 299
300 qDebug("cv = %d",cv); 300 qDebug("cv = %d",cv);
301 301
302 fileSelector = new ImageFileSelector( cv,stack, "fs"); 302 fileSelector = new ImageFileSelector( cv,stack, "fs");
303 303
304 //switchThumbView(); 304 //switchThumbView();
305 305
306 306
307 //fileSelector = new ImageFileSelector("image/*", stack, "fs"); 307 //fileSelector = new ImageFileSelector("image/*", stack, "fs");
308 //fileSelector->setNewVisible(FALSE); 308 //fileSelector->setNewVisible(FALSE);
309 //fileSelector->setCloseVisible(FALSE); 309 //fileSelector->setCloseVisible(FALSE);
310 connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( closeFileSelector() ) ); 310 connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( closeFileSelector() ) );
311 connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), 311 connect( fileSelector, SIGNAL( fileSelected(const DocLnk&) ),
312 this, SLOT( openFile( const DocLnk & ) ) ); 312 this, SLOT( openFile(const DocLnk&) ) );
313 313
314 imageList = fileSelector->fileList(); 314 imageList = fileSelector->fileList();
315 slideAction->setEnabled( imageList.count() != 0); 315 slideAction->setEnabled( imageList.count() != 0);
316 316
317 iconToolBar = new QToolBar(this); 317 iconToolBar = new QToolBar(this);
318 318
319 QAction *a; 319 QAction *a;
320 320
321 a = new QAction( tr( "Open ..." ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); 321 a = new QAction( tr( "Open ..." ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 );
322 connect( a, SIGNAL( activated() ), this, SLOT( open() ) ); 322 connect( a, SIGNAL( activated() ), this, SLOT( open() ) );
323 a->addTo( fileMenuView); 323 a->addTo( fileMenuView);
324 a->addTo( iconToolBar ); 324 a->addTo( iconToolBar );
325 325
326 326
327 a = new QAction( tr( "Rotate 90"), Resource::loadPixmap( "rotate90" ), QString::null, 0, this, 0); 327 a = new QAction( tr( "Rotate 90"), Resource::loadPixmap( "rotate90" ), QString::null, 0, this, 0);
328 connect( a, SIGNAL( activated() ), this, SLOT( rot90() ) ); 328 connect( a, SIGNAL( activated() ), this, SLOT( rot90() ) );
329 a->addTo( iconToolBar ); 329 a->addTo( iconToolBar );
330 a->addTo( viewMenuView ); 330 a->addTo( viewMenuView );
331 331
332 a = new QAction( tr( "Rotate 180" ), Resource::loadPixmap( "repeat" ), QString::null, 0, this, 0 ); 332 a = new QAction( tr( "Rotate 180" ), Resource::loadPixmap( "repeat" ), QString::null, 0, this, 0 );
333 connect( a, SIGNAL( activated() ), this, SLOT( rot180() ) ); 333 connect( a, SIGNAL( activated() ), this, SLOT( rot180() ) );
334 a->addTo( iconToolBar ); 334 a->addTo( iconToolBar );
335 a->addTo( viewMenuView ); 335 a->addTo( viewMenuView );
336 336
337 337
338 a = new QAction( tr( "Rotate 270"), Resource::loadPixmap( "rotate270" ), QString::null, 0, this, 0); 338 a = new QAction( tr( "Rotate 270"), Resource::loadPixmap( "rotate270" ), QString::null, 0, this, 0);
339 connect( a, SIGNAL( activated() ), this, SLOT( rot270() ) ); 339 connect( a, SIGNAL( activated() ), this, SLOT( rot270() ) );
340 //a->addTo( iconToolBar ); 340 //a->addTo( iconToolBar );
341 a->addTo( viewMenuView ); 341 a->addTo( viewMenuView );
342 342
343 343
344 344
345 viewMenuView->insertSeparator(); 345 viewMenuView->insertSeparator();
346 viewMenuView->insertItem(tr("Brightness ..."), this, SLOT(displayControlsDialog()), 0); 346 viewMenuView->insertItem(tr("Brightness ..."), this, SLOT(displayControlsDialog()), 0);
347 viewMenuView->insertItem(tr("Black And White"), this, SLOT(blackAndWhite()), 0,BLACKANDWHITE); 347 viewMenuView->insertItem(tr("Black And White"), this, SLOT(blackAndWhite()), 0,BLACKANDWHITE);
348 viewMenuView->insertSeparator(); 348 viewMenuView->insertSeparator();
349 349
350 350
351 sss = new QAction( tr( "Scale to Screen"), Resource::loadPixmap( "scale" ), QString::null, 0, this, 0,true); 351 sss = new QAction( tr( "Scale to Screen"), Resource::loadPixmap( "scale" ), QString::null, 0, this, 0,true);
352 connect( sss, SIGNAL( activated() ), this, SLOT( switchSizeToScreen() ) ); 352 connect( sss, SIGNAL( activated() ), this, SLOT( switchSizeToScreen() ) );
353 sss->addTo( iconToolBar ); 353 sss->addTo( iconToolBar );
354 sss->addTo( viewMenuView ); 354 sss->addTo( viewMenuView );
355 355
356 sss->setOn(isSized); 356 sss->setOn(isSized);
357 viewMenuView->insertSeparator(); 357 viewMenuView->insertSeparator();
358 358
359 359
360 a = new QAction( tr( "Fullscreen" ), Resource::loadPixmap( "fullscreen" ), 360 a = new QAction( tr( "Fullscreen" ), Resource::loadPixmap( "fullscreen" ),
361 QString::null, 0, this, 0 ); 361 QString::null, 0, this, 0 );
362 connect( a, SIGNAL( activated() ), this, SLOT( fullScreen() ) ); 362 connect( a, SIGNAL( activated() ), this, SLOT( fullScreen() ) );
363 a->addTo( iconToolBar ); 363 a->addTo( iconToolBar );
364 a->addTo( viewMenuView); 364 a->addTo( viewMenuView);
365 365
366 a = new QAction( tr( "Stop Slideshow" ), Resource::loadPixmap( "quit_icon" ), 366 a = new QAction( tr( "Stop Slideshow" ), Resource::loadPixmap( "quit_icon" ),
367 QString::null, 0, this, 0 ); 367 QString::null, 0, this, 0 );
368 connect( a, SIGNAL( activated() ), this, SLOT( stopSlideShow() ) ); 368 connect( a, SIGNAL( activated() ), this, SLOT( stopSlideShow() ) );
369 a->addTo( iconToolBar ); 369 a->addTo( iconToolBar );
370 a->addTo( viewMenuView); 370 a->addTo( viewMenuView);
371 371
372 372
373 Config config( "ImageViewer" ); 373 Config config( "ImageViewer" );
374 config.setGroup( "SlideShow" ); 374 config.setGroup( "SlideShow" );
375 slideDelay = config.readNumEntry( "Delay", 2); 375 slideDelay = config.readNumEntry( "Delay", 2);
376 slideRepeat = config.readBoolEntry( "Repeat", FALSE ); 376 slideRepeat = config.readBoolEntry( "Repeat", FALSE );
diff --git a/noncore/net/linphone/qlinphone.cpp b/noncore/net/linphone/qlinphone.cpp
index 3cc2ebc..ba4ee5f 100644
--- a/noncore/net/linphone/qlinphone.cpp
+++ b/noncore/net/linphone/qlinphone.cpp
@@ -51,129 +51,129 @@ extern "C" {
51 QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; 51 QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data;
52 w->pushGuiTask(new DisplayMessageTask(w,qmsg,DisplayMessageTask::Info)); 52 w->pushGuiTask(new DisplayMessageTask(w,qmsg,DisplayMessageTask::Info));
53 } 53 }
54 static void qt_display_warning(LinphoneCore *lc, char *message) { 54 static void qt_display_warning(LinphoneCore *lc, char *message) {
55 QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; 55 QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data;
56 QString qmsg(message); 56 QString qmsg(message);
57 w->pushGuiTask(new DisplayMessageTask(w,qmsg,DisplayMessageTask::Warn)); 57 w->pushGuiTask(new DisplayMessageTask(w,qmsg,DisplayMessageTask::Warn));
58 } 58 }
59 static void qt_display_url(LinphoneCore *lc, char *message, char *url) { 59 static void qt_display_url(LinphoneCore *lc, char *message, char *url) {
60 QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; 60 QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data;
61 QString qmsg=QString(message)+QString(url); 61 QString qmsg=QString(message)+QString(url);
62 w->pushGuiTask(new DisplayMessageTask(w,qmsg,DisplayMessageTask::Info)); 62 w->pushGuiTask(new DisplayMessageTask(w,qmsg,DisplayMessageTask::Info));
63 } 63 }
64 static void qt_notify_recv(LinphoneCore *lc, const char *url, const char *status) { 64 static void qt_notify_recv(LinphoneCore *lc, const char *url, const char *status) {
65 } 65 }
66 66
67 LinphoneCoreVTable lcvtable={ 67 LinphoneCoreVTable lcvtable={
68 show: 68 show:
69 qt_show, 69 qt_show,
70 inv_recv: 70 inv_recv:
71 qt_inv_recv, 71 qt_inv_recv,
72 bye_recv : 72 bye_recv :
73 stub, 73 stub,
74 notify_recv : 74 notify_recv :
75 qt_notify_recv, 75 qt_notify_recv,
76 display_status : 76 display_status :
77 qt_display_status, 77 qt_display_status,
78 display_message : 78 display_message :
79 qt_display_message, 79 qt_display_message,
80 display_warning : 80 display_warning :
81 qt_display_warning, 81 qt_display_warning,
82 display_url : 82 display_url :
83 qt_display_url, 83 qt_display_url,
84 display_question : 84 display_question :
85 stub 85 stub
86 }; 86 };
87 87
88 88
89} //extern "C" 89} //extern "C"
90 90
91void UpdateStatusBarTask::execute() { 91void UpdateStatusBarTask::execute() {
92 static_cast<QLinphoneMainWidget*>(_w)->displayStatus(_msg); 92 static_cast<QLinphoneMainWidget*>(_w)->displayStatus(_msg);
93} 93}
94 94
95void InviteReceivedTask::execute() { 95void InviteReceivedTask::execute() {
96 static_cast<QLinphoneMainWidget*>(_w)->inviteReceived(_msg); 96 static_cast<QLinphoneMainWidget*>(_w)->inviteReceived(_msg);
97} 97}
98 98
99void DisplayMessageTask::execute() { 99void DisplayMessageTask::execute() {
100 switch(_msgtype) { 100 switch(_msgtype) {
101 case Info: 101 case Info:
102 QMessageBox::information(0,QObject::tr("Information"),_msg); 102 QMessageBox::information(0,QObject::tr("Information"),_msg);
103 break; 103 break;
104 case Warn: 104 case Warn:
105 QMessageBox::warning(0,QObject::tr("Warning"),_msg); 105 QMessageBox::warning(0,QObject::tr("Warning"),_msg);
106 break; 106 break;
107 } 107 }
108} 108}
109 109
110QLinphoneMainWidget::QLinphoneMainWidget(QWidget* parent , const char* name , WFlags fl ) : 110QLinphoneMainWidget::QLinphoneMainWidget(QWidget* parent , const char* name , WFlags fl ) :
111_QLinphoneMainWidget( parent, name, fl ) { 111_QLinphoneMainWidget( parent, name, fl ) {
112 112
113 readConfig(); 113 readConfig();
114 createLinphoneCore(); 114 createLinphoneCore();
115 connect( CheckBox1, SIGNAL( toggled( bool ) ), this, SLOT( slotHide( bool ) ) ); 115 connect( CheckBox1, SIGNAL( toggled(bool) ), this, SLOT( slotHide(bool) ) );
116 CheckBox1->setChecked( true ); 116 CheckBox1->setChecked( true );
117} 117}
118 118
119QLinphoneMainWidget::~QLinphoneMainWidget() { 119QLinphoneMainWidget::~QLinphoneMainWidget() {
120 linphone_core_destroy(_core); 120 linphone_core_destroy(_core);
121 writeConfig(); 121 writeConfig();
122} 122}
123 123
124void QLinphoneMainWidget::slotHide( bool show ) { 124void QLinphoneMainWidget::slotHide( bool show ) {
125 if ( show ) { 125 if ( show ) {
126 TabWidget2->show(); 126 TabWidget2->show();
127 } else { 127 } else {
128 TabWidget2->hide(); 128 TabWidget2->hide();
129 } 129 }
130} 130}
131 131
132void QLinphoneMainWidget::callOrAccept() { 132void QLinphoneMainWidget::callOrAccept() {
133 if (linphone_core_inc_invite_pending(_core)) { 133 if (linphone_core_inc_invite_pending(_core)) {
134 linphone_core_accept_dialog(_core,NULL); 134 linphone_core_accept_dialog(_core,NULL);
135 return; 135 return;
136 } 136 }
137 QString url=sip_url->text(); 137 QString url=sip_url->text();
138 linphone_core_invite(_core,(char*)url.ascii()); 138 linphone_core_invite(_core,(char*)url.ascii());
139} 139}
140void QLinphoneMainWidget::terminateCall() { 140void QLinphoneMainWidget::terminateCall() {
141 linphone_core_terminate_dialog(_core,NULL); 141 linphone_core_terminate_dialog(_core,NULL);
142} 142}
143 143
144void QLinphoneMainWidget::inviteReceived(QString &tmp) { 144void QLinphoneMainWidget::inviteReceived(QString &tmp) {
145 sip_url->setText(tmp); 145 sip_url->setText(tmp);
146} 146}
147 147
148void QLinphoneMainWidget::displayStatus(QString &msg) { 148void QLinphoneMainWidget::displayStatus(QString &msg) {
149 status_bar->setText(msg); 149 status_bar->setText(msg);
150} 150}
151 151
152void QLinphoneMainWidget::pushGuiTask(GuiTask* g) { 152void QLinphoneMainWidget::pushGuiTask(GuiTask* g) {
153 _mutex.lock(); 153 _mutex.lock();
154 _actionq.enqueue(g); 154 _actionq.enqueue(g);
155 _mutex.unlock(); 155 _mutex.unlock();
156 printf("New action added to task list.\n"); 156 printf("New action added to task list.\n");
157} 157}
158 158
159void QLinphoneMainWidget::processGuiTasks() { 159void QLinphoneMainWidget::processGuiTasks() {
160 GuiTask *g; 160 GuiTask *g;
161 _mutex.lock(); 161 _mutex.lock();
162 while(!_actionq.isEmpty()) { 162 while(!_actionq.isEmpty()) {
163 g=_actionq.dequeue(); 163 g=_actionq.dequeue();
164 printf("Executing action...\n"); 164 printf("Executing action...\n");
165 g->execute(); 165 g->execute();
166 delete g; 166 delete g;
167 } 167 }
168 _mutex.unlock(); 168 _mutex.unlock();
169} 169}
170 170
171void QLinphoneMainWidget::timerEvent(QTimerEvent *t) { 171void QLinphoneMainWidget::timerEvent(QTimerEvent *t) {
172 processGuiTasks(); 172 processGuiTasks();
173} 173}
174 174
175void QLinphoneMainWidget::readConfig() { 175void QLinphoneMainWidget::readConfig() {
176 Config cfg( "opie-phone" ); 176 Config cfg( "opie-phone" );
177 cfg.setGroup( "audio" ); 177 cfg.setGroup( "audio" );
178 SliderInput->setValue( cfg.readNumEntry( "rec_lev", 50 ) ); 178 SliderInput->setValue( cfg.readNumEntry( "rec_lev", 50 ) );
179 SliderOutput->setValue( cfg.readNumEntry( "play_lev", 50 ) ); 179 SliderOutput->setValue( cfg.readNumEntry( "play_lev", 50 ) );
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index c2185f2..64557ee 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -1,87 +1,87 @@
1 1
2#include "accountview.h" 2#include "accountview.h"
3#include "accountitem.h" 3#include "accountitem.h"
4#include "selectstore.h" 4#include "selectstore.h"
5 5
6/* OPIE */ 6/* OPIE */
7#include <libmailwrapper/settings.h> 7#include <libmailwrapper/settings.h>
8#include <libmailwrapper/mailwrapper.h> 8#include <libmailwrapper/mailwrapper.h>
9#include <libmailwrapper/mailtypes.h> 9#include <libmailwrapper/mailtypes.h>
10#include <libmailwrapper/abstractmail.h> 10#include <libmailwrapper/abstractmail.h>
11#include <qpe/qpeapplication.h> 11#include <qpe/qpeapplication.h>
12 12
13/* QT */ 13/* QT */
14#include <qmessagebox.h> 14#include <qmessagebox.h>
15#include <qpopupmenu.h> 15#include <qpopupmenu.h>
16 16
17AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) 17AccountView::AccountView( QWidget *parent, const char *name, WFlags flags )
18 : QListView( parent, name, flags ) 18 : QListView( parent, name, flags )
19{ 19{
20 connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), 20 connect( this, SIGNAL( selectionChanged(QListViewItem*) ),
21 SLOT( refresh( QListViewItem * ) ) ); 21 SLOT( refresh(QListViewItem*) ) );
22 connect( this, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, 22 connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
23 SLOT( slotHold( int, QListViewItem *,const QPoint&,int ) ) ); 23 SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) );
24 setSorting(0); 24 setSorting(0);
25} 25}
26 26
27AccountView::~AccountView() 27AccountView::~AccountView()
28{ 28{
29 imapAccounts.clear(); 29 imapAccounts.clear();
30 mhAccounts.clear(); 30 mhAccounts.clear();
31} 31}
32 32
33void AccountView::slotContextMenu(int id) 33void AccountView::slotContextMenu(int id)
34{ 34{
35 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); 35 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
36 if (!view) return; 36 if (!view) return;
37 view->contextMenuSelected(id); 37 view->contextMenuSelected(id);
38} 38}
39 39
40void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) 40void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int)
41{ 41{
42 if (button==1) {return;} 42 if (button==1) {return;}
43 if (!item) return; 43 if (!item) return;
44 AccountViewItem *view = static_cast<AccountViewItem *>(item); 44 AccountViewItem *view = static_cast<AccountViewItem *>(item);
45 QPopupMenu*m = view->getContextMenu(); 45 QPopupMenu*m = view->getContextMenu();
46 if (!m) return; 46 if (!m) return;
47 connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); 47 connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int)));
48 m->setFocus(); 48 m->setFocus();
49 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 49 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
50 delete m; 50 delete m;
51} 51}
52 52
53void AccountView::populate( QList<Account> list ) 53void AccountView::populate( QList<Account> list )
54{ 54{
55 clear(); 55 clear();
56 56
57 imapAccounts.clear(); 57 imapAccounts.clear();
58 mhAccounts.clear(); 58 mhAccounts.clear();
59 59
60 mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); 60 mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this));
61 61
62 Account *it; 62 Account *it;
63 for ( it = list.first(); it; it = list.next() ) 63 for ( it = list.first(); it; it = list.next() )
64 { 64 {
65 if ( it->getType().compare( "IMAP" ) == 0 ) 65 if ( it->getType().compare( "IMAP" ) == 0 )
66 { 66 {
67 IMAPaccount *imap = static_cast<IMAPaccount *>(it); 67 IMAPaccount *imap = static_cast<IMAPaccount *>(it);
68 qDebug( "added IMAP " + imap->getAccountName() ); 68 qDebug( "added IMAP " + imap->getAccountName() );
69 imapAccounts.append(new IMAPviewItem( imap, this )); 69 imapAccounts.append(new IMAPviewItem( imap, this ));
70 } 70 }
71 else if ( it->getType().compare( "POP3" ) == 0 ) 71 else if ( it->getType().compare( "POP3" ) == 0 )
72 { 72 {
73 POP3account *pop3 = static_cast<POP3account *>(it); 73 POP3account *pop3 = static_cast<POP3account *>(it);
74 qDebug( "added POP3 " + pop3->getAccountName() ); 74 qDebug( "added POP3 " + pop3->getAccountName() );
75 /* must not be hold 'cause it isn't required */ 75 /* must not be hold 'cause it isn't required */
76 (void) new POP3viewItem( pop3, this ); 76 (void) new POP3viewItem( pop3, this );
77 } 77 }
78 else if ( it->getType().compare( "NNTP" ) == 0 ) 78 else if ( it->getType().compare( "NNTP" ) == 0 )
79 { 79 {
80 NNTPaccount *nntp = static_cast<NNTPaccount *>(it); 80 NNTPaccount *nntp = static_cast<NNTPaccount *>(it);
81 qDebug( "added NNTP " + nntp->getAccountName() ); 81 qDebug( "added NNTP " + nntp->getAccountName() );
82 /* must not be hold 'cause it isn't required */ 82 /* must not be hold 'cause it isn't required */
83 (void) new NNTPviewItem( nntp, this ); 83 (void) new NNTPviewItem( nntp, this );
84 } 84 }
85 } 85 }
86} 86}
87 87
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp
index 6708779..f51a8fe 100644
--- a/noncore/net/mail/composemail.cpp
+++ b/noncore/net/mail/composemail.cpp
@@ -1,129 +1,129 @@
1#include <qt.h> 1#include <qt.h>
2 2
3#include <opie2/ofiledialog.h> 3#include <opie2/ofiledialog.h>
4#include <qpe/resource.h> 4#include <qpe/resource.h>
5#include <qpe/config.h> 5#include <qpe/config.h>
6#include <qpe/global.h> 6#include <qpe/global.h>
7#include <qpe/contact.h> 7#include <qpe/contact.h>
8 8
9#include "composemail.h" 9#include "composemail.h"
10 10
11#include <libmailwrapper/smtpwrapper.h> 11#include <libmailwrapper/smtpwrapper.h>
12 12
13ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 13ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
14 : ComposeMailUI( parent, name, modal, flags ) 14 : ComposeMailUI( parent, name, modal, flags )
15{ 15{
16 settings = s; 16 settings = s;
17 17
18 QString vfilename = Global::applicationFileName("addressbook", 18 QString vfilename = Global::applicationFileName("addressbook",
19 "businesscard.vcf"); 19 "businesscard.vcf");
20 Contact c; 20 Contact c;
21 if (QFile::exists(vfilename)) { 21 if (QFile::exists(vfilename)) {
22 c = Contact::readVCard( vfilename )[0]; 22 c = Contact::readVCard( vfilename )[0];
23 } 23 }
24 24
25 QStringList mails = c.emailList(); 25 QStringList mails = c.emailList();
26 QString defmail = c.defaultEmail(); 26 QString defmail = c.defaultEmail();
27 27
28 if (defmail.length()!=0) { 28 if (defmail.length()!=0) {
29 fromBox->insertItem(defmail); 29 fromBox->insertItem(defmail);
30 } 30 }
31 QStringList::ConstIterator sit = mails.begin(); 31 QStringList::ConstIterator sit = mails.begin();
32 for (;sit!=mails.end();++sit) { 32 for (;sit!=mails.end();++sit) {
33 if ( (*sit)==defmail) 33 if ( (*sit)==defmail)
34 continue; 34 continue;
35 fromBox->insertItem((*sit)); 35 fromBox->insertItem((*sit));
36 } 36 }
37 senderNameEdit->setText(c.firstName()+" "+c.lastName()); 37 senderNameEdit->setText(c.firstName()+" "+c.lastName());
38 Config cfg( "mail" ); 38 Config cfg( "mail" );
39 cfg.setGroup( "Compose" ); 39 cfg.setGroup( "Compose" );
40 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); 40 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
41 41
42 attList->addColumn( tr( "Name" ) ); 42 attList->addColumn( tr( "Name" ) );
43 attList->addColumn( tr( "Size" ) ); 43 attList->addColumn( tr( "Size" ) );
44 44
45 QList<Account> accounts = settings->getAccounts(); 45 QList<Account> accounts = settings->getAccounts();
46 46
47 Account *it; 47 Account *it;
48 for ( it = accounts.first(); it; it = accounts.next() ) { 48 for ( it = accounts.first(); it; it = accounts.next() ) {
49 if ( it->getType().compare( "SMTP" ) == 0 ) { 49 if ( it->getType().compare( "SMTP" ) == 0 ) {
50 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 50 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
51 smtpAccountBox->insertItem( smtp->getAccountName() ); 51 smtpAccountBox->insertItem( smtp->getAccountName() );
52 smtpAccounts.append( smtp ); 52 smtpAccounts.append( smtp );
53 } 53 }
54 } 54 }
55 55
56 if ( smtpAccounts.count() > 0 ) { 56 if ( smtpAccounts.count() > 0 ) {
57 fillValues( smtpAccountBox->currentItem() ); 57 fillValues( smtpAccountBox->currentItem() );
58 } else { 58 } else {
59 QMessageBox::information( this, tr( "Problem" ), 59 QMessageBox::information( this, tr( "Problem" ),
60 tr( "<p>Please create an SMTP account first.</p>" ), 60 tr( "<p>Please create an SMTP account first.</p>" ),
61 tr( "Ok" ) ); 61 tr( "Ok" ) );
62 return; 62 return;
63 } 63 }
64 64
65 connect( smtpAccountBox, SIGNAL( activated( int ) ), SLOT( fillValues( int ) ) ); 65 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
66 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 66 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
67 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 67 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
68 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 68 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
69 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 69 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
70 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 70 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
71 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 71 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
72} 72}
73 73
74void ComposeMail::pickAddress( QLineEdit *line ) 74void ComposeMail::pickAddress( QLineEdit *line )
75{ 75{
76 QString names = AddressPicker::getNames(); 76 QString names = AddressPicker::getNames();
77 if ( line->text().isEmpty() ) { 77 if ( line->text().isEmpty() ) {
78 line->setText( names ); 78 line->setText( names );
79 } else if ( !names.isEmpty() ) { 79 } else if ( !names.isEmpty() ) {
80 line->setText( line->text() + ", " + names ); 80 line->setText( line->text() + ", " + names );
81 } 81 }
82} 82}
83 83
84 84
85void ComposeMail::setTo( const QString & to ) 85void ComposeMail::setTo( const QString & to )
86{ 86{
87/* QString toline; 87/* QString toline;
88 QStringList toEntry = to; 88 QStringList toEntry = to;
89 for ( QStringList::Iterator it = toEntry.begin(); it != toEntry.end(); ++it ) { 89 for ( QStringList::Iterator it = toEntry.begin(); it != toEntry.end(); ++it ) {
90 toline += (*it); 90 toline += (*it);
91 } 91 }
92 toLine->setText( toline ); 92 toLine->setText( toline );
93*/ 93*/
94toLine->setText( to ); 94toLine->setText( to );
95} 95}
96 96
97void ComposeMail::setSubject( const QString & subject ) 97void ComposeMail::setSubject( const QString & subject )
98{ 98{
99 subjectLine->setText( subject ); 99 subjectLine->setText( subject );
100} 100}
101 101
102void ComposeMail::setInReplyTo( const QString & messageId ) 102void ComposeMail::setInReplyTo( const QString & messageId )
103{ 103{
104 104
105} 105}
106 106
107void ComposeMail::setMessage( const QString & text ) 107void ComposeMail::setMessage( const QString & text )
108{ 108{
109 message->setText( text ); 109 message->setText( text );
110} 110}
111 111
112 112
113void ComposeMail::pickAddressTo() 113void ComposeMail::pickAddressTo()
114{ 114{
115 pickAddress( toLine ); 115 pickAddress( toLine );
116} 116}
117 117
118void ComposeMail::pickAddressCC() 118void ComposeMail::pickAddressCC()
119{ 119{
120 pickAddress( ccLine ); 120 pickAddress( ccLine );
121} 121}
122 122
123void ComposeMail::pickAddressBCC() 123void ComposeMail::pickAddressBCC()
124{ 124{
125 pickAddress( bccLine ); 125 pickAddress( bccLine );
126} 126}
127 127
128void ComposeMail::pickAddressReply() 128void ComposeMail::pickAddressReply()
129{ 129{
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp
index 60bffa5..edeb1de 100644
--- a/noncore/net/mail/editaccounts.cpp
+++ b/noncore/net/mail/editaccounts.cpp
@@ -223,310 +223,310 @@ void EditAccounts::slotNewNews()
223 qDebug( "New News Account" ); 223 qDebug( "New News Account" );
224 slotNewAccount( "NNTP" ); 224 slotNewAccount( "NNTP" );
225} 225}
226 226
227void EditAccounts::slotEditNews() 227void EditAccounts::slotEditNews()
228{ 228{
229 qDebug( "Edit News Account" ); 229 qDebug( "Edit News Account" );
230 if ( !newsList->currentItem() ) 230 if ( !newsList->currentItem() )
231 { 231 {
232 QMessageBox::information( this, tr( "Error" ), 232 QMessageBox::information( this, tr( "Error" ),
233 tr( "<p>Please select an account.</p>" ), 233 tr( "<p>Please select an account.</p>" ),
234 tr( "Ok" ) ); 234 tr( "Ok" ) );
235 return; 235 return;
236 } 236 }
237 237
238 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 238 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
239 slotEditAccount( a ); 239 slotEditAccount( a );
240} 240}
241 241
242void EditAccounts::slotDeleteNews() 242void EditAccounts::slotDeleteNews()
243{ 243{
244 qDebug( "Delete News Account" ); 244 qDebug( "Delete News Account" );
245 if ( !newsList->currentItem() ) 245 if ( !newsList->currentItem() )
246 { 246 {
247 QMessageBox::information( this, tr( "Error" ), 247 QMessageBox::information( this, tr( "Error" ),
248 tr( "<p>Please select an account.</p>" ), 248 tr( "<p>Please select an account.</p>" ),
249 tr( "Ok" ) ); 249 tr( "Ok" ) );
250 return; 250 return;
251 } 251 }
252 252
253 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 253 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
254 slotDeleteAccount( a ); 254 slotDeleteAccount( a );
255} 255}
256 256
257void EditAccounts::slotAdjustColumns() 257void EditAccounts::slotAdjustColumns()
258{ 258{
259 int currPage = configTab->currentPageIndex(); 259 int currPage = configTab->currentPageIndex();
260 260
261 configTab->showPage( mailTab ); 261 configTab->showPage( mailTab );
262 mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); 262 mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 );
263 mailList->setColumnWidth( 1, 50 ); 263 mailList->setColumnWidth( 1, 50 );
264 264
265 configTab->showPage( newsTab ); 265 configTab->showPage( newsTab );
266 newsList->setColumnWidth( 0, newsList->visibleWidth() ); 266 newsList->setColumnWidth( 0, newsList->visibleWidth() );
267 267
268 configTab->setCurrentPage( currPage ); 268 configTab->setCurrentPage( currPage );
269} 269}
270 270
271void EditAccounts::accept() 271void EditAccounts::accept()
272{ 272{
273 settings->saveAccounts(); 273 settings->saveAccounts();
274 274
275 QDialog::accept(); 275 QDialog::accept();
276} 276}
277 277
278/** 278/**
279 * SelectMailType 279 * SelectMailType
280 */ 280 */
281 281
282SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) 282SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags )
283 : SelectMailTypeUI( parent, name, modal, flags ) 283 : SelectMailTypeUI( parent, name, modal, flags )
284{ 284{
285 selected = selection; 285 selected = selection;
286 selected->replace( 0, selected->length(), typeBox->currentText() ); 286 selected->replace( 0, selected->length(), typeBox->currentText() );
287 connect( typeBox, SIGNAL( activated( const QString & ) ), SLOT( slotSelection( const QString & ) ) ); 287 connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) );
288} 288}
289 289
290void SelectMailType::slotSelection( const QString &sel ) 290void SelectMailType::slotSelection( const QString &sel )
291{ 291{
292 selected->replace( 0, selected->length(), sel ); 292 selected->replace( 0, selected->length(), sel );
293} 293}
294 294
295/** 295/**
296 * IMAPconfig 296 * IMAPconfig
297 */ 297 */
298 298
299IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 299IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
300 : IMAPconfigUI( parent, name, modal, flags ) 300 : IMAPconfigUI( parent, name, modal, flags )
301{ 301{
302 data = account; 302 data = account;
303 303
304 fillValues(); 304 fillValues();
305 305
306 connect( ComboBox1, SIGNAL( activated( int ) ), SLOT( slotConnectionToggle( int ) ) ); 306 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
307 ComboBox1->insertItem( "Only if available", 0 ); 307 ComboBox1->insertItem( "Only if available", 0 );
308 ComboBox1->insertItem( "Always, Negotiated", 1 ); 308 ComboBox1->insertItem( "Always, Negotiated", 1 );
309 ComboBox1->insertItem( "Connect on secure port", 2 ); 309 ComboBox1->insertItem( "Connect on secure port", 2 );
310 ComboBox1->insertItem( "Run command instead", 3 ); 310 ComboBox1->insertItem( "Run command instead", 3 );
311 CommandEdit->hide(); 311 CommandEdit->hide();
312 ComboBox1->setCurrentItem( data->ConnectionType() ); 312 ComboBox1->setCurrentItem( data->ConnectionType() );
313} 313}
314 314
315void IMAPconfig::slotConnectionToggle( int index ) 315void IMAPconfig::slotConnectionToggle( int index )
316{ 316{
317 if ( index == 2 ) 317 if ( index == 2 )
318 { 318 {
319 portLine->setText( IMAP_SSL_PORT ); 319 portLine->setText( IMAP_SSL_PORT );
320 } 320 }
321 else if ( index == 3 ) 321 else if ( index == 3 )
322 { 322 {
323 portLine->setText( IMAP_PORT ); 323 portLine->setText( IMAP_PORT );
324 CommandEdit->show(); 324 CommandEdit->show();
325 } 325 }
326 else 326 else
327 { 327 {
328 portLine->setText( IMAP_PORT ); 328 portLine->setText( IMAP_PORT );
329 } 329 }
330} 330}
331 331
332void IMAPconfig::fillValues() 332void IMAPconfig::fillValues()
333{ 333{
334 accountLine->setText( data->getAccountName() ); 334 accountLine->setText( data->getAccountName() );
335 serverLine->setText( data->getServer() ); 335 serverLine->setText( data->getServer() );
336 portLine->setText( data->getPort() ); 336 portLine->setText( data->getPort() );
337 ComboBox1->setCurrentItem( data->ConnectionType() ); 337 ComboBox1->setCurrentItem( data->ConnectionType() );
338 userLine->setText( data->getUser() ); 338 userLine->setText( data->getUser() );
339 passLine->setText( data->getPassword() ); 339 passLine->setText( data->getPassword() );
340 prefixLine->setText(data->getPrefix()); 340 prefixLine->setText(data->getPrefix());
341} 341}
342 342
343void IMAPconfig::accept() 343void IMAPconfig::accept()
344{ 344{
345 data->setAccountName( accountLine->text() ); 345 data->setAccountName( accountLine->text() );
346 data->setServer( serverLine->text() ); 346 data->setServer( serverLine->text() );
347 data->setPort( portLine->text() ); 347 data->setPort( portLine->text() );
348 data->setConnectionType( ComboBox1->currentItem() ); 348 data->setConnectionType( ComboBox1->currentItem() );
349 data->setUser( userLine->text() ); 349 data->setUser( userLine->text() );
350 data->setPassword( passLine->text() ); 350 data->setPassword( passLine->text() );
351 data->setPrefix(prefixLine->text()); 351 data->setPrefix(prefixLine->text());
352 352
353 QDialog::accept(); 353 QDialog::accept();
354} 354}
355 355
356/** 356/**
357 * POP3config 357 * POP3config
358 */ 358 */
359 359
360POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 360POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags )
361 : POP3configUI( parent, name, modal, flags ) 361 : POP3configUI( parent, name, modal, flags )
362{ 362{
363 data = account; 363 data = account;
364 fillValues(); 364 fillValues();
365 365
366 connect( ComboBox1, SIGNAL( activated( int ) ), SLOT( slotConnectionToggle( int ) ) ); 366 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
367 ComboBox1->insertItem( "Only if available", 0 ); 367 ComboBox1->insertItem( "Only if available", 0 );
368 ComboBox1->insertItem( "Always, Negotiated", 1 ); 368 ComboBox1->insertItem( "Always, Negotiated", 1 );
369 ComboBox1->insertItem( "Connect on secure port", 2 ); 369 ComboBox1->insertItem( "Connect on secure port", 2 );
370 ComboBox1->insertItem( "Run command instead", 3 ); 370 ComboBox1->insertItem( "Run command instead", 3 );
371 CommandEdit->hide(); 371 CommandEdit->hide();
372 ComboBox1->setCurrentItem( data->ConnectionType() ); 372 ComboBox1->setCurrentItem( data->ConnectionType() );
373} 373}
374 374
375void POP3config::slotConnectionToggle( int index ) 375void POP3config::slotConnectionToggle( int index )
376{ 376{
377 // 2 is ssl connection 377 // 2 is ssl connection
378 if ( index == 2 ) 378 if ( index == 2 )
379 { 379 {
380 portLine->setText( POP3_SSL_PORT ); 380 portLine->setText( POP3_SSL_PORT );
381 } 381 }
382 else if ( index == 3 ) 382 else if ( index == 3 )
383 { 383 {
384 portLine->setText( POP3_PORT ); 384 portLine->setText( POP3_PORT );
385 CommandEdit->show(); 385 CommandEdit->show();
386 } 386 }
387 else 387 else
388 { 388 {
389 portLine->setText( POP3_PORT ); 389 portLine->setText( POP3_PORT );
390 } 390 }
391} 391}
392 392
393void POP3config::fillValues() 393void POP3config::fillValues()
394{ 394{
395 accountLine->setText( data->getAccountName() ); 395 accountLine->setText( data->getAccountName() );
396 serverLine->setText( data->getServer() ); 396 serverLine->setText( data->getServer() );
397 portLine->setText( data->getPort() ); 397 portLine->setText( data->getPort() );
398 ComboBox1->setCurrentItem( data->ConnectionType() ); 398 ComboBox1->setCurrentItem( data->ConnectionType() );
399 userLine->setText( data->getUser() ); 399 userLine->setText( data->getUser() );
400 passLine->setText( data->getPassword() ); 400 passLine->setText( data->getPassword() );
401} 401}
402 402
403void POP3config::accept() 403void POP3config::accept()
404{ 404{
405 data->setAccountName( accountLine->text() ); 405 data->setAccountName( accountLine->text() );
406 data->setServer( serverLine->text() ); 406 data->setServer( serverLine->text() );
407 data->setPort( portLine->text() ); 407 data->setPort( portLine->text() );
408 data->setConnectionType( ComboBox1->currentItem() ); 408 data->setConnectionType( ComboBox1->currentItem() );
409 data->setUser( userLine->text() ); 409 data->setUser( userLine->text() );
410 data->setPassword( passLine->text() ); 410 data->setPassword( passLine->text() );
411 411
412 QDialog::accept(); 412 QDialog::accept();
413} 413}
414 414
415/** 415/**
416 * SMTPconfig 416 * SMTPconfig
417 */ 417 */
418 418
419SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 419SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
420 : SMTPconfigUI( parent, name, modal, flags ) 420 : SMTPconfigUI( parent, name, modal, flags )
421{ 421{
422 data = account; 422 data = account;
423 423
424 connect( loginBox, SIGNAL( toggled( bool ) ), userLine, SLOT( setEnabled( bool ) ) ); 424 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
425 connect( loginBox, SIGNAL( toggled( bool ) ), passLine, SLOT( setEnabled( bool ) ) ); 425 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
426 426
427 fillValues(); 427 fillValues();
428 428
429 connect( ComboBox1, SIGNAL( activated( int ) ), SLOT( slotConnectionToggle( int ) ) ); 429 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
430 ComboBox1->insertItem( "Only if available", 0 ); 430 ComboBox1->insertItem( "Only if available", 0 );
431 ComboBox1->insertItem( "Always, Negotiated", 1 ); 431 ComboBox1->insertItem( "Always, Negotiated", 1 );
432 ComboBox1->insertItem( "Connect on secure port", 2 ); 432 ComboBox1->insertItem( "Connect on secure port", 2 );
433 ComboBox1->insertItem( "Run command instead", 3 ); 433 ComboBox1->insertItem( "Run command instead", 3 );
434 CommandEdit->hide(); 434 CommandEdit->hide();
435 ComboBox1->setCurrentItem( data->ConnectionType() ); 435 ComboBox1->setCurrentItem( data->ConnectionType() );
436} 436}
437 437
438void SMTPconfig::slotConnectionToggle( int index ) 438void SMTPconfig::slotConnectionToggle( int index )
439{ 439{
440 // 2 is ssl connection 440 // 2 is ssl connection
441 if ( index == 2 ) 441 if ( index == 2 )
442 { 442 {
443 portLine->setText( SMTP_SSL_PORT ); 443 portLine->setText( SMTP_SSL_PORT );
444 } 444 }
445 else if ( index == 3 ) 445 else if ( index == 3 )
446 { 446 {
447 portLine->setText( SMTP_PORT ); 447 portLine->setText( SMTP_PORT );
448 CommandEdit->show(); 448 CommandEdit->show();
449 } 449 }
450 else 450 else
451 { 451 {
452 portLine->setText( SMTP_PORT ); 452 portLine->setText( SMTP_PORT );
453 } 453 }
454} 454}
455 455
456void SMTPconfig::fillValues() 456void SMTPconfig::fillValues()
457{ 457{
458 accountLine->setText( data->getAccountName() ); 458 accountLine->setText( data->getAccountName() );
459 serverLine->setText( data->getServer() ); 459 serverLine->setText( data->getServer() );
460 portLine->setText( data->getPort() ); 460 portLine->setText( data->getPort() );
461 ComboBox1->setCurrentItem( data->ConnectionType() ); 461 ComboBox1->setCurrentItem( data->ConnectionType() );
462 loginBox->setChecked( data->getLogin() ); 462 loginBox->setChecked( data->getLogin() );
463 userLine->setText( data->getUser() ); 463 userLine->setText( data->getUser() );
464 passLine->setText( data->getPassword() ); 464 passLine->setText( data->getPassword() );
465} 465}
466 466
467void SMTPconfig::accept() 467void SMTPconfig::accept()
468{ 468{
469 data->setAccountName( accountLine->text() ); 469 data->setAccountName( accountLine->text() );
470 data->setServer( serverLine->text() ); 470 data->setServer( serverLine->text() );
471 data->setPort( portLine->text() ); 471 data->setPort( portLine->text() );
472 data->setConnectionType( ComboBox1->currentItem() ); 472 data->setConnectionType( ComboBox1->currentItem() );
473 data->setLogin( loginBox->isChecked() ); 473 data->setLogin( loginBox->isChecked() );
474 data->setUser( userLine->text() ); 474 data->setUser( userLine->text() );
475 data->setPassword( passLine->text() ); 475 data->setPassword( passLine->text() );
476 476
477 QDialog::accept(); 477 QDialog::accept();
478} 478}
479 479
480/** 480/**
481 * NNTPconfig 481 * NNTPconfig
482 */ 482 */
483 483
484NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 484NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
485 : NNTPconfigUI( parent, name, modal, flags ) 485 : NNTPconfigUI( parent, name, modal, flags )
486{ 486{
487 data = account; 487 data = account;
488 488
489 connect( loginBox, SIGNAL( toggled( bool ) ), userLine, SLOT( setEnabled( bool ) ) ); 489 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
490 connect( loginBox, SIGNAL( toggled( bool ) ), passLine, SLOT( setEnabled( bool ) ) ); 490 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
491 491
492 fillValues(); 492 fillValues();
493 493
494 connect( sslBox, SIGNAL( toggled( bool ) ), SLOT( slotSSL( bool ) ) ); 494 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) );
495} 495}
496 496
497void NNTPconfig::slotSSL( bool enabled ) 497void NNTPconfig::slotSSL( bool enabled )
498{ 498{
499 if ( enabled ) 499 if ( enabled )
500 { 500 {
501 portLine->setText( NNTP_SSL_PORT ); 501 portLine->setText( NNTP_SSL_PORT );
502 } 502 }
503 else 503 else
504 { 504 {
505 portLine->setText( NNTP_PORT ); 505 portLine->setText( NNTP_PORT );
506 } 506 }
507} 507}
508 508
509void NNTPconfig::fillValues() 509void NNTPconfig::fillValues()
510{ 510{
511 accountLine->setText( data->getAccountName() ); 511 accountLine->setText( data->getAccountName() );
512 serverLine->setText( data->getServer() ); 512 serverLine->setText( data->getServer() );
513 portLine->setText( data->getPort() ); 513 portLine->setText( data->getPort() );
514 sslBox->setChecked( data->getSSL() ); 514 sslBox->setChecked( data->getSSL() );
515 loginBox->setChecked( data->getLogin() ); 515 loginBox->setChecked( data->getLogin() );
516 userLine->setText( data->getUser() ); 516 userLine->setText( data->getUser() );
517 passLine->setText( data->getPassword() ); 517 passLine->setText( data->getPassword() );
518} 518}
519 519
520void NNTPconfig::accept() 520void NNTPconfig::accept()
521{ 521{
522 data->setAccountName( accountLine->text() ); 522 data->setAccountName( accountLine->text() );
523 data->setServer( serverLine->text() ); 523 data->setServer( serverLine->text() );
524 data->setPort( portLine->text() ); 524 data->setPort( portLine->text() );
525 data->setSSL( sslBox->isChecked() ); 525 data->setSSL( sslBox->isChecked() );
526 data->setLogin( loginBox->isChecked() ); 526 data->setLogin( loginBox->isChecked() );
527 data->setUser( userLine->text() ); 527 data->setUser( userLine->text() );
528 data->setPassword( passLine->text() ); 528 data->setPassword( passLine->text() );
529 529
530 QDialog::accept(); 530 QDialog::accept();
531} 531}
532 532
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
index dfc00d8..df7f773 100644
--- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
@@ -261,132 +261,132 @@ void MHwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target)
261 if (r != MAIL_NO_ERROR) { 261 if (r != MAIL_NO_ERROR) {
262 qDebug("error deleting mail"); 262 qDebug("error deleting mail");
263 break; 263 break;
264 } 264 }
265 } 265 }
266} 266}
267 267
268int MHwrapper::deleteAllMail(const Folder*tfolder) 268int MHwrapper::deleteAllMail(const Folder*tfolder)
269{ 269{
270 init_storage(); 270 init_storage();
271 if (!m_storage) { 271 if (!m_storage) {
272 return 0; 272 return 0;
273 } 273 }
274 int res = 1; 274 int res = 1;
275 if (!tfolder) return 0; 275 if (!tfolder) return 0;
276 int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); 276 int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
277 if (r!=MAIL_NO_ERROR) { 277 if (r!=MAIL_NO_ERROR) {
278 qDebug("error selecting folder!"); 278 qDebug("error selecting folder!");
279 return 0; 279 return 0;
280 } 280 }
281 mailmessage_list*l=0; 281 mailmessage_list*l=0;
282 r = mailsession_get_messages_list(m_storage->sto_session,&l); 282 r = mailsession_get_messages_list(m_storage->sto_session,&l);
283 if (r != MAIL_NO_ERROR) { 283 if (r != MAIL_NO_ERROR) {
284 qDebug("Error message list"); 284 qDebug("Error message list");
285 res = 0; 285 res = 0;
286 } 286 }
287 unsigned j = 0; 287 unsigned j = 0;
288 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { 288 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) {
289 mailmessage * msg; 289 mailmessage * msg;
290 msg = (mailmessage*)carray_get(l->msg_tab, i); 290 msg = (mailmessage*)carray_get(l->msg_tab, i);
291 j = msg->msg_index; 291 j = msg->msg_index;
292 r = mailsession_remove_message(m_storage->sto_session,j); 292 r = mailsession_remove_message(m_storage->sto_session,j);
293 if (r != MAIL_NO_ERROR) { 293 if (r != MAIL_NO_ERROR) {
294 Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); 294 Global::statusMessage(tr("Error deleting mail %1").arg(i+1));
295 res = 0; 295 res = 0;
296 break; 296 break;
297 } 297 }
298 } 298 }
299 if (l) mailmessage_list_free(l); 299 if (l) mailmessage_list_free(l);
300 return res; 300 return res;
301} 301}
302 302
303int MHwrapper::deleteMbox(const Folder*tfolder) 303int MHwrapper::deleteMbox(const Folder*tfolder)
304{ 304{
305 init_storage(); 305 init_storage();
306 if (!m_storage) { 306 if (!m_storage) {
307 return 0; 307 return 0;
308 } 308 }
309 if (!tfolder) return 0; 309 if (!tfolder) return 0;
310 if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0; 310 if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0;
311 311
312 int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); 312 int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
313 313
314 if (r != MAIL_NO_ERROR) { 314 if (r != MAIL_NO_ERROR) {
315 qDebug("error deleting mail box"); 315 qDebug("error deleting mail box");
316 return 0; 316 return 0;
317 } 317 }
318 QString cmd = "rm -rf "+tfolder->getName(); 318 QString cmd = "rm -rf "+tfolder->getName();
319 QStringList command; 319 QStringList command;
320 command << "/bin/sh"; 320 command << "/bin/sh";
321 command << "-c"; 321 command << "-c";
322 command << cmd.latin1(); 322 command << cmd.latin1();
323 OProcess *process = new OProcess(); 323 OProcess *process = new OProcess();
324 324
325 connect(process, SIGNAL(processExited(OProcess *)), 325 connect(process, SIGNAL(processExited(OProcess*)),
326 this, SLOT( processEnded(OProcess *))); 326 this, SLOT( processEnded(OProcess*)));
327 connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)), 327 connect(process, SIGNAL( receivedStderr(OProcess*,char*,int)),
328 this, SLOT( oprocessStderr(OProcess *, char *, int))); 328 this, SLOT( oprocessStderr(OProcess*,char*,int)));
329 329
330 *process << command; 330 *process << command;
331 removeMboxfailed = false; 331 removeMboxfailed = false;
332 if(!process->start(OProcess::Block, OProcess::All) ) { 332 if(!process->start(OProcess::Block, OProcess::All) ) {
333 qDebug("could not start process"); 333 qDebug("could not start process");
334 return 0; 334 return 0;
335 } 335 }
336 qDebug("mail box deleted"); 336 qDebug("mail box deleted");
337 return 1; 337 return 1;
338} 338}
339 339
340void MHwrapper::processEnded(OProcess *p) 340void MHwrapper::processEnded(OProcess *p)
341{ 341{
342 if (p) delete p; 342 if (p) delete p;
343} 343}
344 344
345void MHwrapper::oprocessStderr(OProcess*, char *buffer, int ) 345void MHwrapper::oprocessStderr(OProcess*, char *buffer, int )
346{ 346{
347 QString lineStr = buffer; 347 QString lineStr = buffer;
348 QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") ); 348 QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") );
349 removeMboxfailed = true; 349 removeMboxfailed = true;
350} 350}
351 351
352void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) 352void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
353{ 353{
354 init_storage(); 354 init_storage();
355 if (!m_storage) { 355 if (!m_storage) {
356 return; 356 return;
357 } 357 }
358 target_stat.message_count = 0; 358 target_stat.message_count = 0;
359 target_stat.message_unseen = 0; 359 target_stat.message_unseen = 0;
360 target_stat.message_recent = 0; 360 target_stat.message_recent = 0;
361 QString f = buildPath(mailbox); 361 QString f = buildPath(mailbox);
362 int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count, 362 int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count,
363 &target_stat.message_recent,&target_stat.message_unseen); 363 &target_stat.message_recent,&target_stat.message_unseen);
364 if (r != MAIL_NO_ERROR) { 364 if (r != MAIL_NO_ERROR) {
365 Global::statusMessage(tr("Error retrieving status")); 365 Global::statusMessage(tr("Error retrieving status"));
366 } 366 }
367} 367}
368 368
369const QString&MHwrapper::getType()const 369const QString&MHwrapper::getType()const
370{ 370{
371 return wrapperType; 371 return wrapperType;
372} 372}
373 373
374const QString&MHwrapper::getName()const 374const QString&MHwrapper::getName()const
375{ 375{
376 return MHName; 376 return MHName;
377} 377}
378void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 378void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
379{ 379{
380 init_storage(); 380 init_storage();
381 if (!m_storage) { 381 if (!m_storage) {
382 return; 382 return;
383 } 383 }
384 if (targetWrapper != this) { 384 if (targetWrapper != this) {
385 qDebug("Using generic"); 385 qDebug("Using generic");
386 Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); 386 Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit);
387 return; 387 return;
388 } 388 }
389 qDebug("Using internal routines for move/copy"); 389 qDebug("Using internal routines for move/copy");
390 QString tf = buildPath(targetFolder); 390 QString tf = buildPath(targetFolder);
391 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); 391 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1());
392 if (r != MAIL_NO_ERROR) { 392 if (r != MAIL_NO_ERROR) {
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index a3c68ae..d75d52a 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -1,99 +1,99 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <sys/stat.h> 2#include <sys/stat.h>
3#include <sys/types.h> 3#include <sys/types.h>
4#include <unistd.h> 4#include <unistd.h>
5#include <fcntl.h> 5#include <fcntl.h>
6#include <string.h> 6#include <string.h>
7#include <qdir.h> 7#include <qdir.h>
8#include <qt.h> 8#include <qt.h>
9#include <qmessagebox.h> 9#include <qmessagebox.h>
10 10
11#include <qpe/config.h> 11#include <qpe/config.h>
12#include <qpe/qcopenvelope_qws.h> 12#include <qpe/qcopenvelope_qws.h>
13 13
14#include <libetpan/libetpan.h> 14#include <libetpan/libetpan.h>
15 15
16#include "smtpwrapper.h" 16#include "smtpwrapper.h"
17#include "mailwrapper.h" 17#include "mailwrapper.h"
18#include "abstractmail.h" 18#include "abstractmail.h"
19#include "logindialog.h" 19#include "logindialog.h"
20#include "mailtypes.h" 20#include "mailtypes.h"
21#include "sendmailprogress.h" 21#include "sendmailprogress.h"
22 22
23const char* SMTPwrapper::USER_AGENT="OpieMail v0.4"; 23const char* SMTPwrapper::USER_AGENT="OpieMail v0.4";
24 24
25progressMailSend*SMTPwrapper::sendProgress = 0; 25progressMailSend*SMTPwrapper::sendProgress = 0;
26 26
27SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) 27SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp )
28 : QObject() 28 : QObject()
29{ 29{
30 m_SmtpAccount = aSmtp; 30 m_SmtpAccount = aSmtp;
31 Config cfg( "mail" ); 31 Config cfg( "mail" );
32 cfg.setGroup( "Status" ); 32 cfg.setGroup( "Status" );
33 m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); 33 m_queuedMail = cfg.readNumEntry( "outgoing", 0 );
34 emit queuedMails( m_queuedMail ); 34 emit queuedMails( m_queuedMail );
35 connect( this, SIGNAL( queuedMails( int ) ), this, SLOT( emitQCop( int ) ) ); 35 connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) );
36 m_smtp = 0; 36 m_smtp = 0;
37} 37}
38 38
39SMTPwrapper::~SMTPwrapper() 39SMTPwrapper::~SMTPwrapper()
40{ 40{
41 disc_server(); 41 disc_server();
42} 42}
43 43
44void SMTPwrapper::emitQCop( int queued ) { 44void SMTPwrapper::emitQCop( int queued ) {
45 QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); 45 QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" );
46 env << queued; 46 env << queued;
47} 47}
48 48
49QString SMTPwrapper::mailsmtpError( int errnum ) { 49QString SMTPwrapper::mailsmtpError( int errnum ) {
50 switch ( errnum ) { 50 switch ( errnum ) {
51 case MAILSMTP_NO_ERROR: 51 case MAILSMTP_NO_ERROR:
52 return tr( "No error" ); 52 return tr( "No error" );
53 case MAILSMTP_ERROR_UNEXPECTED_CODE: 53 case MAILSMTP_ERROR_UNEXPECTED_CODE:
54 return tr( "Unexpected error code" ); 54 return tr( "Unexpected error code" );
55 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: 55 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE:
56 return tr( "Service not available" ); 56 return tr( "Service not available" );
57 case MAILSMTP_ERROR_STREAM: 57 case MAILSMTP_ERROR_STREAM:
58 return tr( "Stream error" ); 58 return tr( "Stream error" );
59 case MAILSMTP_ERROR_HOSTNAME: 59 case MAILSMTP_ERROR_HOSTNAME:
60 return tr( "gethostname() failed" ); 60 return tr( "gethostname() failed" );
61 case MAILSMTP_ERROR_NOT_IMPLEMENTED: 61 case MAILSMTP_ERROR_NOT_IMPLEMENTED:
62 return tr( "Not implemented" ); 62 return tr( "Not implemented" );
63 case MAILSMTP_ERROR_ACTION_NOT_TAKEN: 63 case MAILSMTP_ERROR_ACTION_NOT_TAKEN:
64 return tr( "Error, action not taken" ); 64 return tr( "Error, action not taken" );
65 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: 65 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION:
66 return tr( "Data exceeds storage allocation" ); 66 return tr( "Data exceeds storage allocation" );
67 case MAILSMTP_ERROR_IN_PROCESSING: 67 case MAILSMTP_ERROR_IN_PROCESSING:
68 return tr( "Error in processing" ); 68 return tr( "Error in processing" );
69 case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED: 69 case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED:
70 return tr( "Starttls not supported" ); 70 return tr( "Starttls not supported" );
71 // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: 71 // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE:
72 // return tr( "Insufficient system storage" ); 72 // return tr( "Insufficient system storage" );
73 case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: 73 case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE:
74 return tr( "Mailbox unavailable" ); 74 return tr( "Mailbox unavailable" );
75 case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: 75 case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED:
76 return tr( "Mailbox name not allowed" ); 76 return tr( "Mailbox name not allowed" );
77 case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: 77 case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND:
78 return tr( "Bad command sequence" ); 78 return tr( "Bad command sequence" );
79 case MAILSMTP_ERROR_USER_NOT_LOCAL: 79 case MAILSMTP_ERROR_USER_NOT_LOCAL:
80 return tr( "User not local" ); 80 return tr( "User not local" );
81 case MAILSMTP_ERROR_TRANSACTION_FAILED: 81 case MAILSMTP_ERROR_TRANSACTION_FAILED:
82 return tr( "Transaction failed" ); 82 return tr( "Transaction failed" );
83 case MAILSMTP_ERROR_MEMORY: 83 case MAILSMTP_ERROR_MEMORY:
84 return tr( "Memory error" ); 84 return tr( "Memory error" );
85 case MAILSMTP_ERROR_CONNECTION_REFUSED: 85 case MAILSMTP_ERROR_CONNECTION_REFUSED:
86 return tr( "Connection refused" ); 86 return tr( "Connection refused" );
87 default: 87 default:
88 return tr( "Unknown error code" ); 88 return tr( "Unknown error code" );
89 } 89 }
90} 90}
91 91
92mailimf_mailbox *SMTPwrapper::newMailbox(const QString&name, const QString&mail ) { 92mailimf_mailbox *SMTPwrapper::newMailbox(const QString&name, const QString&mail ) {
93 return mailimf_mailbox_new( strdup( name.latin1() ), 93 return mailimf_mailbox_new( strdup( name.latin1() ),
94 strdup( mail.latin1() ) ); 94 strdup( mail.latin1() ) );
95} 95}
96 96
97mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr ) { 97mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr ) {
98 mailimf_address_list *addresses; 98 mailimf_address_list *addresses;
99 99
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 2a1f90d..3f34fe7 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -1,197 +1,197 @@
1#include <qlabel.h> 1#include <qlabel.h>
2#include <qvbox.h> 2#include <qvbox.h>
3#include <qheader.h> 3#include <qheader.h>
4#include <qtimer.h> 4#include <qtimer.h>
5#include <qlayout.h> 5#include <qlayout.h>
6#include <qmessagebox.h> 6#include <qmessagebox.h>
7 7
8#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9#include <qpe/resource.h> 9#include <qpe/resource.h>
10 10
11#include "defines.h" 11#include "defines.h"
12#include "mainwindow.h" 12#include "mainwindow.h"
13 13
14 14
15MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 15MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
16 : QMainWindow( parent, name, flags ) 16 : QMainWindow( parent, name, flags )
17{ 17{
18 18
19 setCaption( tr( "Mail" ) ); 19 setCaption( tr( "Mail" ) );
20 setToolBarsMovable( false ); 20 setToolBarsMovable( false );
21 21
22 toolBar = new QToolBar( this ); 22 toolBar = new QToolBar( this );
23 menuBar = new QMenuBar( toolBar ); 23 menuBar = new QMenuBar( toolBar );
24 mailMenu = new QPopupMenu( menuBar ); 24 mailMenu = new QPopupMenu( menuBar );
25 menuBar->insertItem( tr( "Mail" ), mailMenu ); 25 menuBar->insertItem( tr( "Mail" ), mailMenu );
26 settingsMenu = new QPopupMenu( menuBar ); 26 settingsMenu = new QPopupMenu( menuBar );
27 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 27 menuBar->insertItem( tr( "Settings" ), settingsMenu );
28 28
29 addToolBar( toolBar ); 29 addToolBar( toolBar );
30 toolBar->setHorizontalStretchable( true ); 30 toolBar->setHorizontalStretchable( true );
31 31
32 QLabel *spacer = new QLabel( toolBar ); 32 QLabel *spacer = new QLabel( toolBar );
33 spacer->setBackgroundMode( QWidget::PaletteButton ); 33 spacer->setBackgroundMode( QWidget::PaletteButton );
34 toolBar->setStretchableWidget( spacer ); 34 toolBar->setStretchableWidget( spacer );
35 35
36 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, 36 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL,
37 0, 0, this ); 37 0, 0, this );
38 composeMail->addTo( toolBar ); 38 composeMail->addTo( toolBar );
39 composeMail->addTo( mailMenu ); 39 composeMail->addTo( mailMenu );
40 40
41 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, 41 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED,
42 0, 0, this ); 42 0, 0, this );
43 sendQueued->addTo( toolBar ); 43 sendQueued->addTo( toolBar );
44 sendQueued->addTo( mailMenu ); 44 sendQueued->addTo( mailMenu );
45 45
46 /* 46 /*
47 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 47 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
48 0, 0, this ); 48 0, 0, this );
49 syncFolders->addTo( toolBar ); 49 syncFolders->addTo( toolBar );
50 syncFolders->addTo( mailMenu ); 50 syncFolders->addTo( mailMenu );
51 */ 51 */
52 52
53 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, 53 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS,
54 0, 0, this, 0, true ); 54 0, 0, this, 0, true );
55 showFolders->addTo( toolBar ); 55 showFolders->addTo( toolBar );
56 showFolders->addTo( mailMenu ); 56 showFolders->addTo( mailMenu );
57 showFolders->setOn( true ); 57 showFolders->setOn( true );
58 connect(showFolders, SIGNAL( toggled( bool ) ), 58 connect(showFolders, SIGNAL( toggled(bool) ),
59 SLOT( slotShowFolders( bool ) ) ); 59 SLOT( slotShowFolders(bool) ) );
60 60
61 /* 61 /*
62 searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ), 62 searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ),
63 0, 0, this ); 63 0, 0, this );
64 searchMails->addTo( toolBar ); 64 searchMails->addTo( toolBar );
65 searchMails->addTo( mailMenu ); 65 searchMails->addTo( mailMenu );
66 */ 66 */
67 67
68 deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this); 68 deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this);
69 deleteMails->addTo( toolBar ); 69 deleteMails->addTo( toolBar );
70 deleteMails->addTo( mailMenu ); 70 deleteMails->addTo( mailMenu );
71 connect( deleteMails, SIGNAL( activated() ), 71 connect( deleteMails, SIGNAL( activated() ),
72 SLOT( slotDeleteMail() ) ); 72 SLOT( slotDeleteMail() ) );
73 73
74 editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) , 74 editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) ,
75 0, 0, this ); 75 0, 0, this );
76 editSettings->addTo( settingsMenu ); 76 editSettings->addTo( settingsMenu );
77 connect( editSettings, SIGNAL( activated() ), 77 connect( editSettings, SIGNAL( activated() ),
78 SLOT( slotEditSettings() ) ); 78 SLOT( slotEditSettings() ) );
79 editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) , 79 editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) ,
80 0, 0, this ); 80 0, 0, this );
81 editAccounts->addTo( settingsMenu ); 81 editAccounts->addTo( settingsMenu );
82 82
83 //setCentralWidget( view ); 83 //setCentralWidget( view );
84 84
85 QVBox* wrapperBox = new QVBox( this ); 85 QVBox* wrapperBox = new QVBox( this );
86 setCentralWidget( wrapperBox ); 86 setCentralWidget( wrapperBox );
87 87
88 QWidget *view = new QWidget( wrapperBox ); 88 QWidget *view = new QWidget( wrapperBox );
89 89
90 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); 90 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight );
91 91
92 folderView = new AccountView( view ); 92 folderView = new AccountView( view );
93 folderView->header()->hide(); 93 folderView->header()->hide();
94 folderView->setRootIsDecorated( true ); 94 folderView->setRootIsDecorated( true );
95 folderView->addColumn( tr( "Mailbox" ) ); 95 folderView->addColumn( tr( "Mailbox" ) );
96 96
97 layout->addWidget( folderView ); 97 layout->addWidget( folderView );
98 98
99 mailView = new QListView( view ); 99 mailView = new QListView( view );
100 mailView->addColumn( tr( "" ) ); 100 mailView->addColumn( tr( "" ) );
101 mailView->addColumn( tr( "Subject" ),QListView::Manual ); 101 mailView->addColumn( tr( "Subject" ),QListView::Manual );
102 mailView->addColumn( tr( "Sender" ),QListView::Manual ); 102 mailView->addColumn( tr( "Sender" ),QListView::Manual );
103 mailView->addColumn( tr( "Size" ),QListView::Manual); 103 mailView->addColumn( tr( "Size" ),QListView::Manual);
104 mailView->addColumn( tr( "Date" )); 104 mailView->addColumn( tr( "Date" ));
105 mailView->setAllColumnsShowFocus(true); 105 mailView->setAllColumnsShowFocus(true);
106 mailView->setSorting(-1); 106 mailView->setSorting(-1);
107 107
108 statusWidget = new StatusWidget( wrapperBox ); 108 statusWidget = new StatusWidget( wrapperBox );
109 statusWidget->hide(); 109 statusWidget->hide();
110 110
111 layout->addWidget( mailView ); 111 layout->addWidget( mailView );
112 layout->setStretchFactor( folderView, 1 ); 112 layout->setStretchFactor( folderView, 1 );
113 layout->setStretchFactor( mailView, 2 ); 113 layout->setStretchFactor( mailView, 2 );
114 114
115 slotAdjustLayout(); 115 slotAdjustLayout();
116 116
117 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 117 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
118 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 118 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
119 119
120 connect( mailView, SIGNAL( mouseButtonClicked(int, QListViewItem *,const QPoint&,int ) ),this, 120 connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this,
121 SLOT( mailLeftClicked( int, QListViewItem *,const QPoint&,int ) ) ); 121 SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) );
122 connect( mailView, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, 122 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
123 SLOT( mailHold( int, QListViewItem *,const QPoint&,int ) ) ); 123 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
124 connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); 124 connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*)));
125 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 125 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
126 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 126 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
127// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 127// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
128 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 128 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
129 // Added by Stefan Eilers to allow starting by addressbook.. 129 // Added by Stefan Eilers to allow starting by addressbook..
130 // copied from old mail2 130 // copied from old mail2
131#if !defined(QT_NO_COP) 131#if !defined(QT_NO_COP)
132 connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ), 132 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
133 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); 133 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
134#endif 134#endif
135 135
136 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 136 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
137} 137}
138 138
139MainWindow::~MainWindow() 139MainWindow::~MainWindow()
140{ 140{
141} 141}
142 142
143void MainWindow::appMessage(const QCString &, const QByteArray &) 143void MainWindow::appMessage(const QCString &, const QByteArray &)
144{ 144{
145 qDebug("appMessage not reached"); 145 qDebug("appMessage not reached");
146} 146}
147 147
148void MainWindow::slotAdjustLayout() { 148void MainWindow::slotAdjustLayout() {
149 149
150 QWidget *d = QApplication::desktop(); 150 QWidget *d = QApplication::desktop();
151 151
152 if ( d->width() < d->height() ) { 152 if ( d->width() < d->height() ) {
153 layout->setDirection( QBoxLayout::TopToBottom ); 153 layout->setDirection( QBoxLayout::TopToBottom );
154 } else { 154 } else {
155 layout->setDirection( QBoxLayout::LeftToRight ); 155 layout->setDirection( QBoxLayout::LeftToRight );
156 } 156 }
157} 157}
158 158
159void MainWindow::slotAdjustColumns() 159void MainWindow::slotAdjustColumns()
160{ 160{
161 bool hidden = folderView->isHidden(); 161 bool hidden = folderView->isHidden();
162 if ( hidden ) folderView->show(); 162 if ( hidden ) folderView->show();
163 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 163 folderView->setColumnWidth( 0, folderView->visibleWidth() );
164 if ( hidden ) folderView->hide(); 164 if ( hidden ) folderView->hide();
165 165
166 mailView->setColumnWidth( 0, 10 ); 166 mailView->setColumnWidth( 0, 10 );
167 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); 167 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 );
168 mailView->setColumnWidth( 2, 80 ); 168 mailView->setColumnWidth( 2, 80 );
169 mailView->setColumnWidth( 3, 50 ); 169 mailView->setColumnWidth( 3, 50 );
170 mailView->setColumnWidth( 4, 50 ); 170 mailView->setColumnWidth( 4, 50 );
171} 171}
172 172
173void MainWindow::slotEditSettings() 173void MainWindow::slotEditSettings()
174{ 174{
175} 175}
176 176
177void MainWindow::slotShowFolders( bool ) 177void MainWindow::slotShowFolders( bool )
178{ 178{
179 qDebug( "slotShowFolders not reached" ); 179 qDebug( "slotShowFolders not reached" );
180} 180}
181 181
182void MainWindow::refreshMailView(QList<RecMail>*) 182void MainWindow::refreshMailView(QList<RecMail>*)
183{ 183{
184 qDebug( "refreshMailView not reached" ); 184 qDebug( "refreshMailView not reached" );
185} 185}
186 186
187void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) 187void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int )
188{ 188{
189 qDebug( "mailLeftClicked not reached" ); 189 qDebug( "mailLeftClicked not reached" );
190} 190}
191 191
192void MainWindow::displayMail() 192void MainWindow::displayMail()
193{ 193{
194 qDebug("displayMail not reached"); 194 qDebug("displayMail not reached");
195} 195}
196 196
197void MainWindow::slotDeleteMail() 197void MainWindow::slotDeleteMail()
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index f015228..8636957 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -224,133 +224,133 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
224 types.insert( "all", "*" ); 224 types.insert( "all", "*" );
225 QString str = Opie::OFileDialog::getSaveFileName( 1, 225 QString str = Opie::OFileDialog::getSaveFileName( 1,
226 "/", item->text( 2 ) , types, 0 ); 226 "/", item->text( 2 ) , types, 0 );
227 227
228 if( !str.isEmpty() ) 228 if( !str.isEmpty() )
229 { 229 {
230 encodedString*content = m_recMail.Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 230 encodedString*content = m_recMail.Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
231 if (content) 231 if (content)
232 { 232 {
233 QFile output(str); 233 QFile output(str);
234 output.open(IO_WriteOnly); 234 output.open(IO_WriteOnly);
235 output.writeBlock(content->Content(),content->Length()); 235 output.writeBlock(content->Content(),content->Length());
236 output.close(); 236 output.close();
237 delete content; 237 delete content;
238 } 238 }
239 } 239 }
240 } 240 }
241 break ; 241 break ;
242 242
243 case 1: 243 case 1:
244 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 244 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
245 { 245 {
246 setText(); 246 setText();
247 } 247 }
248 else 248 else
249 { 249 {
250 if ( m_recMail.Wrapper() != 0l ) 250 if ( m_recMail.Wrapper() != 0l )
251 { // make sure that there is a wrapper , even after delete or simular actions 251 { // make sure that there is a wrapper , even after delete or simular actions
252 browser->setText( m_recMail.Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); 252 browser->setText( m_recMail.Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
253 } 253 }
254 } 254 }
255 break; 255 break;
256 } 256 }
257 delete menu; 257 delete menu;
258} 258}
259 259
260 260
261void ViewMail::setMail( RecMail mail ) 261void ViewMail::setMail( RecMail mail )
262{ 262{
263 263
264 m_recMail = mail; 264 m_recMail = mail;
265 265
266 m_mail[0] = mail.getFrom(); 266 m_mail[0] = mail.getFrom();
267 m_mail[1] = mail.getSubject(); 267 m_mail[1] = mail.getSubject();
268 m_mail[3] = mail.getDate(); 268 m_mail[3] = mail.getDate();
269 m_mail[4] = mail.Msgid(); 269 m_mail[4] = mail.Msgid();
270 270
271 m_mail2[0] = mail.To(); 271 m_mail2[0] = mail.To();
272 m_mail2[1] = mail.CC(); 272 m_mail2[1] = mail.CC();
273 m_mail2[2] = mail.Bcc(); 273 m_mail2[2] = mail.Bcc();
274 274
275 setText(); 275 setText();
276} 276}
277 277
278 278
279 279
280ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) 280ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
281 : ViewMailBase(parent, name, fl), _inLoop(false) 281 : ViewMailBase(parent, name, fl), _inLoop(false)
282{ 282{
283 m_gotBody = false; 283 m_gotBody = false;
284 deleted = false; 284 deleted = false;
285 285
286 connect( reply, SIGNAL(activated()), SLOT(slotReply())); 286 connect( reply, SIGNAL(activated()), SLOT(slotReply()));
287 connect( forward, SIGNAL(activated()), SLOT(slotForward())); 287 connect( forward, SIGNAL(activated()), SLOT(slotForward()));
288 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail( ) ) ); 288 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) );
289 connect( showHtml, SIGNAL( toggled( bool ) ), SLOT( slotShowHtml( bool ) ) ); 289 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) );
290 290
291 attachments->setEnabled(m_gotBody); 291 attachments->setEnabled(m_gotBody);
292 connect( attachments, SIGNAL( clicked ( QListViewItem *, const QPoint & , int ) ), SLOT( slotItemClicked( QListViewItem *, const QPoint & , int ) ) ); 292 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) );
293 293
294 readConfig(); 294 readConfig();
295 attachments->setSorting(-1); 295 attachments->setSorting(-1);
296} 296}
297 297
298void ViewMail::readConfig() 298void ViewMail::readConfig()
299{ 299{
300 Config cfg( "mail" ); 300 Config cfg( "mail" );
301 cfg.setGroup( "Settings" ); 301 cfg.setGroup( "Settings" );
302 m_showHtml = cfg.readBoolEntry( "showHtml", false ); 302 m_showHtml = cfg.readBoolEntry( "showHtml", false );
303 showHtml->setOn( m_showHtml ); 303 showHtml->setOn( m_showHtml );
304} 304}
305 305
306void ViewMail::setText() 306void ViewMail::setText()
307{ 307{
308 308
309 QString toString; 309 QString toString;
310 QString ccString; 310 QString ccString;
311 QString bccString; 311 QString bccString;
312 312
313 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) 313 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it )
314 { 314 {
315 toString += (*it); 315 toString += (*it);
316 } 316 }
317 for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) 317 for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it )
318 { 318 {
319 ccString += (*it); 319 ccString += (*it);
320 } 320 }
321 for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) 321 for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it )
322 { 322 {
323 bccString += (*it); 323 bccString += (*it);
324 } 324 }
325 325
326 setCaption( caption().arg( m_mail[0] ) ); 326 setCaption( caption().arg( m_mail[0] ) );
327 327
328 m_mailHtml = "<html><body>" 328 m_mailHtml = "<html><body>"
329 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" 329 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>"
330 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" 330 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>"
331 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" 331 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>"
332 "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" 332 "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>"
333 "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + 333 "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" +
334 tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" 334 tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>"
335 "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + 335 "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] +
336 "</td></tr></table><font face=fixed>"; 336 "</td></tr></table><font face=fixed>";
337 337
338 if ( !m_showHtml ) 338 if ( !m_showHtml )
339 { 339 {
340 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); 340 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" );
341 } 341 }
342 else 342 else
343 { 343 {
344 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); 344 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" );
345 } 345 }
346 // remove later in favor of a real handling 346 // remove later in favor of a real handling
347 m_gotBody = true; 347 m_gotBody = true;
348} 348}
349 349
350 350
351ViewMail::~ViewMail() 351ViewMail::~ViewMail()
352{ 352{
353 m_recMail.Wrapper()->cleanMimeCache(); 353 m_recMail.Wrapper()->cleanMimeCache();
354 hide(); 354 hide();
355} 355}
356 356
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 4064549..4c39569 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -115,269 +115,269 @@ OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl)
115 localMenu->setCheckable(TRUE); 115 localMenu->setCheckable(TRUE);
116 116
117 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); 117 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
118 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 118 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
119 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 119 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
120 remoteMenu->insertSeparator(); 120 remoteMenu->insertSeparator();
121 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 121 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
122 122
123 tabMenu->insertSeparator(); 123 tabMenu->insertSeparator();
124 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 124 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
125 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 125 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
126 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); 126 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() ));
127 tabMenu->insertSeparator(); 127 tabMenu->insertSeparator();
128// tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 128// tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
129 tabMenu->setCheckable(TRUE); 129 tabMenu->setCheckable(TRUE);
130 130
131 131
132 cdUpButton = new QToolButton( view,"cdUpButton"); 132 cdUpButton = new QToolButton( view,"cdUpButton");
133 cdUpButton->setPixmap(Resource::loadPixmap("up")); 133 cdUpButton->setPixmap(Resource::loadPixmap("up"));
134 cdUpButton ->setFixedSize( QSize( 20, 20 ) ); 134 cdUpButton ->setFixedSize( QSize( 20, 20 ) );
135 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 135 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
136 layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); 136 layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 );
137 cdUpButton->hide(); 137 cdUpButton->hide();
138 138
139// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",view,"docsButton"); 139// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",view,"docsButton");
140// docButton->setFixedSize( QSize( 20, 20 ) ); 140// docButton->setFixedSize( QSize( 20, 20 ) );
141// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 141// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
142// docButton->setFlat(TRUE); 142// docButton->setFlat(TRUE);
143// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); 143// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 );
144 144
145 homeButton = new QToolButton(view,"homeButton"); 145 homeButton = new QToolButton(view,"homeButton");
146 homeButton->setPixmap( Resource::loadPixmap("home")); 146 homeButton->setPixmap( Resource::loadPixmap("home"));
147 homeButton->setFixedSize( QSize( 20, 20 ) ); 147 homeButton->setFixedSize( QSize( 20, 20 ) );
148 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 148 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
149 layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); 149 layout->addMultiCellWidget( homeButton, 0, 0, 4, 4);
150 homeButton->hide(); 150 homeButton->hide();
151 151
152 TabWidget = new QTabWidget( view, "TabWidget" ); 152 TabWidget = new QTabWidget( view, "TabWidget" );
153 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); 153 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 );
154 154
155// TabWidget->setTabShape(QTabWidget::Triangular); 155// TabWidget->setTabShape(QTabWidget::Triangular);
156 156
157 tab = new QWidget( TabWidget, "tab" ); 157 tab = new QWidget( TabWidget, "tab" );
158 tabLayout = new QGridLayout( tab ); 158 tabLayout = new QGridLayout( tab );
159 tabLayout->setSpacing( 2); 159 tabLayout->setSpacing( 2);
160 tabLayout->setMargin( 2); 160 tabLayout->setMargin( 2);
161 161
162 Local_View = new QListView( tab, "Local_View" ); 162 Local_View = new QListView( tab, "Local_View" );
163// Local_View->setResizePolicy( QListView::AutoOneFit ); 163// Local_View->setResizePolicy( QListView::AutoOneFit );
164 Local_View->addColumn( tr("File"),150); 164 Local_View->addColumn( tr("File"),150);
165 Local_View->addColumn( tr("Date"),-1); 165 Local_View->addColumn( tr("Date"),-1);
166 Local_View->setColumnAlignment(1,QListView::AlignRight); 166 Local_View->setColumnAlignment(1,QListView::AlignRight);
167 Local_View->addColumn( tr("Size"),-1); 167 Local_View->addColumn( tr("Size"),-1);
168 Local_View->setColumnAlignment(2,QListView::AlignRight); 168 Local_View->setColumnAlignment(2,QListView::AlignRight);
169 Local_View->setAllColumnsShowFocus(TRUE); 169 Local_View->setAllColumnsShowFocus(TRUE);
170 170
171 Local_View->setMultiSelection( TRUE); 171 Local_View->setMultiSelection( TRUE);
172 Local_View->setSelectionMode(QListView::Extended); 172 Local_View->setSelectionMode(QListView::Extended);
173 Local_View->setFocusPolicy(QWidget::ClickFocus); 173 Local_View->setFocusPolicy(QWidget::ClickFocus);
174 174
175 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 175 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
176 176
177 tabLayout->addWidget( Local_View, 0, 0 ); 177 tabLayout->addWidget( Local_View, 0, 0 );
178 178
179 connect( Local_View, SIGNAL( clicked( QListViewItem*)), 179 connect( Local_View, SIGNAL( clicked(QListViewItem*)),
180 this,SLOT( localListClicked(QListViewItem *)) ); 180 this,SLOT( localListClicked(QListViewItem*)) );
181// connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), 181// connect( Local_View, SIGNAL( doubleClicked(QListViewItem*)),
182// this,SLOT( localListClicked(QListViewItem *)) ); 182// this,SLOT( localListClicked(QListViewItem*)) );
183 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 183 connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
184 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 184 this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) );
185 185
186 TabWidget->insertTab( tab, tr( "Local" ) ); 186 TabWidget->insertTab( tab, tr( "Local" ) );
187 187
188 tab_2 = new QWidget( TabWidget, "tab_2" ); 188 tab_2 = new QWidget( TabWidget, "tab_2" );
189 tabLayout_2 = new QGridLayout( tab_2 ); 189 tabLayout_2 = new QGridLayout( tab_2 );
190 tabLayout_2->setSpacing( 2); 190 tabLayout_2->setSpacing( 2);
191 tabLayout_2->setMargin( 2); 191 tabLayout_2->setMargin( 2);
192 192
193 Remote_View = new QListView( tab_2, "Remote_View" ); 193 Remote_View = new QListView( tab_2, "Remote_View" );
194 Remote_View->addColumn( tr("File"),150); 194 Remote_View->addColumn( tr("File"),150);
195 Remote_View->addColumn( tr("Date"),-1); 195 Remote_View->addColumn( tr("Date"),-1);
196// Remote_View->setColumnAlignment(1,QListView::AlignRight); 196// Remote_View->setColumnAlignment(1,QListView::AlignRight);
197 Remote_View->addColumn( tr("Size"),-1); 197 Remote_View->addColumn( tr("Size"),-1);
198 Remote_View->setColumnAlignment(2,QListView::AlignRight); 198 Remote_View->setColumnAlignment(2,QListView::AlignRight);
199 Remote_View->setColumnAlignment(3,QListView::AlignCenter); 199 Remote_View->setColumnAlignment(3,QListView::AlignCenter);
200 Remote_View->addColumn( tr("Dir"),-1); 200 Remote_View->addColumn( tr("Dir"),-1);
201 Remote_View->setColumnAlignment(4,QListView::AlignRight); 201 Remote_View->setColumnAlignment(4,QListView::AlignRight);
202 Remote_View->setAllColumnsShowFocus(TRUE); 202 Remote_View->setAllColumnsShowFocus(TRUE);
203 203
204 Remote_View->setMultiSelection( FALSE); 204 Remote_View->setMultiSelection( FALSE);
205 Remote_View->setSelectionMode(QListView::Extended); 205 Remote_View->setSelectionMode(QListView::Extended);
206 Remote_View->setFocusPolicy(QWidget::ClickFocus); 206 Remote_View->setFocusPolicy(QWidget::ClickFocus);
207 207
208 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 208 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
209 209
210 connect( Remote_View, SIGNAL( clicked( QListViewItem*)), 210 connect( Remote_View, SIGNAL( clicked(QListViewItem*)),
211 this,SLOT( remoteListClicked(QListViewItem *)) ); 211 this,SLOT( remoteListClicked(QListViewItem*)) );
212 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 212 connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
213 this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); 213 this,SLOT( RemoteListPressed(int,QListViewItem*,const QPoint&,int)) );
214 214
215 tabLayout_2->addWidget( Remote_View, 0, 0 ); 215 tabLayout_2->addWidget( Remote_View, 0, 0 );
216 216
217 TabWidget->insertTab( tab_2, tr( "Remote" ) ); 217 TabWidget->insertTab( tab_2, tr( "Remote" ) );
218 218
219 tab_3 = new QWidget( TabWidget, "tab_3" ); 219 tab_3 = new QWidget( TabWidget, "tab_3" );
220 tabLayout_3 = new QGridLayout( tab_3 ); 220 tabLayout_3 = new QGridLayout( tab_3 );
221 tabLayout_3->setSpacing( 2); 221 tabLayout_3->setSpacing( 2);
222 tabLayout_3->setMargin( 2); 222 tabLayout_3->setMargin( 2);
223 223
224 TextLabel1 = new QLabel( tab_3, "TextLabel1" ); 224 TextLabel1 = new QLabel( tab_3, "TextLabel1" );
225 TextLabel1->setText( tr( "Username" ) ); 225 TextLabel1->setText( tr( "Username" ) );
226 tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); 226 tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 );
227 227
228 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); 228 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" );
229 UsernameComboBox->setEditable(TRUE); 229 UsernameComboBox->setEditable(TRUE);
230 tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); 230 tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 );
231 231
232 connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this, 232 connect( UsernameComboBox,SIGNAL(textChanged(const QString&)),this,
233 SLOT( UsernameComboBoxEdited(const QString & ) )); 233 SLOT( UsernameComboBoxEdited(const QString&) ));
234 234
235 TextLabel2 = new QLabel( tab_3, "TextLabel2" ); 235 TextLabel2 = new QLabel( tab_3, "TextLabel2" );
236 TextLabel2->setText( tr( "Password" ) ); 236 TextLabel2->setText( tr( "Password" ) );
237 tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); 237 tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 );
238 238
239 PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); 239 PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" );
240 PasswordEdit->setEchoMode(QLineEdit::Password); 240 PasswordEdit->setEchoMode(QLineEdit::Password);
241 tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); 241 tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 );
242 242
243 connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this, 243 connect( PasswordEdit,SIGNAL(textChanged(const QString&)),this,
244 SLOT( PasswordEditEdited(const QString & ) )); 244 SLOT( PasswordEditEdited(const QString&) ));
245 245
246//PasswordEdit->setFixedWidth(85); 246//PasswordEdit->setFixedWidth(85);
247 TextLabel3 = new QLabel( tab_3, "TextLabel3" ); 247 TextLabel3 = new QLabel( tab_3, "TextLabel3" );
248 TextLabel3->setText( tr( "Remote server" ) ); 248 TextLabel3->setText( tr( "Remote server" ) );
249 tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); 249 tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 );
250 250
251 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); 251 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" );
252 ServerComboBox->setEditable(TRUE); 252 ServerComboBox->setEditable(TRUE);
253 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); 253 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 );
254 254
255 connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); 255 connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int) ));
256 connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this, 256 connect(ServerComboBox,SIGNAL(textChanged(const QString&)),this,
257 SLOT(serverComboEdited(const QString & ) )); 257 SLOT(serverComboEdited(const QString&) ));
258 258
259 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); 259 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" );
260 TextLabel5->setText( tr( "Remote path" ) ); 260 TextLabel5->setText( tr( "Remote path" ) );
261 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); 261 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 );
262 262
263 263
264 remotePath = new QLineEdit( "/", tab_3, "remotePath" ); 264 remotePath = new QLineEdit( "/", tab_3, "remotePath" );
265 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); 265 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 );
266 TextLabel4 = new QLabel( tab_3, "TextLabel4" ); 266 TextLabel4 = new QLabel( tab_3, "TextLabel4" );
267 TextLabel4->setText( tr( "Port" ) ); 267 TextLabel4->setText( tr( "Port" ) );
268 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); 268 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 );
269 269
270 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); 270 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" );
271 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); 271 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
272 PortSpinBox->setMaxValue(32786); 272 PortSpinBox->setMaxValue(32786);
273 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); 273 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1);
274 274
275 serverListView = new QListBox( tab_3, "ServerListView" ); 275 serverListView = new QListBox( tab_3, "ServerListView" );
276 tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); 276 tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5);
277 277
278 connect( serverListView, SIGNAL( highlighted( const QString &)), 278 connect( serverListView, SIGNAL( highlighted(const QString&)),
279 this,SLOT( serverListClicked( const QString &) ) ); 279 this,SLOT( serverListClicked(const QString&) ) );
280 280
281 connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" ); 281 connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" );
282 tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); 282 tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1);
283 connectServerBtn->setToggleButton(TRUE); 283 connectServerBtn->setToggleButton(TRUE);
284 connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); 284 connect(connectServerBtn,SIGNAL( toggled(bool)),SLOT( connectorBtnToggled(bool) ));
285 285
286 newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" ); 286 newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" );
287 tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); 287 tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2);
288 connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); 288 connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() ));
289 289
290 QPushButton *deleteServerBtn; 290 QPushButton *deleteServerBtn;
291 deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" ); 291 deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" );
292 tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); 292 tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3);
293 293
294 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); 294 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer()));
295 295
296 296
297 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 297 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
298 tabLayout_3->addItem( spacer, 5, 0 ); 298 tabLayout_3->addItem( spacer, 5, 0 );
299 299
300 TabWidget->insertTab( tab_3, tr( "Config" ) ); 300 TabWidget->insertTab( tab_3, tr( "Config" ) );
301 301
302#if 0 302#if 0
303 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 303 connect(TabWidget,SIGNAL(currentChanged(QWidget*)),
304 this,SLOT(tabChanged(QWidget*))); 304 this,SLOT(tabChanged(QWidget*)));
305#endif 305#endif
306 306
307 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 307 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
308 currentDir.setPath( QDir::currentDirPath()); 308 currentDir.setPath( QDir::currentDirPath());
309// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 309// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
310 310
311 currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" ); 311 currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" );
312 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); 312 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4);
313 currentPathCombo ->setFixedWidth(220); 313 currentPathCombo ->setFixedWidth(220);
314 currentPathCombo->setEditable(TRUE); 314 currentPathCombo->setEditable(TRUE);
315 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 315 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
316 316
317#if 0 317#if 0
318 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 318 connect( currentPathCombo, SIGNAL( activated(const QString&) ),
319 this, SLOT( currentPathComboActivated( const QString & ) ) ); 319 this, SLOT( currentPathComboActivated(const QString&) ) );
320 320
321 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 321 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
322 this,SLOT(currentPathComboChanged())); 322 this,SLOT(currentPathComboChanged()));
323#endif 323#endif
324 ProgressBar = new QProgressBar( view, "ProgressBar" ); 324 ProgressBar = new QProgressBar( view, "ProgressBar" );
325 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); 325 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4);
326 ProgressBar->setMaximumHeight(10); 326 ProgressBar->setMaximumHeight(10);
327 filterStr="*"; 327 filterStr="*";
328 b=FALSE; 328 b=FALSE;
329#if 0 329#if 0
330 populateLocalView(); 330 populateLocalView();
331#endif 331#endif
332 readConfig(); 332 readConfig();
333 333
334// ServerComboBox->setCurrentItem(currentServerConfig); 334// ServerComboBox->setCurrentItem(currentServerConfig);
335 335
336 TabWidget->setCurrentPage(2); 336 TabWidget->setCurrentPage(2);
337 qDebug("Constructor done"); 337 qDebug("Constructor done");
338} 338}
339 339
340OpieFtp::~OpieFtp() 340OpieFtp::~OpieFtp()
341{ 341{
342} 342}
343 343
344void OpieFtp::cleanUp() 344void OpieFtp::cleanUp()
345{ 345{
346 if(conn) 346 if(conn)
347 FtpQuit(conn); 347 FtpQuit(conn);
348 QString sfile=QDir::homeDirPath(); 348 QString sfile=QDir::homeDirPath();
349 if(sfile.right(1) != "/") 349 if(sfile.right(1) != "/")
350 sfile+="/._temp"; 350 sfile+="/._temp";
351 else 351 else
352 sfile+="._temp"; 352 sfile+="._temp";
353 QFile file( sfile); 353 QFile file( sfile);
354 if(file.exists()) 354 if(file.exists())
355 file.remove(); 355 file.remove();
356 Config cfg("opieftp"); 356 Config cfg("opieftp");
357 cfg.setGroup("Server"); 357 cfg.setGroup("Server");
358 cfg.writeEntry("currentServer", currentServerConfig); 358 cfg.writeEntry("currentServer", currentServerConfig);
359 359
360 exit(0); 360 exit(0);
361} 361}
362 362
363void OpieFtp::tabChanged(QWidget *) 363void OpieFtp::tabChanged(QWidget *)
364{ 364{
365 if (TabWidget->currentPageIndex() == 0) { 365 if (TabWidget->currentPageIndex() == 0) {
366 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 366 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
367 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); 367 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE);
368 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 368 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
369 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 369 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
370 if(cdUpButton->isHidden()) 370 if(cdUpButton->isHidden())
371 cdUpButton->show(); 371 cdUpButton->show();
372 if(homeButton->isHidden()) 372 if(homeButton->isHidden())
373 homeButton->show(); 373 homeButton->show();
374 374
375 } 375 }
376 if (TabWidget->currentPageIndex() == 1) { 376 if (TabWidget->currentPageIndex() == 1) {
377 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 377 currentPathCombo->lineEdit()->setText( currentRemoteDir );
378 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); 378 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE);
379 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 379 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
380 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 380 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
381 if(cdUpButton->isHidden()) 381 if(cdUpButton->isHidden())
382 cdUpButton->show(); 382 cdUpButton->show();
383 homeButton->hide(); 383 homeButton->hide();
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp
index b0771f6..667e977 100644
--- a/noncore/net/opieirc/ircchanneltab.cpp
+++ b/noncore/net/opieirc/ircchanneltab.cpp
@@ -1,95 +1,95 @@
1#include <qpe/resource.h> 1#include <qpe/resource.h>
2#include <qwhatsthis.h> 2#include <qwhatsthis.h>
3#include <qhbox.h> 3#include <qhbox.h>
4#include "ircchanneltab.h" 4#include "ircchanneltab.h"
5#include "ircservertab.h" 5#include "ircservertab.h"
6 6
7IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { 7IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) {
8 m_mainWindow = mainWindow; 8 m_mainWindow = mainWindow;
9 m_parentTab = parentTab; 9 m_parentTab = parentTab;
10 m_channel = channel; 10 m_channel = channel;
11 m_description->setText(tr("Talking on channel") + " <b>" + channel->channelname() + "</b>"); 11 m_description->setText(tr("Talking on channel") + " <b>" + channel->channelname() + "</b>");
12 QHBox *hbox = new QHBox(this); 12 QHBox *hbox = new QHBox(this);
13 m_textview = new QTextView(hbox); 13 m_textview = new QTextView(hbox);
14 m_textview->setHScrollBarMode(QScrollView::AlwaysOff); 14 m_textview->setHScrollBarMode(QScrollView::AlwaysOff);
15 m_textview->setVScrollBarMode(QScrollView::AlwaysOn); 15 m_textview->setVScrollBarMode(QScrollView::AlwaysOn);
16 m_listVisible = TRUE; 16 m_listVisible = TRUE;
17 m_listButton = new QPushButton(">", m_textview); 17 m_listButton = new QPushButton(">", m_textview);
18 m_textview->setCornerWidget(m_listButton); 18 m_textview->setCornerWidget(m_listButton);
19 m_textview->setTextFormat(RichText); 19 m_textview->setTextFormat(RichText);
20 QWhatsThis::add(m_textview, tr("Channel discussion")); 20 QWhatsThis::add(m_textview, tr("Channel discussion"));
21 connect(m_listButton, SIGNAL(clicked()), this, SLOT(toggleList())); 21 connect(m_listButton, SIGNAL(clicked()), this, SLOT(toggleList()));
22 m_list = new IRCChannelList(m_channel, hbox); 22 m_list = new IRCChannelList(m_channel, hbox);
23 m_list->update(); 23 m_list->update();
24 m_list->setMaximumWidth(LISTWIDTH); 24 m_list->setMaximumWidth(LISTWIDTH);
25 m_field = new IRCHistoryLineEdit(this); 25 m_field = new IRCHistoryLineEdit(this);
26 QWhatsThis::add(m_field, tr("Type your message here to participate in the channel discussion")); 26 QWhatsThis::add(m_field, tr("Type your message here to participate in the channel discussion"));
27 m_popup = new QPopupMenu(m_list); 27 m_popup = new QPopupMenu(m_list);
28 m_lines = 0; 28 m_lines = 0;
29 /* Required so that embedded-style "right" clicks work */ 29 /* Required so that embedded-style "right" clicks work */
30 QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); 30 QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold);
31 connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &))); 31 connect(m_list, SIGNAL(mouseButtonPressed(int,QListBoxItem*,const QPoint&)), this, SLOT(mouseButtonPressed(int,QListBoxItem*,const QPoint&)));
32 /* Construct the popup menu */ 32 /* Construct the popup menu */
33 QPopupMenu *ctcpMenu = new QPopupMenu(m_list); 33 QPopupMenu *ctcpMenu = new QPopupMenu(m_list);
34 m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu); 34 m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu);
35 m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery())); 35 m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery()));
36 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing())); 36 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing()));
37 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion())); 37 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion()));
38 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois())); 38 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois()));
39 connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling())); 39 connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling()));
40 m_layout->add(hbox); 40 m_layout->add(hbox);
41 hbox->show(); 41 hbox->show();
42 m_layout->add(m_field); 42 m_layout->add(m_field);
43 m_field->setFocus(); 43 m_field->setFocus();
44 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); 44 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
45 settingsChanged(); 45 settingsChanged();
46} 46}
47 47
48void IRCChannelTab::scrolling(){ 48void IRCChannelTab::scrolling(){
49 m_textview->ensureVisible(0, m_textview->contentsHeight()); 49 m_textview->ensureVisible(0, m_textview->contentsHeight());
50} 50}
51 51
52void IRCChannelTab::appendText(QString text) { 52void IRCChannelTab::appendText(QString text) {
53 /* not using append because it creates layout problems */ 53 /* not using append because it creates layout problems */
54 QString txt = m_textview->text() + text + "\n"; 54 QString txt = m_textview->text() + text + "\n";
55 if (m_maxLines > 0 && m_lines >= m_maxLines) { 55 if (m_maxLines > 0 && m_lines >= m_maxLines) {
56 int firstBreak = txt.find('\n'); 56 int firstBreak = txt.find('\n');
57 if (firstBreak != -1) { 57 if (firstBreak != -1) {
58 txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); 58 txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1));
59 } 59 }
60 } else { 60 } else {
61 m_lines++; 61 m_lines++;
62 } 62 }
63 m_textview->ensureVisible(0, m_textview->contentsHeight()); 63 m_textview->ensureVisible(0, m_textview->contentsHeight());
64 m_textview->setText(txt); 64 m_textview->setText(txt);
65 m_textview->ensureVisible(0, m_textview->contentsHeight()); 65 m_textview->ensureVisible(0, m_textview->contentsHeight());
66 emit changed(this); 66 emit changed(this);
67} 67}
68 68
69IRCChannelTab::~IRCChannelTab() { 69IRCChannelTab::~IRCChannelTab() {
70 m_parentTab->removeChannelTab(this); 70 m_parentTab->removeChannelTab(this);
71} 71}
72 72
73void IRCChannelTab::processCommand() { 73void IRCChannelTab::processCommand() {
74 QString text = m_field->text(); 74 QString text = m_field->text();
75 if (text.length()>0) { 75 if (text.length()>0) {
76 if (session()->isSessionActive()) { 76 if (session()->isSessionActive()) {
77 if (text.startsWith("/") && !text.startsWith("//")) { 77 if (text.startsWith("/") && !text.startsWith("//")) {
78 /* Command mode */ 78 /* Command mode */
79 m_parentTab->executeCommand(this, text);; 79 m_parentTab->executeCommand(this, text);;
80 } else { 80 } else {
81 if (text.startsWith("//")) 81 if (text.startsWith("//"))
82 text = text.right(text.length()-1); 82 text = text.right(text.length()-1);
83 session()->sendMessage(m_channel, m_field->text()); 83 session()->sendMessage(m_channel, m_field->text());
84 appendText("<font color=\"" + m_textColor + "\">&lt;</font><font color=\"" + m_selfColor + "\">"+m_parentTab->server()->nick()+"</font><font color=\"" + m_textColor + "\">&gt; "+IRCOutput::toHTML(m_field->text())+"</font><br>"); 84 appendText("<font color=\"" + m_textColor + "\">&lt;</font><font color=\"" + m_selfColor + "\">"+m_parentTab->server()->nick()+"</font><font color=\"" + m_textColor + "\">&gt; "+IRCOutput::toHTML(m_field->text())+"</font><br>");
85 } 85 }
86 } else { 86 } else {
87 appendText("<font color=\"" + m_errorColor + "\">"+tr("Disconnected")+"</font><br>"); 87 appendText("<font color=\"" + m_errorColor + "\">"+tr("Disconnected")+"</font><br>");
88 } 88 }
89 } 89 }
90 m_field->clear(); 90 m_field->clear();
91} 91}
92 92
93void IRCChannelTab::settingsChanged() { 93void IRCChannelTab::settingsChanged() {
94 m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); 94 m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>");
95 m_lines = 0; 95 m_lines = 0;
diff --git a/noncore/net/opieirc/ircsession.cpp b/noncore/net/opieirc/ircsession.cpp
index 6404d71..3b176d0 100644
--- a/noncore/net/opieirc/ircsession.cpp
+++ b/noncore/net/opieirc/ircsession.cpp
@@ -1,73 +1,73 @@
1#include "ircsession.h" 1#include "ircsession.h"
2#include "ircmessageparser.h" 2#include "ircmessageparser.h"
3#include "ircversion.h" 3#include "ircversion.h"
4 4
5IRCSession::IRCSession(IRCServer *server) { 5IRCSession::IRCSession(IRCServer *server) {
6 m_server = server; 6 m_server = server;
7 m_connection = new IRCConnection(m_server); 7 m_connection = new IRCConnection(m_server);
8 m_parser = new IRCMessageParser(this); 8 m_parser = new IRCMessageParser(this);
9 connect(m_connection, SIGNAL(messageArrived(IRCMessage *)), this, SLOT(handleMessage(IRCMessage *))); 9 connect(m_connection, SIGNAL(messageArrived(IRCMessage*)), this, SLOT(handleMessage(IRCMessage*)));
10 connect(m_parser, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput))); 10 connect(m_parser, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput)));
11 connect(m_connection, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput))); 11 connect(m_connection, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput)));
12} 12}
13 13
14IRCSession::~IRCSession() { 14IRCSession::~IRCSession() {
15 /* We want this to get deleted automatically */ 15 /* We want this to get deleted automatically */
16 m_channels.setAutoDelete(TRUE); 16 m_channels.setAutoDelete(TRUE);
17 m_people.setAutoDelete(TRUE); 17 m_people.setAutoDelete(TRUE);
18 18
19 delete m_parser; 19 delete m_parser;
20 delete m_connection; 20 delete m_connection;
21} 21}
22 22
23void IRCSession::beginSession() { 23void IRCSession::beginSession() {
24 m_connection->doConnect(); 24 m_connection->doConnect();
25} 25}
26 26
27void IRCSession::join(QString channelname) { 27void IRCSession::join(QString channelname) {
28 m_connection->sendLine("JOIN "+channelname); 28 m_connection->sendLine("JOIN "+channelname);
29} 29}
30 30
31void IRCSession::quit(){ 31void IRCSession::quit(){
32 m_connection->sendLine("QUIT :[OI] I'm too good to need a reason"); 32 m_connection->sendLine("QUIT :[OI] I'm too good to need a reason");
33} 33}
34 34
35void IRCSession::quit(QString message){ 35void IRCSession::quit(QString message){
36 m_connection->sendLine("QUIT :" + message); 36 m_connection->sendLine("QUIT :" + message);
37} 37}
38 38
39void IRCSession::topic(IRCChannel *channel, QString message){ 39void IRCSession::topic(IRCChannel *channel, QString message){
40 m_connection->sendLine("TOPIC :" + channel->channelname() + " " + message); 40 m_connection->sendLine("TOPIC :" + channel->channelname() + " " + message);
41} 41}
42 42
43void IRCSession::mode(IRCChannel *channel, QString message){ 43void IRCSession::mode(IRCChannel *channel, QString message){
44 m_connection->sendLine("MODE " + channel->channelname() + " " + message); 44 m_connection->sendLine("MODE " + channel->channelname() + " " + message);
45} 45}
46 46
47void IRCSession::mode(IRCPerson *person, QString message){ 47void IRCSession::mode(IRCPerson *person, QString message){
48 m_connection->sendLine("MODE " + person->nick() + " " + message); 48 m_connection->sendLine("MODE " + person->nick() + " " + message);
49} 49}
50 50
51void IRCSession::mode(QString message){ 51void IRCSession::mode(QString message){
52 m_connection->sendLine("MODE " + message); 52 m_connection->sendLine("MODE " + message);
53} 53}
54 54
55void IRCSession::raw(QString message){ 55void IRCSession::raw(QString message){
56 m_connection->sendLine(message); 56 m_connection->sendLine(message);
57} 57}
58 58
59void IRCSession::kick(IRCChannel *channel, IRCPerson *person) { 59void IRCSession::kick(IRCChannel *channel, IRCPerson *person) {
60 m_connection->sendLine("KICK "+ channel->channelname() + " " + person->nick() +" :0wn3d - no reason"); 60 m_connection->sendLine("KICK "+ channel->channelname() + " " + person->nick() +" :0wn3d - no reason");
61} 61}
62 62
63void IRCSession::op(IRCChannel *channel, IRCPerson *person) { 63void IRCSession::op(IRCChannel *channel, IRCPerson *person) {
64 m_connection->sendLine("MODE "+ channel->channelname() + " +ooo " + person->nick()); 64 m_connection->sendLine("MODE "+ channel->channelname() + " +ooo " + person->nick());
65} 65}
66 66
67void IRCSession::kick(IRCChannel *channel, IRCPerson *person, QString message) { 67void IRCSession::kick(IRCChannel *channel, IRCPerson *person, QString message) {
68 m_connection->sendLine("KICK "+ channel->channelname() + " " + person->nick() +" :" + message); 68 m_connection->sendLine("KICK "+ channel->channelname() + " " + person->nick() +" :" + message);
69} 69}
70 70
71void IRCSession::sendMessage(IRCPerson *person, QString message) { 71void IRCSession::sendMessage(IRCPerson *person, QString message) {
72 m_connection->sendLine("PRIVMSG " + person->nick() + " :" + message); 72 m_connection->sendLine("PRIVMSG " + person->nick() + " :" + message);
73} 73}
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp
index 7414154..0923a11 100644
--- a/noncore/net/opieirc/mainwindow.cpp
+++ b/noncore/net/opieirc/mainwindow.cpp
@@ -1,91 +1,91 @@
1#include <qmenubar.h> 1#include <qmenubar.h>
2#include <qpe/resource.h> 2#include <qpe/resource.h>
3#include <qwhatsthis.h> 3#include <qwhatsthis.h>
4 4
5#include "mainwindow.h" 5#include "mainwindow.h"
6#include "ircservertab.h" 6#include "ircservertab.h"
7#include "ircserverlist.h" 7#include "ircserverlist.h"
8#include "ircsettings.h" 8#include "ircsettings.h"
9 9
10MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { 10MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
11 setCaption(tr("IRC Client")); 11 setCaption(tr("IRC Client"));
12 m_tabWidget = new IRCTabWidget(this); 12 m_tabWidget = new IRCTabWidget(this);
13 QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here")); 13 QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here"));
14 connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(selected(QWidget *))); 14 connect(m_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(selected(QWidget*)));
15 setCentralWidget(m_tabWidget); 15 setCentralWidget(m_tabWidget);
16 setToolBarsMovable(FALSE); 16 setToolBarsMovable(FALSE);
17 QMenuBar *menuBar = new QMenuBar(this); 17 QMenuBar *menuBar = new QMenuBar(this);
18 QPopupMenu *irc = new QPopupMenu(this); 18 QPopupMenu *irc = new QPopupMenu(this);
19 menuBar->insertItem(tr("IRC"), irc); 19 menuBar->insertItem(tr("IRC"), irc);
20 QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); 20 QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0);
21 connect(a, SIGNAL(activated()), this, SLOT(newConnection())); 21 connect(a, SIGNAL(activated()), this, SLOT(newConnection()));
22 a->setWhatsThis(tr("Create a new connection to an IRC server")); 22 a->setWhatsThis(tr("Create a new connection to an IRC server"));
23 a->addTo(irc); 23 a->addTo(irc);
24 a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0); 24 a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0);
25 a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance")); 25 a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance"));
26 connect(a, SIGNAL(activated()), this, SLOT(settings())); 26 connect(a, SIGNAL(activated()), this, SLOT(settings()));
27 a->addTo(irc); 27 a->addTo(irc);
28 loadSettings(); 28 loadSettings();
29} 29}
30 30
31/*IRCTabWidget MainWindow::getTabWidget(){ 31/*IRCTabWidget MainWindow::getTabWidget(){
32 return m_tabWidget; 32 return m_tabWidget;
33} */ 33} */
34 34
35void MainWindow::loadSettings() { 35void MainWindow::loadSettings() {
36 Config config("OpieIRC"); 36 Config config("OpieIRC");
37 config.setGroup("OpieIRC"); 37 config.setGroup("OpieIRC");
38 IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); 38 IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF");
39 IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); 39 IRCTab::m_textColor = config.readEntry("TextColor", "#000000");
40 IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); 40 IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000");
41 IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); 41 IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000");
42 IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); 42 IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB");
43 IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); 43 IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF");
44 IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); 44 IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300");
45 IRCTab::m_maxLines = config.readNumEntry("Lines", 100); 45 IRCTab::m_maxLines = config.readNumEntry("Lines", 100);
46} 46}
47 47
48void MainWindow::selected(QWidget *) { 48void MainWindow::selected(QWidget *) {
49 m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); 49 m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black);
50 emit updateScroll(); 50 emit updateScroll();
51} 51}
52 52
53void MainWindow::addTab(IRCTab *tab) { 53void MainWindow::addTab(IRCTab *tab) {
54 connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *))); 54 connect(tab, SIGNAL(changed(IRCTab*)), this, SLOT(changeEvent(IRCTab*)));
55 m_tabWidget->addTab(tab, tab->title()); 55 m_tabWidget->addTab(tab, tab->title());
56 m_tabWidget->showPage(tab); 56 m_tabWidget->showPage(tab);
57 tab->setID(m_tabWidget->currentPageIndex()); 57 tab->setID(m_tabWidget->currentPageIndex());
58 m_tabs.append(tab); 58 m_tabs.append(tab);
59} 59}
60 60
61void MainWindow::changeEvent(IRCTab *tab) { 61void MainWindow::changeEvent(IRCTab *tab) {
62 if (tab->id() != m_tabWidget->currentPageIndex()) 62 if (tab->id() != m_tabWidget->currentPageIndex())
63 m_tabWidget->setTabColor(tab->id(), blue); 63 m_tabWidget->setTabColor(tab->id(), blue);
64} 64}
65 65
66void MainWindow::killTab(IRCTab *tab) { 66void MainWindow::killTab(IRCTab *tab) {
67 m_tabWidget->removePage(tab); 67 m_tabWidget->removePage(tab);
68 m_tabs.remove(tab); 68 m_tabs.remove(tab);
69 /* there might be nicer ways to do this .. */ 69 /* there might be nicer ways to do this .. */
70 delete tab; 70 delete tab;
71} 71}
72 72
73void MainWindow::newConnection() { 73void MainWindow::newConnection() {
74 IRCServerList list(this, "ServerList", TRUE); 74 IRCServerList list(this, "ServerList", TRUE);
75 if (list.exec() == QDialog::Accepted && list.hasServer()) { 75 if (list.exec() == QDialog::Accepted && list.hasServer()) {
76 IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget); 76 IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget);
77 addTab(serverTab); 77 addTab(serverTab);
78 serverTab->doConnect(); 78 serverTab->doConnect();
79 } 79 }
80} 80}
81 81
82void MainWindow::settings() { 82void MainWindow::settings() {
83 IRCSettings settings(this, "Settings", TRUE); 83 IRCSettings settings(this, "Settings", TRUE);
84 if (settings.exec() == QDialog::Accepted) { 84 if (settings.exec() == QDialog::Accepted) {
85 QListIterator<IRCTab> it(m_tabs); 85 QListIterator<IRCTab> it(m_tabs);
86 for (; it.current(); ++it) { 86 for (; it.current(); ++it) {
87 /* Inform all tabs about the new settings */ 87 /* Inform all tabs about the new settings */
88 it.current()->settingsChanged(); 88 it.current()->settingsChanged();
89 } 89 }
90 } 90 }
91} 91}
diff --git a/noncore/net/opietooth/lib/startdunconnection.cpp b/noncore/net/opietooth/lib/startdunconnection.cpp
index 6b6d247..c3850eb 100644
--- a/noncore/net/opietooth/lib/startdunconnection.cpp
+++ b/noncore/net/opietooth/lib/startdunconnection.cpp
@@ -1,67 +1,67 @@
1 1
2#include "startdunconnection.h" 2#include "startdunconnection.h"
3 3
4using namespace OpieTooth; 4using namespace OpieTooth;
5 5
6 6
7StartDunConnection::StartDunConnection() { 7StartDunConnection::StartDunConnection() {
8 m_dunConnect = 0l; 8 m_dunConnect = 0l;
9 setConnectionType(); 9 setConnectionType();
10} 10}
11 11
12StartDunConnection::~StartDunConnection() { 12StartDunConnection::~StartDunConnection() {
13 delete m_dunConnect; 13 delete m_dunConnect;
14} 14}
15 15
16StartDunConnection::StartDunConnection( QString mac ) { 16StartDunConnection::StartDunConnection( QString mac ) {
17 m_dunConnect = 0l; 17 m_dunConnect = 0l;
18 m_mac = mac; 18 m_mac = mac;
19 setConnectionType(); 19 setConnectionType();
20} 20}
21 21
22void StartDunConnection::setName( QString name ) { 22void StartDunConnection::setName( QString name ) {
23 m_name = name; 23 m_name = name;
24} 24}
25 25
26QString StartDunConnection::name() { 26QString StartDunConnection::name() {
27 return m_name; 27 return m_name;
28} 28}
29 29
30void StartDunConnection::setConnectionType() { 30void StartDunConnection::setConnectionType() {
31 m_connectionType = Pan; 31 m_connectionType = Pan;
32} 32}
33 33
34StartConnection::ConnectionType StartDunConnection::type() { 34StartConnection::ConnectionType StartDunConnection::type() {
35 return m_connectionType; 35 return m_connectionType;
36} 36}
37 37
38void StartDunConnection::start() { 38void StartDunConnection::start() {
39 m_dunConnect = new OProcess(); 39 m_dunConnect = new OProcess();
40 *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac; 40 *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac;
41 41
42 connect( m_dunConnect, SIGNAL( processExited( OProcess* ) ) , 42 connect( m_dunConnect, SIGNAL( processExited(OProcess*) ) ,
43 this, SLOT( slotExited( OProcess* ) ) ); 43 this, SLOT( slotExited(OProcess*) ) );
44 connect( m_dunConnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ), 44 connect( m_dunConnect, SIGNAL( receivedStdout(OProcess*,char*,int) ),
45 this, SLOT( slotStdOut( OProcess*, char*, int ) ) ); 45 this, SLOT( slotStdOut(OProcess*,char*,int) ) );
46 if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { 46 if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
47 qWarning( "could not start" ); 47 qWarning( "could not start" );
48 delete m_dunConnect; 48 delete m_dunConnect;
49 } 49 }
50} 50}
51 51
52 52
53void StartDunConnection::slotExited( OProcess* proc ) { 53void StartDunConnection::slotExited( OProcess* proc ) {
54 delete m_dunConnect; 54 delete m_dunConnect;
55} 55}
56 56
57void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len) 57void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len)
58{} 58{}
59 59
60 60
61void StartDunConnection::stop() { 61void StartDunConnection::stop() {
62 if ( m_dunConnect ) { 62 if ( m_dunConnect ) {
63 delete m_dunConnect; 63 delete m_dunConnect;
64 m_dunConnect = 0l; 64 m_dunConnect = 0l;
65 } 65 }
66} 66}
67 67
diff --git a/noncore/net/opietooth/lib/startpanconnection.cpp b/noncore/net/opietooth/lib/startpanconnection.cpp
index 6e0ab7e..a42b407 100644
--- a/noncore/net/opietooth/lib/startpanconnection.cpp
+++ b/noncore/net/opietooth/lib/startpanconnection.cpp
@@ -1,82 +1,82 @@
1 1
2#include "startpanconnection.h" 2#include "startpanconnection.h"
3 3
4using namespace OpieTooth; 4using namespace OpieTooth;
5 5
6 6
7StartPanConnection::StartPanConnection() { 7StartPanConnection::StartPanConnection() {
8 m_panConnect = 0l; 8 m_panConnect = 0l;
9 setConnectionType(); 9 setConnectionType();
10} 10}
11 11
12StartPanConnection::~StartPanConnection() { 12StartPanConnection::~StartPanConnection() {
13 delete m_panConnect; 13 delete m_panConnect;
14} 14}
15 15
16StartPanConnection::StartPanConnection( QString mac ) { 16StartPanConnection::StartPanConnection( QString mac ) {
17 m_panConnect = 0l; 17 m_panConnect = 0l;
18 m_mac = mac; 18 m_mac = mac;
19 setConnectionType(); 19 setConnectionType();
20} 20}
21 21
22void StartPanConnection::setName( QString name ) { 22void StartPanConnection::setName( QString name ) {
23 m_name = name; 23 m_name = name;
24} 24}
25 25
26QString StartPanConnection::name() { 26QString StartPanConnection::name() {
27 return m_name; 27 return m_name;
28} 28}
29 29
30void StartPanConnection::setConnectionType() { 30void StartPanConnection::setConnectionType() {
31 m_connectionType = Pan; 31 m_connectionType = Pan;
32} 32}
33 33
34StartConnection::ConnectionType StartPanConnection::type() { 34StartConnection::ConnectionType StartPanConnection::type() {
35 return m_connectionType; 35 return m_connectionType;
36} 36}
37 37
38void StartPanConnection::start() { 38void StartPanConnection::start() {
39 m_panConnect = new OProcess(); 39 m_panConnect = new OProcess();
40 qDebug( "IM START " + m_mac ); 40 qDebug( "IM START " + m_mac );
41 *m_panConnect << "pand" << "--connect" << m_mac; 41 *m_panConnect << "pand" << "--connect" << m_mac;
42 42
43 connect( m_panConnect, SIGNAL( processExited( OProcess* ) ) , 43 connect( m_panConnect, SIGNAL( processExited(OProcess*) ) ,
44 this, SLOT( slotExited( OProcess* ) ) ); 44 this, SLOT( slotExited(OProcess*) ) );
45 connect( m_panConnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ), 45 connect( m_panConnect, SIGNAL( receivedStdout(OProcess*,char*,int) ),
46 this, SLOT( slotStdOut( OProcess*, char*, int ) ) ); 46 this, SLOT( slotStdOut(OProcess*,char*,int) ) );
47 if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { 47 if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
48 qWarning( "could not start" ); 48 qWarning( "could not start" );
49 delete m_panConnect; 49 delete m_panConnect;
50 } 50 }
51} 51}
52 52
53 53
54void StartPanConnection::slotExited( OProcess* proc ) { 54void StartPanConnection::slotExited( OProcess* proc ) {
55 delete m_panConnect; 55 delete m_panConnect;
56 m_panConnect = 0l; 56 m_panConnect = 0l;
57} 57}
58 58
59void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len) 59void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len)
60{} 60{}
61 61
62 62
63void StartPanConnection::stop() { 63void StartPanConnection::stop() {
64 if ( m_panConnect ) { 64 if ( m_panConnect ) {
65 delete m_panConnect; 65 delete m_panConnect;
66 m_panConnect = 0l; 66 m_panConnect = 0l;
67 } 67 }
68 m_panConnect = new OProcess(); 68 m_panConnect = new OProcess();
69 qDebug("IM STOP " + m_mac); 69 qDebug("IM STOP " + m_mac);
70 70
71 *m_panConnect << "pand" << "--kill" << m_mac; 71 *m_panConnect << "pand" << "--kill" << m_mac;
72 72
73 connect( m_panConnect, SIGNAL( processExited( OProcess* ) ) , 73 connect( m_panConnect, SIGNAL( processExited(OProcess*) ) ,
74 this, SLOT( slotExited( OProcess* ) ) ); 74 this, SLOT( slotExited(OProcess*) ) );
75 connect( m_panConnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ), 75 connect( m_panConnect, SIGNAL( receivedStdout(OProcess*,char*,int) ),
76 this, SLOT( slotStdOut( OProcess*, char*, int ) ) ); 76 this, SLOT( slotStdOut(OProcess*,char*,int) ) );
77 if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { 77 if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
78 qWarning( "could not stop" ); 78 qWarning( "could not stop" );
79 delete m_panConnect; 79 delete m_panConnect;
80 } 80 }
81} 81}
82 82
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 0ea45d2..29030ab 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -4,142 +4,142 @@
4 * 4 *
5 * copyright : (c) 2002 by Maximilian Reiß 5 * copyright : (c) 2002 by Maximilian Reiß
6 * email : max.reiss@gmx.de 6 * email : max.reiss@gmx.de
7 * 7 *
8 */ 8 */
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; 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; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include "bluebase.h" 18#include "bluebase.h"
19#include "scandialog.h" 19#include "scandialog.h"
20#include "hciconfwrapper.h" 20#include "hciconfwrapper.h"
21#include "devicehandler.h" 21#include "devicehandler.h"
22#include "btconnectionitem.h" 22#include "btconnectionitem.h"
23#include "rfcommassigndialogimpl.h" 23#include "rfcommassigndialogimpl.h"
24 24
25/* OPIE */ 25/* OPIE */
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27#include <qpe/resource.h> 27#include <qpe/resource.h>
28#include <qpe/config.h> 28#include <qpe/config.h>
29 29
30/* QT */ 30/* QT */
31#include <qframe.h> 31#include <qframe.h>
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qpushbutton.h> 33#include <qpushbutton.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qvariant.h> 35#include <qvariant.h>
36#include <qimage.h> 36#include <qimage.h>
37#include <qpixmap.h> 37#include <qpixmap.h>
38#include <qtabwidget.h> 38#include <qtabwidget.h>
39#include <qscrollview.h> 39#include <qscrollview.h>
40#include <qvbox.h> 40#include <qvbox.h>
41#include <qmessagebox.h> 41#include <qmessagebox.h>
42#include <qcheckbox.h> 42#include <qcheckbox.h>
43#include <qlineedit.h> 43#include <qlineedit.h>
44#include <qlistview.h> 44#include <qlistview.h>
45#include <qdir.h> 45#include <qdir.h>
46#include <qpopupmenu.h> 46#include <qpopupmenu.h>
47#include <qtimer.h> 47#include <qtimer.h>
48#include <qlist.h> 48#include <qlist.h>
49 49
50/* STD */ 50/* STD */
51#include <remotedevice.h> 51#include <remotedevice.h>
52#include <services.h> 52#include <services.h>
53#include <stdlib.h> 53#include <stdlib.h>
54 54
55using namespace OpieTooth; 55using namespace OpieTooth;
56 56
57BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 57BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
58 : BluetoothBase( parent, name, fl ) 58 : BluetoothBase( parent, name, fl )
59{ 59{
60 60
61 m_localDevice = new Manager( "hci0" ); 61 m_localDevice = new Manager( "hci0" );
62 62
63 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); 63 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) );
64 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); 64 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) );
65 65
66 connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) ); 66 connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) );
67 // not good since lib is async 67 // not good since lib is async
68 // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), 68 // connect( ListView2, SIGNAL( expanded(QListViewItem*) ),
69 // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); 69 // this, SLOT( addServicesToDevice(QListViewItem*) ) );
70 connect( ListView2, SIGNAL( clicked( QListViewItem* )), 70 connect( ListView2, SIGNAL( clicked(QListViewItem*)),
71 this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); 71 this, SLOT( startServiceActionClicked(QListViewItem*) ) );
72 connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), 72 connect( ListView2, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ),
73 this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); 73 this, SLOT(startServiceActionHold(QListViewItem*,const QPoint&,int) ) );
74 connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), 74 connect( m_localDevice , SIGNAL( foundServices(const QString&,Services::ValueList) ),
75 this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); 75 this, SLOT( addServicesToDevice(const QString&,Services::ValueList) ) );
76 connect( m_localDevice, SIGNAL( available( const QString&, bool ) ), 76 connect( m_localDevice, SIGNAL( available(const QString&,bool) ),
77 this, SLOT( deviceActive( const QString& , bool ) ) ); 77 this, SLOT( deviceActive(const QString&,bool) ) );
78 connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ), 78 connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ),
79 this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) ); 79 this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) );
80 connect( m_localDevice, SIGNAL( signalStrength( const QString&, const QString& ) ), 80 connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ),
81 this, SLOT( addSignalStrength( const QString&, const QString& ) ) ); 81 this, SLOT( addSignalStrength(const QString&,const QString&) ) );
82 82
83 83
84 // let hold be rightButtonClicked() 84 // let hold be rightButtonClicked()
85 QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold); 85 QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold);
86 QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold); 86 QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold);
87 87
88 //Load all icons needed 88 //Load all icons needed
89 m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); 89 m_offPix = Resource::loadPixmap( "opietooth/notconnected" );
90 m_onPix = Resource::loadPixmap( "opietooth/connected" ); 90 m_onPix = Resource::loadPixmap( "opietooth/connected" );
91 m_findPix = Resource::loadPixmap( "opietooth/find" ); 91 m_findPix = Resource::loadPixmap( "opietooth/find" );
92 92
93 QPalette pal = this->palette(); 93 QPalette pal = this->palette();
94 QColor col = pal.color( QPalette::Active, QColorGroup::Background ); 94 QColor col = pal.color( QPalette::Active, QColorGroup::Background );
95 pal.setColor( QPalette::Active, QColorGroup::Button, col ); 95 pal.setColor( QPalette::Active, QColorGroup::Button, col );
96 pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); 96 pal.setColor( QPalette::Inactive, QColorGroup::Button, col );
97 pal.setColor( QPalette::Normal, QColorGroup::Button, col ); 97 pal.setColor( QPalette::Normal, QColorGroup::Button, col );
98 pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); 98 pal.setColor( QPalette::Disabled, QColorGroup::Button, col );
99 this->setPalette( pal ); 99 this->setPalette( pal );
100 100
101 setCaption( tr( "Bluetooth Manager" ) ); 101 setCaption( tr( "Bluetooth Manager" ) );
102 102
103 readConfig(); 103 readConfig();
104 initGui(); 104 initGui();
105 105
106 ListView2->setRootIsDecorated(true); 106 ListView2->setRootIsDecorated(true);
107 107
108 108
109 writeToHciConfig(); 109 writeToHciConfig();
110 // search conncetions 110 // search conncetions
111 addConnectedDevices(); 111 addConnectedDevices();
112 addSignalStrength(); 112 addSignalStrength();
113 m_iconLoader = new BTIconLoader(); 113 m_iconLoader = new BTIconLoader();
114 readSavedDevices(); 114 readSavedDevices();
115} 115}
116 116
117/** 117/**
118 * Reads all options from the config file 118 * Reads all options from the config file
119 */ 119 */
120void BlueBase::readConfig() 120void BlueBase::readConfig()
121{ 121{
122 122
123 Config cfg( "bluetoothmanager" ); 123 Config cfg( "bluetoothmanager" );
124 cfg.setGroup( "bluezsettings" ); 124 cfg.setGroup( "bluezsettings" );
125 125
126 m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with 126 m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with
127 m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak 127 m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak
128 m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); 128 m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE );
129 m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); 129 m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE );
130 m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE ); 130 m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE );
131 m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE ); 131 m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE );
132} 132}
133 133
134/** 134/**
135 * Writes all options to the config file 135 * Writes all options to the config file
136 */ 136 */
137void BlueBase::writeConfig() 137void BlueBase::writeConfig()
138{ 138{
139 139
140 Config cfg( "bluetoothmanager" ); 140 Config cfg( "bluetoothmanager" );
141 cfg.setGroup( "bluezsettings" ); 141 cfg.setGroup( "bluezsettings" );
142 142
143 cfg.writeEntry( "name" , m_deviceName ); 143 cfg.writeEntry( "name" , m_deviceName );
144 cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); 144 cfg.writeEntryCrypt( "passkey" , m_defaultPasskey );
145 cfg.writeEntry( "useEncryption" , m_useEncryption ); 145 cfg.writeEntry( "useEncryption" , m_useEncryption );
@@ -576,113 +576,113 @@ void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList )
576 576
577 } 577 }
578 else 578 else
579 { 579 {
580 ListView4->clear(); 580 ListView4->clear();
581 ConnectionState con; 581 ConnectionState con;
582 con.setMac( tr("No connections found") ); 582 con.setMac( tr("No connections found") );
583 connectionItem = new BTConnectionItem( ListView4 , con ); 583 connectionItem = new BTConnectionItem( ListView4 , con );
584 } 584 }
585 585
586 // recall connection search after some time 586 // recall connection search after some time
587 QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) ); 587 QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) );
588} 588}
589 589
590 590
591/** 591/**
592 * Find out if a device can currently be reached 592 * Find out if a device can currently be reached
593 * @param device 593 * @param device
594 */ 594 */
595void BlueBase::deviceActive( const RemoteDevice &device ) 595void BlueBase::deviceActive( const RemoteDevice &device )
596{ 596{
597 // search by mac, async, gets a signal back 597 // search by mac, async, gets a signal back
598 // We should have a BTDeviceItem there or where does it get added to the map -zecke 598 // We should have a BTDeviceItem there or where does it get added to the map -zecke
599 m_localDevice->isAvailable( device.mac() ); 599 m_localDevice->isAvailable( device.mac() );
600} 600}
601 601
602 602
603/** 603/**
604 * The signal catcher. Set the avail. status on device. 604 * The signal catcher. Set the avail. status on device.
605 * @param device - the mac address 605 * @param device - the mac address
606 * @param connected - if it is avail. or not 606 * @param connected - if it is avail. or not
607 */ 607 */
608void BlueBase::deviceActive( const QString& device, bool connected ) 608void BlueBase::deviceActive( const QString& device, bool connected )
609{ 609{
610 qDebug("deviceActive slot"); 610 qDebug("deviceActive slot");
611 611
612 QMap<QString,BTDeviceItem*>::Iterator it; 612 QMap<QString,BTDeviceItem*>::Iterator it;
613 613
614 it = m_deviceList.find( device ); 614 it = m_deviceList.find( device );
615 if( it == m_deviceList.end() ) 615 if( it == m_deviceList.end() )
616 return; 616 return;
617 617
618 BTDeviceItem* deviceItem = it.data(); 618 BTDeviceItem* deviceItem = it.data();
619 619
620 620
621 if ( connected ) 621 if ( connected )
622 { 622 {
623 deviceItem->setPixmap( 1, m_onPix ); 623 deviceItem->setPixmap( 1, m_onPix );
624 } 624 }
625 else 625 else
626 { 626 {
627 deviceItem->setPixmap( 1, m_offPix ); 627 deviceItem->setPixmap( 1, m_offPix );
628 } 628 }
629 m_deviceList.remove( it ); 629 m_deviceList.remove( it );
630} 630}
631 631
632 632
633/** 633/**
634 * Open the "scan for devices" dialog 634 * Open the "scan for devices" dialog
635 */ 635 */
636void BlueBase::startScan() 636void BlueBase::startScan()
637{ 637{
638 ScanDialog *scan = new ScanDialog( this, "ScanDialog", 638 ScanDialog *scan = new ScanDialog( this, "ScanDialog",
639 true, WDestructiveClose ); 639 true, WDestructiveClose );
640 QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ), 640 QObject::connect( scan, SIGNAL( selectedDevices(const QValueList<RemoteDevice>&) ),
641 this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) ); 641 this, SLOT( addSearchedDevices(const QValueList<RemoteDevice>&) ) );
642 642
643 QPEApplication::showDialog( scan ); 643 QPEApplication::showDialog( scan );
644} 644}
645 645
646 646
647/** 647/**
648 * Set the informations about the local device in information Tab 648 * Set the informations about the local device in information Tab
649 */ 649 */
650void BlueBase::setInfo() 650void BlueBase::setInfo()
651{ 651{
652 StatusLabel->setText( status() ); 652 StatusLabel->setText( status() );
653} 653}
654 654
655 655
656/** 656/**
657 * Decontructor 657 * Decontructor
658 */ 658 */
659BlueBase::~BlueBase() 659BlueBase::~BlueBase()
660{ 660{
661 writeSavedDevices(); 661 writeSavedDevices();
662 delete m_iconLoader; 662 delete m_iconLoader;
663} 663}
664 664
665 665
666/** 666/**
667 * find searches the ListView for a BTDeviceItem containig 667 * find searches the ListView for a BTDeviceItem containig
668 * the same Device if found return true else false 668 * the same Device if found return true else false
669 * @param dev RemoteDevice to find 669 * @param dev RemoteDevice to find
670 * @return returns true if found 670 * @return returns true if found
671 */ 671 */
672bool BlueBase::find( const RemoteDevice& rem ) 672bool BlueBase::find( const RemoteDevice& rem )
673{ 673{
674 QListViewItemIterator it( ListView2 ); 674 QListViewItemIterator it( ListView2 );
675 BTListItem* item; 675 BTListItem* item;
676 BTDeviceItem* device; 676 BTDeviceItem* device;
677 for (; it.current(); ++it ) 677 for (; it.current(); ++it )
678 { 678 {
679 item = (BTListItem*) it.current(); 679 item = (BTListItem*) it.current();
680 if ( item->typeId() != BTListItem::Device ) 680 if ( item->typeId() != BTListItem::Device )
681 continue; 681 continue;
682 682
683 device = (BTDeviceItem*)item; 683 device = (BTDeviceItem*)item;
684 if ( rem.equals( device->remoteDevice() ) ) 684 if ( rem.equals( device->remoteDevice() ) )
685 return true; 685 return true;
686 } 686 }
687 return false; // not found 687 return false; // not found
688} 688}
diff --git a/noncore/net/opietooth/manager/obexdialog.cpp b/noncore/net/opietooth/manager/obexdialog.cpp
index 15973d4..46a0e3d 100644
--- a/noncore/net/opietooth/manager/obexdialog.cpp
+++ b/noncore/net/opietooth/manager/obexdialog.cpp
@@ -1,86 +1,86 @@
1 1
2#include "obexdialog.h" 2#include "obexdialog.h"
3#include <qpushbutton.h> 3#include <qpushbutton.h>
4#include <qmultilineedit.h> 4#include <qmultilineedit.h>
5#include <qlineedit.h> 5#include <qlineedit.h>
6#include <qlayout.h> 6#include <qlayout.h>
7#include <qlabel.h> 7#include <qlabel.h>
8#include <qfileinfo.h> 8#include <qfileinfo.h>
9 9
10#include <qpe/resource.h> 10#include <qpe/resource.h>
11 11
12#include <opie/oprocess.h> 12#include <opie/oprocess.h>
13#include <opie/ofiledialog.h> 13#include <opie/ofiledialog.h>
14 14
15using namespace OpieTooth; 15using namespace OpieTooth;
16 16
17ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) 17ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device )
18 : QDialog( parent, name, modal, fl ) { 18 : QDialog( parent, name, modal, fl ) {
19 19
20 if ( !name ) 20 if ( !name )
21 setName( "ObexDialog" ); 21 setName( "ObexDialog" );
22 setCaption( tr( "beam files " ) ) ; 22 setCaption( tr( "beam files " ) ) ;
23 23
24 m_device = device; 24 m_device = device;
25 25
26 layout = new QVBoxLayout( this ); 26 layout = new QVBoxLayout( this );
27 27
28 QLabel* info = new QLabel( this ); 28 QLabel* info = new QLabel( this );
29 info->setText( tr("Which file should be beamed?") ); 29 info->setText( tr("Which file should be beamed?") );
30 30
31 cmdLine = new QLineEdit( this ); 31 cmdLine = new QLineEdit( this );
32 32
33 QPushButton *browserButton; 33 QPushButton *browserButton;
34 browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); 34 browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton");
35 connect( browserButton, SIGNAL(released() ), this , SLOT(browse() ) ); 35 connect( browserButton, SIGNAL(released() ), this , SLOT(browse() ) );
36 36
37 chNameLine = new QLineEdit( this ); 37 chNameLine = new QLineEdit( this );
38 38
39 sendButton = new QPushButton( this ); 39 sendButton = new QPushButton( this );
40 sendButton->setText( tr( "Send" ) ); 40 sendButton->setText( tr( "Send" ) );
41 41
42 layout->addWidget(info); 42 layout->addWidget(info);
43 layout->addWidget(cmdLine); 43 layout->addWidget(cmdLine);
44 layout->addWidget(browserButton); 44 layout->addWidget(browserButton);
45 layout->addWidget(chNameLine); 45 layout->addWidget(chNameLine);
46 layout->addWidget(sendButton); 46 layout->addWidget(sendButton);
47 47
48 connect( sendButton, SIGNAL( clicked() ), this, SLOT( sendData() ) ); 48 connect( sendButton, SIGNAL( clicked() ), this, SLOT( sendData() ) );
49 49
50} 50}
51 51
52ObexDialog::~ObexDialog() { 52ObexDialog::~ObexDialog() {
53} 53}
54 54
55void ObexDialog::browse() { 55void ObexDialog::browse() {
56 56
57 MimeTypes types; 57 MimeTypes types;
58 QStringList all; 58 QStringList all;
59 all << "*/*"; 59 all << "*/*";
60 types.insert("All Files", all ); 60 types.insert("All Files", all );
61 61
62 QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); 62 QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 );
63 cmdLine->setText( str ); 63 cmdLine->setText( str );
64 64
65} 65}
66 66
67void ObexDialog::sendData() { 67void ObexDialog::sendData() {
68 QString fileURL = cmdLine->text(); 68 QString fileURL = cmdLine->text();
69 QString file = QFileInfo( fileURL ).fileName(); 69 QString file = QFileInfo( fileURL ).fileName();
70 QString modifiedName = chNameLine->text(); 70 QString modifiedName = chNameLine->text();
71 71
72 // vom popupmenu beziehen 72 // vom popupmenu beziehen
73 OProcess* obexSend = new OProcess(); 73 OProcess* obexSend = new OProcess();
74 if ( !modifiedName.isEmpty() ) { 74 if ( !modifiedName.isEmpty() ) {
75 *obexSend << "ussp-push" << m_device << fileURL << modifiedName; 75 *obexSend << "ussp-push" << m_device << fileURL << modifiedName;
76 } else { 76 } else {
77 *obexSend << "ussp-push" << m_device << fileURL << file; 77 *obexSend << "ussp-push" << m_device << fileURL << file;
78 } 78 }
79 if (!obexSend->start(OProcess::DontCare, OProcess::AllOutput) ) { 79 if (!obexSend->start(OProcess::DontCare, OProcess::AllOutput) ) {
80 qWarning("could not start"); 80 qWarning("could not start");
81 delete obexSend; 81 delete obexSend;
82 } 82 }
83 83
84 84
85 85
86} 86}
diff --git a/noncore/net/opietooth/manager/pppdialog.cpp b/noncore/net/opietooth/manager/pppdialog.cpp
index 1f347ce..4e58552 100644
--- a/noncore/net/opietooth/manager/pppdialog.cpp
+++ b/noncore/net/opietooth/manager/pppdialog.cpp
@@ -1,68 +1,68 @@
1 1
2#include "pppdialog.h" 2#include "pppdialog.h"
3#include <qpushbutton.h> 3#include <qpushbutton.h>
4#include <qmultilineedit.h> 4#include <qmultilineedit.h>
5#include <qlineedit.h> 5#include <qlineedit.h>
6#include <qlayout.h> 6#include <qlayout.h>
7#include <qlabel.h> 7#include <qlabel.h>
8#include <opie/oprocess.h> 8#include <opie/oprocess.h>
9 9
10using namespace OpieTooth; 10using namespace OpieTooth;
11 11
12PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) 12PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device )
13 : QDialog( parent, name, modal, fl ) { 13 : QDialog( parent, name, modal, fl ) {
14 14
15 if ( !name ) 15 if ( !name )
16 setName( "PPPDialog" ); 16 setName( "PPPDialog" );
17 setCaption( tr( "ppp connection " ) ) ; 17 setCaption( tr( "ppp connection " ) ) ;
18 18
19 m_device = device; 19 m_device = device;
20 20
21 layout = new QVBoxLayout( this ); 21 layout = new QVBoxLayout( this );
22 22
23 QLabel* info = new QLabel( this ); 23 QLabel* info = new QLabel( this );
24 info->setText( tr("Enter an ppp script name:") ); 24 info->setText( tr("Enter an ppp script name:") );
25 25
26 cmdLine = new QLineEdit( this ); 26 cmdLine = new QLineEdit( this );
27 27
28 outPut = new QMultiLineEdit( this ); 28 outPut = new QMultiLineEdit( this );
29 QFont outPut_font( outPut->font() ); 29 QFont outPut_font( outPut->font() );
30 outPut_font.setPointSize( 8 ); 30 outPut_font.setPointSize( 8 );
31 outPut->setFont( outPut_font ); 31 outPut->setFont( outPut_font );
32 outPut->setWordWrap( QMultiLineEdit::WidgetWidth ); 32 outPut->setWordWrap( QMultiLineEdit::WidgetWidth );
33 33
34 connectButton = new QPushButton( this ); 34 connectButton = new QPushButton( this );
35 connectButton->setText( tr( "Connect" ) ); 35 connectButton->setText( tr( "Connect" ) );
36 36
37 layout->addWidget(info); 37 layout->addWidget(info);
38 layout->addWidget(cmdLine); 38 layout->addWidget(cmdLine);
39 layout->addWidget(outPut); 39 layout->addWidget(outPut);
40 layout->addWidget(connectButton); 40 layout->addWidget(connectButton);
41 41
42 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); 42 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) );
43 43
44} 44}
45 45
46PPPDialog::~PPPDialog() { 46PPPDialog::~PPPDialog() {
47} 47}
48 48
49void PPPDialog::connectToDevice() { 49void PPPDialog::connectToDevice() {
50 outPut->clear(); 50 outPut->clear();
51 // vom popupmenu beziehen 51 // vom popupmenu beziehen
52 QString connectScript = "/etc/ppp/peers/" + cmdLine->text(); 52 QString connectScript = "/etc/ppp/peers/" + cmdLine->text();
53 OProcess* pppDial = new OProcess(); 53 OProcess* pppDial = new OProcess();
54 *pppDial << "pppd" << m_device << "call" << connectScript; 54 *pppDial << "pppd" << m_device << "call" << connectScript;
55 connect( pppDial, SIGNAL(receivedStdout(OProcess*, char*, int ) ), 55 connect( pppDial, SIGNAL(receivedStdout(OProcess*,char*,int) ),
56 this, SLOT(fillOutPut(OProcess*, char*, int ) ) ); 56 this, SLOT(fillOutPut(OProcess*,char*,int) ) );
57 if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) { 57 if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) {
58 qWarning("could not start"); 58 qWarning("could not start");
59 delete pppDial; 59 delete pppDial;
60 } 60 }
61} 61}
62 62
63void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) { 63void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) {
64 QCString str(cha, len ); 64 QCString str(cha, len );
65 outPut->insertLine( str ); 65 outPut->insertLine( str );
66 delete pppDial; 66 delete pppDial;
67} 67}
68 68
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp
index de4f742..c8ea3e3 100644
--- a/noncore/net/opietooth/manager/scandialog.cpp
+++ b/noncore/net/opietooth/manager/scandialog.cpp
@@ -5,130 +5,130 @@
5 * copyright : (c) 2002 by Maximilian Reiß 5 * copyright : (c) 2002 by Maximilian Reiß
6 * email : max.reiss@gmx.de 6 * email : max.reiss@gmx.de
7 * 7 *
8 */ 8 */
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; 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; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18 18
19#include "scandialog.h" 19#include "scandialog.h"
20 20
21#include <qheader.h> 21#include <qheader.h>
22#include <qlistview.h> 22#include <qlistview.h>
23#include <qpushbutton.h> 23#include <qpushbutton.h>
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qvariant.h> 25#include <qvariant.h>
26#include <qtooltip.h> 26#include <qtooltip.h>
27#include <qwhatsthis.h> 27#include <qwhatsthis.h>
28#include <qprogressbar.h> 28#include <qprogressbar.h>
29#include <qlist.h> 29#include <qlist.h>
30 30
31#include <manager.h> 31#include <manager.h>
32#include <device.h> 32#include <device.h>
33 33
34 34
35namespace OpieTooth { 35namespace OpieTooth {
36 36
37#include <remotedevice.h> 37#include <remotedevice.h>
38 38
39/** 39/**
40 */ 40 */
41 ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 41 ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
42 : QDialog( parent, name, modal, fl ) { 42 : QDialog( parent, name, modal, fl ) {
43 43
44 setCaption( tr( "Scan for devices" ) ); 44 setCaption( tr( "Scan for devices" ) );
45 45
46 Layout11 = new QVBoxLayout( this ); 46 Layout11 = new QVBoxLayout( this );
47 Layout11->setSpacing( 6 ); 47 Layout11->setSpacing( 6 );
48 Layout11->setMargin( 0 ); 48 Layout11->setMargin( 0 );
49 49
50 progress = new QProgressBar( this, "progbar"); 50 progress = new QProgressBar( this, "progbar");
51 progress->setTotalSteps(20); 51 progress->setTotalSteps(20);
52 52
53 StartStopButton = new QPushButton( this, "StartButton" ); 53 StartStopButton = new QPushButton( this, "StartButton" );
54 StartStopButton->setText( tr( "Start scan" ) ); 54 StartStopButton->setText( tr( "Start scan" ) );
55 55
56 ListView1 = new QListView( this, "ListView1" ); 56 ListView1 = new QListView( this, "ListView1" );
57 57
58 //ListView1->addColumn( tr( "Add" ) ); 58 //ListView1->addColumn( tr( "Add" ) );
59 ListView1->addColumn( tr( "Add Device" ) ); 59 ListView1->addColumn( tr( "Add Device" ) );
60 //ListView1->addColumn( tr( "Type" ) ); 60 //ListView1->addColumn( tr( "Type" ) );
61 61
62 Layout11->addWidget( ListView1 ); 62 Layout11->addWidget( ListView1 );
63 Layout11->addWidget( progress ); 63 Layout11->addWidget( progress );
64 Layout11->addWidget( StartStopButton ); 64 Layout11->addWidget( StartStopButton );
65 65
66 localDevice = new Manager( "hci0" ); 66 localDevice = new Manager( "hci0" );
67 67
68 connect( StartStopButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); 68 connect( StartStopButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) );
69 connect( localDevice, SIGNAL( foundDevices( const QString& , RemoteDevice::ValueList ) ), 69 connect( localDevice, SIGNAL( foundDevices(const QString&,RemoteDevice::ValueList) ),
70 this, SLOT( fillList( const QString& , RemoteDevice::ValueList ) ) ) ; 70 this, SLOT( fillList(const QString&,RemoteDevice::ValueList) ) ) ;
71 71
72 progressStat = 0; 72 progressStat = 0;
73 m_search = false; 73 m_search = false;
74 } 74 }
75 75
76// hack, make cleaner later 76// hack, make cleaner later
77 void ScanDialog::progressTimer() { 77 void ScanDialog::progressTimer() {
78 78
79 progressStat++; 79 progressStat++;
80 if ( progressStat++ < 20 && m_search ) { 80 if ( progressStat++ < 20 && m_search ) {
81 QTimer::singleShot( 2000, this, SLOT( progressTimer() ) ); 81 QTimer::singleShot( 2000, this, SLOT( progressTimer() ) );
82 progress->setProgress( progressStat++ ); 82 progress->setProgress( progressStat++ );
83 } 83 }
84 } 84 }
85 85
86 void ScanDialog::accept() { 86 void ScanDialog::accept() {
87 emitToManager(); 87 emitToManager();
88 QDialog::accept(); 88 QDialog::accept();
89 } 89 }
90 90
91 91
92 void ScanDialog::startSearch() { 92 void ScanDialog::startSearch() {
93 if ( m_search ) { 93 if ( m_search ) {
94 stopSearch(); 94 stopSearch();
95 return; 95 return;
96 } 96 }
97 m_search = true; 97 m_search = true;
98 progress->setProgress(0); 98 progress->setProgress(0);
99 progressStat = 0; 99 progressStat = 0;
100 100
101 // empty list before a new scan 101 // empty list before a new scan
102 ListView1->clear(); 102 ListView1->clear();
103 103
104 progressTimer(); 104 progressTimer();
105 // when finished, it emmite foundDevices() 105 // when finished, it emmite foundDevices()
106 // checken ob initialisiert , qcop ans applet. 106 // checken ob initialisiert , qcop ans applet.
107 StartStopButton->setText( tr( "Stop scan" ) ); 107 StartStopButton->setText( tr( "Stop scan" ) );
108 108
109 localDevice->searchDevices(); 109 localDevice->searchDevices();
110 110
111 } 111 }
112 112
113 void ScanDialog::stopSearch() { 113 void ScanDialog::stopSearch() {
114 m_search = true; 114 m_search = true;
115 } 115 }
116 116
117 void ScanDialog::fillList(const QString&, RemoteDevice::ValueList deviceList) { 117 void ScanDialog::fillList(const QString&, RemoteDevice::ValueList deviceList) {
118 progress->setProgress(0); 118 progress->setProgress(0);
119 progressStat = 0; 119 progressStat = 0;
120 QCheckListItem * deviceItem; 120 QCheckListItem * deviceItem;
121 121
122 RemoteDevice::ValueList::Iterator it; 122 RemoteDevice::ValueList::Iterator it;
123 for( it = deviceList.begin(); it != deviceList.end(); ++it ) { 123 for( it = deviceList.begin(); it != deviceList.end(); ++it ) {
124 124
125 deviceItem = new QCheckListItem( ListView1, (*it).name(), QCheckListItem::CheckBox ); 125 deviceItem = new QCheckListItem( ListView1, (*it).name(), QCheckListItem::CheckBox );
126 deviceItem->setText( 1, (*it).mac() ); 126 deviceItem->setText( 1, (*it).mac() );
127 } 127 }
128 m_search = false; 128 m_search = false;
129 StartStopButton->setText( tr( "Start scan" ) ); 129 StartStopButton->setText( tr( "Start scan" ) );
130 } 130 }
131 131
132/** 132/**
133 * Iterates trough the items, and collects the checked items. 133 * Iterates trough the items, and collects the checked items.
134 * Then it emits it, so the manager can connect to the signal to fill the listing. 134 * Then it emits it, so the manager can connect to the signal to fill the listing.
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index b39203b..8ae87fe 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -60,355 +60,355 @@
60#include <qlineedit.h> 60#include <qlineedit.h>
61#include <qlistbox.h> 61#include <qlistbox.h>
62#include <qmessagebox.h> 62#include <qmessagebox.h>
63#include <qpushbutton.h> 63#include <qpushbutton.h>
64#include <qradiobutton.h> 64#include <qradiobutton.h>
65#if QT_VERSION >= 300 65#if QT_VERSION >= 300
66#include <qstylefactory.h> 66#include <qstylefactory.h>
67#endif 67#endif
68#include <qtoolbutton.h> 68#include <qtoolbutton.h>
69#include <qwindowsstyle.h> 69#include <qwindowsstyle.h>
70#include <qlistview.h> 70#include <qlistview.h>
71#include <qheader.h> 71#include <qheader.h>
72#include <qvbox.h> 72#include <qvbox.h>
73#include <qwhatsthis.h> 73#include <qwhatsthis.h>
74 74
75using namespace Opie; 75using namespace Opie;
76 76
77 77
78class DefaultWindowDecoration : public WindowDecorationInterface 78class DefaultWindowDecoration : public WindowDecorationInterface
79{ 79{
80public: 80public:
81 DefaultWindowDecoration() : ref(0) {} 81 DefaultWindowDecoration() : ref(0) {}
82 QString name() const 82 QString name() const
83 { 83 {
84 return "Default"; 84 return "Default";
85 } 85 }
86 QPixmap icon() const 86 QPixmap icon() const
87 { 87 {
88 return QPixmap(); 88 return QPixmap();
89 } 89 }
90 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 90 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface )
91 { 91 {
92 *iface = 0; 92 *iface = 0;
93 if ( uuid == IID_QUnknown ) 93 if ( uuid == IID_QUnknown )
94 *iface = this; 94 *iface = this;
95 else if ( uuid == IID_WindowDecoration ) 95 else if ( uuid == IID_WindowDecoration )
96 *iface = this; 96 *iface = this;
97 97
98 if ( *iface ) 98 if ( *iface )
99 (*iface)->addRef(); 99 (*iface)->addRef();
100 return QS_OK; 100 return QS_OK;
101 } 101 }
102 Q_REFCOUNT 102 Q_REFCOUNT
103 103
104private: 104private:
105 ulong ref; 105 ulong ref;
106}; 106};
107 107
108 108
109 109
110 110
111 111
112 112
113 113
114QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) 114QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg )
115{ 115{
116 QWidget* tab = new QWidget( parent, "StyleTab" ); 116 QWidget* tab = new QWidget( parent, "StyleTab" );
117 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); 117 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 );
118 118
119 m_style_list = new QListBox( tab, "m_style_list" ); 119 m_style_list = new QListBox( tab, "m_style_list" );
120 vertLayout->addWidget( m_style_list ); 120 vertLayout->addWidget( m_style_list );
121 QWhatsThis::add( m_style_list, tr( "Styles control the way items such as buttons and scroll bars appear in all applications.\n\nClick here to select an available style." ) ); 121 QWhatsThis::add( m_style_list, tr( "Styles control the way items such as buttons and scroll bars appear in all applications.\n\nClick here to select an available style." ) );
122 122
123 m_style_settings = new QPushButton ( tr( "Settings..." ), tab ); 123 m_style_settings = new QPushButton ( tr( "Settings..." ), tab );
124 connect ( m_style_settings, SIGNAL( clicked ( )), this, SLOT( styleSettingsClicked ( ))); 124 connect ( m_style_settings, SIGNAL( clicked()), this, SLOT( styleSettingsClicked()));
125 vertLayout-> addWidget ( m_style_settings ); 125 vertLayout-> addWidget ( m_style_settings );
126 QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) ); 126 QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) );
127 127
128 QString s = cfg. readEntry ( "Style", "Light" ); 128 QString s = cfg. readEntry ( "Style", "Light" );
129 129
130 130
131#if QT_VERSION >= 300 131#if QT_VERSION >= 300
132 m_style_list->insertStringList(QStyleFactory::styles()); 132 m_style_list->insertStringList(QStyleFactory::styles());
133#else 133#else
134 m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( ))); 134 m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( )));
135 m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( ))); 135 m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( )));
136 m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( ))); 136 m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( )));
137#endif 137#endif
138 138
139 { 139 {
140 QString path = QPEApplication::qpeDir ( ); 140 QString path = QPEApplication::qpeDir ( );
141 path.append( "/plugins/styles/" ); 141 path.append( "/plugins/styles/" );
142 QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); 142 QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
143 143
144 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) 144 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
145 { 145 {
146 QString libstr = path; 146 QString libstr = path;
147 libstr.append( "/" ); 147 libstr.append( "/" );
148 libstr.append( *it ); 148 libstr.append( *it );
149 QLibrary *lib = new QLibrary ( libstr ); 149 QLibrary *lib = new QLibrary ( libstr );
150 StyleInterface *iface; 150 StyleInterface *iface;
151 151
152 if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) 152 if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface )
153 { 153 {
154 StyleListItem *slit = new StyleListItem ( lib, iface ); 154 StyleListItem *slit = new StyleListItem ( lib, iface );
155 m_style_list-> insertItem ( slit ); 155 m_style_list-> insertItem ( slit );
156 156
157 if ( slit-> key ( ) == s ) 157 if ( slit-> key ( ) == s )
158 m_style_list-> setCurrentItem ( slit ); 158 m_style_list-> setCurrentItem ( slit );
159 } 159 }
160 else 160 else
161 delete lib; 161 delete lib;
162 } 162 }
163 } 163 }
164 164
165 m_original_style = m_style_list-> currentItem ( ); 165 m_original_style = m_style_list-> currentItem ( );
166 styleClicked ( m_original_style ); 166 styleClicked ( m_original_style );
167 167
168 connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) ); 168 connect( m_style_list, SIGNAL( highlighted(int) ), this, SLOT( styleClicked(int) ) );
169 169
170 return tab; 170 return tab;
171} 171}
172 172
173QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) 173QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg )
174{ 174{
175 QWidget* tab = new QWidget( parent, "DecoTab" ); 175 QWidget* tab = new QWidget( parent, "DecoTab" );
176 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); 176 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 );
177 177
178 m_deco_list = new QListBox( tab, "m_deco_list" ); 178 m_deco_list = new QListBox( tab, "m_deco_list" );
179 vertLayout->addWidget( m_deco_list ); 179 vertLayout->addWidget( m_deco_list );
180 QWhatsThis::add( m_deco_list, tr( "Window decorations control the way the application title bar and its buttons appear.\n\nClick here to select an available decoration." ) ); 180 QWhatsThis::add( m_deco_list, tr( "Window decorations control the way the application title bar and its buttons appear.\n\nClick here to select an available decoration." ) );
181 181
182 QString s = cfg. readEntry ( "Decoration", "libflat.so" ); 182 QString s = cfg. readEntry ( "Decoration", "libflat.so" );
183 183
184 m_deco_list-> insertItem ( new DecoListItem ( "QPE" )); 184 m_deco_list-> insertItem ( new DecoListItem ( "QPE" ));
185 185
186 { 186 {
187 QString path = QPEApplication::qpeDir(); 187 QString path = QPEApplication::qpeDir();
188 path.append( "/plugins/decorations/" ); 188 path.append( "/plugins/decorations/" );
189 QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); 189 QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
190 190
191 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) 191 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
192 { 192 {
193 QString libstr = path; 193 QString libstr = path;
194 libstr.append( "/" ); 194 libstr.append( "/" );
195 libstr.append( *it ); 195 libstr.append( *it );
196 QLibrary *lib = new QLibrary ( libstr ); 196 QLibrary *lib = new QLibrary ( libstr );
197 WindowDecorationInterface *iface; 197 WindowDecorationInterface *iface;
198 198
199 if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) 199 if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK )
200 { 200 {
201 DecoListItem *dlit = new DecoListItem ( lib, iface ); 201 DecoListItem *dlit = new DecoListItem ( lib, iface );
202 m_deco_list-> insertItem ( dlit ); 202 m_deco_list-> insertItem ( dlit );
203 203
204 if ( dlit-> key ( ) == s ) 204 if ( dlit-> key ( ) == s )
205 m_deco_list-> setCurrentItem ( dlit ); 205 m_deco_list-> setCurrentItem ( dlit );
206 } 206 }
207 else 207 else
208 delete lib; 208 delete lib;
209 } 209 }
210 } 210 }
211 211
212 m_original_deco = m_deco_list-> currentItem ( ); 212 m_original_deco = m_deco_list-> currentItem ( );
213 if ( m_deco_list-> currentItem ( ) < 0 ) 213 if ( m_deco_list-> currentItem ( ) < 0 )
214 m_deco_list-> setCurrentItem ( 0 ); 214 m_deco_list-> setCurrentItem ( 0 );
215 decoClicked ( m_original_deco ); 215 decoClicked ( m_original_deco );
216 216
217 connect( m_deco_list, SIGNAL( highlighted( int ) ), this, SLOT( decoClicked( int ) ) ); 217 connect( m_deco_list, SIGNAL( highlighted(int) ), this, SLOT( decoClicked(int) ) );
218 218
219 return tab; 219 return tab;
220} 220}
221 221
222QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg ) 222QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg )
223{ 223{
224 QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); 224 QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" );
225 QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); 225 QString styleStr = cfg. readEntry ( "FontStyle", "Regular" );
226 int size = cfg. readNumEntry ( "FontSize", 10 ); 226 int size = cfg. readNumEntry ( "FontSize", 10 );
227 227
228 m_fontselect = new OFontSelector ( false, parent, "FontTab" ); 228 m_fontselect = new OFontSelector ( false, parent, "FontTab" );
229 m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); 229 m_fontselect-> setSelectedFont ( familyStr, styleStr, size );
230 QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) ); 230 QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) );
231 231
232 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), 232 connect( m_fontselect, SIGNAL( fontSelected(const QFont&)),
233 this, SLOT( fontClicked ( const QFont & ))); 233 this, SLOT( fontClicked(const QFont&)));
234 234
235 return m_fontselect; 235 return m_fontselect;
236} 236}
237 237
238QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) 238QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg )
239{ 239{
240 QWidget *tab = new QWidget( parent, "ColorTab" ); 240 QWidget *tab = new QWidget( parent, "ColorTab" );
241 QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 ); 241 QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 );
242 gridLayout->setRowStretch ( 3, 10 ); 242 gridLayout->setRowStretch ( 3, 10 );
243 243
244 m_color_list = new QListBox ( tab ); 244 m_color_list = new QListBox ( tab );
245 gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 ); 245 gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 );
246 connect( m_color_list, SIGNAL( highlighted( int ) ), this, SLOT( colorClicked( int ) ) ); 246 connect( m_color_list, SIGNAL( highlighted(int) ), this, SLOT( colorClicked(int) ) );
247 QWhatsThis::add( m_color_list, tr( "Color schemes are a collection of colors which are used for various parts of the display.\n\nClick here to select an available scheme." ) ); 247 QWhatsThis::add( m_color_list, tr( "Color schemes are a collection of colors which are used for various parts of the display.\n\nClick here to select an available scheme." ) );
248 248
249 m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg )); 249 m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg ));
250 250
251 QString path = QPEApplication::qpeDir ( ); 251 QString path = QPEApplication::qpeDir ( );
252 path.append( "/etc/colors/" ); 252 path.append( "/etc/colors/" );
253 QStringList sl = QDir ( path ). entryList ( "*.scheme" ); 253 QStringList sl = QDir ( path ). entryList ( "*.scheme" );
254 254
255 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) 255 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
256 { 256 {
257 QString name = (*it). left ((*it). find ( ".scheme" )); 257 QString name = (*it). left ((*it). find ( ".scheme" ));
258 QString pathstr = path; 258 QString pathstr = path;
259 pathstr.append( *it ); 259 pathstr.append( *it );
260 Config config ( pathstr, Config::File ); 260 Config config ( pathstr, Config::File );
261 config. setGroup ( "Colors" ); 261 config. setGroup ( "Colors" );
262 262
263 m_color_list-> insertItem ( new ColorListItem ( name, config )); 263 m_color_list-> insertItem ( new ColorListItem ( name, config ));
264 } 264 }
265 265
266 m_color_list-> setCurrentItem ( 0 ); 266 m_color_list-> setCurrentItem ( 0 );
267 267
268 QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); 268 QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" );
269 tempButton->setText( tr( "Edit..." ) ); 269 tempButton->setText( tr( "Edit..." ) );
270 connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); 270 connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) );
271 gridLayout->addWidget( tempButton, 0, 1 ); 271 gridLayout->addWidget( tempButton, 0, 1 );
272 QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); 272 QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) );
273 273
274 tempButton = new QPushButton( tab, "deleteSchemeButton" ); 274 tempButton = new QPushButton( tab, "deleteSchemeButton" );
275 tempButton->setText( tr( "Delete" ) ); 275 tempButton->setText( tr( "Delete" ) );
276 connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); 276 connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) );
277 gridLayout->addWidget( tempButton, 1, 1 ); 277 gridLayout->addWidget( tempButton, 1, 1 );
278 QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); 278 QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) );
279 279
280 tempButton = new QPushButton( tab, "saveSchemeButton" ); 280 tempButton = new QPushButton( tab, "saveSchemeButton" );
281 tempButton->setText( tr( "Save" ) ); 281 tempButton->setText( tr( "Save" ) );
282 connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); 282 connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) );
283 gridLayout->addWidget( tempButton, 2, 1 ); 283 gridLayout->addWidget( tempButton, 2, 1 );
284 QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); 284 QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) );
285 285
286 return tab; 286 return tab;
287} 287}
288 288
289QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) 289QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
290{ 290{
291 QWidget *tab = new QWidget ( parent ); 291 QWidget *tab = new QWidget ( parent );
292 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); 292 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 );
293 293
294 QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); 294 QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 );
295 295
296 m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab ); 296 m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab );
297 m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" )); 297 m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" ));
298 lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 ); 298 lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 );
299 QWhatsThis::add( m_force, tr( "Click here to allow all applications to use global appearance settings." ) ); 299 QWhatsThis::add( m_force, tr( "Click here to allow all applications to use global appearance settings." ) );
300 300
301 QLabel *l = new QLabel ( tab ); 301 QLabel *l = new QLabel ( tab );
302 l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" ))); 302 l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" )));
303 lay-> addMultiCellWidget ( l, 1, 1, 0, 1 ); 303 lay-> addMultiCellWidget ( l, 1, 1, 0, 1 );
304 QWhatsThis::add( l, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); 304 QWhatsThis::add( l, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) );
305 305
306 m_except = new QListView ( tab ); 306 m_except = new QListView ( tab );
307 m_except-> addColumn ( Resource::loadIconSet ( "appearance" ), "", 24 ); 307 m_except-> addColumn ( Resource::loadIconSet ( "appearance" ), "", 24 );
308 m_except-> addColumn ( Resource::loadIconSet ( "font" ), "", 24 ); 308 m_except-> addColumn ( Resource::loadIconSet ( "font" ), "", 24 );
309 m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco" ), "", 24 ); 309 m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco" ), "", 24 );
310 m_except-> addColumn ( tr( "Binary file(s)" )); 310 m_except-> addColumn ( tr( "Binary file(s)" ));
311 m_except-> setColumnAlignment ( 0, AlignCenter ); 311 m_except-> setColumnAlignment ( 0, AlignCenter );
312 m_except-> setColumnAlignment ( 1, AlignCenter ); 312 m_except-> setColumnAlignment ( 1, AlignCenter );
313 m_except-> setColumnAlignment ( 2, AlignCenter ); 313 m_except-> setColumnAlignment ( 2, AlignCenter );
314 m_except-> setAllColumnsShowFocus ( true ); 314 m_except-> setAllColumnsShowFocus ( true );
315 m_except-> setMinimumHeight ( 30 ); 315 m_except-> setMinimumHeight ( 30 );
316 m_except-> header ( )-> setClickEnabled ( false ); 316 m_except-> header ( )-> setClickEnabled ( false );
317 m_except-> header ( )-> setResizeEnabled ( false ); 317 m_except-> header ( )-> setResizeEnabled ( false );
318 m_except-> header ( )-> setMovingEnabled ( false ); 318 m_except-> header ( )-> setMovingEnabled ( false );
319 m_except-> setSorting ( -1 ); 319 m_except-> setSorting ( -1 );
320 lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 ); 320 lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 );
321 QWhatsThis::add( m_except, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); 321 QWhatsThis::add( m_except, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) );
322 322
323 connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int ))); 323 connect ( m_except, SIGNAL( clicked(QListViewItem*,const QPoint&,int)), this, SLOT( clickedExcept(QListViewItem*,const QPoint&,int)));
324 324
325 QToolButton *tb = new QToolButton ( tab ); 325 QToolButton *tb = new QToolButton ( tab );
326 tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" )); 326 tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" ));
327 tb-> setFocusPolicy ( QWidget::StrongFocus ); 327 tb-> setFocusPolicy ( QWidget::StrongFocus );
328 lay-> addWidget ( tb, 2, 1 ); 328 lay-> addWidget ( tb, 2, 1 );
329 connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( ))); 329 connect ( tb, SIGNAL( clicked()), this, SLOT( addExcept()));
330 QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) ); 330 QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) );
331 331
332 tb = new QToolButton ( tab ); 332 tb = new QToolButton ( tab );
333 tb-> setIconSet ( Resource::loadIconSet ( "editdelete" )); 333 tb-> setIconSet ( Resource::loadIconSet ( "editdelete" ));
334 tb-> setFocusPolicy ( QWidget::StrongFocus ); 334 tb-> setFocusPolicy ( QWidget::StrongFocus );
335 lay-> addWidget ( tb, 3, 1 ); 335 lay-> addWidget ( tb, 3, 1 );
336 connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( ))); 336 connect ( tb, SIGNAL( clicked()), this, SLOT( delExcept()));
337 QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) ); 337 QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) );
338 338
339 tb = new QToolButton ( tab ); 339 tb = new QToolButton ( tab );
340 tb-> setIconSet ( Resource::loadIconSet ( "up" )); 340 tb-> setIconSet ( Resource::loadIconSet ( "up" ));
341 tb-> setFocusPolicy ( QWidget::StrongFocus ); 341 tb-> setFocusPolicy ( QWidget::StrongFocus );
342 lay-> addWidget ( tb, 4, 1 ); 342 lay-> addWidget ( tb, 4, 1 );
343 connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( ))); 343 connect ( tb, SIGNAL( clicked()), this, SLOT( upExcept()));
344 QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) ); 344 QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) );
345 345
346 tb = new QToolButton ( tab ); 346 tb = new QToolButton ( tab );
347 tb-> setIconSet ( Resource::loadIconSet ( "down" )); 347 tb-> setIconSet ( Resource::loadIconSet ( "down" ));
348 tb-> setFocusPolicy ( QWidget::StrongFocus ); 348 tb-> setFocusPolicy ( QWidget::StrongFocus );
349 lay-> addWidget ( tb, 5, 1 ); 349 lay-> addWidget ( tb, 5, 1 );
350 connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( ))); 350 connect ( tb, SIGNAL( clicked()), this, SLOT( downExcept()));
351 QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) ); 351 QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) );
352 352
353 lay-> setRowStretch ( 6, 10 ); 353 lay-> setRowStretch ( 6, 10 );
354 lay-> setColStretch ( 0, 10 ); 354 lay-> setColStretch ( 0, 10 );
355 355
356 QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); 356 QStringList sl = cfg. readListEntry ( "NoStyle", ';' );
357 QListViewItem *lvit = 0; 357 QListViewItem *lvit = 0;
358 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) 358 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
359 { 359 {
360 int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); 360 int fl = ( *it ). left ( 1 ). toInt ( 0, 32 );
361 361
362 lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); 362 lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 );
363 } 363 }
364 364
365 365
366 vertLayout-> addSpacing ( 3 ); 366 vertLayout-> addSpacing ( 3 );
367 QFrame *f = new QFrame ( tab ); 367 QFrame *f = new QFrame ( tab );
368 f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); 368 f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken );
369 vertLayout-> addWidget ( f ); 369 vertLayout-> addWidget ( f );
370 vertLayout-> addSpacing ( 3 ); 370 vertLayout-> addSpacing ( 3 );
371 371
372 372
373 QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); 373 QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 );
374 374
375 int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; 375 int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1;
376 bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); 376 bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" );
377 377
378 QLabel* label = new QLabel( tr( "Tab style:" ), tab ); 378 QLabel* label = new QLabel( tr( "Tab style:" ), tab );
379 gridLayout-> addWidget ( label, 0, 0 ); 379 gridLayout-> addWidget ( label, 0, 0 );
380 QWhatsThis::add( label, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); 380 QWhatsThis::add( label, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) );
381 381
382 QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); 382 QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" );
383 btngrp-> hide ( ); 383 btngrp-> hide ( );
384 btngrp-> setExclusive ( true ); 384 btngrp-> setExclusive ( true );
385 385
386 m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); 386 m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" );
387 m_tabstyle_list-> insertItem ( tr( "Tabs" )); 387 m_tabstyle_list-> insertItem ( tr( "Tabs" ));
388 m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); 388 m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" ));
389 m_tabstyle_list-> insertItem ( tr( "Drop down list" )); 389 m_tabstyle_list-> insertItem ( tr( "Drop down list" ));
390 m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); 390 m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" ));
391 m_tabstyle_list-> setCurrentItem ( style ); 391 m_tabstyle_list-> setCurrentItem ( style );
392 gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); 392 gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 );
393 QWhatsThis::add( m_tabstyle_list, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); 393 QWhatsThis::add( m_tabstyle_list, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) );
394 394
395 m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); 395 m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" );
396 btngrp-> insert ( m_tabstyle_top ); 396 btngrp-> insert ( m_tabstyle_top );
397 gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); 397 gridLayout-> addWidget( m_tabstyle_top, 1, 1 );
398 QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); 398 QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) );
399 399
400 m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); 400 m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" );
401 btngrp-> insert ( m_tabstyle_bottom ); 401 btngrp-> insert ( m_tabstyle_bottom );
402 gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); 402 gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 );
403 QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); 403 QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) );
404 404
405 m_tabstyle_top-> setChecked ( tabtop ); 405 m_tabstyle_top-> setChecked ( tabtop );
406 m_tabstyle_bottom-> setChecked ( !tabtop ); 406 m_tabstyle_bottom-> setChecked ( !tabtop );
407 407
408 m_original_tabstyle = style; 408 m_original_tabstyle = style;
409 m_original_tabpos = tabtop; 409 m_original_tabpos = tabtop;
410 410
411 vertLayout-> addSpacing ( 3 ); 411 vertLayout-> addSpacing ( 3 );
412 QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); 412 QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 );
413 413
414 QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); 414 QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab );
@@ -426,129 +426,129 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
426 rotbtngrp-> insert ( m_rotdir_cw ); 426 rotbtngrp-> insert ( m_rotdir_cw );
427 rotbtngrp-> insert ( m_rotdir_ccw ); 427 rotbtngrp-> insert ( m_rotdir_ccw );
428 rotbtngrp-> insert ( m_rotdir_flip ); 428 rotbtngrp-> insert ( m_rotdir_flip );
429 429
430 ccw1. convertFromImage( ccwImage ); 430 ccw1. convertFromImage( ccwImage );
431 m_rotdir_cw-> setPixmap( cw1 ); 431 m_rotdir_cw-> setPixmap( cw1 );
432 m_rotdir_ccw-> setPixmap( ccw1 ); 432 m_rotdir_ccw-> setPixmap( ccw1 );
433 m_rotdir_flip-> setPixmap( flip1 ); 433 m_rotdir_flip-> setPixmap( flip1 );
434 434
435 rotLay-> addWidget ( rotlabel, 0 ); 435 rotLay-> addWidget ( rotlabel, 0 );
436 rotLay-> addWidget ( m_rotdir_cw, 0 ); 436 rotLay-> addWidget ( m_rotdir_cw, 0 );
437 rotLay-> addWidget ( m_rotdir_ccw, 0 ); 437 rotLay-> addWidget ( m_rotdir_ccw, 0 );
438 rotLay-> addWidget ( m_rotdir_flip, 0 ); 438 rotLay-> addWidget ( m_rotdir_flip, 0 );
439 439
440 int rotDirection = cfg.readNumEntry( "rotatedir" ); 440 int rotDirection = cfg.readNumEntry( "rotatedir" );
441 ODirection rot = CW; 441 ODirection rot = CW;
442 442
443 if (rotDirection == -1) 443 if (rotDirection == -1)
444 { 444 {
445 rot = ODevice::inst ( )-> direction ( ); 445 rot = ODevice::inst ( )-> direction ( );
446 } 446 }
447 else 447 else
448 { 448 {
449 rot = (ODirection)rotDirection; 449 rot = (ODirection)rotDirection;
450 } 450 }
451 451
452 m_rotdir_cw-> setChecked ( rot == CW ); 452 m_rotdir_cw-> setChecked ( rot == CW );
453 m_rotdir_ccw-> setChecked ( rot == CCW ); 453 m_rotdir_ccw-> setChecked ( rot == CCW );
454 m_rotdir_flip-> setChecked ( rot == Flip ); 454 m_rotdir_flip-> setChecked ( rot == Flip );
455 455
456 return tab; 456 return tab;
457} 457}
458 458
459 459
460Appearance::Appearance( QWidget* parent, const char* name, WFlags ) 460Appearance::Appearance( QWidget* parent, const char* name, WFlags )
461 : QDialog ( parent, name, true, WStyle_ContextHelp ) 461 : QDialog ( parent, name, true, WStyle_ContextHelp )
462{ 462{
463 setCaption( tr( "Appearance Settings" ) ); 463 setCaption( tr( "Appearance Settings" ) );
464 464
465 Config config( "qpe" ); 465 Config config( "qpe" );
466 config.setGroup( "Appearance" ); 466 config.setGroup( "Appearance" );
467 467
468 QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); 468 QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 );
469 469
470 m_sample = new SampleWindow ( this ); 470 m_sample = new SampleWindow ( this );
471 471
472 m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); 472 m_sample-> setDecoration ( new DefaultWindowDecoration ( ) );
473 QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); 473 QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) );
474 474
475 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 475 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
476 QWidget *styletab; 476 QWidget *styletab;
477 477
478 m_color_list = 0; 478 m_color_list = 0;
479 479
480 tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); 480 tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" ));
481 tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); 481 tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" ));
482 tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); 482 tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) );
483 tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); 483 tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) );
484 tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); 484 tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) );
485 485
486 top-> addWidget ( tw, 10 ); 486 top-> addWidget ( tw, 10 );
487 top-> addWidget ( m_sample, 1 ); 487 top-> addWidget ( m_sample, 1 );
488 488
489 tw-> setCurrentTab ( styletab ); 489 tw-> setCurrentTab ( styletab );
490 connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * ))); 490 connect ( tw, SIGNAL( currentChanged(QWidget*)), this, SLOT( tabChanged(QWidget*)));
491 491
492 m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; 492 m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false;
493} 493}
494 494
495Appearance::~Appearance() 495Appearance::~Appearance()
496{} 496{}
497 497
498void Appearance::tabChanged ( QWidget *w ) 498void Appearance::tabChanged ( QWidget *w )
499{ 499{
500 if ( w == m_advtab ) 500 if ( w == m_advtab )
501 { 501 {
502 m_sample-> hide ( ); 502 m_sample-> hide ( );
503 updateGeometry ( ); // shouldn't be necessary ... 503 updateGeometry ( ); // shouldn't be necessary ...
504 } 504 }
505 else 505 else
506 m_sample-> show ( ); 506 m_sample-> show ( );
507} 507}
508 508
509void Appearance::accept ( ) 509void Appearance::accept ( )
510{ 510{
511 bool newtabpos = m_tabstyle_top-> isChecked ( ); 511 bool newtabpos = m_tabstyle_top-> isChecked ( );
512 int newtabstyle = m_tabstyle_list-> currentItem ( ); 512 int newtabstyle = m_tabstyle_list-> currentItem ( );
513 513
514 Config config ( "qpe" ); 514 Config config ( "qpe" );
515 config. setGroup ( "Appearance" ); 515 config. setGroup ( "Appearance" );
516 516
517 if ( m_style_changed ) 517 if ( m_style_changed )
518 { 518 {
519 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); 519 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
520 if ( item ) 520 if ( item )
521 config.writeEntry( "Style", item-> key ( )); 521 config.writeEntry( "Style", item-> key ( ));
522 } 522 }
523 523
524 if ( m_deco_changed ) 524 if ( m_deco_changed )
525 { 525 {
526 DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); 526 DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( ));
527 if ( item ) 527 if ( item )
528 config.writeEntry( "Decoration", item-> key ( )); 528 config.writeEntry( "Decoration", item-> key ( ));
529 } 529 }
530 530
531 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) 531 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos ))
532 { 532 {
533 config. writeEntry ( "TabStyle", newtabstyle + 1 ); 533 config. writeEntry ( "TabStyle", newtabstyle + 1 );
534 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); 534 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" );
535 } 535 }
536 536
537 if ( m_font_changed ) 537 if ( m_font_changed )
538 { 538 {
539 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); 539 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( ));
540 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); 540 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( ));
541 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); 541 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( ));
542 } 542 }
543 543
544 544
545 if ( m_color_changed ) 545 if ( m_color_changed )
546 { 546 {
547 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 547 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
548 548
549 if ( item ) 549 if ( item )
550 item-> save ( config ); 550 item-> save ( config );
551 } 551 }
552 552
553 ODirection rot; 553 ODirection rot;
554 if (m_rotdir_ccw-> isChecked ( )) 554 if (m_rotdir_ccw-> isChecked ( ))
diff --git a/noncore/settings/appearance2/sample.cpp b/noncore/settings/appearance2/sample.cpp
index b3a9d48..f6c4dca 100644
--- a/noncore/settings/appearance2/sample.cpp
+++ b/noncore/settings/appearance2/sample.cpp
@@ -30,159 +30,159 @@
30#include <qpopupmenu.h> 30#include <qpopupmenu.h>
31#include <qpainter.h> 31#include <qpainter.h>
32#include <qmenubar.h> 32#include <qmenubar.h>
33#include <qcheckbox.h> 33#include <qcheckbox.h>
34#include <qpushbutton.h> 34#include <qpushbutton.h>
35#include <qscrollbar.h> 35#include <qscrollbar.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qwhatsthis.h> 37#include <qwhatsthis.h>
38#include <qpixmapcache.h> 38#include <qpixmapcache.h>
39#include <qtimer.h> 39#include <qtimer.h>
40#include <qobjectlist.h> 40#include <qobjectlist.h>
41#include <qcommonstyle.h> 41#include <qcommonstyle.h>
42 42
43#include "sample.h" 43#include "sample.h"
44 44
45 45
46class SampleText : public QWidget 46class SampleText : public QWidget
47{ 47{
48public: 48public:
49 SampleText( const QString &t, bool h, QWidget *parent ) 49 SampleText( const QString &t, bool h, QWidget *parent )
50 : QWidget( parent ), hl(h), text(t) 50 : QWidget( parent ), hl(h), text(t)
51 { 51 {
52 if ( hl ) 52 if ( hl )
53 setBackgroundMode( PaletteHighlight ); 53 setBackgroundMode( PaletteHighlight );
54 else 54 else
55 setBackgroundMode( PaletteBase ); 55 setBackgroundMode( PaletteBase );
56 } 56 }
57 57
58 QSize sizeHint() const 58 QSize sizeHint() const
59 { 59 {
60 QFontMetrics fm(font()); 60 QFontMetrics fm(font());
61 return QSize( fm.width(text)+10, fm.height()+4 ); 61 return QSize( fm.width(text)+10, fm.height()+4 );
62 } 62 }
63 63
64 void paintEvent( QPaintEvent * ) 64 void paintEvent( QPaintEvent * )
65 { 65 {
66 QPainter p(this); 66 QPainter p(this);
67 if ( hl ) 67 if ( hl )
68 p.setPen( colorGroup().highlightedText() ); 68 p.setPen( colorGroup().highlightedText() );
69 else 69 else
70 p.setPen( colorGroup().text() ); 70 p.setPen( colorGroup().text() );
71 p.drawText( rect(), AlignCenter, text ); 71 p.drawText( rect(), AlignCenter, text );
72 } 72 }
73 73
74private: 74private:
75 bool hl; 75 bool hl;
76 QString text; 76 QString text;
77}; 77};
78 78
79 79
80SampleWindow::SampleWindow( QWidget *parent ) : QWidget(parent), iface(0) 80SampleWindow::SampleWindow( QWidget *parent ) : QWidget(parent), iface(0)
81{ 81{
82 init(); 82 init();
83} 83}
84 84
85QSize SampleWindow::sizeHint() const 85QSize SampleWindow::sizeHint() const
86{ 86{
87 return container->sizeHint() + QSize( 10, 35 ); 87 return container->sizeHint() + QSize( 10, 35 );
88} 88}
89 89
90void SampleWindow::setFont( const QFont &f ) 90void SampleWindow::setFont( const QFont &f )
91{ 91{
92 QWidget::setFont( f ); 92 QWidget::setFont( f );
93 popup->setFont( f ); 93 popup->setFont( f );
94 QTimer::singleShot ( 0, this, SLOT( fixGeometry ( ))); 94 QTimer::singleShot ( 0, this, SLOT( fixGeometry()));
95} 95}
96 96
97static void setStyleRecursive ( QWidget *w, QStyle *s ) 97static void setStyleRecursive ( QWidget *w, QStyle *s )
98{ 98{
99 w->setStyle( s ); 99 w->setStyle( s );
100 QObjectList *childObjects=(QObjectList*)w->children(); 100 QObjectList *childObjects=(QObjectList*)w->children();
101 if ( childObjects ) { 101 if ( childObjects ) {
102 QObject * o; 102 QObject * o;
103 for(o=childObjects->first();o!=0;o=childObjects->next()) { 103 for(o=childObjects->first();o!=0;o=childObjects->next()) {
104 if( o->isWidgetType() ) { 104 if( o->isWidgetType() ) {
105 setStyleRecursive((QWidget *)o,s); 105 setStyleRecursive((QWidget *)o,s);
106 } 106 }
107 } 107 }
108 } 108 }
109} 109}
110 110
111 111
112void SampleWindow::setStyle2 ( QStyle *sty, const QPalette &pal ) 112void SampleWindow::setStyle2 ( QStyle *sty, const QPalette &pal )
113{ 113{
114 typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, QColorGroup &, bool, bool); 114 typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, QColorGroup &, bool, bool);
115 115
116 extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl); 116 extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl);
117 117
118 QPixmapCache::clear ( ); 118 QPixmapCache::clear ( );
119 QPalette p = pal; // ette ( ); 119 QPalette p = pal; // ette ( );
120 sty-> polish ( p ); 120 sty-> polish ( p );
121 qt_set_draw_menu_bar_impl ( 0 ); 121 qt_set_draw_menu_bar_impl ( 0 );
122 setStyleRecursive ( this, sty ); 122 setStyleRecursive ( this, sty );
123 setPalette ( p ); 123 setPalette ( p );
124 QTimer::singleShot ( 0, this, SLOT( fixGeometry ( ))); 124 QTimer::singleShot ( 0, this, SLOT( fixGeometry()));
125} 125}
126 126
127 127
128void SampleWindow::setDecoration( WindowDecorationInterface *i ) 128void SampleWindow::setDecoration( WindowDecorationInterface *i )
129{ 129{
130 iface = i; 130 iface = i;
131 wd.rect = QRect( 0, 0, 150, 75 ); 131 wd.rect = QRect( 0, 0, 150, 75 );
132 wd.caption = tr("Sample"); 132 wd.caption = tr("Sample");
133 wd.palette = palette(); 133 wd.palette = palette();
134 wd.flags = WindowDecorationInterface::WindowData::Dialog | 134 wd.flags = WindowDecorationInterface::WindowData::Dialog |
135 WindowDecorationInterface::WindowData::Active; 135 WindowDecorationInterface::WindowData::Active;
136 wd.reserved = 1; 136 wd.reserved = 1;
137 137
138 th = iface->metric(WindowDecorationInterface::TitleHeight, &wd); 138 th = iface->metric(WindowDecorationInterface::TitleHeight, &wd);
139 tb = iface->metric(WindowDecorationInterface::TopBorder, &wd); 139 tb = iface->metric(WindowDecorationInterface::TopBorder, &wd);
140 lb = iface->metric(WindowDecorationInterface::LeftBorder, &wd); 140 lb = iface->metric(WindowDecorationInterface::LeftBorder, &wd);
141 rb = iface->metric(WindowDecorationInterface::RightBorder, &wd); 141 rb = iface->metric(WindowDecorationInterface::RightBorder, &wd);
142 bb = iface->metric(WindowDecorationInterface::BottomBorder, &wd); 142 bb = iface->metric(WindowDecorationInterface::BottomBorder, &wd);
143 143
144 int yoff = th + tb; 144 int yoff = th + tb;
145 int xoff = lb; 145 int xoff = lb;
146 146
147 wd.rect.setX( 0 ); 147 wd.rect.setX( 0 );
148 wd.rect.setWidth( width() - lb - rb ); 148 wd.rect.setWidth( width() - lb - rb );
149 wd.rect.setY( 0 ); 149 wd.rect.setY( 0 );
150 wd.rect.setHeight( height() - yoff - bb ); 150 wd.rect.setHeight( height() - yoff - bb );
151 151
152 container->setGeometry( xoff, yoff, wd.rect.width(), wd.rect.height() ); 152 container->setGeometry( xoff, yoff, wd.rect.width(), wd.rect.height() );
153 setMinimumSize( container->sizeHint().width()+lb+rb, 153 setMinimumSize( container->sizeHint().width()+lb+rb,
154 container->sizeHint().height()+tb+th+bb ); 154 container->sizeHint().height()+tb+th+bb );
155} 155}
156 156
157void SampleWindow::paintEvent( QPaintEvent * ) 157void SampleWindow::paintEvent( QPaintEvent * )
158{ 158{
159 if ( !iface ) 159 if ( !iface )
160 return; 160 return;
161 161
162 QPainter p( this ); 162 QPainter p( this );
163 163
164 p.translate( lb, th+tb ); 164 p.translate( lb, th+tb );
165 165
166 iface->drawArea(WindowDecorationInterface::Border, &p, &wd); 166 iface->drawArea(WindowDecorationInterface::Border, &p, &wd);
167 iface->drawArea(WindowDecorationInterface::Title, &p, &wd); 167 iface->drawArea(WindowDecorationInterface::Title, &p, &wd);
168 168
169 p.setPen(palette().active().color(QColorGroup::HighlightedText)); 169 p.setPen(palette().active().color(QColorGroup::HighlightedText));
170 QFont f( font() ); 170 QFont f( font() );
171 f.setWeight( QFont::Bold ); 171 f.setWeight( QFont::Bold );
172 p.setFont(f); 172 p.setFont(f);
173 iface->drawArea(WindowDecorationInterface::TitleText, &p, &wd); 173 iface->drawArea(WindowDecorationInterface::TitleText, &p, &wd);
174 174
175 QRect brect( 0, -th, iface->metric(WindowDecorationInterface::HelpWidth,&wd), th ); 175 QRect brect( 0, -th, iface->metric(WindowDecorationInterface::HelpWidth,&wd), th );
176 iface->drawButton( WindowDecorationInterface::Help, &p, &wd, 176 iface->drawButton( WindowDecorationInterface::Help, &p, &wd,
177 brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); 177 brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 );
178 brect.moveBy( wd.rect.width() - 178 brect.moveBy( wd.rect.width() -
179 iface->metric(WindowDecorationInterface::OKWidth,&wd) - 179 iface->metric(WindowDecorationInterface::OKWidth,&wd) -
180 iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 ); 180 iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 );
181 iface->drawButton( WindowDecorationInterface::Close, &p, &wd, 181 iface->drawButton( WindowDecorationInterface::Close, &p, &wd,
182 brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); 182 brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 );
183 brect.moveBy( iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 ); 183 brect.moveBy( iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 );
184 iface->drawButton( WindowDecorationInterface::OK, &p, &wd, 184 iface->drawButton( WindowDecorationInterface::OK, &p, &wd,
185 brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); 185 brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 );
186} 186}
187 187
188void SampleWindow::init() 188void SampleWindow::init()
diff --git a/noncore/settings/aqpkg/inputdlg.cpp b/noncore/settings/aqpkg/inputdlg.cpp
index 06e934c..30f0527 100644
--- a/noncore/settings/aqpkg/inputdlg.cpp
+++ b/noncore/settings/aqpkg/inputdlg.cpp
@@ -14,121 +14,121 @@
14    .i_,=:_.      -<s. This file is distributed in the hope that 14    .i_,=:_.      -<s. This file is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.=       =       ; Public License for more details. 19..}^=.=       =       ; Public License for more details.
20++=   -.     .`     .: 20++=   -.     .`     .:
21 :     =  ...= . :.=- You should have received a copy of the GNU 21 :     =  ...= . :.=- You should have received a copy of the GNU
22 -.   .:....=;==+<; General Public License along with this file; 22 -.   .:....=;==+<; General Public License along with this file;
23  -_. . .   )=.  = see the file COPYING. If not, write to the 23  -_. . .   )=.  = see the file COPYING. If not, write to the
24    --        :-=` Free Software Foundation, Inc., 24    --        :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330, 25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30#include <qlayout.h> 30#include <qlayout.h>
31#include <qlabel.h> 31#include <qlabel.h>
32#include <qlineedit.h> 32#include <qlineedit.h>
33#include <qpushbutton.h> 33#include <qpushbutton.h>
34#include <qspinbox.h> 34#include <qspinbox.h>
35#include <qcombobox.h> 35#include <qcombobox.h>
36#include <qwidgetstack.h> 36#include <qwidgetstack.h>
37#include <qvalidator.h> 37#include <qvalidator.h>
38#include <qapplication.h> 38#include <qapplication.h>
39 39
40#include "inputdlg.h" 40#include "inputdlg.h"
41#include "global.h" 41#include "global.h"
42 42
43 43
44InputDialog :: InputDialog( const QString &label, QWidget* parent, const char* name, 44InputDialog :: InputDialog( const QString &label, QWidget* parent, const char* name,
45 bool modal ) 45 bool modal )
46 : QDialog( parent, name, modal ) 46 : QDialog( parent, name, modal )
47{ 47{
48 lineEdit = 0; 48 lineEdit = 0;
49 49
50 QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 ); 50 QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 );
51 51
52 QLabel* l = new QLabel( label, this ); 52 QLabel* l = new QLabel( label, this );
53 vbox->addWidget( l ); 53 vbox->addWidget( l );
54 54
55 lineEdit = new QLineEdit( this ); 55 lineEdit = new QLineEdit( this );
56 vbox->addWidget( lineEdit ); 56 vbox->addWidget( lineEdit );
57 57
58 QHBoxLayout *hbox = new QHBoxLayout( 6 ); 58 QHBoxLayout *hbox = new QHBoxLayout( 6 );
59 vbox->addLayout( hbox, AlignRight ); 59 vbox->addLayout( hbox, AlignRight );
60 60
61 ok = new QPushButton( tr( "&OK" ), this ); 61 ok = new QPushButton( tr( "&OK" ), this );
62 ok->setDefault( TRUE ); 62 ok->setDefault( TRUE );
63 QPushButton *cancel = new QPushButton( tr( "&Cancel" ), this ); 63 QPushButton *cancel = new QPushButton( tr( "&Cancel" ), this );
64 64
65 QSize bs( ok->sizeHint() ); 65 QSize bs( ok->sizeHint() );
66 if ( cancel->sizeHint().width() > bs.width() ) 66 if ( cancel->sizeHint().width() > bs.width() )
67 bs.setWidth( cancel->sizeHint().width() ); 67 bs.setWidth( cancel->sizeHint().width() );
68 68
69 ok->setFixedSize( bs ); 69 ok->setFixedSize( bs );
70 cancel->setFixedSize( bs ); 70 cancel->setFixedSize( bs );
71 71
72 hbox->addWidget( new QWidget( this ) ); 72 hbox->addWidget( new QWidget( this ) );
73 hbox->addWidget( ok ); 73 hbox->addWidget( ok );
74 hbox->addWidget( cancel ); 74 hbox->addWidget( cancel );
75 75
76 connect( lineEdit, SIGNAL( returnPressed() ), 76 connect( lineEdit, SIGNAL( returnPressed() ),
77 this, SLOT( tryAccept() ) ); 77 this, SLOT( tryAccept() ) );
78 connect( lineEdit, SIGNAL( textChanged( const QString & ) ), 78 connect( lineEdit, SIGNAL( textChanged(const QString&) ),
79 this, SLOT( textChanged( const QString & ) ) ); 79 this, SLOT( textChanged(const QString&) ) );
80 80
81 connect( ok, SIGNAL( clicked() ), this, SLOT( accept() ) ); 81 connect( ok, SIGNAL( clicked() ), this, SLOT( accept() ) );
82 connect( cancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); 82 connect( cancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
83 83
84 resize( QMAX( sizeHint().width(), 240 ), sizeHint().height() ); 84 resize( QMAX( sizeHint().width(), 240 ), sizeHint().height() );
85} 85}
86 86
87/*! 87/*!
88 Destructor. 88 Destructor.
89*/ 89*/
90 90
91InputDialog::~InputDialog() 91InputDialog::~InputDialog()
92{ 92{
93} 93}
94 94
95void InputDialog :: setText( const QString &text ) 95void InputDialog :: setText( const QString &text )
96{ 96{
97 lineEdit->setText( text ); 97 lineEdit->setText( text );
98 lineEdit->selectAll(); 98 lineEdit->selectAll();
99} 99}
100 100
101QString InputDialog :: getText() 101QString InputDialog :: getText()
102{ 102{
103 return lineEdit->text(); 103 return lineEdit->text();
104} 104}
105 105
106QString InputDialog::getText( const QString &caption, const QString &label, 106QString InputDialog::getText( const QString &caption, const QString &label,
107 const QString &text, bool *ok, QWidget *parent, 107 const QString &text, bool *ok, QWidget *parent,
108 const char *name ) 108 const char *name )
109{ 109{
110 InputDialog *dlg = new InputDialog( label, parent, name, true ); 110 InputDialog *dlg = new InputDialog( label, parent, name, true );
111 dlg->setCaption( caption ); 111 dlg->setCaption( caption );
112 dlg->setText( text ); 112 dlg->setText( text );
113 113
114 QString result; 114 QString result;
115 *ok = dlg->exec() == QDialog::Accepted; 115 *ok = dlg->exec() == QDialog::Accepted;
116 if ( *ok ) 116 if ( *ok )
117 result = dlg->getText(); 117 result = dlg->getText();
118 118
119 delete dlg; 119 delete dlg;
120 return result; 120 return result;
121} 121}
122 122
123 123
124 124
125void InputDialog :: textChanged( const QString &s ) 125void InputDialog :: textChanged( const QString &s )
126{ 126{
127 ok->setEnabled( !s.isEmpty() ); 127 ok->setEnabled( !s.isEmpty() );
128} 128}
129 129
130void InputDialog :: tryAccept() 130void InputDialog :: tryAccept()
131{ 131{
132 if ( !lineEdit->text().isEmpty() ) 132 if ( !lineEdit->text().isEmpty() )
133 accept(); 133 accept();
134} 134}
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index d927a36..d2babb4 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -111,257 +111,257 @@ InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManag
111 QString upgrade = tr( "Upgrade\n" ); 111 QString upgrade = tr( "Upgrade\n" );
112 for ( ; it.current(); ++it ) 112 for ( ; it.current(); ++it )
113 { 113 {
114 InstallData *item = it.current(); 114 InstallData *item = it.current();
115 InstallData *newitem = new InstallData(); 115 InstallData *newitem = new InstallData();
116 116
117 newitem->option = item->option; 117 newitem->option = item->option;
118 newitem->packageName = item->packageName; 118 newitem->packageName = item->packageName;
119 newitem->destination = item->destination; 119 newitem->destination = item->destination;
120 newitem->recreateLinks = item->recreateLinks; 120 newitem->recreateLinks = item->recreateLinks;
121 packages.append( newitem ); 121 packages.append( newitem );
122 122
123 if ( item->option == "I" ) 123 if ( item->option == "I" )
124 { 124 {
125 install.append( QString( " %1\n" ).arg( item->packageName ) ); 125 install.append( QString( " %1\n" ).arg( item->packageName ) );
126 } 126 }
127 else if ( item->option == "D" ) 127 else if ( item->option == "D" )
128 { 128 {
129 remove.append( QString( " %1\n" ).arg( item->packageName ) ); 129 remove.append( QString( " %1\n" ).arg( item->packageName ) );
130 } 130 }
131 else if ( item->option == "U" || item->option == "R" ) 131 else if ( item->option == "U" || item->option == "R" )
132 { 132 {
133 QString type; 133 QString type;
134 if ( item->option == "R" ) 134 if ( item->option == "R" )
135 type = tr( "(ReInstall)" ); 135 type = tr( "(ReInstall)" );
136 else 136 else
137 type = tr( "(Upgrade)" ); 137 type = tr( "(Upgrade)" );
138 upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) ); 138 upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) );
139 } 139 }
140 } 140 }
141 141
142 output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); 142 output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) );
143 143
144 displayAvailableSpace( destination->currentText() ); 144 displayAvailableSpace( destination->currentText() );
145} 145}
146 146
147InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title ) 147InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title )
148 : QWidget( 0, 0, 0 ) 148 : QWidget( 0, 0, 0 )
149{ 149{
150 setCaption( title ); 150 setCaption( title );
151 init( FALSE ); 151 init( FALSE );
152 pIpkg = ipkg; 152 pIpkg = ipkg;
153 output->setText( initialText ); 153 output->setText( initialText );
154} 154}
155 155
156 156
157InstallDlgImpl::~InstallDlgImpl() 157InstallDlgImpl::~InstallDlgImpl()
158{ 158{
159 if ( pIpkg ) 159 if ( pIpkg )
160 delete pIpkg; 160 delete pIpkg;
161} 161}
162 162
163void InstallDlgImpl :: init( bool displayextrainfo ) 163void InstallDlgImpl :: init( bool displayextrainfo )
164{ 164{
165 QGridLayout *layout = new QGridLayout( this ); 165 QGridLayout *layout = new QGridLayout( this );
166 layout->setSpacing( 4 ); 166 layout->setSpacing( 4 );
167 layout->setMargin( 4 ); 167 layout->setMargin( 4 );
168 168
169 if ( displayextrainfo ) 169 if ( displayextrainfo )
170 { 170 {
171 QLabel *label = new QLabel( tr( "Destination" ), this ); 171 QLabel *label = new QLabel( tr( "Destination" ), this );
172 layout->addWidget( label, 0, 0 ); 172 layout->addWidget( label, 0, 0 );
173 destination = new QComboBox( FALSE, this ); 173 destination = new QComboBox( FALSE, this );
174 layout->addWidget( destination, 0, 1 ); 174 layout->addWidget( destination, 0, 1 );
175 connect( destination, SIGNAL( highlighted( const QString & ) ), 175 connect( destination, SIGNAL( highlighted(const QString&) ),
176 this, SLOT( displayAvailableSpace( const QString & ) ) ); 176 this, SLOT( displayAvailableSpace(const QString&) ) );
177 177
178 QLabel *label2 = new QLabel( tr( "Space Avail" ), this ); 178 QLabel *label2 = new QLabel( tr( "Space Avail" ), this );
179 layout->addWidget( label2, 1, 0 ); 179 layout->addWidget( label2, 1, 0 );
180 txtAvailableSpace = new QLabel( "", this ); 180 txtAvailableSpace = new QLabel( "", this );
181 layout->addWidget( txtAvailableSpace, 1, 1 ); 181 layout->addWidget( txtAvailableSpace, 1, 1 );
182 } 182 }
183 else 183 else
184 { 184 {
185 destination = 0x0; 185 destination = 0x0;
186 txtAvailableSpace = 0x0; 186 txtAvailableSpace = 0x0;
187 } 187 }
188 188
189 QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); 189 QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this );
190 GroupBox2->layout()->setSpacing( 0 ); 190 GroupBox2->layout()->setSpacing( 0 );
191 GroupBox2->layout()->setMargin( 4 ); 191 GroupBox2->layout()->setMargin( 4 );
192 192
193 QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() ); 193 QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() );
194 output = new QMultiLineEdit( GroupBox2 ); 194 output = new QMultiLineEdit( GroupBox2 );
195 GroupBox2Layout->addWidget( output ); 195 GroupBox2Layout->addWidget( output );
196 layout->addMultiCellWidget( GroupBox2, 2, 2, 0, 1 ); 196 layout->addMultiCellWidget( GroupBox2, 2, 2, 0, 1 );
197 197
198 btnInstall = new QPushButton( Resource::loadPixmap( "aqpkg/apply" ), tr( "Start" ), this ); 198 btnInstall = new QPushButton( Resource::loadPixmap( "aqpkg/apply" ), tr( "Start" ), this );
199 layout->addWidget( btnInstall, 3, 0 ); 199 layout->addWidget( btnInstall, 3, 0 );
200 connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) ); 200 connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) );
201 201
202 btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this ); 202 btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this );
203 layout->addWidget( btnOptions, 3, 1 ); 203 layout->addWidget( btnOptions, 3, 1 );
204 connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) ); 204 connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) );
205} 205}
206 206
207void InstallDlgImpl :: optionsSelected() 207void InstallDlgImpl :: optionsSelected()
208{ 208{
209 if ( btnOptions->text() == tr( "Options" ) ) 209 if ( btnOptions->text() == tr( "Options" ) )
210 { 210 {
211 InstallOptionsDlgImpl opt( flags, infoLevel, this, "Option", true ); 211 InstallOptionsDlgImpl opt( flags, infoLevel, this, "Option", true );
212 if ( opt.exec() == QDialog::Accepted ) 212 if ( opt.exec() == QDialog::Accepted )
213 { 213 {
214 // set options selected from dialog 214 // set options selected from dialog
215 flags = opt.getFlags(); 215 flags = opt.getFlags();
216 infoLevel = opt.getInfoLevel(); 216 infoLevel = opt.getInfoLevel();
217 217
218#ifdef QWS 218#ifdef QWS
219 Config cfg( "aqpkg" ); 219 Config cfg( "aqpkg" );
220 cfg.setGroup( "settings" ); 220 cfg.setGroup( "settings" );
221 cfg.writeEntry( "installFlags", flags ); 221 cfg.writeEntry( "installFlags", flags );
222 cfg.writeEntry( "infoLevel", infoLevel ); 222 cfg.writeEntry( "infoLevel", infoLevel );
223#endif 223#endif
224 } 224 }
225 } 225 }
226 else // Save output 226 else // Save output
227 { 227 {
228 QMap<QString, QStringList> map; 228 QMap<QString, QStringList> map;
229 map.insert( tr( "All" ), QStringList() ); 229 map.insert( tr( "All" ), QStringList() );
230 QStringList text; 230 QStringList text;
231 text << "text/*"; 231 text << "text/*";
232 map.insert(tr( "Text" ), text ); 232 map.insert(tr( "Text" ), text );
233 text << "*"; 233 text << "*";
234 map.insert( tr( "All" ), text ); 234 map.insert( tr( "All" ), text );
235 235
236 QString filename = Opie::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); 236 QString filename = Opie::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map );
237 if( !filename.isEmpty() ) 237 if( !filename.isEmpty() )
238 { 238 {
239 QString currentFileName = QFileInfo( filename ).fileName(); 239 QString currentFileName = QFileInfo( filename ).fileName();
240 DocLnk doc; 240 DocLnk doc;
241 doc.setType( "text/plain" ); 241 doc.setType( "text/plain" );
242 doc.setFile( filename ); 242 doc.setFile( filename );
243 doc.setName( currentFileName ); 243 doc.setName( currentFileName );
244 FileManager fm; 244 FileManager fm;
245 fm.saveFile( doc, output->text() ); 245 fm.saveFile( doc, output->text() );
246 } 246 }
247 } 247 }
248} 248}
249 249
250void InstallDlgImpl :: installSelected() 250void InstallDlgImpl :: installSelected()
251{ 251{
252 if ( btnInstall->text() == tr( "Abort" ) ) 252 if ( btnInstall->text() == tr( "Abort" ) )
253 { 253 {
254 if ( pIpkg ) 254 if ( pIpkg )
255 { 255 {
256 displayText( tr( "\n**** User Clicked ABORT ***" ) ); 256 displayText( tr( "\n**** User Clicked ABORT ***" ) );
257 pIpkg->abort(); 257 pIpkg->abort();
258 displayText( tr( "**** Process Aborted ****" ) ); 258 displayText( tr( "**** Process Aborted ****" ) );
259 } 259 }
260 260
261 btnInstall->setText( tr( "Close" ) ); 261 btnInstall->setText( tr( "Close" ) );
262 btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); 262 btnInstall->setIconSet( Resource::loadPixmap( "enter" ) );
263 return; 263 return;
264 } 264 }
265 else if ( btnInstall->text() == tr( "Close" ) ) 265 else if ( btnInstall->text() == tr( "Close" ) )
266 { 266 {
267 emit reloadData( this ); 267 emit reloadData( this );
268 return; 268 return;
269 } 269 }
270 270
271 // Disable buttons 271 // Disable buttons
272 btnOptions->setEnabled( false ); 272 btnOptions->setEnabled( false );
273// btnInstall->setEnabled( false ); 273// btnInstall->setEnabled( false );
274 274
275 btnInstall->setText( tr( "Abort" ) ); 275 btnInstall->setText( tr( "Abort" ) );
276 btnInstall->setIconSet( Resource::loadPixmap( "close" ) ); 276 btnInstall->setIconSet( Resource::loadPixmap( "close" ) );
277 277
278 if ( pIpkg ) 278 if ( pIpkg )
279 { 279 {
280 output->setText( "" ); 280 output->setText( "" );
281 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 281 connect( pIpkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&)));
282 connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); 282 connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished()));
283 pIpkg->runIpkg(); 283 pIpkg->runIpkg();
284 } 284 }
285 else 285 else
286 { 286 {
287 output->setText( "" ); 287 output->setText( "" );
288 Destination *d = dataMgr->getDestination( destination->currentText() ); 288 Destination *d = dataMgr->getDestination( destination->currentText() );
289 QString dest = d->getDestinationName(); 289 QString dest = d->getDestinationName();
290 QString destDir = d->getDestinationPath(); 290 QString destDir = d->getDestinationPath();
291 int instFlags = flags; 291 int instFlags = flags;
292 if ( d->linkToRoot() ) 292 if ( d->linkToRoot() )
293 instFlags |= MAKE_LINKS; 293 instFlags |= MAKE_LINKS;
294 294
295#ifdef QWS 295#ifdef QWS
296 // Save settings 296 // Save settings
297 Config cfg( "aqpkg" ); 297 Config cfg( "aqpkg" );
298 cfg.setGroup( "settings" ); 298 cfg.setGroup( "settings" );
299 cfg.writeEntry( "dest", dest ); 299 cfg.writeEntry( "dest", dest );
300#endif 300#endif
301 301
302 pIpkg = new Ipkg; 302 pIpkg = new Ipkg;
303 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 303 connect( pIpkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&)));
304 connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); 304 connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished()));
305 305
306 firstPackage = TRUE; 306 firstPackage = TRUE;
307 ipkgFinished(); 307 ipkgFinished();
308 308
309 // First run through the remove list, then the install list then the upgrade list 309 // First run through the remove list, then the install list then the upgrade list
310/* 310/*
311 pIpkg->setOption( "remove" ); 311 pIpkg->setOption( "remove" );
312 QListIterator<InstallData> it( removeList ); 312 QListIterator<InstallData> it( removeList );
313 InstallData *idata; 313 InstallData *idata;
314 for ( ; it.current(); ++it ) 314 for ( ; it.current(); ++it )
315 { 315 {
316 idata = it.current(); 316 idata = it.current();
317 pIpkg->setDestination( idata->destination->getDestinationName() ); 317 pIpkg->setDestination( idata->destination->getDestinationName() );
318 pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); 318 pIpkg->setDestinationDir( idata->destination->getDestinationPath() );
319 pIpkg->setPackage( idata->packageName ); 319 pIpkg->setPackage( idata->packageName );
320 320
321 int tmpFlags = flags; 321 int tmpFlags = flags;
322 if ( idata->destination->linkToRoot() ) 322 if ( idata->destination->linkToRoot() )
323 tmpFlags |= MAKE_LINKS; 323 tmpFlags |= MAKE_LINKS;
324 324
325 pIpkg->setFlags( tmpFlags, infoLevel ); 325 pIpkg->setFlags( tmpFlags, infoLevel );
326 pIpkg->runIpkg(); 326 pIpkg->runIpkg();
327 } 327 }
328 328
329 pIpkg->setOption( "install" ); 329 pIpkg->setOption( "install" );
330 pIpkg->setDestination( dest ); 330 pIpkg->setDestination( dest );
331 pIpkg->setDestinationDir( destDir ); 331 pIpkg->setDestinationDir( destDir );
332 pIpkg->setFlags( instFlags, infoLevel ); 332 pIpkg->setFlags( instFlags, infoLevel );
333 QListIterator<InstallData> it2( installList ); 333 QListIterator<InstallData> it2( installList );
334 for ( ; it2.current(); ++it2 ) 334 for ( ; it2.current(); ++it2 )
335 { 335 {
336 pIpkg->setPackage( it2.current()->packageName ); 336 pIpkg->setPackage( it2.current()->packageName );
337 pIpkg->runIpkg(); 337 pIpkg->runIpkg();
338 } 338 }
339 339
340 flags |= FORCE_REINSTALL; 340 flags |= FORCE_REINSTALL;
341 QListIterator<InstallData> it3( updateList ); 341 QListIterator<InstallData> it3( updateList );
342 for ( ; it3.current() ; ++it3 ) 342 for ( ; it3.current() ; ++it3 )
343 { 343 {
344 idata = it3.current(); 344 idata = it3.current();
345 if ( idata->option == "R" ) 345 if ( idata->option == "R" )
346 pIpkg->setOption( "reinstall" ); 346 pIpkg->setOption( "reinstall" );
347 else 347 else
348 pIpkg->setOption( "upgrade" ); 348 pIpkg->setOption( "upgrade" );
349 pIpkg->setDestination( idata->destination->getDestinationName() ); 349 pIpkg->setDestination( idata->destination->getDestinationName() );
350 pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); 350 pIpkg->setDestinationDir( idata->destination->getDestinationPath() );
351 pIpkg->setPackage( idata->packageName ); 351 pIpkg->setPackage( idata->packageName );
352 352
353 int tmpFlags = flags; 353 int tmpFlags = flags;
354 if ( idata->destination->linkToRoot() && idata->recreateLinks ) 354 if ( idata->destination->linkToRoot() && idata->recreateLinks )
355 tmpFlags |= MAKE_LINKS; 355 tmpFlags |= MAKE_LINKS;
356 pIpkg->setFlags( tmpFlags, infoLevel ); 356 pIpkg->setFlags( tmpFlags, infoLevel );
357 pIpkg->runIpkg(); 357 pIpkg->runIpkg();
358 } 358 }
359 359
360 delete pIpkg; 360 delete pIpkg;
361 pIpkg = 0; 361 pIpkg = 0;
362*/ 362*/
363 } 363 }
364} 364}
365 365
366 366
367void InstallDlgImpl :: displayText(const QString &text ) 367void InstallDlgImpl :: displayText(const QString &text )
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp
index 3761b67..866afed 100644
--- a/noncore/settings/aqpkg/ipkg.cpp
+++ b/noncore/settings/aqpkg/ipkg.cpp
@@ -227,136 +227,136 @@ void Ipkg :: removeStatusEntry()
227 QString value; 227 QString value;
228 228
229 while ( !readStream.atEnd() ) 229 while ( !readStream.atEnd() )
230 { 230 {
231 //read new line 231 //read new line
232 line = readStream.readLine(); 232 line = readStream.readLine();
233 233
234 if ( line.contains( ":", TRUE ) ) 234 if ( line.contains( ":", TRUE ) )
235 { 235 {
236 //grep key and value from line 236 //grep key and value from line
237 k[0] = '\0'; 237 k[0] = '\0';
238 v[0] = '\0'; 238 v[0] = '\0';
239 sscanf( line, "%[^:]: %[^\n]", k, v ); 239 sscanf( line, "%[^:]: %[^\n]", k, v );
240 key = k; 240 key = k;
241 value = v; 241 value = v;
242 key = key.stripWhiteSpace(); 242 key = key.stripWhiteSpace();
243 value = value.stripWhiteSpace(); 243 value = value.stripWhiteSpace();
244 } else { 244 } else {
245 key = ""; 245 key = "";
246 value = ""; 246 value = "";
247 } 247 }
248 248
249 if ( key == "Package" && value == package ) 249 if ( key == "Package" && value == package )
250 { 250 {
251 //skip lines from the deleted package 251 //skip lines from the deleted package
252 while ( ( !readStream.atEnd() ) && ( line.stripWhiteSpace() != "" ) ) 252 while ( ( !readStream.atEnd() ) && ( line.stripWhiteSpace() != "" ) )
253 { 253 {
254 line = readStream.readLine(); 254 line = readStream.readLine();
255 } 255 }
256 } else { 256 } else {
257 257
258 //write other lines into the tempfile 258 //write other lines into the tempfile
259 writeStream << line << "\n"; 259 writeStream << line << "\n";
260 260
261 // Improve UI responsiveness 261 // Improve UI responsiveness
262 i++; 262 i++;
263 if ( ( i % 50 ) == 0 ) 263 if ( ( i % 50 ) == 0 )
264 qApp->processEvents(); 264 qApp->processEvents();
265 } 265 }
266 } 266 }
267 267
268 readFile.close(); 268 readFile.close();
269 writeFile.close(); 269 writeFile.close();
270 270
271 // Remove old status file and put tmp stats file in its place 271 // Remove old status file and put tmp stats file in its place
272 remove( statusFile ); 272 remove( statusFile );
273 rename( outStatusFile, statusFile ); 273 rename( outStatusFile, statusFile );
274 } 274 }
275 275
276int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ ) 276int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ )
277{ 277{
278 // If one is already running - should never be but just to be safe 278 // If one is already running - should never be but just to be safe
279 if ( proc ) 279 if ( proc )
280 { 280 {
281 delete proc; 281 delete proc;
282 proc = 0; 282 proc = 0;
283 } 283 }
284 284
285 // OK we're gonna use OProcess to run this thing 285 // OK we're gonna use OProcess to run this thing
286 proc = new OProcess(); 286 proc = new OProcess();
287 aborted = false; 287 aborted = false;
288 288
289 289
290 // Connect up our slots 290 // Connect up our slots
291 connect(proc, SIGNAL(processExited(OProcess *)), 291 connect(proc, SIGNAL(processExited(OProcess*)),
292 this, SLOT( processFinished())); 292 this, SLOT( processFinished()));
293 293
294 connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)), 294 connect(proc, SIGNAL(receivedStdout(OProcess*,char*,int)),
295 this, SLOT(commandStdout(OProcess *, char *, int))); 295 this, SLOT(commandStdout(OProcess*,char*,int)));
296 296
297 connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), 297 connect(proc, SIGNAL(receivedStderr(OProcess*,char*,int)),
298 this, SLOT(commandStderr(OProcess *, char *, int))); 298 this, SLOT(commandStderr(OProcess*,char*,int)));
299 299
300 for ( QStringList::Iterator it = cmd.begin(); it != cmd.end(); ++it ) 300 for ( QStringList::Iterator it = cmd.begin(); it != cmd.end(); ++it )
301 { 301 {
302 *proc << (*it).latin1(); 302 *proc << (*it).latin1();
303 } 303 }
304 304
305 // Start the process going 305 // Start the process going
306 finished = false; 306 finished = false;
307 if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) 307 if(!proc->start(OProcess::NotifyOnExit, OProcess::All))
308 { 308 {
309 emit outputText( tr("Couldn't start ipkg process" ) ); 309 emit outputText( tr("Couldn't start ipkg process" ) );
310 } 310 }
311} 311}
312 312
313void Ipkg::commandStdout(OProcess*, char *buffer, int buflen) 313void Ipkg::commandStdout(OProcess*, char *buffer, int buflen)
314{ 314{
315 QString lineStr = buffer; 315 QString lineStr = buffer;
316 if ( lineStr[buflen-1] == '\n' ) 316 if ( lineStr[buflen-1] == '\n' )
317 buflen --; 317 buflen --;
318 lineStr = lineStr.left( buflen ); 318 lineStr = lineStr.left( buflen );
319 emit outputText( lineStr ); 319 emit outputText( lineStr );
320 320
321 // check if we are installing dependant packages 321 // check if we are installing dependant packages
322 if ( option == "install" || option == "reinstall" ) 322 if ( option == "install" || option == "reinstall" )
323 { 323 {
324 // Need to keep track of any dependant packages that get installed 324 // Need to keep track of any dependant packages that get installed
325 // so that we can create links to them as necessary 325 // so that we can create links to them as necessary
326 if ( lineStr.startsWith( "Installing " ) ) 326 if ( lineStr.startsWith( "Installing " ) )
327 { 327 {
328 int start = lineStr.find( " " ) + 1; 328 int start = lineStr.find( " " ) + 1;
329 int end = lineStr.find( " ", start ); 329 int end = lineStr.find( " ", start );
330 QString *package = new QString( lineStr.mid( start, end-start ) ); 330 QString *package = new QString( lineStr.mid( start, end-start ) );
331 dependantPackages->append( package ); 331 dependantPackages->append( package );
332 } 332 }
333 } 333 }
334 else if ( option == "remove" && !( flags & FORCE_DEPENDS ) && 334 else if ( option == "remove" && !( flags & FORCE_DEPENDS ) &&
335 lineStr.find( "is depended upon by packages:" ) != -1 ) 335 lineStr.find( "is depended upon by packages:" ) != -1 )
336 { 336 {
337 // Ipkg should send this to STDERR, but doesn't - so trap here 337 // Ipkg should send this to STDERR, but doesn't - so trap here
338 error = true; 338 error = true;
339 } 339 }
340 340
341 buffer[0] = '\0'; 341 buffer[0] = '\0';
342} 342}
343 343
344void Ipkg::commandStderr(OProcess*, char *buffer, int buflen) 344void Ipkg::commandStderr(OProcess*, char *buffer, int buflen)
345{ 345{
346 QString lineStr = buffer; 346 QString lineStr = buffer;
347 if ( lineStr[buflen-1] == '\n' ) 347 if ( lineStr[buflen-1] == '\n' )
348 buflen --; 348 buflen --;
349 lineStr=lineStr.left( buflen ); 349 lineStr=lineStr.left( buflen );
350 emit outputText( lineStr ); 350 emit outputText( lineStr );
351 buffer[0] = '\0'; 351 buffer[0] = '\0';
352 error = true; 352 error = true;
353} 353}
354 354
355void Ipkg::processFinished() 355void Ipkg::processFinished()
356{ 356{
357 // Finally, if we are removing a package, remove its entry from the <destdir>/usr/lib/ipkg/status file 357 // Finally, if we are removing a package, remove its entry from the <destdir>/usr/lib/ipkg/status file
358 // to workaround an ipkg bug which stops reinstall to a different location 358 // to workaround an ipkg bug which stops reinstall to a different location
359 359
360 if ( !error && option == "remove" ) 360 if ( !error && option == "remove" )
361 removeStatusEntry(); 361 removeStatusEntry();
362 362
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 6f5c712..6b31cd1 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -39,146 +39,146 @@
39#include "settingsimpl.h" 39#include "settingsimpl.h"
40#include "utils.h" 40#include "utils.h"
41 41
42/* OPIE */ 42/* OPIE */
43#include <qpe/qcopenvelope_qws.h> 43#include <qpe/qcopenvelope_qws.h>
44#include <qpe/qpeapplication.h> 44#include <qpe/qpeapplication.h>
45#include <qpe/config.h> 45#include <qpe/config.h>
46#include <qpe/resource.h> 46#include <qpe/resource.h>
47 47
48/* QT */ 48/* QT */
49#include <qmenubar.h> 49#include <qmenubar.h>
50#include <qtoolbar.h> 50#include <qtoolbar.h>
51#include <qaction.h> 51#include <qaction.h>
52#include <qcombobox.h> 52#include <qcombobox.h>
53#include <qfile.h> 53#include <qfile.h>
54#include <qlabel.h> 54#include <qlabel.h>
55#include <qlayout.h> 55#include <qlayout.h>
56#include <qlineedit.h> 56#include <qlineedit.h>
57#include <qlistview.h> 57#include <qlistview.h>
58#include <qmenubar.h> 58#include <qmenubar.h>
59#include <qmessagebox.h> 59#include <qmessagebox.h>
60#include <qpopupmenu.h> 60#include <qpopupmenu.h>
61#include <qprogressbar.h> 61#include <qprogressbar.h>
62#include <qtimer.h> 62#include <qtimer.h>
63#include <qwhatsthis.h> 63#include <qwhatsthis.h>
64#include <qwidgetstack.h> 64#include <qwidgetstack.h>
65 65
66/* STD */ 66/* STD */
67#include <linux/limits.h> 67#include <linux/limits.h>
68#include <unistd.h> 68#include <unistd.h>
69 69
70extern int compareVersions( const char *v1, const char *v2 ); 70extern int compareVersions( const char *v1, const char *v2 );
71 71
72MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl ) 72MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl )
73 :QMainWindow( parent, name, fl || WStyle_ContextHelp ) 73 :QMainWindow( parent, name, fl || WStyle_ContextHelp )
74{ 74{
75 // Disable suspend mode 75 // Disable suspend mode
76 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; 76 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend;
77 77
78 LOCAL_SERVER = QObject::tr( "Installed packages" ); 78 LOCAL_SERVER = QObject::tr( "Installed packages" );
79 LOCAL_IPKGS = QObject::tr( "Local packages" ); 79 LOCAL_IPKGS = QObject::tr( "Local packages" );
80 80
81 setCaption( tr( "AQPkg - Package Manager" ) ); 81 setCaption( tr( "AQPkg - Package Manager" ) );
82 82
83 // Create UI widgets 83 // Create UI widgets
84 initMainWidget(); 84 initMainWidget();
85 initProgressWidget(); 85 initProgressWidget();
86 86
87 // Build menu and tool bars 87 // Build menu and tool bars
88 setToolBarsMovable( FALSE ); 88 setToolBarsMovable( FALSE );
89 89
90 QToolBar *bar = new QToolBar( this ); 90 QToolBar *bar = new QToolBar( this );
91 bar->setHorizontalStretchable( TRUE ); 91 bar->setHorizontalStretchable( TRUE );
92 QMenuBar *mb = new QMenuBar( bar ); 92 QMenuBar *mb = new QMenuBar( bar );
93 mb->setMargin( 0 ); 93 mb->setMargin( 0 );
94 bar = new QToolBar( this ); 94 bar = new QToolBar( this );
95 95
96 // Find toolbar 96 // Find toolbar
97 findBar = new QToolBar( this ); 97 findBar = new QToolBar( this );
98 addToolBar( findBar, QMainWindow::Top, true ); 98 addToolBar( findBar, QMainWindow::Top, true );
99 findBar->setHorizontalStretchable( true ); 99 findBar->setHorizontalStretchable( true );
100 findEdit = new QLineEdit( findBar ); 100 findEdit = new QLineEdit( findBar );
101 QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); 101 QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) );
102 findBar->setStretchableWidget( findEdit ); 102 findBar->setStretchableWidget( findEdit );
103 connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); 103 connect( findEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( findPackage(const QString&) ) );
104 104
105 // Quick jump toolbar 105 // Quick jump toolbar
106 jumpBar = new QToolBar( this ); 106 jumpBar = new QToolBar( this );
107 addToolBar( jumpBar, QMainWindow::Top, true ); 107 addToolBar( jumpBar, QMainWindow::Top, true );
108 jumpBar->setHorizontalStretchable( true ); 108 jumpBar->setHorizontalStretchable( true );
109 QWidget *w = new QWidget( jumpBar ); 109 QWidget *w = new QWidget( jumpBar );
110 jumpBar->setStretchableWidget( w ); 110 jumpBar->setStretchableWidget( w );
111 111
112 QGridLayout *layout = new QGridLayout( w ); 112 QGridLayout *layout = new QGridLayout( w );
113 113
114 char text[2]; 114 char text[2];
115 text[1] = '\0'; 115 text[1] = '\0';
116 for ( int i = 0 ; i < 26 ; ++i ) 116 for ( int i = 0 ; i < 26 ; ++i )
117 { 117 {
118 text[0] = 'A' + i; 118 text[0] = 'A' + i;
119 LetterPushButton *b = new LetterPushButton( text, w ); 119 LetterPushButton *b = new LetterPushButton( text, w );
120 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); 120 connect( b, SIGNAL( released(QString) ), this, SLOT( letterPushed(QString) ) );
121 layout->addWidget( b, i / 13, i % 13); 121 layout->addWidget( b, i / 13, i % 13);
122 } 122 }
123 123
124 QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); 124 QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 );
125 a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); 125 a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) );
126 connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); 126 connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) );
127 a->addTo( jumpBar ); 127 a->addTo( jumpBar );
128 jumpBar->hide(); 128 jumpBar->hide();
129 129
130 // Packages menu 130 // Packages menu
131 QPopupMenu *popup = new QPopupMenu( this ); 131 QPopupMenu *popup = new QPopupMenu( this );
132 132
133 a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); 133 a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 );
134 a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); 134 a->setWhatsThis( tr( "Click here to update package lists from servers." ) );
135 connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); 135 connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) );
136 a->addTo( popup ); 136 a->addTo( popup );
137 a->addTo( bar ); 137 a->addTo( bar );
138 138
139 actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); 139 actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 );
140 actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); 140 actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) );
141 connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); 141 connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) );
142 actionUpgrade->addTo( popup ); 142 actionUpgrade->addTo( popup );
143 actionUpgrade->addTo( bar ); 143 actionUpgrade->addTo( bar );
144 144
145 iconDownload = Resource::loadPixmap( "aqpkg/download" ); 145 iconDownload = Resource::loadPixmap( "aqpkg/download" );
146 iconRemove = Resource::loadPixmap( "aqpkg/remove" ); 146 iconRemove = Resource::loadPixmap( "aqpkg/remove" );
147 actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); 147 actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 );
148 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); 148 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) );
149 connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) ); 149 connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) );
150 actionDownload->addTo( popup ); 150 actionDownload->addTo( popup );
151 actionDownload->addTo( bar ); 151 actionDownload->addTo( bar );
152 152
153 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); 153 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 );
154 a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); 154 a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) );
155 connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) ); 155 connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) );
156 a->addTo( popup ); 156 a->addTo( popup );
157 a->addTo( bar ); 157 a->addTo( bar );
158 158
159 popup->insertSeparator(); 159 popup->insertSeparator();
160 160
161 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); 161 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 );
162 a->setWhatsThis( tr( "Click here to configure this application." ) ); 162 a->setWhatsThis( tr( "Click here to configure this application." ) );
163 connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); 163 connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) );
164 a->addTo( popup ); 164 a->addTo( popup );
165 mb->insertItem( tr( "Actions" ), popup ); 165 mb->insertItem( tr( "Actions" ), popup );
166 166
167 // View menu 167 // View menu
168 popup = new QPopupMenu( this ); 168 popup = new QPopupMenu( this );
169 169
170 actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); 170 actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 );
171 actionUninstalled->setToggleAction( TRUE ); 171 actionUninstalled->setToggleAction( TRUE );
172 actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); 172 actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) );
173 connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) ); 173 connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) );
174 actionUninstalled->addTo( popup ); 174 actionUninstalled->addTo( popup );
175 175
176 actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); 176 actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 );
177 actionInstalled->setToggleAction( TRUE ); 177 actionInstalled->setToggleAction( TRUE );
178 actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); 178 actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) );
179 connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) ); 179 connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) );
180 actionInstalled->addTo( popup ); 180 actionInstalled->addTo( popup );
181 181
182 actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); 182 actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 );
183 actionUpdated->setToggleAction( TRUE ); 183 actionUpdated->setToggleAction( TRUE );
184 actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); 184 actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) );
@@ -204,173 +204,173 @@ MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl )
204 a->setWhatsThis( tr( "Click here to search for text in package names." ) ); 204 a->setWhatsThis( tr( "Click here to search for text in package names." ) );
205 connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); 205 connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) );
206 a->addTo( popup ); 206 a->addTo( popup );
207 207
208 actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); 208 actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 );
209 actionFindNext->setEnabled( FALSE ); 209 actionFindNext->setEnabled( FALSE );
210 actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); 210 actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) );
211 connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); 211 connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) );
212 actionFindNext->addTo( popup ); 212 actionFindNext->addTo( popup );
213 actionFindNext->addTo( findBar ); 213 actionFindNext->addTo( findBar );
214 214
215 215
216 popup->insertSeparator(); 216 popup->insertSeparator();
217 217
218 a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 ); 218 a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 );
219 a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) ); 219 a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) );
220 connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) ); 220 connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) );
221 a->addTo( popup ); 221 a->addTo( popup );
222 222
223 mb->insertItem( tr( "View" ), popup ); 223 mb->insertItem( tr( "View" ), popup );
224 224
225 // Finish find toolbar creation 225 // Finish find toolbar creation
226 a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 226 a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
227 a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); 227 a->setWhatsThis( tr( "Click here to hide the find toolbar." ) );
228 connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); 228 connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) );
229 a->addTo( findBar ); 229 a->addTo( findBar );
230 findBar->hide(); 230 findBar->hide();
231 231
232 // Create widget stack and add UI widgets 232 // Create widget stack and add UI widgets
233 stack = new QWidgetStack( this ); 233 stack = new QWidgetStack( this );
234 stack->addWidget( progressWindow, 2 ); 234 stack->addWidget( progressWindow, 2 );
235 stack->addWidget( networkPkgWindow, 1 ); 235 stack->addWidget( networkPkgWindow, 1 );
236 setCentralWidget( stack ); 236 setCentralWidget( stack );
237 stack->raiseWidget( progressWindow ); 237 stack->raiseWidget( progressWindow );
238 238
239 // Delayed call to finish initialization 239 // Delayed call to finish initialization
240 QTimer::singleShot( 100, this, SLOT( init() ) ); 240 QTimer::singleShot( 100, this, SLOT( init() ) );
241} 241}
242 242
243MainWindow :: ~MainWindow() 243MainWindow :: ~MainWindow()
244{ 244{
245 delete mgr; 245 delete mgr;
246 246
247 // Reenable suspend mode 247 // Reenable suspend mode
248 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 248 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
249} 249}
250 250
251void MainWindow :: initMainWidget() 251void MainWindow :: initMainWidget()
252{ 252{
253 networkPkgWindow = new QWidget( this ); 253 networkPkgWindow = new QWidget( this );
254 254
255 QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); 255 QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow );
256 256
257 serversList = new QComboBox( networkPkgWindow ); 257 serversList = new QComboBox( networkPkgWindow );
258 connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) ); 258 connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) );
259 QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); 259 QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) );
260 260
261 installedIcon = Resource::loadPixmap( "installed" ); 261 installedIcon = Resource::loadPixmap( "installed" );
262 updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); 262 updatedIcon = Resource::loadPixmap( "aqpkg/updated" );
263 263
264 packagesList = new QListView( networkPkgWindow ); 264 packagesList = new QListView( networkPkgWindow );
265 packagesList->addColumn( tr( "Packages" ), 225 ); 265 packagesList->addColumn( tr( "Packages" ), 225 );
266 QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); 266 QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) );
267 QPEApplication::setStylusOperation( packagesList->viewport(), QPEApplication::RightOnHold ); 267 QPEApplication::setStylusOperation( packagesList->viewport(), QPEApplication::RightOnHold );
268 connect( packagesList, SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), 268 connect( packagesList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)),
269 this, SLOT(slotDisplayPackage(QListViewItem *)) ); 269 this, SLOT(slotDisplayPackage(QListViewItem*)) );
270 270
271 QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); 271 QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 );
272 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); 272 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 );
273 hbox1->addWidget( l ); 273 hbox1->addWidget( l );
274 hbox1->addWidget( serversList ); 274 hbox1->addWidget( serversList );
275 275
276 vbox->addWidget( packagesList ); 276 vbox->addWidget( packagesList );
277 277
278 downloadEnabled = TRUE; 278 downloadEnabled = TRUE;
279} 279}
280 280
281void MainWindow :: initProgressWidget() 281void MainWindow :: initProgressWidget()
282{ 282{
283 progressWindow = new QWidget( this ); 283 progressWindow = new QWidget( this );
284 284
285 QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); 285 QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 );
286 286
287 m_status = new QLabel( progressWindow ); 287 m_status = new QLabel( progressWindow );
288 m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); 288 m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
289 layout->addWidget( m_status ); 289 layout->addWidget( m_status );
290 290
291 m_progress = new QProgressBar( progressWindow ); 291 m_progress = new QProgressBar( progressWindow );
292 layout->addWidget( m_progress ); 292 layout->addWidget( m_progress );
293} 293}
294 294
295void MainWindow :: init() 295void MainWindow :: init()
296{ 296{
297#ifdef QWS 297#ifdef QWS
298 // read download directory from config file 298 // read download directory from config file
299 Config cfg( "aqpkg" ); 299 Config cfg( "aqpkg" );
300 cfg.setGroup( "settings" ); 300 cfg.setGroup( "settings" );
301 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); 301 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
302 // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); 302 // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
303 303
304#endif 304#endif
305 305
306 stack->raiseWidget( progressWindow ); 306 stack->raiseWidget( progressWindow );
307 307
308 mgr = new DataManager(); 308 mgr = new DataManager();
309 connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); 309 connect( mgr, SIGNAL( progressSetSteps(int) ), this, SLOT( setProgressSteps(int) ) );
310 connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), 310 connect( mgr, SIGNAL( progressSetMessage(const QString&) ),
311 this, SLOT( setProgressMessage( const QString & ) ) ); 311 this, SLOT( setProgressMessage(const QString&) ) );
312 connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); 312 connect( mgr, SIGNAL( progressUpdate(int) ), this, SLOT( updateProgress(int) ) );
313 mgr->loadServers(); 313 mgr->loadServers();
314 314
315 showUninstalledPkgs = false; 315 showUninstalledPkgs = false;
316 showInstalledPkgs = false; 316 showInstalledPkgs = false;
317 showUpgradedPkgs = false; 317 showUpgradedPkgs = false;
318 categoryFilterEnabled = false; 318 categoryFilterEnabled = false;
319 319
320 updateData(); 320 updateData();
321 321
322 stack->raiseWidget( networkPkgWindow ); 322 stack->raiseWidget( networkPkgWindow );
323} 323}
324 324
325void MainWindow :: setDocument( const QString &doc ) 325void MainWindow :: setDocument( const QString &doc )
326{ 326{
327 // Remove path from package 327 // Remove path from package
328 QString package = Utils::getPackageNameFromIpkFilename( doc ); 328 QString package = Utils::getPackageNameFromIpkFilename( doc );
329 329
330 // First select local server 330 // First select local server
331 for ( int i = 0 ; i < serversList->count() ; ++i ) 331 for ( int i = 0 ; i < serversList->count() ; ++i )
332 { 332 {
333 if ( serversList->text( i ) == LOCAL_IPKGS ) 333 if ( serversList->text( i ) == LOCAL_IPKGS )
334 { 334 {
335 serversList->setCurrentItem( i ); 335 serversList->setCurrentItem( i );
336 break; 336 break;
337 } 337 }
338 } 338 }
339 serverSelected( 0 ); 339 serverSelected( 0 );
340 340
341 // Now set the check box of the selected package 341 // Now set the check box of the selected package
342 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 342 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
343 item != 0 ; 343 item != 0 ;
344 item = (QCheckListItem *)item->nextSibling() ) 344 item = (QCheckListItem *)item->nextSibling() )
345 { 345 {
346 if ( item->text().startsWith( package ) ) 346 if ( item->text().startsWith( package ) )
347 { 347 {
348 item->setOn( true ); 348 item->setOn( true );
349 break; 349 break;
350 } 350 }
351 } 351 }
352} 352}
353 353
354void MainWindow :: displaySettings() 354void MainWindow :: displaySettings()
355{ 355{
356 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); 356 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true );
357 if ( dlg->showDlg() ) 357 if ( dlg->showDlg() )
358 { 358 {
359 stack->raiseWidget( progressWindow ); 359 stack->raiseWidget( progressWindow );
360 updateData(); 360 updateData();
361 stack->raiseWidget( networkPkgWindow ); 361 stack->raiseWidget( networkPkgWindow );
362 } 362 }
363 delete dlg; 363 delete dlg;
364} 364}
365 365
366void MainWindow :: closeEvent( QCloseEvent *e ) 366void MainWindow :: closeEvent( QCloseEvent *e )
367{ 367{
368 // If install dialog is visible, return to main view, otherwise close app 368 // If install dialog is visible, return to main view, otherwise close app
369 QWidget *widget = stack->visibleWidget(); 369 QWidget *widget = stack->visibleWidget();
370 370
371 if ( widget != networkPkgWindow && widget != progressWindow ) 371 if ( widget != networkPkgWindow && widget != progressWindow )
372 { 372 {
373 if ( widget ) delete widget; 373 if ( widget ) delete widget;
374 stack->raiseWidget( networkPkgWindow ); 374 stack->raiseWidget( networkPkgWindow );
375 e->ignore(); 375 e->ignore();
376 } 376 }
@@ -709,347 +709,347 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
709 if ( serverName == LOCAL_SERVER ) 709 if ( serverName == LOCAL_SERVER )
710 { 710 {
711 downloadEnabled = TRUE; 711 downloadEnabled = TRUE;
712 actionUpgrade->setEnabled( FALSE ); 712 actionUpgrade->setEnabled( FALSE );
713 } 713 }
714 else if ( serverName == LOCAL_IPKGS ) 714 else if ( serverName == LOCAL_IPKGS )
715 { 715 {
716 downloadEnabled = FALSE; 716 downloadEnabled = FALSE;
717 actionUpgrade->setEnabled( FALSE ); 717 actionUpgrade->setEnabled( FALSE );
718 } 718 }
719 else 719 else
720 { 720 {
721 downloadEnabled = TRUE; 721 downloadEnabled = TRUE;
722 actionUpgrade->setEnabled( TRUE ); 722 actionUpgrade->setEnabled( TRUE );
723 } 723 }
724 enableDownload( downloadEnabled ); 724 enableDownload( downloadEnabled );
725 725
726 // Display this widget once everything is done 726 // Display this widget once everything is done
727 if ( doProgress && raiseProgress ) 727 if ( doProgress && raiseProgress )
728 { 728 {
729 stack->raiseWidget( networkPkgWindow ); 729 stack->raiseWidget( networkPkgWindow );
730 } 730 }
731} 731}
732 732
733void MainWindow :: searchForPackage( const QString &text ) 733void MainWindow :: searchForPackage( const QString &text )
734{ 734{
735 if ( !text.isEmpty() ) 735 if ( !text.isEmpty() )
736 { 736 {
737 // look through package list for text startng at current position 737 // look through package list for text startng at current position
738 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); 738 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
739 739
740 if ( start == 0 ) 740 if ( start == 0 )
741 start = (QCheckListItem *)packagesList->firstChild(); 741 start = (QCheckListItem *)packagesList->firstChild();
742 742
743 for ( QCheckListItem *item = start; item != 0 ; 743 for ( QCheckListItem *item = start; item != 0 ;
744 item = (QCheckListItem *)item->nextSibling() ) 744 item = (QCheckListItem *)item->nextSibling() )
745 { 745 {
746 if ( item->text().lower().find( text ) != -1 ) 746 if ( item->text().lower().find( text ) != -1 )
747 { 747 {
748 packagesList->ensureItemVisible( item ); 748 packagesList->ensureItemVisible( item );
749 packagesList->setCurrentItem( item ); 749 packagesList->setCurrentItem( item );
750 break; 750 break;
751 } 751 }
752 } 752 }
753 } 753 }
754} 754}
755 755
756void MainWindow :: updateServer() 756void MainWindow :: updateServer()
757{ 757{
758 QString serverName = serversList->currentText(); 758 QString serverName = serversList->currentText();
759 759
760 // Update the current server 760 // Update the current server
761 // Display dialog 761 // Display dialog
762 762
763 // Disable buttons to stop silly people clicking lots on them :) 763 // Disable buttons to stop silly people clicking lots on them :)
764 764
765 // First, write out ipkg_conf file so that ipkg can use it 765 // First, write out ipkg_conf file so that ipkg can use it
766 mgr->writeOutIpkgConf(); 766 mgr->writeOutIpkgConf();
767 767
768 Ipkg *ipkg = new Ipkg; 768 Ipkg *ipkg = new Ipkg;
769 ipkg->setOption( "update" ); 769 ipkg->setOption( "update" );
770 770
771 InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ), 771 InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ),
772 tr( "Update lists" ) ); 772 tr( "Update lists" ) );
773 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); 773 connect( dlg, SIGNAL( reloadData(InstallDlgImpl*) ), this, SLOT( reloadData(InstallDlgImpl*) ) );
774 reloadDocuments = FALSE; 774 reloadDocuments = FALSE;
775 stack->addWidget( dlg, 3 ); 775 stack->addWidget( dlg, 3 );
776 stack->raiseWidget( dlg ); 776 stack->raiseWidget( dlg );
777 777
778 // delete progDlg; 778 // delete progDlg;
779} 779}
780 780
781void MainWindow :: upgradePackages() 781void MainWindow :: upgradePackages()
782{ 782{
783 // We're gonna do an upgrade of all packages 783 // We're gonna do an upgrade of all packages
784 // First warn user that this isn't recommended 784 // First warn user that this isn't recommended
785 // TODO - ODevice???? 785 // TODO - ODevice????
786 QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" ); 786 QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" );
787 QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, 787 QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning,
788 QMessageBox::Yes, 788 QMessageBox::Yes,
789 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , 789 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default ,
790 0, this ); 790 0, this );
791 warn.adjustSize(); 791 warn.adjustSize();
792 792
793 if ( warn.exec() == QMessageBox::Yes ) 793 if ( warn.exec() == QMessageBox::Yes )
794 { 794 {
795 // First, write out ipkg_conf file so that ipkg can use it 795 // First, write out ipkg_conf file so that ipkg can use it
796 mgr->writeOutIpkgConf(); 796 mgr->writeOutIpkgConf();
797 797
798 // Now run upgrade 798 // Now run upgrade
799 Ipkg *ipkg = new Ipkg; 799 Ipkg *ipkg = new Ipkg;
800 ipkg->setOption( "upgrade" ); 800 ipkg->setOption( "upgrade" );
801 801
802 InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ), 802 InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ),
803 tr ( "Upgrade" ) ); 803 tr ( "Upgrade" ) );
804 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); 804 connect( dlg, SIGNAL( reloadData(InstallDlgImpl*) ), this, SLOT( reloadData(InstallDlgImpl*) ) );
805 reloadDocuments = TRUE; 805 reloadDocuments = TRUE;
806 stack->addWidget( dlg, 3 ); 806 stack->addWidget( dlg, 3 );
807 stack->raiseWidget( dlg ); 807 stack->raiseWidget( dlg );
808 } 808 }
809} 809}
810 810
811void MainWindow :: downloadPackage() 811void MainWindow :: downloadPackage()
812{ 812{
813 bool doUpdate = true; 813 bool doUpdate = true;
814 if ( downloadEnabled ) 814 if ( downloadEnabled )
815 { 815 {
816 // See if any packages are selected 816 // See if any packages are selected
817 bool found = false; 817 bool found = false;
818 if ( serversList->currentText() != LOCAL_SERVER ) 818 if ( serversList->currentText() != LOCAL_SERVER )
819 { 819 {
820 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 820 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
821 item != 0 && !found; 821 item != 0 && !found;
822 item = (QCheckListItem *)item->nextSibling() ) 822 item = (QCheckListItem *)item->nextSibling() )
823 { 823 {
824 if ( item->isOn() ) 824 if ( item->isOn() )
825 found = true; 825 found = true;
826 } 826 }
827 } 827 }
828 828
829 // If user selected some packages then download the and store the locally 829 // If user selected some packages then download the and store the locally
830 // otherwise, display dialog asking user what package to download from an http server 830 // otherwise, display dialog asking user what package to download from an http server
831 // and whether to install it 831 // and whether to install it
832 if ( found ) 832 if ( found )
833 downloadSelectedPackages(); 833 downloadSelectedPackages();
834 else 834 else
835 downloadRemotePackage(); 835 downloadRemotePackage();
836 836
837 } 837 }
838 else 838 else
839 { 839 {
840 doUpdate = false; 840 doUpdate = false;
841 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 841 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
842 item != 0 ; 842 item != 0 ;
843 item = (QCheckListItem *)item->nextSibling() ) 843 item = (QCheckListItem *)item->nextSibling() )
844 { 844 {
845 if ( item->isOn() ) 845 if ( item->isOn() )
846 { 846 {
847 QString name = item->text(); 847 QString name = item->text();
848 int pos = name.find( "*" ); 848 int pos = name.find( "*" );
849 name.truncate( pos ); 849 name.truncate( pos );
850 850
851 // if (there is a (installed), remove it 851 // if (there is a (installed), remove it
852 pos = name.find( "(installed)" ); 852 pos = name.find( "(installed)" );
853 if ( pos > 0 ) 853 if ( pos > 0 )
854 name.truncate( pos - 1 ); 854 name.truncate( pos - 1 );
855 855
856 Package *p = mgr->getServer( serversList->currentText() )->getPackage( name ); 856 Package *p = mgr->getServer( serversList->currentText() )->getPackage( name );
857 857
858 QString msgtext; 858 QString msgtext;
859 msgtext = tr( "Are you sure you wish to delete\n%1?" ).arg( (const char *)p->getPackageName() ); 859 msgtext = tr( "Are you sure you wish to delete\n%1?" ).arg( (const char *)p->getPackageName() );
860 if ( QMessageBox::information( this, tr( "Are you sure?" ), 860 if ( QMessageBox::information( this, tr( "Are you sure?" ),
861 msgtext, tr( "No" ), tr( "Yes" ) ) == 1 ) 861 msgtext, tr( "No" ), tr( "Yes" ) ) == 1 )
862 { 862 {
863 doUpdate = true; 863 doUpdate = true;
864 QFile f( p->getFilename() ); 864 QFile f( p->getFilename() );
865 f.remove(); 865 f.remove();
866 } 866 }
867 } 867 }
868 } 868 }
869 } 869 }
870 870
871 if ( doUpdate ) 871 if ( doUpdate )
872 { 872 {
873 reloadData( 0x0 ); 873 reloadData( 0x0 );
874 } 874 }
875} 875}
876 876
877void MainWindow :: downloadSelectedPackages() 877void MainWindow :: downloadSelectedPackages()
878{ 878{
879 // First, write out ipkg_conf file so that ipkg can use it 879 // First, write out ipkg_conf file so that ipkg can use it
880 mgr->writeOutIpkgConf(); 880 mgr->writeOutIpkgConf();
881 881
882 // Display dialog to user asking where to download the files to 882 // Display dialog to user asking where to download the files to
883 bool ok = FALSE; 883 bool ok = FALSE;
884 QString dir = ""; 884 QString dir = "";
885#ifdef QWS 885#ifdef QWS
886 // read download directory from config file 886 // read download directory from config file
887 Config cfg( "aqpkg" ); 887 Config cfg( "aqpkg" );
888 cfg.setGroup( "settings" ); 888 cfg.setGroup( "settings" );
889 dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" ); 889 dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" );
890#endif 890#endif
891 891
892 QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this ); 892 QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this );
893 if ( ok && !text.isEmpty() ) 893 if ( ok && !text.isEmpty() )
894 dir = text; // user entered something and pressed ok 894 dir = text; // user entered something and pressed ok
895 else 895 else
896 return; // user entered nothing or pressed cancel 896 return; // user entered nothing or pressed cancel
897 897
898#ifdef QWS 898#ifdef QWS
899 // Store download directory in config file 899 // Store download directory in config file
900 cfg.writeEntry( "downloadDir", dir ); 900 cfg.writeEntry( "downloadDir", dir );
901#endif 901#endif
902 902
903 // Get starting directory 903 // Get starting directory
904 char initDir[PATH_MAX]; 904 char initDir[PATH_MAX];
905 getcwd( initDir, PATH_MAX ); 905 getcwd( initDir, PATH_MAX );
906 906
907 // Download each package 907 // Download each package
908 Ipkg ipkg; 908 Ipkg ipkg;
909 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 909 connect( &ipkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&)));
910 910
911 ipkg.setOption( "download" ); 911 ipkg.setOption( "download" );
912 ipkg.setRuntimeDirectory( dir ); 912 ipkg.setRuntimeDirectory( dir );
913 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 913 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
914 item != 0 ; 914 item != 0 ;
915 item = (QCheckListItem *)item->nextSibling() ) 915 item = (QCheckListItem *)item->nextSibling() )
916 { 916 {
917 if ( item->isOn() ) 917 if ( item->isOn() )
918 { 918 {
919 ipkg.setPackage( item->text() ); 919 ipkg.setPackage( item->text() );
920 ipkg.runIpkg( ); 920 ipkg.runIpkg( );
921 } 921 }
922 } 922 }
923} 923}
924 924
925void MainWindow :: downloadRemotePackage() 925void MainWindow :: downloadRemotePackage()
926{ 926{
927 // Display dialog 927 // Display dialog
928 bool ok; 928 bool ok;
929 QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this ); 929 QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this );
930 if ( !ok || package.isEmpty() ) 930 if ( !ok || package.isEmpty() )
931 return; 931 return;
932 // DownloadRemoteDlgImpl dlg( this, "Install", true ); 932 // DownloadRemoteDlgImpl dlg( this, "Install", true );
933 // if ( dlg.exec() == QDialog::Rejected ) 933 // if ( dlg.exec() == QDialog::Rejected )
934 // return; 934 // return;
935 935
936 // grab details from dialog 936 // grab details from dialog
937 // QString package = dlg.getPackageLocation(); 937 // QString package = dlg.getPackageLocation();
938 938
939 InstallData *item = new InstallData(); 939 InstallData *item = new InstallData();
940 item->option = "I"; 940 item->option = "I";
941 item->packageName = package; 941 item->packageName = package;
942 QList<InstallData> workingPackages; 942 QList<InstallData> workingPackages;
943 workingPackages.setAutoDelete( TRUE ); 943 workingPackages.setAutoDelete( TRUE );
944 workingPackages.append( item ); 944 workingPackages.append( item );
945 945
946 InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) ); 946 InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) );
947 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); 947 connect( dlg, SIGNAL( reloadData(InstallDlgImpl*) ), this, SLOT( reloadData(InstallDlgImpl*) ) );
948 reloadDocuments = TRUE; 948 reloadDocuments = TRUE;
949 stack->addWidget( dlg, 3 ); 949 stack->addWidget( dlg, 3 );
950 stack->raiseWidget( dlg ); 950 stack->raiseWidget( dlg );
951} 951}
952 952
953 953
954void MainWindow :: applyChanges() 954void MainWindow :: applyChanges()
955{ 955{
956 stickyOption = ""; 956 stickyOption = "";
957 957
958 // First, write out ipkg_conf file so that ipkg can use it 958 // First, write out ipkg_conf file so that ipkg can use it
959 mgr->writeOutIpkgConf(); 959 mgr->writeOutIpkgConf();
960 960
961 // Now for each selected item 961 // Now for each selected item
962 // deal with it 962 // deal with it
963 963
964 QList<InstallData> workingPackages; 964 QList<InstallData> workingPackages;
965 workingPackages.setAutoDelete( TRUE ); 965 workingPackages.setAutoDelete( TRUE );
966 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 966 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
967 item != 0 ; 967 item != 0 ;
968 item = (QCheckListItem *)item->nextSibling() ) 968 item = (QCheckListItem *)item->nextSibling() )
969 { 969 {
970 if ( item->isOn() ) 970 if ( item->isOn() )
971 { 971 {
972 InstallData *instdata = dealWithItem( item ); 972 InstallData *instdata = dealWithItem( item );
973 if ( instdata ) 973 if ( instdata )
974 workingPackages.append( instdata ); 974 workingPackages.append( instdata );
975 else 975 else
976 return; 976 return;
977 } 977 }
978 } 978 }
979 979
980 if ( workingPackages.count() == 0 ) 980 if ( workingPackages.count() == 0 )
981 { 981 {
982 // Nothing to do 982 // Nothing to do
983 QMessageBox::information( this, tr( "Nothing to do" ), 983 QMessageBox::information( this, tr( "Nothing to do" ),
984 tr( "No packages selected" ), tr( "OK" ) ); 984 tr( "No packages selected" ), tr( "OK" ) );
985 985
986 return; 986 return;
987 } 987 }
988 988
989 // do the stuff 989 // do the stuff
990 InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) ); 990 InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) );
991 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); 991 connect( dlg, SIGNAL( reloadData(InstallDlgImpl*) ), this, SLOT( reloadData(InstallDlgImpl*) ) );
992 reloadDocuments = TRUE; 992 reloadDocuments = TRUE;
993 stack->addWidget( dlg, 3 ); 993 stack->addWidget( dlg, 3 );
994 stack->raiseWidget( dlg ); 994 stack->raiseWidget( dlg );
995} 995}
996 996
997// decide what to do - either remove, upgrade or install 997// decide what to do - either remove, upgrade or install
998// Current rules: 998// Current rules:
999// If not installed - install 999// If not installed - install
1000// If installed and different version available - upgrade 1000// If installed and different version available - upgrade
1001// If installed and version up to date - remove 1001// If installed and version up to date - remove
1002InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) 1002InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
1003{ 1003{
1004 QString name = item->text(); 1004 QString name = item->text();
1005 1005
1006 // Get package 1006 // Get package
1007 Server *s = mgr->getServer( serversList->currentText() ); 1007 Server *s = mgr->getServer( serversList->currentText() );
1008 Package *p = s->getPackage( name ); 1008 Package *p = s->getPackage( name );
1009 1009
1010 // If the package has a filename then it is a local file 1010 // If the package has a filename then it is a local file
1011 if ( p->isPackageStoredLocally() ) 1011 if ( p->isPackageStoredLocally() )
1012 name = p->getFilename(); 1012 name = p->getFilename();
1013 1013
1014 QString option; 1014 QString option;
1015 QString dest = "root"; 1015 QString dest = "root";
1016 if ( !p->isInstalled() ) 1016 if ( !p->isInstalled() )
1017 { 1017 {
1018 InstallData *newitem = new InstallData(); 1018 InstallData *newitem = new InstallData();
1019 newitem->option = "I"; 1019 newitem->option = "I";
1020 newitem->packageName = name; 1020 newitem->packageName = name;
1021 return newitem; 1021 return newitem;
1022 } 1022 }
1023 else 1023 else
1024 { 1024 {
1025 InstallData *newitem = new InstallData(); 1025 InstallData *newitem = new InstallData();
1026 newitem->option = "D"; 1026 newitem->option = "D";
1027 // If local file, remove using package name, not filename 1027 // If local file, remove using package name, not filename
1028 if ( p->isPackageStoredLocally() ) 1028 if ( p->isPackageStoredLocally() )
1029 name = item->text(); 1029 name = item->text();
1030 1030
1031 if ( !p->isPackageStoredLocally() ) 1031 if ( !p->isPackageStoredLocally() )
1032 newitem->packageName = p->getInstalledPackageName(); 1032 newitem->packageName = p->getInstalledPackageName();
1033 else 1033 else
1034 newitem->packageName = name; 1034 newitem->packageName = name;
1035 1035
1036 if ( p->getInstalledTo() ) 1036 if ( p->getInstalledTo() )
1037 { 1037 {
1038 newitem->destination = p->getInstalledTo(); 1038 newitem->destination = p->getInstalledTo();
1039 } 1039 }
1040 else 1040 else
1041 { 1041 {
1042 newitem->destination = p->getLocalPackage()->getInstalledTo(); 1042 newitem->destination = p->getLocalPackage()->getInstalledTo();
1043 } 1043 }
1044 1044
1045 // Now see if version is newer or not 1045 // Now see if version is newer or not
1046 int val = compareVersions( p->getInstalledVersion(), p->getVersion() ); 1046 int val = compareVersions( p->getInstalledVersion(), p->getVersion() );
1047 1047
1048 // If the version requested is older and user selected a local ipk file, then reinstall the file 1048 // If the version requested is older and user selected a local ipk file, then reinstall the file
1049 if ( p->isPackageStoredLocally() && val == -1 ) 1049 if ( p->isPackageStoredLocally() && val == -1 )
1050 val = 0; 1050 val = 0;
1051 1051
1052 if ( val == -2 ) 1052 if ( val == -2 )
1053 { 1053 {
1054 // Error - should handle 1054 // Error - should handle
1055 } 1055 }
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp
index 6e9dd99..b9dbb6e 100644
--- a/noncore/settings/aqpkg/settingsimpl.cpp
+++ b/noncore/settings/aqpkg/settingsimpl.cpp
@@ -50,187 +50,187 @@
50/* STD */ 50/* STD */
51#include <fstream> 51#include <fstream>
52#include <algorithm> 52#include <algorithm>
53using namespace std; 53using namespace std;
54 54
55SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) 55SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
56 : QDialog( parent, name, modal, fl ) 56 : QDialog( parent, name, modal, fl )
57{ 57{
58 setCaption( tr( "Configuration" ) ); 58 setCaption( tr( "Configuration" ) );
59 59
60 // Setup layout to make everything pretty 60 // Setup layout to make everything pretty
61 QVBoxLayout *layout = new QVBoxLayout( this ); 61 QVBoxLayout *layout = new QVBoxLayout( this );
62 layout->setMargin( 2 ); 62 layout->setMargin( 2 );
63 layout->setSpacing( 4 ); 63 layout->setSpacing( 4 );
64 64
65 // Setup tabs for all info 65 // Setup tabs for all info
66 Opie::OTabWidget *tabwidget = new Opie::OTabWidget( this ); 66 Opie::OTabWidget *tabwidget = new Opie::OTabWidget( this );
67 layout->addWidget( tabwidget ); 67 layout->addWidget( tabwidget );
68 68
69 tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) ); 69 tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) );
70 tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) ); 70 tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) );
71 tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) ); 71 tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) );
72 tabwidget->setCurrentTab( tr( "Servers" ) ); 72 tabwidget->setCurrentTab( tr( "Servers" ) );
73 73
74 dataMgr = dataManager; 74 dataMgr = dataManager;
75 setupData(); 75 setupData();
76 changed = false; 76 changed = false;
77 newserver = false; 77 newserver = false;
78 newdestination = false; 78 newdestination = false;
79} 79}
80 80
81SettingsImpl :: ~SettingsImpl() 81SettingsImpl :: ~SettingsImpl()
82{ 82{
83} 83}
84 84
85bool SettingsImpl :: showDlg() 85bool SettingsImpl :: showDlg()
86{ 86{
87 QPEApplication::execDialog( this ); 87 QPEApplication::execDialog( this );
88 if ( changed ) 88 if ( changed )
89 dataMgr->writeOutIpkgConf(); 89 dataMgr->writeOutIpkgConf();
90 90
91 return changed; 91 return changed;
92} 92}
93 93
94QWidget *SettingsImpl :: initServerTab() 94QWidget *SettingsImpl :: initServerTab()
95{ 95{
96 QWidget *control = new QWidget( this ); 96 QWidget *control = new QWidget( this );
97 97
98 QVBoxLayout *vb = new QVBoxLayout( control ); 98 QVBoxLayout *vb = new QVBoxLayout( control );
99 99
100 QScrollView *sv = new QScrollView( control ); 100 QScrollView *sv = new QScrollView( control );
101 vb->addWidget( sv, 0, 0 ); 101 vb->addWidget( sv, 0, 0 );
102 sv->setResizePolicy( QScrollView::AutoOneFit ); 102 sv->setResizePolicy( QScrollView::AutoOneFit );
103 sv->setFrameStyle( QFrame::NoFrame ); 103 sv->setFrameStyle( QFrame::NoFrame );
104 104
105 QWidget *container = new QWidget( sv->viewport() ); 105 QWidget *container = new QWidget( sv->viewport() );
106 sv->addChild( container ); 106 sv->addChild( container );
107 107
108 QGridLayout *layout = new QGridLayout( container ); 108 QGridLayout *layout = new QGridLayout( container );
109 layout->setSpacing( 2 ); 109 layout->setSpacing( 2 );
110 layout->setMargin( 4 ); 110 layout->setMargin( 4 );
111 111
112 servers = new QListBox( container ); 112 servers = new QListBox( container );
113 servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); 113 servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
114 connect( servers, SIGNAL( highlighted( int ) ), this, SLOT( editServer( int ) ) ); 114 connect( servers, SIGNAL( highlighted(int) ), this, SLOT( editServer(int) ) );
115 layout->addMultiCellWidget( servers, 0, 0, 0, 1 ); 115 layout->addMultiCellWidget( servers, 0, 0, 0, 1 );
116 116
117 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); 117 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container );
118 connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) ); 118 connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) );
119 layout->addWidget( btn, 1, 0 ); 119 layout->addWidget( btn, 1, 0 );
120 120
121 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); 121 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
122 connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) ); 122 connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) );
123 layout->addWidget( btn, 1, 1 ); 123 layout->addWidget( btn, 1, 1 );
124 124
125 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); 125 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container );
126 grpbox->layout()->setSpacing( 2 ); 126 grpbox->layout()->setSpacing( 2 );
127 grpbox->layout()->setMargin( 4 ); 127 grpbox->layout()->setMargin( 4 );
128 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); 128 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 );
129 129
130 QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); 130 QGridLayout *grplayout = new QGridLayout( grpbox->layout() );
131 131
132 QLabel *label = new QLabel( tr( "Name:" ), grpbox ); 132 QLabel *label = new QLabel( tr( "Name:" ), grpbox );
133 grplayout->addWidget( label, 0, 0 ); 133 grplayout->addWidget( label, 0, 0 );
134 servername = new QLineEdit( grpbox ); 134 servername = new QLineEdit( grpbox );
135 grplayout->addWidget( servername, 0, 1 ); 135 grplayout->addWidget( servername, 0, 1 );
136 136
137 label = new QLabel( tr( "Address:" ), grpbox ); 137 label = new QLabel( tr( "Address:" ), grpbox );
138 grplayout->addWidget( label, 1, 0 ); 138 grplayout->addWidget( label, 1, 0 );
139 serverurl = new QLineEdit( grpbox ); 139 serverurl = new QLineEdit( grpbox );
140 grplayout->addWidget( serverurl, 1, 1 ); 140 grplayout->addWidget( serverurl, 1, 1 );
141 141
142 active = new QCheckBox( tr( "Active Server" ), grpbox ); 142 active = new QCheckBox( tr( "Active Server" ), grpbox );
143 grplayout->addMultiCellWidget( active, 2, 2, 0, 1 ); 143 grplayout->addMultiCellWidget( active, 2, 2, 0, 1 );
144 144
145 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); 145 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox );
146 connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) ); 146 connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) );
147 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); 147 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 );
148 148
149 return control; 149 return control;
150} 150}
151 151
152QWidget *SettingsImpl :: initDestinationTab() 152QWidget *SettingsImpl :: initDestinationTab()
153{ 153{
154 QWidget *control = new QWidget( this ); 154 QWidget *control = new QWidget( this );
155 155
156 QVBoxLayout *vb = new QVBoxLayout( control ); 156 QVBoxLayout *vb = new QVBoxLayout( control );
157 157
158 QScrollView *sv = new QScrollView( control ); 158 QScrollView *sv = new QScrollView( control );
159 vb->addWidget( sv, 0, 0 ); 159 vb->addWidget( sv, 0, 0 );
160 sv->setResizePolicy( QScrollView::AutoOneFit ); 160 sv->setResizePolicy( QScrollView::AutoOneFit );
161 sv->setFrameStyle( QFrame::NoFrame ); 161 sv->setFrameStyle( QFrame::NoFrame );
162 162
163 QWidget *container = new QWidget( sv->viewport() ); 163 QWidget *container = new QWidget( sv->viewport() );
164 sv->addChild( container ); 164 sv->addChild( container );
165 165
166 QGridLayout *layout = new QGridLayout( container ); 166 QGridLayout *layout = new QGridLayout( container );
167 layout->setSpacing( 2 ); 167 layout->setSpacing( 2 );
168 layout->setMargin( 4 ); 168 layout->setMargin( 4 );
169 169
170 destinations = new QListBox( container ); 170 destinations = new QListBox( container );
171 destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); 171 destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
172 connect( destinations, SIGNAL( highlighted( int ) ), this, SLOT( editDestination( int ) ) ); 172 connect( destinations, SIGNAL( highlighted(int) ), this, SLOT( editDestination(int) ) );
173 layout->addMultiCellWidget( destinations, 0, 0, 0, 1 ); 173 layout->addMultiCellWidget( destinations, 0, 0, 0, 1 );
174 174
175 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); 175 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container );
176 connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) ); 176 connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) );
177 layout->addWidget( btn, 1, 0 ); 177 layout->addWidget( btn, 1, 0 );
178 178
179 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); 179 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
180 connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) ); 180 connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) );
181 layout->addWidget( btn, 1, 1 ); 181 layout->addWidget( btn, 1, 1 );
182 182
183 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container ); 183 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container );
184 grpbox->layout()->setSpacing( 2 ); 184 grpbox->layout()->setSpacing( 2 );
185 grpbox->layout()->setMargin( 4 ); 185 grpbox->layout()->setMargin( 4 );
186 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); 186 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 );
187 187
188 QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); 188 QGridLayout *grplayout = new QGridLayout( grpbox->layout() );
189 189
190 QLabel *label = new QLabel( tr( "Name:" ), grpbox ); 190 QLabel *label = new QLabel( tr( "Name:" ), grpbox );
191 grplayout->addWidget( label, 0, 0 ); 191 grplayout->addWidget( label, 0, 0 );
192 destinationname = new QLineEdit( grpbox ); 192 destinationname = new QLineEdit( grpbox );
193 grplayout->addWidget( destinationname, 0, 1 ); 193 grplayout->addWidget( destinationname, 0, 1 );
194 194
195 label = new QLabel( tr( "Location:" ), grpbox ); 195 label = new QLabel( tr( "Location:" ), grpbox );
196 grplayout->addWidget( label, 1, 0 ); 196 grplayout->addWidget( label, 1, 0 );
197 destinationurl = new QLineEdit( grpbox ); 197 destinationurl = new QLineEdit( grpbox );
198 grplayout->addWidget( destinationurl, 1, 1 ); 198 grplayout->addWidget( destinationurl, 1, 1 );
199 199
200 linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox ); 200 linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox );
201 grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 ); 201 grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 );
202 202
203 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); 203 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox );
204 connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) ); 204 connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) );
205 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); 205 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 );
206 206
207 return control; 207 return control;
208} 208}
209 209
210QWidget *SettingsImpl :: initProxyTab() 210QWidget *SettingsImpl :: initProxyTab()
211{ 211{
212 QWidget *control = new QWidget( this ); 212 QWidget *control = new QWidget( this );
213 213
214 QVBoxLayout *vb = new QVBoxLayout( control ); 214 QVBoxLayout *vb = new QVBoxLayout( control );
215 215
216 QScrollView *sv = new QScrollView( control ); 216 QScrollView *sv = new QScrollView( control );
217 vb->addWidget( sv, 0, 0 ); 217 vb->addWidget( sv, 0, 0 );
218 sv->setResizePolicy( QScrollView::AutoOneFit ); 218 sv->setResizePolicy( QScrollView::AutoOneFit );
219 sv->setFrameStyle( QFrame::NoFrame ); 219 sv->setFrameStyle( QFrame::NoFrame );
220 220
221 QWidget *container = new QWidget( sv->viewport() ); 221 QWidget *container = new QWidget( sv->viewport() );
222 sv->addChild( container ); 222 sv->addChild( container );
223 223
224 QGridLayout *layout = new QGridLayout( container ); 224 QGridLayout *layout = new QGridLayout( container );
225 layout->setSpacing( 2 ); 225 layout->setSpacing( 2 );
226 layout->setMargin( 4 ); 226 layout->setMargin( 4 );
227 227
228 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); 228 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container );
229 grpbox->layout()->setSpacing( 2 ); 229 grpbox->layout()->setSpacing( 2 );
230 grpbox->layout()->setMargin( 4 ); 230 grpbox->layout()->setMargin( 4 );
231 layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); 231 layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 );
232 QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); 232 QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() );
233 txtHttpProxy = new QLineEdit( grpbox ); 233 txtHttpProxy = new QLineEdit( grpbox );
234 grplayout->addWidget( txtHttpProxy ); 234 grplayout->addWidget( txtHttpProxy );
235 chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); 235 chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox );
236 grplayout->addWidget( chkHttpProxyEnabled ); 236 grplayout->addWidget( chkHttpProxyEnabled );
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp
index 977c283..6b83bc9 100644
--- a/noncore/settings/backup/backuprestore.cpp
+++ b/noncore/settings/backup/backuprestore.cpp
@@ -1,119 +1,119 @@
1 1
2#include "backuprestore.h" 2#include "backuprestore.h"
3#include "errordialog.h" 3#include "errordialog.h"
4 4
5/* OPIE */ 5/* OPIE */
6#include <opie2/ostorageinfo.h> 6#include <opie2/ostorageinfo.h>
7#include <qpe/qpeapplication.h> 7#include <qpe/qpeapplication.h>
8 8
9/* QT */ 9/* QT */
10#include <qapplication.h> 10#include <qapplication.h>
11#include <qmultilineedit.h> 11#include <qmultilineedit.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qfile.h> 13#include <qfile.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlistview.h> 15#include <qlistview.h>
16#include <qpushbutton.h> 16#include <qpushbutton.h>
17#include <qheader.h> 17#include <qheader.h>
18#include <qpe/resource.h> 18#include <qpe/resource.h>
19#include <qpe/config.h> 19#include <qpe/config.h>
20#include <qmessagebox.h> 20#include <qmessagebox.h>
21#include <qcombobox.h> 21#include <qcombobox.h>
22#include <qlist.h> 22#include <qlist.h>
23#include <stdlib.h> 23#include <stdlib.h>
24#include <qregexp.h> 24#include <qregexp.h>
25#include <qtextstream.h> 25#include <qtextstream.h>
26#include <qtextview.h> 26#include <qtextview.h>
27 27
28/* STD */ 28/* STD */
29#include <errno.h> 29#include <errno.h>
30#include <stdlib.h> 30#include <stdlib.h>
31#include <unistd.h> 31#include <unistd.h>
32#include <sys/stat.h> 32#include <sys/stat.h>
33#include <dirent.h> 33#include <dirent.h>
34 34
35#define HEADER_NAME 0 35#define HEADER_NAME 0
36#define HEADER_BACKUP 1 36#define HEADER_BACKUP 1
37#define BACKUP_LOCATION 2 37#define BACKUP_LOCATION 2
38 38
39#define EXTENSION ".bck" 39#define EXTENSION ".bck"
40 40
41const QString tempFileName = "/tmp/backup.err"; 41const QString tempFileName = "/tmp/backup.err";
42 42
43 43
44BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl) 44BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl)
45 : BackupAndRestoreBase(parent, name, fl) 45 : BackupAndRestoreBase(parent, name, fl)
46{ 46{
47 backupList->header()->hide(); 47 backupList->header()->hide();
48 restoreList->header()->hide(); 48 restoreList->header()->hide();
49 connect(backupButton, SIGNAL(clicked()), 49 connect(backupButton, SIGNAL(clicked()),
50 this, SLOT(backup())); 50 this, SLOT(backup()));
51 connect(restoreButton, SIGNAL(clicked()), 51 connect(restoreButton, SIGNAL(clicked()),
52 this, SLOT(restore())); 52 this, SLOT(restore()));
53 connect(backupList, SIGNAL(clicked( QListViewItem * )), 53 connect(backupList, SIGNAL(clicked(QListViewItem*)),
54 this, SLOT(selectItem(QListViewItem*))); 54 this, SLOT(selectItem(QListViewItem*)));
55 connect(restoreSource, SIGNAL(activated( int )), 55 connect(restoreSource, SIGNAL(activated(int)),
56 this, SLOT(sourceDirChanged(int))); 56 this, SLOT(sourceDirChanged(int)));
57 connect(updateList, SIGNAL(clicked()), 57 connect(updateList, SIGNAL(clicked()),
58 this, SLOT( fileListUpdate())); 58 this, SLOT( fileListUpdate()));
59 59
60 //add directorys for backing up 60 //add directorys for backing up
61 applicationSettings = new QListViewItem(backupList, "Application Settings", "", "Settings/"); 61 applicationSettings = new QListViewItem(backupList, "Application Settings", "", "Settings/");
62 selectItem(applicationSettings); 62 selectItem(applicationSettings);
63 applicationSettings = new QListViewItem(backupList, "Application Data", "", "Applications/"); 63 applicationSettings = new QListViewItem(backupList, "Application Data", "", "Applications/");
64 selectItem(applicationSettings); 64 selectItem(applicationSettings);
65 documents= new QListViewItem(backupList, "Documents", "", "Documents/"); 65 documents= new QListViewItem(backupList, "Documents", "", "Documents/");
66 selectItem(documents); 66 selectItem(documents);
67 67
68 scanForApplicationSettings(); 68 scanForApplicationSettings();
69 69
70 OStorageInfo storage; 70 OStorageInfo storage;
71 71
72 backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" ); 72 backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" );
73 if ( storage.hasCf() ) 73 if ( storage.hasCf() )
74 { 74 {
75 backupLocations.insert( "CF", storage.cfPath() ); 75 backupLocations.insert( "CF", storage.cfPath() );
76 qDebug( "Cf Path: " + storage.cfPath() ); 76 qDebug( "Cf Path: " + storage.cfPath() );
77 } 77 }
78 if ( storage.hasSd() ) 78 if ( storage.hasSd() )
79 { 79 {
80 backupLocations.insert( "SD", storage.sdPath() ); 80 backupLocations.insert( "SD", storage.sdPath() );
81 qDebug( " Sd Path: " + storage.sdPath() ); 81 qDebug( " Sd Path: " + storage.sdPath() );
82 } 82 }
83 if ( storage.hasMmc() ) 83 if ( storage.hasMmc() )
84 { 84 {
85 backupLocations.insert( "MMC", storage.mmcPath() ); 85 backupLocations.insert( "MMC", storage.mmcPath() );
86 qDebug( "Mmc Path: " + storage.mmcPath() ); 86 qDebug( "Mmc Path: " + storage.mmcPath() );
87 } 87 }
88 88
89 Config config("BackupAndRestore"); 89 Config config("BackupAndRestore");
90 //read last locations 90 //read last locations
91 config.setGroup("LastLocation"); 91 config.setGroup("LastLocation");
92 QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" ); 92 QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" );
93 QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" ); 93 QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" );
94 int locationIndex = 0; 94 int locationIndex = 0;
95 95
96 QMap<QString, QString>::Iterator it; 96 QMap<QString, QString>::Iterator it;
97 for( it = backupLocations.begin(); it != backupLocations.end(); ++it ) 97 for( it = backupLocations.begin(); it != backupLocations.end(); ++it )
98 { 98 {
99 storeToLocation->insertItem(it.key()); 99 storeToLocation->insertItem(it.key());
100 restoreSource->insertItem(it.key()); 100 restoreSource->insertItem(it.key());
101 101
102 //check for last locations 102 //check for last locations
103 if ( it.key() == lastStoreLocation ) 103 if ( it.key() == lastStoreLocation )
104 storeToLocation->setCurrentItem( locationIndex ); 104 storeToLocation->setCurrentItem( locationIndex );
105 if ( it.key() == lastRestoreLocation ) 105 if ( it.key() == lastRestoreLocation )
106 restoreSource->setCurrentItem( locationIndex ); 106 restoreSource->setCurrentItem( locationIndex );
107 locationIndex++; 107 locationIndex++;
108 } 108 }
109 109
110 // Read the list of items to ignore. 110 // Read the list of items to ignore.
111 QList<QString> dontBackupList; 111 QList<QString> dontBackupList;
112 dontBackupList.setAutoDelete(true); 112 dontBackupList.setAutoDelete(true);
113 config.setGroup("DontBackup"); 113 config.setGroup("DontBackup");
114 int total = config.readNumEntry("Total", 0); 114 int total = config.readNumEntry("Total", 0);
115 for(int i = 0; i < total; i++) 115 for(int i = 0; i < total; i++)
116 { 116 {
117 dontBackupList.append(new QString(config.readEntry(QString("%1").arg(i), ""))); 117 dontBackupList.append(new QString(config.readEntry(QString("%1").arg(i), "")));
118 } 118 }
119 119
diff --git a/noncore/settings/netsystemtime/mainwindow.cpp b/noncore/settings/netsystemtime/mainwindow.cpp
index 7df41d4..c995d6e 100644
--- a/noncore/settings/netsystemtime/mainwindow.cpp
+++ b/noncore/settings/netsystemtime/mainwindow.cpp
@@ -16,152 +16,152 @@
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "mainwindow.h" 29#include "mainwindow.h"
30#include "timetabwidget.h" 30#include "timetabwidget.h"
31#include "formattabwidget.h" 31#include "formattabwidget.h"
32#include "settingstabwidget.h" 32#include "settingstabwidget.h"
33#include "ntptabwidget.h" 33#include "ntptabwidget.h"
34#include "predicttabwidget.h" 34#include "predicttabwidget.h"
35 35
36#include <qpe/config.h> 36#include <qpe/config.h>
37#include <qpe/datebookdb.h> 37#include <qpe/datebookdb.h>
38#include <qpe/qpeapplication.h> 38#include <qpe/qpeapplication.h>
39#include <qpe/qpedialog.h> 39#include <qpe/qpedialog.h>
40 40
41#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) 41#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
42#include <qpe/qcopenvelope_qws.h> 42#include <qpe/qcopenvelope_qws.h>
43#endif 43#endif
44 44
45#include <qlayout.h> 45#include <qlayout.h>
46#include <qmessagebox.h> 46#include <qmessagebox.h>
47#include <qsocket.h> 47#include <qsocket.h>
48#include <qstring.h> 48#include <qstring.h>
49#include <qtimer.h> 49#include <qtimer.h>
50 50
51MainWindow::MainWindow( QWidget *parent , const char *name, bool modal, WFlags f ) 51MainWindow::MainWindow( QWidget *parent , const char *name, bool modal, WFlags f )
52 : QDialog( 0x0, 0x0, TRUE, 0 ) 52 : QDialog( 0x0, 0x0, TRUE, 0 )
53{ 53{
54 setCaption( tr( "SystemTime" ) ); 54 setCaption( tr( "SystemTime" ) );
55 55
56 QVBoxLayout *layout = new QVBoxLayout( this ); 56 QVBoxLayout *layout = new QVBoxLayout( this );
57 layout->setMargin( 2 ); 57 layout->setMargin( 2 );
58 layout->setSpacing( 4 ); 58 layout->setSpacing( 4 );
59 59
60 // Create main tabbed control 60 // Create main tabbed control
61 mainWidget = new OTabWidget( this ); 61 mainWidget = new OTabWidget( this );
62 62
63 // Default object pointers to null 63 // Default object pointers to null
64 ntpProcess = 0x0; 64 ntpProcess = 0x0;
65 ntpTab = 0x0; 65 ntpTab = 0x0;
66 66
67 // Add tab widgets 67 // Add tab widgets
68 mainWidget->addTab( timeTab = new TimeTabWidget( mainWidget ), "netsystemtime/DateTime", tr( "Time" ) ); 68 mainWidget->addTab( timeTab = new TimeTabWidget( mainWidget ), "netsystemtime/DateTime", tr( "Time" ) );
69 mainWidget->addTab( formatTab = new FormatTabWidget( mainWidget ), "netsystemtime/formattab", tr( "Format" ) ); 69 mainWidget->addTab( formatTab = new FormatTabWidget( mainWidget ), "netsystemtime/formattab", tr( "Format" ) );
70 mainWidget->addTab( settingsTab = new SettingsTabWidget( mainWidget ), "SettingsIcon", tr( "Settings" ) ); 70 mainWidget->addTab( settingsTab = new SettingsTabWidget( mainWidget ), "SettingsIcon", tr( "Settings" ) );
71 mainWidget->addTab( predictTab = new PredictTabWidget( mainWidget ), "netsystemtime/predicttab", tr( "Predict" ) ); 71 mainWidget->addTab( predictTab = new PredictTabWidget( mainWidget ), "netsystemtime/predicttab", tr( "Predict" ) );
72 Config config( "ntp" ); 72 Config config( "ntp" );
73 config.setGroup( "settings" ); 73 config.setGroup( "settings" );
74 slotDisplayNTPTab( config.readBoolEntry( "displayNtpTab", FALSE ) ); 74 slotDisplayNTPTab( config.readBoolEntry( "displayNtpTab", FALSE ) );
75 slotDisplayPredictTab( config.readBoolEntry( "displayPredictTab", FALSE ) ); 75 slotDisplayPredictTab( config.readBoolEntry( "displayPredictTab", FALSE ) );
76 76
77 mainWidget->setCurrentTab( tr( "Time" ) ); 77 mainWidget->setCurrentTab( tr( "Time" ) );
78 layout->addWidget( mainWidget ); 78 layout->addWidget( mainWidget );
79 79
80 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), 80 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)),
81 this, SLOT(slotQCopReceive(const QCString&, const QByteArray&)) ); 81 this, SLOT(slotQCopReceive(const QCString&,const QByteArray&)) );
82 82
83 83
84 // Create NTP socket 84 // Create NTP socket
85 ntpSock = new QSocket( this ); 85 ntpSock = new QSocket( this );
86 connect( ntpSock, SIGNAL(error(int)),SLOT(slotCheckNtp(int)) ); 86 connect( ntpSock, SIGNAL(error(int)),SLOT(slotCheckNtp(int)) );
87 slotProbeNTPServer(); 87 slotProbeNTPServer();
88 88
89 // Create timer for automatic time lookups 89 // Create timer for automatic time lookups
90 ntpTimer = new QTimer( this ); 90 ntpTimer = new QTimer( this );
91 91
92 // Connect everything together 92 // Connect everything together
93 connect( timeTab, SIGNAL(getNTPTime()), this, SLOT(slotGetNTPTime()) ); 93 connect( timeTab, SIGNAL(getNTPTime()), this, SLOT(slotGetNTPTime()) );
94 connect( timeTab, SIGNAL(tzChanged(const QString &)), predictTab, SLOT(slotTZChanged(const QString &)) ); 94 connect( timeTab, SIGNAL(tzChanged(const QString&)), predictTab, SLOT(slotTZChanged(const QString&)) );
95 connect( timeTab, SIGNAL(getPredictedTime()), predictTab, SLOT(slotSetPredictedTime()) ); 95 connect( timeTab, SIGNAL(getPredictedTime()), predictTab, SLOT(slotSetPredictedTime()) );
96 connect( formatTab, SIGNAL(show12HourTime(int)), timeTab, SLOT(slotUse12HourTime( int )) ); 96 connect( formatTab, SIGNAL(show12HourTime(int)), timeTab, SLOT(slotUse12HourTime(int)) );
97 connect( formatTab, SIGNAL(dateFormatChanged(const DateFormat &)), 97 connect( formatTab, SIGNAL(dateFormatChanged(const DateFormat&)),
98 timeTab, SLOT(slotDateFormatChanged(const DateFormat &)) ); 98 timeTab, SLOT(slotDateFormatChanged(const DateFormat&)) );
99 connect( formatTab, SIGNAL(weekStartChanged(int)), timeTab, SLOT(slotWeekStartChanged(int)) ); 99 connect( formatTab, SIGNAL(weekStartChanged(int)), timeTab, SLOT(slotWeekStartChanged(int)) );
100 connect( settingsTab, SIGNAL(ntpDelayChanged(int)), this, SLOT(slotNTPDelayChanged(int)) ); 100 connect( settingsTab, SIGNAL(ntpDelayChanged(int)), this, SLOT(slotNTPDelayChanged(int)) );
101 connect( settingsTab, SIGNAL(displayNTPTab(bool)), this, SLOT(slotDisplayNTPTab(bool)) ); 101 connect( settingsTab, SIGNAL(displayNTPTab(bool)), this, SLOT(slotDisplayNTPTab(bool)) );
102 connect( settingsTab, SIGNAL(displayPredictTab(bool)), this, SLOT(slotDisplayPredictTab(bool)) ); 102 connect( settingsTab, SIGNAL(displayPredictTab(bool)), this, SLOT(slotDisplayPredictTab(bool)) );
103 connect( predictTab, SIGNAL(setTime(const QDateTime &)), this, SLOT(slotSetTime(const QDateTime &)) ); 103 connect( predictTab, SIGNAL(setTime(const QDateTime&)), this, SLOT(slotSetTime(const QDateTime&)) );
104 104
105 // Do initial time server check 105 // Do initial time server check
106 slotNTPDelayChanged( config.readNumEntry( "ntpRefreshFreq", 1440 ) ); 106 slotNTPDelayChanged( config.readNumEntry( "ntpRefreshFreq", 1440 ) );
107 slotCheckNtp( -1 ); 107 slotCheckNtp( -1 );
108 108
109 // Display app 109 // Display app
110 //showMaximized(); 110 //showMaximized();
111 (void)new QPEDialogListener(this); 111 (void)new QPEDialogListener(this);
112} 112}
113 113
114MainWindow::~MainWindow() 114MainWindow::~MainWindow()
115{ 115{
116 if ( ntpProcess ) 116 if ( ntpProcess )
117 delete ntpProcess; 117 delete ntpProcess;
118} 118}
119 119
120void MainWindow::accept() 120void MainWindow::accept()
121{ 121{
122 // Turn off the screensaver (Note: needs to be encased in { } so that it deconstructs and sends) 122 // Turn off the screensaver (Note: needs to be encased in { } so that it deconstructs and sends)
123 { 123 {
124 QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); 124 QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
125 disableScreenSaver << 0 << 0 << 0; 125 disableScreenSaver << 0 << 0 << 0;
126 } 126 }
127 127
128 // Update the systemtime 128 // Update the systemtime
129 timeTab->saveSettings( TRUE ); 129 timeTab->saveSettings( TRUE );
130 130
131 // Save format options 131 // Save format options
132 formatTab->saveSettings( TRUE ); 132 formatTab->saveSettings( TRUE );
133 133
134 // Save settings options 134 // Save settings options
135 settingsTab->saveSettings(); 135 settingsTab->saveSettings();
136 136
137 // Since time has changed quickly load in the DateBookDB to allow the alarm server to get a better 137 // Since time has changed quickly load in the DateBookDB to allow the alarm server to get a better
138 // grip on itself (example re-trigger alarms for when we travel back in time). 138 // grip on itself (example re-trigger alarms for when we travel back in time).
139 DateBookDB db; 139 DateBookDB db;
140 140
141 // Turn back on the screensaver 141 // Turn back on the screensaver
142 QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); 142 QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
143 enableScreenSaver << -1 << -1 << -1; 143 enableScreenSaver << -1 << -1 << -1;
144 144
145 // Exit app 145 // Exit app
146 qApp->quit(); 146 qApp->quit();
147} 147}
148 148
149void MainWindow::reject() 149void MainWindow::reject()
150{ 150{
151 // Reset time settings 151 // Reset time settings
152 timeTab->saveSettings( FALSE ); 152 timeTab->saveSettings( FALSE );
153 153
154 // Send notifications but do not save settings 154 // Send notifications but do not save settings
155 formatTab->saveSettings( FALSE ); 155 formatTab->saveSettings( FALSE );
156 156
157 // Exit app 157 // Exit app
158 qApp->quit(); 158 qApp->quit();
159} 159}
160 160
161void MainWindow::runNTP() 161void MainWindow::runNTP()
162{ 162{
163 if ( !ntpDelayElapsed() && ntpInteractive ) 163 if ( !ntpDelayElapsed() && ntpInteractive )
164 { 164 {
165 QString msg = tr( "You asked for a delay of %1 minutes, but only %2 minutes elapsed since last lookup.<br>Continue?" ).arg( QString::number( ntpDelay ) ).arg( QString::number( _lookupDiff / 60 ) ); 165 QString msg = tr( "You asked for a delay of %1 minutes, but only %2 minutes elapsed since last lookup.<br>Continue?" ).arg( QString::number( ntpDelay ) ).arg( QString::number( _lookupDiff / 60 ) );
166 166
167 switch ( 167 switch (
diff --git a/noncore/settings/netsystemtime/settingstabwidget.cpp b/noncore/settings/netsystemtime/settingstabwidget.cpp
index 2a7e28d..ad80e05 100644
--- a/noncore/settings/netsystemtime/settingstabwidget.cpp
+++ b/noncore/settings/netsystemtime/settingstabwidget.cpp
@@ -17,134 +17,134 @@
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "settingstabwidget.h" 29#include "settingstabwidget.h"
30 30
31#include <qpe/config.h> 31#include <qpe/config.h>
32#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
33 33
34#include <qcheckbox.h> 34#include <qcheckbox.h>
35#include <qcombobox.h> 35#include <qcombobox.h>
36#include <qlabel.h> 36#include <qlabel.h>
37#include <qlayout.h> 37#include <qlayout.h>
38#include <qscrollview.h> 38#include <qscrollview.h>
39#include <qspinbox.h> 39#include <qspinbox.h>
40 40
41SettingsTabWidget::SettingsTabWidget( QWidget *parent ) 41SettingsTabWidget::SettingsTabWidget( QWidget *parent )
42 : QWidget( parent, 0x0, 0 ) 42 : QWidget( parent, 0x0, 0 )
43{ 43{
44 QVBoxLayout *tmpvb = new QVBoxLayout( this ); 44 QVBoxLayout *tmpvb = new QVBoxLayout( this );
45 QScrollView *sv = new QScrollView( this ); 45 QScrollView *sv = new QScrollView( this );
46 tmpvb->addWidget( sv, 0, 0 ); 46 tmpvb->addWidget( sv, 0, 0 );
47 sv->setResizePolicy( QScrollView::AutoOneFit ); 47 sv->setResizePolicy( QScrollView::AutoOneFit );
48 sv->setFrameStyle( QFrame::NoFrame ); 48 sv->setFrameStyle( QFrame::NoFrame );
49 QWidget *container = new QWidget( sv->viewport() ); 49 QWidget *container = new QWidget( sv->viewport() );
50 sv->addChild( container ); 50 sv->addChild( container );
51 51
52 QGridLayout *layout = new QGridLayout( container ); 52 QGridLayout *layout = new QGridLayout( container );
53 layout->setMargin( 2 ); 53 layout->setMargin( 2 );
54 layout->setSpacing( 4 ); 54 layout->setSpacing( 4 );
55 55
56 // Time server selector 56 // Time server selector
57 layout->addWidget( new QLabel( tr( "Time server" ), container ), 0, 0 ); 57 layout->addWidget( new QLabel( tr( "Time server" ), container ), 0, 0 );
58 cbTimeServer = new QComboBox( TRUE, container ); 58 cbTimeServer = new QComboBox( TRUE, container );
59 layout->addMultiCellWidget( cbTimeServer, 1, 1, 0, 1 ); 59 layout->addMultiCellWidget( cbTimeServer, 1, 1, 0, 1 );
60 60
61 // Lookup delay selector 61 // Lookup delay selector
62 layout->addWidget( new QLabel( tr( "minutes between time updates" ), container ), 2, 1 ); 62 layout->addWidget( new QLabel( tr( "minutes between time updates" ), container ), 2, 1 );
63 sbNtpDelay = new QSpinBox( 1, 9999999, 1, container ); 63 sbNtpDelay = new QSpinBox( 1, 9999999, 1, container );
64 sbNtpDelay->setWrapping( TRUE ); 64 sbNtpDelay->setWrapping( TRUE );
65 sbNtpDelay->setMaximumWidth( 50 ); 65 sbNtpDelay->setMaximumWidth( 50 );
66 connect( sbNtpDelay, SIGNAL(valueChanged(int)), this, SIGNAL(ntpDelayChanged(int)) ); 66 connect( sbNtpDelay, SIGNAL(valueChanged(int)), this, SIGNAL(ntpDelayChanged(int)) );
67 layout->addWidget( sbNtpDelay, 2, 0 ); 67 layout->addWidget( sbNtpDelay, 2, 0 );
68 68
69 // Prediction delay selector 69 // Prediction delay selector
70 layout->addWidget( new QLabel( tr( "minutes between prediction updates" ), container ), 3, 1 ); 70 layout->addWidget( new QLabel( tr( "minutes between prediction updates" ), container ), 3, 1 );
71 sbPredictDelay = new QSpinBox( 42, 9999999, 1, container ); 71 sbPredictDelay = new QSpinBox( 42, 9999999, 1, container );
72 sbPredictDelay->setWrapping( TRUE ); 72 sbPredictDelay->setWrapping( TRUE );
73 sbPredictDelay->setMaximumWidth( 50 ); 73 sbPredictDelay->setMaximumWidth( 50 );
74 layout->addWidget( sbPredictDelay, 3, 0 ); 74 layout->addWidget( sbPredictDelay, 3, 0 );
75 75
76 // Space filler 76 // Space filler
77 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 4, 0 ); 77 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 4, 0 );
78 78
79 // Display time server information selector 79 // Display time server information selector
80 chNtpTab = new QCheckBox( tr( "Display time server information" ), container ); 80 chNtpTab = new QCheckBox( tr( "Display time server information" ), container );
81 connect( chNtpTab, SIGNAL( toggled( bool ) ), this, SIGNAL( displayNTPTab( bool ) ) ); 81 connect( chNtpTab, SIGNAL( toggled(bool) ), this, SIGNAL( displayNTPTab(bool) ) );
82 layout->addMultiCellWidget( chNtpTab, 5, 5, 0, 1 ); 82 layout->addMultiCellWidget( chNtpTab, 5, 5, 0, 1 );
83 83
84 // Display time prediction information selector 84 // Display time prediction information selector
85 chPredictTab = new QCheckBox( tr( "Display time prediction information" ), container ); 85 chPredictTab = new QCheckBox( tr( "Display time prediction information" ), container );
86 connect( chPredictTab, SIGNAL( toggled( bool ) ), this, SIGNAL( displayPredictTab( bool ) ) ); 86 connect( chPredictTab, SIGNAL( toggled(bool) ), this, SIGNAL( displayPredictTab(bool) ) );
87 layout->addMultiCellWidget( chPredictTab, 6, 6, 0, 1 ); 87 layout->addMultiCellWidget( chPredictTab, 6, 6, 0, 1 );
88 88
89 // Space filler 89 // Space filler
90 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 7, 0 ); 90 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 7, 0 );
91 91
92 // Initialize values 92 // Initialize values
93 QString ntpSrvsFile = QPEApplication::qpeDir(); 93 QString ntpSrvsFile = QPEApplication::qpeDir();
94 ntpSrvsFile.append( "etc/ntpservers" ); 94 ntpSrvsFile.append( "etc/ntpservers" );
95 Config ntpSrvs( ntpSrvsFile, Config::File ); 95 Config ntpSrvs( ntpSrvsFile, Config::File );
96 ntpSrvs.setGroup( "servers" ); 96 ntpSrvs.setGroup( "servers" );
97 int srvCount = ntpSrvs.readNumEntry( "count", 0 ); 97 int srvCount = ntpSrvs.readNumEntry( "count", 0 );
98 for ( int i = 0; i < srvCount; i++ ) 98 for ( int i = 0; i < srvCount; i++ )
99 { 99 {
100 ntpSrvs.setGroup( QString::number( i ) ); 100 ntpSrvs.setGroup( QString::number( i ) );
101 cbTimeServer->insertItem( ntpSrvs.readEntry( "name" ) ); 101 cbTimeServer->insertItem( ntpSrvs.readEntry( "name" ) );
102 } 102 }
103 if ( srvCount==0 ) 103 if ( srvCount==0 )
104 cbTimeServer->insertItem( "time.fu-berlin.de" ); 104 cbTimeServer->insertItem( "time.fu-berlin.de" );
105 105
106 Config config( "ntp" ); 106 Config config( "ntp" );
107 config.setGroup( "settings" ); 107 config.setGroup( "settings" );
108 sbPredictDelay->setValue( config.readNumEntry( "minLookupDiff", 720 ) ); 108 sbPredictDelay->setValue( config.readNumEntry( "minLookupDiff", 720 ) );
109 sbNtpDelay->setValue( config.readNumEntry( "ntpRefreshFreq", 1440 ) ); 109 sbNtpDelay->setValue( config.readNumEntry( "ntpRefreshFreq", 1440 ) );
110 cbTimeServer->setCurrentItem( config.readNumEntry( "ntpServer", 0 ) ); 110 cbTimeServer->setCurrentItem( config.readNumEntry( "ntpServer", 0 ) );
111 chNtpTab->setChecked( config.readBoolEntry( "displayNtpTab", FALSE ) ); 111 chNtpTab->setChecked( config.readBoolEntry( "displayNtpTab", FALSE ) );
112 chPredictTab->setChecked( config.readBoolEntry( "displayPredictTab", FALSE ) ); 112 chPredictTab->setChecked( config.readBoolEntry( "displayPredictTab", FALSE ) );
113} 113}
114 114
115SettingsTabWidget::~SettingsTabWidget() 115SettingsTabWidget::~SettingsTabWidget()
116{ 116{
117} 117}
118 118
119void SettingsTabWidget::saveSettings() 119void SettingsTabWidget::saveSettings()
120{ 120{
121 int srvCount = cbTimeServer->count(); 121 int srvCount = cbTimeServer->count();
122 bool serversChanged = TRUE; 122 bool serversChanged = TRUE;
123 int curSrv = cbTimeServer->currentItem(); 123 int curSrv = cbTimeServer->currentItem();
124 QString edit = cbTimeServer->currentText(); 124 QString edit = cbTimeServer->currentText();
125 for ( int i = 0; i < srvCount; i++ ) 125 for ( int i = 0; i < srvCount; i++ )
126 { 126 {
127 if ( edit == cbTimeServer->text( i ) ) 127 if ( edit == cbTimeServer->text( i ) )
128 serversChanged = FALSE; 128 serversChanged = FALSE;
129 } 129 }
130 if ( serversChanged ) 130 if ( serversChanged )
131 { 131 {
132 QString ntpSrvsFile = QPEApplication::qpeDir(); 132 QString ntpSrvsFile = QPEApplication::qpeDir();
133 ntpSrvsFile.append( "etc/ntpservers" ); 133 ntpSrvsFile.append( "etc/ntpservers" );
134 Config ntpSrvs( ntpSrvsFile, Config::File ); 134 Config ntpSrvs( ntpSrvsFile, Config::File );
135 ntpSrvs.setGroup( "servers" ); 135 ntpSrvs.setGroup( "servers" );
136 ntpSrvs.writeEntry( "count", ++srvCount ); 136 ntpSrvs.writeEntry( "count", ++srvCount );
137 ntpSrvs.setGroup( "0" ); 137 ntpSrvs.setGroup( "0" );
138 ntpSrvs.writeEntry( "name", edit ); 138 ntpSrvs.writeEntry( "name", edit );
139 curSrv = 0; 139 curSrv = 0;
140 for ( int i = 1; i < srvCount; i++ ) 140 for ( int i = 1; i < srvCount; i++ )
141 { 141 {
142 // qDebug( "ntpSrvs[%i/%i]=%s", i, srvCount, cbTimeServer->text( i ).latin1() ); 142 // qDebug( "ntpSrvs[%i/%i]=%s", i, srvCount, cbTimeServer->text( i ).latin1() );
143 ntpSrvs.setGroup( QString::number( i ) ); 143 ntpSrvs.setGroup( QString::number( i ) );
144 ntpSrvs.writeEntry( "name", cbTimeServer->text( i-1 ) ); 144 ntpSrvs.writeEntry( "name", cbTimeServer->text( i-1 ) );
145 } 145 }
146 } 146 }
147 Config config( "ntp", Config::User ); 147 Config config( "ntp", Config::User );
148 config.setGroup( "settings" ); 148 config.setGroup( "settings" );
149 config.writeEntry( "ntpServer", curSrv ); 149 config.writeEntry( "ntpServer", curSrv );
150 config.writeEntry( "minLookupDiff", sbPredictDelay->value() ); 150 config.writeEntry( "minLookupDiff", sbPredictDelay->value() );
diff --git a/noncore/settings/netsystemtime/timetabwidget.cpp b/noncore/settings/netsystemtime/timetabwidget.cpp
index 6f24462..1ea460e 100644
--- a/noncore/settings/netsystemtime/timetabwidget.cpp
+++ b/noncore/settings/netsystemtime/timetabwidget.cpp
@@ -41,129 +41,129 @@
41#include <qcombobox.h> 41#include <qcombobox.h>
42#include <qdatetime.h> 42#include <qdatetime.h>
43#include <qframe.h> 43#include <qframe.h>
44#include <qlabel.h> 44#include <qlabel.h>
45#include <qlayout.h> 45#include <qlayout.h>
46#include <qpushbutton.h> 46#include <qpushbutton.h>
47#include <qscrollview.h> 47#include <qscrollview.h>
48#include <qspinbox.h> 48#include <qspinbox.h>
49 49
50#include <stdlib.h> 50#include <stdlib.h>
51#include <sys/time.h> 51#include <sys/time.h>
52 52
53static const int ValueAM = 0; 53static const int ValueAM = 0;
54static const int ValuePM = 1; 54static const int ValuePM = 1;
55 55
56TimeTabWidget::TimeTabWidget( QWidget *parent ) 56TimeTabWidget::TimeTabWidget( QWidget *parent )
57 : QWidget( parent, 0x0, 0 ) 57 : QWidget( parent, 0x0, 0 )
58{ 58{
59 // Synchronize HW clock to systemtime 59 // Synchronize HW clock to systemtime
60 // This app will update systemtime 60 // This app will update systemtime
61 // - if Cancel is clicked, will reset systemtime to HW clock's time 61 // - if Cancel is clicked, will reset systemtime to HW clock's time
62 // - if Ok is clicked, will leave systemtime as is 62 // - if Ok is clicked, will leave systemtime as is
63 system("/sbin/hwclock --systohc --utc"); 63 system("/sbin/hwclock --systohc --utc");
64 64
65 QVBoxLayout *tmpvb = new QVBoxLayout( this ); 65 QVBoxLayout *tmpvb = new QVBoxLayout( this );
66 QScrollView *sv = new QScrollView( this ); 66 QScrollView *sv = new QScrollView( this );
67 tmpvb->addWidget( sv, 0, 0 ); 67 tmpvb->addWidget( sv, 0, 0 );
68 sv->setResizePolicy( QScrollView::AutoOneFit ); 68 sv->setResizePolicy( QScrollView::AutoOneFit );
69 sv->setFrameStyle( QFrame::NoFrame ); 69 sv->setFrameStyle( QFrame::NoFrame );
70 QWidget *container = new QWidget( sv->viewport() ); 70 QWidget *container = new QWidget( sv->viewport() );
71 sv->addChild( container ); 71 sv->addChild( container );
72 72
73 QGridLayout *layout = new QGridLayout( container ); 73 QGridLayout *layout = new QGridLayout( container );
74 layout->setMargin( 2 ); 74 layout->setMargin( 2 );
75 layout->setSpacing( 4 ); 75 layout->setSpacing( 4 );
76 76
77 // Hours 77 // Hours
78 layout->addMultiCellWidget( new QLabel( tr( "Hour" ), container ), 1, 1, 0, 1 ); 78 layout->addMultiCellWidget( new QLabel( tr( "Hour" ), container ), 1, 1, 0, 1 );
79 sbHour = new QSpinBox( container ); 79 sbHour = new QSpinBox( container );
80 sbHour->setWrapping( TRUE ); 80 sbHour->setWrapping( TRUE );
81 layout->addMultiCellWidget( sbHour, 2, 2, 0, 1 ); 81 layout->addMultiCellWidget( sbHour, 2, 2, 0, 1 );
82 82
83 // Minutes 83 // Minutes
84 layout->addMultiCellWidget( new QLabel( tr( "Minute" ), container ), 1, 1, 2, 3 ); 84 layout->addMultiCellWidget( new QLabel( tr( "Minute" ), container ), 1, 1, 2, 3 );
85 sbMin = new QSpinBox( container ); 85 sbMin = new QSpinBox( container );
86 sbMin->setWrapping( TRUE ); 86 sbMin->setWrapping( TRUE );
87 sbMin->setMinValue( 0 ); 87 sbMin->setMinValue( 0 );
88 sbMin->setMaxValue( 59 ); 88 sbMin->setMaxValue( 59 );
89 layout->addMultiCellWidget( sbMin, 2, 2, 2, 3 ); 89 layout->addMultiCellWidget( sbMin, 2, 2, 2, 3 );
90 90
91 // AM/PM 91 // AM/PM
92 cbAmpm = new QComboBox( container ); 92 cbAmpm = new QComboBox( container );
93 cbAmpm->insertItem( tr( "AM" ), ValueAM ); 93 cbAmpm->insertItem( tr( "AM" ), ValueAM );
94 cbAmpm->insertItem( tr( "PM" ), ValuePM ); 94 cbAmpm->insertItem( tr( "PM" ), ValuePM );
95 layout->addMultiCellWidget( cbAmpm, 2, 2, 4, 5 ); 95 layout->addMultiCellWidget( cbAmpm, 2, 2, 4, 5 );
96 96
97 // Date 97 // Date
98 layout->addWidget( new QLabel( tr( "Date" ), container ), 4, 0 ); 98 layout->addWidget( new QLabel( tr( "Date" ), container ), 4, 0 );
99 btnDate = new DateButton( TRUE, container ); 99 btnDate = new DateButton( TRUE, container );
100 layout->addMultiCellWidget( btnDate, 4, 4, 1, 5 ); 100 layout->addMultiCellWidget( btnDate, 4, 4, 1, 5 );
101 101
102 // Timezone 102 // Timezone
103 layout->addMultiCellWidget( new QLabel( tr( "Time zone" ), container ), 6, 6, 0, 1 ); 103 layout->addMultiCellWidget( new QLabel( tr( "Time zone" ), container ), 6, 6, 0, 1 );
104 selTimeZone = new TimeZoneSelector( container ); 104 selTimeZone = new TimeZoneSelector( container );
105 connect( selTimeZone, SIGNAL(signalNewTz(const QString &)), this, SLOT(slotTZChanged(const QString &)) ); 105 connect( selTimeZone, SIGNAL(signalNewTz(const QString&)), this, SLOT(slotTZChanged(const QString&)) );
106 layout->addMultiCellWidget( selTimeZone, 6, 6, 2, 5 ); 106 layout->addMultiCellWidget( selTimeZone, 6, 6, 2, 5 );
107 107
108 // Space filler 108 // Space filler
109 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 7, 0 ); 109 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 7, 0 );
110 110
111 // Set NTP time button 111 // Set NTP time button
112 QPushButton *pb = new QPushButton( Resource::loadPixmap( "netsystemtime/ntptab" ), 112 QPushButton *pb = new QPushButton( Resource::loadPixmap( "netsystemtime/ntptab" ),
113 tr( "Get time from the network" ), container ); 113 tr( "Get time from the network" ), container );
114 connect( pb, SIGNAL(clicked()), this, SIGNAL(getNTPTime()) ); 114 connect( pb, SIGNAL(clicked()), this, SIGNAL(getNTPTime()) );
115 layout->addMultiCellWidget( pb, 8, 8, 0, 5 ); 115 layout->addMultiCellWidget( pb, 8, 8, 0, 5 );
116 116
117 // Set predicted time button 117 // Set predicted time button
118 pb = new QPushButton( Resource::loadPixmap( "netsystemtime/predicttab" ), tr( "Set predicted time" ), 118 pb = new QPushButton( Resource::loadPixmap( "netsystemtime/predicttab" ), tr( "Set predicted time" ),
119 container ); 119 container );
120 connect( pb, SIGNAL(clicked()), this, SIGNAL(getPredictedTime()) ); 120 connect( pb, SIGNAL(clicked()), this, SIGNAL(getPredictedTime()) );
121 layout->addMultiCellWidget( pb, 9, 9, 0, 5 ); 121 layout->addMultiCellWidget( pb, 9, 9, 0, 5 );
122 122
123 // Space filler at bottom of widget 123 // Space filler at bottom of widget
124 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 10, 0 ); 124 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 10, 0 );
125 125
126 // Initialize values 126 // Initialize values
127 Config config( "locale" ); 127 Config config( "locale" );
128 config.setGroup( "Location" ); 128 config.setGroup( "Location" );
129 selTimeZone->setCurrentZone( config.readEntry( "Timezone", "America/New_York" ) ); 129 selTimeZone->setCurrentZone( config.readEntry( "Timezone", "America/New_York" ) );
130 use12HourTime = FALSE; 130 use12HourTime = FALSE;
131 setDateTime( QDateTime::currentDateTime() ); 131 setDateTime( QDateTime::currentDateTime() );
132} 132}
133 133
134TimeTabWidget::~TimeTabWidget() 134TimeTabWidget::~TimeTabWidget()
135{ 135{
136} 136}
137 137
138void TimeTabWidget::saveSettings( bool commit ) 138void TimeTabWidget::saveSettings( bool commit )
139{ 139{
140 if ( commit ) 140 if ( commit )
141 { 141 {
142 // Set timezone and announce to world 142 // Set timezone and announce to world
143 QString tz = selTimeZone->currentZone(); 143 QString tz = selTimeZone->currentZone();
144 Config config("locale"); 144 Config config("locale");
145 config.setGroup( "Location" ); 145 config.setGroup( "Location" );
146 config.writeEntry( "Timezone", tz ); 146 config.writeEntry( "Timezone", tz );
147 setenv( "TZ", tz, 1 ); 147 setenv( "TZ", tz, 1 );
148 QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" ); 148 QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" );
149 setTimeZone << tz; 149 setTimeZone << tz;
150 150
151 // If controls have a valid date & time, update systemtime 151 // If controls have a valid date & time, update systemtime
152 int hour = sbHour->value(); 152 int hour = sbHour->value();
153 if ( use12HourTime && cbAmpm->currentItem() == ValuePM ) 153 if ( use12HourTime && cbAmpm->currentItem() == ValuePM )
154 hour += 12; 154 hour += 12;
155 QDateTime dt( btnDate->date(), QTime ( hour, sbMin->value(), QTime::currentTime().second() ) ); 155 QDateTime dt( btnDate->date(), QTime ( hour, sbMin->value(), QTime::currentTime().second() ) );
156 setSystemTime( dt ); 156 setSystemTime( dt );
157 } 157 }
158 else 158 else
159 { 159 {
160 // Reset systemtime to hardware clock (i.e. undo any changes made by this app) 160 // Reset systemtime to hardware clock (i.e. undo any changes made by this app)
161 system("/sbin/hwclock --hctosys --utc"); 161 system("/sbin/hwclock --hctosys --utc");
162 } 162 }
163} 163}
164 164
165void TimeTabWidget::setDateTime( const QDateTime &dt ) 165void TimeTabWidget::setDateTime( const QDateTime &dt )
166{ 166{
167 // Set time 167 // Set time
168 QTime t = dt.time(); 168 QTime t = dt.time();
169 if( use12HourTime ) 169 if( use12HourTime )
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
index 698dfd3..ff65424 100644
--- a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
@@ -1,93 +1,93 @@
1 1
2#include "interfaceinformationimp.h" 2#include "interfaceinformationimp.h"
3#include "interfaceadvanced.h" 3#include "interfaceadvanced.h"
4 4
5/* OPIE */ 5/* OPIE */
6#include <qpe/config.h> 6#include <qpe/config.h>
7#include <qpe/qpeapplication.h> 7#include <qpe/qpeapplication.h>
8 8
9/* QT */ 9/* QT */
10#include <qcheckbox.h> 10#include <qcheckbox.h>
11#include <qpushbutton.h> 11#include <qpushbutton.h>
12#include <qlabel.h> 12#include <qlabel.h>
13#include <qgroupbox.h> 13#include <qgroupbox.h>
14#include <qmessagebox.h> 14#include <qmessagebox.h>
15 15
16 16
17#ifdef QWS 17#ifdef QWS
18#else 18#else
19 #define showMaximized show 19 #define showMaximized show
20#endif 20#endif
21 21
22/** 22/**
23 * Constructor for the InterfaceInformationImp class. This class pretty much 23 * Constructor for the InterfaceInformationImp class. This class pretty much
24 * just display's information about the interface that is passed to it. 24 * just display's information about the interface that is passed to it.
25 */ 25 */
26InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i) 26InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i)
27{ 27{
28 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); 28 connect(i, SIGNAL(updateInterface(Interface*)), this, SLOT(updateInterface(Interface*)));
29 connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); 29 connect(i, SIGNAL(updateMessage(const QString&)), this, SLOT(showMessage(const QString&)));
30 updateInterface(interface); 30 updateInterface(interface);
31 connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); 31 connect(startButton, SIGNAL(clicked()), interface, SLOT(start()));
32 connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); 32 connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop()));
33 connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); 33 connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart()));
34 connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); 34 connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh()));
35 connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); 35 connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced()));
36 Config cfg("networksettings", Config::User); 36 Config cfg("networksettings", Config::User);
37 cfg.setGroup("interface"); 37 cfg.setGroup("interface");
38 CheckBoxSilent->setChecked( cfg.readBoolEntry("silent", false) ); 38 CheckBoxSilent->setChecked( cfg.readBoolEntry("silent", false) );
39} 39}
40 40
41InterfaceInformationImp::~InterfaceInformationImp() 41InterfaceInformationImp::~InterfaceInformationImp()
42{ 42{
43 Config cfg("networksettings", Config::User); 43 Config cfg("networksettings", Config::User);
44 cfg.setGroup("interface"); 44 cfg.setGroup("interface");
45 cfg.writeEntry("silent", CheckBoxSilent->isChecked() ); 45 cfg.writeEntry("silent", CheckBoxSilent->isChecked() );
46} 46}
47 47
48/** 48/**
49 * Update the interface information and buttons. 49 * Update the interface information and buttons.
50 * @param Intarface *i the interface to update (should be the one we already 50 * @param Intarface *i the interface to update (should be the one we already
51 * know about). 51 * know about).
52 */ 52 */
53void InterfaceInformationImp::updateInterface(Interface *) 53void InterfaceInformationImp::updateInterface(Interface *)
54{ 54{
55 if(interface->getStatus()) 55 if(interface->getStatus())
56 { 56 {
57 startButton->setEnabled(false); 57 startButton->setEnabled(false);
58 stopButton->setEnabled(true); 58 stopButton->setEnabled(true);
59 restartButton->setEnabled(true); 59 restartButton->setEnabled(true);
60 } 60 }
61 else 61 else
62 { 62 {
63 startButton->setEnabled(true); 63 startButton->setEnabled(true);
64 stopButton->setEnabled(false); 64 stopButton->setEnabled(false);
65 restartButton->setEnabled(false); 65 restartButton->setEnabled(false);
66 } 66 }
67 macAddressLabel->setText(interface->getMacAddress()); 67 macAddressLabel->setText(interface->getMacAddress());
68 ipAddressLabel->setText(interface->getIp()); 68 ipAddressLabel->setText(interface->getIp());
69 subnetMaskLabel->setText(interface->getSubnetMask()); 69 subnetMaskLabel->setText(interface->getSubnetMask());
70 broadcastLabel->setText(interface->getBroadcast()); 70 broadcastLabel->setText(interface->getBroadcast());
71} 71}
72 72
73/** 73/**
74 * Create the advanced widget. Fill it with the current interface's information. 74 * Create the advanced widget. Fill it with the current interface's information.
75 * Display it. 75 * Display it.
76 */ 76 */
77void InterfaceInformationImp::advanced() 77void InterfaceInformationImp::advanced()
78{ 78{
79 InterfaceAdvanced *a = new InterfaceAdvanced(this, "InterfaceAdvanced", Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog); 79 InterfaceAdvanced *a = new InterfaceAdvanced(this, "InterfaceAdvanced", Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog);
80 a->interfaceName->setText(interface->getInterfaceName()); 80 a->interfaceName->setText(interface->getInterfaceName());
81 a->macAddressLabel->setText(interface->getMacAddress()); 81 a->macAddressLabel->setText(interface->getMacAddress());
82 a->ipAddressLabel->setText(interface->getIp()); 82 a->ipAddressLabel->setText(interface->getIp());
83 a->subnetMaskLabel->setText(interface->getSubnetMask()); 83 a->subnetMaskLabel->setText(interface->getSubnetMask());
84 a->broadcastLabel->setText(interface->getBroadcast()); 84 a->broadcastLabel->setText(interface->getBroadcast());
85 a->dhcpServerLabel->setText(interface->getDhcpServerIp()); 85 a->dhcpServerLabel->setText(interface->getDhcpServerIp());
86 a->leaseObtainedLabel->setText(interface->getLeaseObtained()); 86 a->leaseObtainedLabel->setText(interface->getLeaseObtained());
87 a->leaseExpiresLabel->setText(interface->getLeaseExpires()); 87 a->leaseExpiresLabel->setText(interface->getLeaseExpires());
88 a->dhcpInformation->setEnabled(interface->isDhcp()); 88 a->dhcpInformation->setEnabled(interface->isDhcp());
89 QPEApplication::showWidget( a ); 89 QPEApplication::showWidget( a );
90} 90}
91 91
92/** 92/**
93 * Messages from the interface if start/stop went as planned. 93 * Messages from the interface if start/stop went as planned.
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index b0a1dd9..1e16b97 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -36,129 +36,129 @@
36 36
37/* STD */ 37/* STD */
38#include <net/if.h> 38#include <net/if.h>
39#include <sys/ioctl.h> 39#include <sys/ioctl.h>
40#include <sys/socket.h> 40#include <sys/socket.h>
41 41
42#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" 42#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme"
43#define _PROCNETDEV "/proc/net/dev" 43#define _PROCNETDEV "/proc/net/dev"
44 44
45MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWindow(parent, name, Qt::WStyle_ContextHelp), advancedUserMode(true), scheme(DEFAULT_SCHEME) 45MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWindow(parent, name, Qt::WStyle_ContextHelp), advancedUserMode(true), scheme(DEFAULT_SCHEME)
46{ 46{
47 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); 47 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
48 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); 48 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
49 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); 49 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
50 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); 50 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
51 51
52 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); 52 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
53 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); 53 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
54 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); 54 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
55 55
56 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); 56 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
57 57
58 //FIXME: disable profiles for the moment: 58 //FIXME: disable profiles for the moment:
59 tabWidget->setTabEnabled( tab, false ); 59 tabWidget->setTabEnabled( tab, false );
60 60
61 // Load connections. 61 // Load connections.
62 // /usr/local/kde/lib/libinterfaces.la 62 // /usr/local/kde/lib/libinterfaces.la
63#ifdef QWS 63#ifdef QWS
64 loadModules(QPEApplication::qpeDir() + "plugins/networksettings"); 64 loadModules(QPEApplication::qpeDir() + "plugins/networksettings");
65#else 65#else
66 loader = KLibLoader::self(); 66 loader = KLibLoader::self();
67 loadModules(QString("/usr/")+KStandardDirs::kde_default("lib")); 67 loadModules(QString("/usr/")+KStandardDirs::kde_default("lib"));
68#endif 68#endif
69 getAllInterfaces(); 69 getAllInterfaces();
70 70
71 Interfaces i; 71 Interfaces i;
72 QStringList list = i.getInterfaceList(); 72 QStringList list = i.getInterfaceList();
73 QMap<QString, Interface*>::Iterator it; 73 QMap<QString, Interface*>::Iterator it;
74 for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) 74 for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni )
75 { 75 {
76 /* 76 /*
77 * we skipped it in getAllInterfaces now 77 * we skipped it in getAllInterfaces now
78 * we need to ignore it as well 78 * we need to ignore it as well
79 */ 79 */
80 if (m_handledIfaces.contains( *ni) ) 80 if (m_handledIfaces.contains( *ni) )
81 { 81 {
82 qDebug("Not up iface handled by module"); 82 qDebug("Not up iface handled by module");
83 continue; 83 continue;
84 } 84 }
85 bool found = false; 85 bool found = false;
86 for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ) 86 for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it )
87 { 87 {
88 if(it.key() == (*ni)) 88 if(it.key() == (*ni))
89 found = true; 89 found = true;
90 } 90 }
91 if(!found) 91 if(!found)
92 { 92 {
93 if(!(*ni).contains("_")) 93 if(!(*ni).contains("_"))
94 { 94 {
95 Interface *i = new Interface(this, *ni, false); 95 Interface *i = new Interface(this, *ni, false);
96 i->setAttached(false); 96 i->setAttached(false);
97 i->setHardwareName(tr("Disconnected")); 97 i->setHardwareName(tr("Disconnected"));
98 interfaceNames.insert(i->getInterfaceName(), i); 98 interfaceNames.insert(i->getInterfaceName(), i);
99 updateInterface(i); 99 updateInterface(i);
100 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); 100 connect(i, SIGNAL(updateInterface(Interface*)), this, SLOT(updateInterface(Interface*)));
101 } 101 }
102 } 102 }
103 } 103 }
104 104
105 //getInterfaceList(); 105 //getInterfaceList();
106 connectionList->header()->hide(); 106 connectionList->header()->hide();
107 107
108 Config cfg("NetworkSetup"); 108 Config cfg("NetworkSetup");
109 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); 109 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
110 for ( QStringList::Iterator it = profiles.begin(); 110 for ( QStringList::Iterator it = profiles.begin();
111 it != profiles.end(); ++it) 111 it != profiles.end(); ++it)
112 profilesList->insertItem((*it)); 112 profilesList->insertItem((*it));
113 currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); 113 currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All"));
114 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); 114 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
115 scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); 115 scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME);
116 116
117 QFile file(scheme); 117 QFile file(scheme);
118 if ( file.open(IO_ReadOnly) ) 118 if ( file.open(IO_ReadOnly) )
119 { // file opened successfully 119 { // file opened successfully
120 QTextStream stream( &file ); // use a text stream 120 QTextStream stream( &file ); // use a text stream
121 while ( !stream.eof() ) 121 while ( !stream.eof() )
122 { // until end of file... 122 { // until end of file...
123 QString line = stream.readLine(); // line of text excluding '\n' 123 QString line = stream.readLine(); // line of text excluding '\n'
124 if(line.contains("SCHEME")) 124 if(line.contains("SCHEME"))
125 { 125 {
126 line = line.mid(7, line.length()); 126 line = line.mid(7, line.length());
127 currentProfileLabel->setText(line); 127 currentProfileLabel->setText(line);
128 break; 128 break;
129 } 129 }
130 } 130 }
131 file.close(); 131 file.close();
132 } 132 }
133 makeChannel(); 133 makeChannel();
134} 134}
135 135
136/** 136/**
137 * Deconstructor. Save profiles. Delete loaded libraries. 137 * Deconstructor. Save profiles. Delete loaded libraries.
138 */ 138 */
139MainWindowImp::~MainWindowImp() 139MainWindowImp::~MainWindowImp()
140{ 140{
141 // Save profiles. 141 // Save profiles.
142 Config cfg("NetworkSetup"); 142 Config cfg("NetworkSetup");
143 cfg.setGroup("General"); 143 cfg.setGroup("General");
144 cfg.writeEntry("Profiles", profiles.join(" ")); 144 cfg.writeEntry("Profiles", profiles.join(" "));
145 145
146 // Delete all interfaces that don't have owners. 146 // Delete all interfaces that don't have owners.
147 QMap<Interface*, QListViewItem*>::Iterator iIt; 147 QMap<Interface*, QListViewItem*>::Iterator iIt;
148 for( iIt = items.begin(); iIt != items.end(); ++iIt ) 148 for( iIt = items.begin(); iIt != items.end(); ++iIt )
149 { 149 {
150 if(iIt.key()->getModuleOwner() == NULL) 150 if(iIt.key()->getModuleOwner() == NULL)
151 delete iIt.key(); 151 delete iIt.key();
152 } 152 }
153 153
154#ifdef QWS 154#ifdef QWS
155 // Delete Modules and Libraries 155 // Delete Modules and Libraries
156 QMap<Module*, QLibrary*>::Iterator it; 156 QMap<Module*, QLibrary*>::Iterator it;
157 for( it = libraries.begin(); it != libraries.end(); ++it ) 157 for( it = libraries.begin(); it != libraries.end(); ++it )
158 { 158 {
159 delete it.key(); 159 delete it.key();
160 // I wonder why I can't delete the libraries 160 // I wonder why I can't delete the libraries
161 // What fucking shit this is. 161 // What fucking shit this is.
162 //delete it.data(); 162 //delete it.data();
163 } 163 }
164#else 164#else
@@ -191,146 +191,146 @@ void MainWindowImp::getAllInterfaces()
191 191
192 for (unsigned int i = 0; i < ifc.ifc_len / sizeof(struct ifreq); i++) 192 for (unsigned int i = 0; i < ifc.ifc_len / sizeof(struct ifreq); i++)
193 { 193 {
194 struct ifreq *pifr = &ifrs[i]; 194 struct ifreq *pifr = &ifrs[i];
195 195
196 ifaces += pifr->ifr_name; 196 ifaces += pifr->ifr_name;
197 } 197 }
198 } 198 }
199 else 199 else
200 { 200 {
201 procFile.open(IO_ReadOnly); 201 procFile.open(IO_ReadOnly);
202 QString line; 202 QString line;
203 QTextStream procTs(&procFile); 203 QTextStream procTs(&procFile);
204 int loc = -1; 204 int loc = -1;
205 205
206 procTs.readLine(); // eat a line 206 procTs.readLine(); // eat a line
207 procTs.readLine(); // eat a line 207 procTs.readLine(); // eat a line
208 while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null) 208 while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null)
209 { 209 {
210 if((loc = line.find(":")) != -1) 210 if((loc = line.find(":")) != -1)
211 { 211 {
212 ifaces += line.left(loc); 212 ifaces += line.left(loc);
213 } 213 }
214 } 214 }
215 } 215 }
216 216
217 for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it) 217 for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it)
218 { 218 {
219 int flags = 0; 219 int flags = 0;
220 if ( m_handledIfaces.contains( (*it) ) ) 220 if ( m_handledIfaces.contains( (*it) ) )
221 { 221 {
222 qDebug(" %s is handled by a module", (*it).latin1() ); 222 qDebug(" %s is handled by a module", (*it).latin1() );
223 continue; 223 continue;
224 } 224 }
225 // int family; 225 // int family;
226 i = NULL; 226 i = NULL;
227 227
228 strcpy(ifr.ifr_name, (*it).latin1()); 228 strcpy(ifr.ifr_name, (*it).latin1());
229 229
230 struct ifreq ifcopy; 230 struct ifreq ifcopy;
231 ifcopy = ifr; 231 ifcopy = ifr;
232 result = ioctl(sockfd, SIOCGIFFLAGS, &ifcopy); 232 result = ioctl(sockfd, SIOCGIFFLAGS, &ifcopy);
233 flags = ifcopy.ifr_flags; 233 flags = ifcopy.ifr_flags;
234 i = new Interface(this, ifr.ifr_name, false); 234 i = new Interface(this, ifr.ifr_name, false);
235 i->setAttached(true); 235 i->setAttached(true);
236 if ((flags & IFF_UP) == IFF_UP) 236 if ((flags & IFF_UP) == IFF_UP)
237 i->setStatus(true); 237 i->setStatus(true);
238 else 238 else
239 i->setStatus(false); 239 i->setStatus(false);
240 240
241 if ((flags & IFF_BROADCAST) == IFF_BROADCAST) 241 if ((flags & IFF_BROADCAST) == IFF_BROADCAST)
242 i->setHardwareName("Ethernet"); 242 i->setHardwareName("Ethernet");
243 else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT) 243 else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT)
244 i->setHardwareName("Point to Point"); 244 i->setHardwareName("Point to Point");
245 else if ((flags & IFF_MULTICAST) == IFF_MULTICAST) 245 else if ((flags & IFF_MULTICAST) == IFF_MULTICAST)
246 i->setHardwareName("Multicast"); 246 i->setHardwareName("Multicast");
247 else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK) 247 else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK)
248 i->setHardwareName("Loopback"); 248 i->setHardwareName("Loopback");
249 else 249 else
250 i->setHardwareName("Unknown"); 250 i->setHardwareName("Unknown");
251 251
252 qWarning("Adding interface %s to interfaceNames\n", ifr.ifr_name); 252 qWarning("Adding interface %s to interfaceNames\n", ifr.ifr_name);
253 interfaceNames.insert(i->getInterfaceName(), i); 253 interfaceNames.insert(i->getInterfaceName(), i);
254 updateInterface(i); 254 updateInterface(i);
255 connect(i, SIGNAL(updateInterface(Interface *)), 255 connect(i, SIGNAL(updateInterface(Interface*)),
256 this, SLOT(updateInterface(Interface *))); 256 this, SLOT(updateInterface(Interface*)));
257 } 257 }
258 // now lets ask the plugins too ;) 258 // now lets ask the plugins too ;)
259 QMap<Module*, QLibrary*>::Iterator it; 259 QMap<Module*, QLibrary*>::Iterator it;
260 QList<Interface> ilist; 260 QList<Interface> ilist;
261 for( it = libraries.begin(); it != libraries.end(); ++it ) 261 for( it = libraries.begin(); it != libraries.end(); ++it )
262 { 262 {
263 if(it.key()) 263 if(it.key())
264 { 264 {
265 ilist = it.key()->getInterfaces(); 265 ilist = it.key()->getInterfaces();
266 for( i = ilist.first(); i != 0; i = ilist.next() ) 266 for( i = ilist.first(); i != 0; i = ilist.next() )
267 { 267 {
268 qWarning("Adding interface %s to interfaceNames\n", i->getInterfaceName().latin1() ); 268 qWarning("Adding interface %s to interfaceNames\n", i->getInterfaceName().latin1() );
269 interfaceNames.insert(i->getInterfaceName(), i); 269 interfaceNames.insert(i->getInterfaceName(), i);
270 updateInterface(i); 270 updateInterface(i);
271 connect(i, SIGNAL(updateInterface(Interface *)), 271 connect(i, SIGNAL(updateInterface(Interface*)),
272 this, SLOT(updateInterface(Interface *))); 272 this, SLOT(updateInterface(Interface*)));
273 } 273 }
274 } 274 }
275 } 275 }
276} 276}
277 277
278/** 278/**
279 * Load all modules that are found in the path 279 * Load all modules that are found in the path
280 * @param path a directory that is scaned for any plugins that can be loaded 280 * @param path a directory that is scaned for any plugins that can be loaded
281 * and attempts to load them 281 * and attempts to load them
282 */ 282 */
283void MainWindowImp::loadModules(const QString &path) 283void MainWindowImp::loadModules(const QString &path)
284{ 284{
285#ifdef DEBUG 285#ifdef DEBUG
286 qDebug("MainWindowImp::loadModules: %s", path.latin1()); 286 qDebug("MainWindowImp::loadModules: %s", path.latin1());
287#endif 287#endif
288 QDir d(path); 288 QDir d(path);
289 if(!d.exists()) 289 if(!d.exists())
290 return; 290 return;
291 291
292 // Don't want sym links 292 // Don't want sym links
293 d.setFilter( QDir::Files | QDir::NoSymLinks ); 293 d.setFilter( QDir::Files | QDir::NoSymLinks );
294 const QFileInfoList *list = d.entryInfoList(); 294 const QFileInfoList *list = d.entryInfoList();
295 QFileInfoListIterator it( *list ); 295 QFileInfoListIterator it( *list );
296 QFileInfo *fi; 296 QFileInfo *fi;
297 while ( (fi=it.current()) ) 297 while ( (fi=it.current()) )
298 { 298 {
299#ifdef QWS 299#ifdef QWS
300 if(fi->fileName().contains(".so")) 300 if(fi->fileName().contains(".so"))
301 { 301 {
302#else 302#else
303 if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_")) 303 if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_"))
304 { 304 {
305#endif 305#endif
306 loadPlugin(path + "/" + fi->fileName()); 306 loadPlugin(path + "/" + fi->fileName());
307 qDebug("loaded plugin: >%s< ",QString(path + "/" + fi->fileName()).latin1()); 307 qDebug("loaded plugin: >%s< ",QString(path + "/" + fi->fileName()).latin1());
308 } 308 }
309 ++it; 309 ++it;
310 } 310 }
311} 311}
312 312
313/** 313/**
314 * Attempt to load a function and resolve a function. 314 * Attempt to load a function and resolve a function.
315 * @param pluginFileName - the name of the file in which to attempt to load 315 * @param pluginFileName - the name of the file in which to attempt to load
316 * @param resolveString - function pointer to resolve 316 * @param resolveString - function pointer to resolve
317 * @return pointer to the function with name resolveString or NULL 317 * @return pointer to the function with name resolveString or NULL
318 */ 318 */
319Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString) 319Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString)
320{ 320{
321#ifdef DEBUG 321#ifdef DEBUG
322 qDebug("MainWindowImp::loadPlugin: %s: resolving %s", pluginFileName.latin1(), resolveString.latin1()); 322 qDebug("MainWindowImp::loadPlugin: %s: resolving %s", pluginFileName.latin1(), resolveString.latin1());
323#endif 323#endif
324#ifdef QWS 324#ifdef QWS
325 QLibrary *lib = new QLibrary(pluginFileName); 325 QLibrary *lib = new QLibrary(pluginFileName);
326 void *functionPointer = lib->resolve(resolveString); 326 void *functionPointer = lib->resolve(resolveString);
327 if( !functionPointer ) 327 if( !functionPointer )
328 { 328 {
329#ifdef DEBUG 329#ifdef DEBUG
330 qDebug("MainWindowImp::loadPlugin: Warning: %s is not a plugin", pluginFileName.latin1()); 330 qDebug("MainWindowImp::loadPlugin: Warning: %s is not a plugin", pluginFileName.latin1());
331#endif 331#endif
332 delete lib; 332 delete lib;
333 return NULL; 333 return NULL;
334 } 334 }
335 // Try to get an object. 335 // Try to get an object.
336 Module *object = ((Module* (*)()) functionPointer)(); 336 Module *object = ((Module* (*)()) functionPointer)();
@@ -651,98 +651,98 @@ void MainWindowImp::removeProfile()
651 { 651 {
652 QString interfaceName = it.key()->getInterfaceName(); 652 QString interfaceName = it.key()->getInterfaceName();
653 qDebug(interfaceName.latin1()); 653 qDebug(interfaceName.latin1());
654 if(interfaces.setInterface(interfaceName + "_" + profileToRemove)) 654 if(interfaces.setInterface(interfaceName + "_" + profileToRemove))
655 { 655 {
656 interfaces.removeInterface(); 656 interfaces.removeInterface();
657 if(interfaces.setMapping(interfaceName)) 657 if(interfaces.setMapping(interfaceName))
658 { 658 {
659 if(profilesList->count() == 1) 659 if(profilesList->count() == 1)
660 interfaces.removeMapping(); 660 interfaces.removeMapping();
661 else 661 else
662 { 662 {
663 interfaces.removeMap("map", interfaceName + "_" + profileToRemove); 663 interfaces.removeMap("map", interfaceName + "_" + profileToRemove);
664 } 664 }
665 } 665 }
666 interfaces.write(); 666 interfaces.write();
667 break; 667 break;
668 } 668 }
669 } 669 }
670 } 670 }
671} 671}
672 672
673/** 673/**
674 * A new profile has been selected, change. 674 * A new profile has been selected, change.
675 * @param newProfile the new profile. 675 * @param newProfile the new profile.
676 */ 676 */
677void MainWindowImp::changeProfile() 677void MainWindowImp::changeProfile()
678{ 678{
679 if(profilesList->currentItem() == -1) 679 if(profilesList->currentItem() == -1)
680 { 680 {
681 QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok); 681 QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok);
682 return; 682 return;
683 } 683 }
684 QString newProfile = profilesList->text(profilesList->currentItem()); 684 QString newProfile = profilesList->text(profilesList->currentItem());
685 if(newProfile != currentProfileLabel->text()) 685 if(newProfile != currentProfileLabel->text())
686 { 686 {
687 currentProfileLabel->setText(newProfile); 687 currentProfileLabel->setText(newProfile);
688 QFile::remove(scheme); 688 QFile::remove(scheme);
689 QFile file(scheme); 689 QFile file(scheme);
690 if ( file.open(IO_ReadWrite) ) 690 if ( file.open(IO_ReadWrite) )
691 { 691 {
692 QTextStream stream( &file ); 692 QTextStream stream( &file );
693 stream << QString("SCHEME=%1").arg(newProfile); 693 stream << QString("SCHEME=%1").arg(newProfile);
694 file.close(); 694 file.close();
695 } 695 }
696 // restart all up devices? 696 // restart all up devices?
697 if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok) 697 if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok)
698 { 698 {
699 // Go through them one by one 699 // Go through them one by one
700 QMap<Interface*, QListViewItem*>::Iterator it; 700 QMap<Interface*, QListViewItem*>::Iterator it;
701 for( it = items.begin(); it != items.end(); ++it ) 701 for( it = items.begin(); it != items.end(); ++it )
702 { 702 {
703 if(it.key()->getStatus() == true) 703 if(it.key()->getStatus() == true)
704 it.key()->restart(); 704 it.key()->restart();
705 } 705 }
706 } 706 }
707 } 707 }
708 // TODO change the profile in the modules 708 // TODO change the profile in the modules
709} 709}
710 710
711 711
712void MainWindowImp::makeChannel() 712void MainWindowImp::makeChannel()
713{ 713{
714 channel = new QCopChannel( "QPE/Application/networksettings", this ); 714 channel = new QCopChannel( "QPE/Application/networksettings", this );
715 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 715 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
716 this, SLOT(receive(const QCString&, const QByteArray&)) ); 716 this, SLOT(receive(const QCString&,const QByteArray&)) );
717} 717}
718 718
719void MainWindowImp::receive(const QCString &msg, const QByteArray &arg) 719void MainWindowImp::receive(const QCString &msg, const QByteArray &arg)
720{ 720{
721 bool found = false; 721 bool found = false;
722 qDebug("MainWindowImp::receive QCop msg >"+msg+"<"); 722 qDebug("MainWindowImp::receive QCop msg >"+msg+"<");
723 if (msg == "raise") 723 if (msg == "raise")
724 { 724 {
725 raise(); 725 raise();
726 return; 726 return;
727 } 727 }
728 728
729 QString dest = msg.left(msg.find("(")); 729 QString dest = msg.left(msg.find("("));
730 QCString param = msg.right(msg.length() - msg.find("(") - 1); 730 QCString param = msg.right(msg.length() - msg.find("(") - 1);
731 param = param.left( param.length() - 1 ); 731 param = param.left( param.length() - 1 );
732 qDebug("dest >%s< param >"+param+"<",dest.latin1()); 732 qDebug("dest >%s< param >"+param+"<",dest.latin1());
733 733
734 QMap<Module*, QLibrary*>::Iterator it; 734 QMap<Module*, QLibrary*>::Iterator it;
735 for( it = libraries.begin(); it != libraries.end(); ++it ) 735 for( it = libraries.begin(); it != libraries.end(); ++it )
736 { 736 {
737 qDebug("plugin >%s<", it.key()->type().latin1() ); 737 qDebug("plugin >%s<", it.key()->type().latin1() );
738 if(it.key()->type() == dest) 738 if(it.key()->type() == dest)
739 { 739 {
740 it.key()->receive( param, arg ); 740 it.key()->receive( param, arg );
741 found = true; 741 found = true;
742 } 742 }
743 } 743 }
744 744
745 745
746 if (found) QPEApplication::setKeepRunning(); 746 if (found) QPEApplication::setKeepRunning();
747 else qDebug("Huh what do ya want"); 747 else qDebug("Huh what do ya want");
748} 748}
diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp
index 7d21605..3b2393c 100644
--- a/noncore/settings/networksettings/ppp/edit.cpp
+++ b/noncore/settings/networksettings/ppp/edit.cpp
@@ -511,130 +511,130 @@ void IPWidget::hitIPSelect( int i )
511 ipaddress_label->setEnabled(false); 511 ipaddress_label->setEnabled(false);
512 sub_label->setEnabled(false); 512 sub_label->setEnabled(false);
513 ipaddress_l->setEnabled(false); 513 ipaddress_l->setEnabled(false);
514 subnetmask_l->setEnabled(false); 514 subnetmask_l->setEnabled(false);
515 } 515 }
516 else 516 else
517 { 517 {
518 ipaddress_label->setEnabled(true); 518 ipaddress_label->setEnabled(true);
519 sub_label->setEnabled(true); 519 sub_label->setEnabled(true);
520 ipaddress_l->setEnabled(true); 520 ipaddress_l->setEnabled(true);
521 subnetmask_l->setEnabled(true); 521 subnetmask_l->setEnabled(true);
522 } 522 }
523} 523}
524 524
525 525
526 526
527DNSWidget::DNSWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name ) 527DNSWidget::DNSWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name )
528 : QWidget(parent, name), _pppdata(pd) 528 : QWidget(parent, name), _pppdata(pd)
529{ 529{
530 QGridLayout *tl = new QGridLayout(this, 7, 2, 0 ); 530 QGridLayout *tl = new QGridLayout(this, 7, 2, 0 );
531 531
532 dnsdomain_label = new QLabel(tr("Domain name:"), this); 532 dnsdomain_label = new QLabel(tr("Domain name:"), this);
533 tl->addWidget(dnsdomain_label, 0, 0); 533 tl->addWidget(dnsdomain_label, 0, 0);
534 534
535 dnsdomain = new QLineEdit(this); 535 dnsdomain = new QLineEdit(this);
536 536
537 tl->addWidget(dnsdomain, 0, 1); 537 tl->addWidget(dnsdomain, 0, 1);
538 QString tmp = tr("If you enter a domain name here, this domain\n" 538 QString tmp = tr("If you enter a domain name here, this domain\n"
539 "name is used for your computer while you are\n" 539 "name is used for your computer while you are\n"
540 "connected. When the connection is closed, the\n" 540 "connected. When the connection is closed, the\n"
541 "original domain name of your computer is\n" 541 "original domain name of your computer is\n"
542 "restored.\n" 542 "restored.\n"
543 "\n" 543 "\n"
544 "If you leave this field blank, no changes are\n" 544 "If you leave this field blank, no changes are\n"
545 "made to the domain name."); 545 "made to the domain name.");
546 546
547 QWhatsThis::add(dnsdomain_label,tmp); 547 QWhatsThis::add(dnsdomain_label,tmp);
548 QWhatsThis::add(dnsdomain,tmp); 548 QWhatsThis::add(dnsdomain,tmp);
549 549
550 conf_label = new QLabel(tr("Configuration:"), this); 550 conf_label = new QLabel(tr("Configuration:"), this);
551 tl->addWidget(conf_label, 1, 0); 551 tl->addWidget(conf_label, 1, 0);
552 552
553 bg = new QButtonGroup("Group", this); 553 bg = new QButtonGroup("Group", this);
554 connect(bg, SIGNAL(clicked(int)), SLOT(DNS_Mode_Selected(int))); 554 connect(bg, SIGNAL(clicked(int)), SLOT(DNS_Mode_Selected(int)));
555 bg->hide(); 555 bg->hide();
556 556
557 autodns = new QRadioButton(tr("Automatic"), this); 557 autodns = new QRadioButton(tr("Automatic"), this);
558 bg->insert(autodns, 0); 558 bg->insert(autodns, 0);
559 tl->addWidget(autodns, 1, 1); 559 tl->addWidget(autodns, 1, 1);
560 if(!_pppdata->pppdVersionMin(2, 3, 7)) 560 if(!_pppdata->pppdVersionMin(2, 3, 7))
561 autodns->setEnabled(false); 561 autodns->setEnabled(false);
562 562
563 mandns = new QRadioButton(tr("Manual"), this); 563 mandns = new QRadioButton(tr("Manual"), this);
564 bg->insert(mandns, 1); 564 bg->insert(mandns, 1);
565 tl->addWidget(mandns, 2, 1); 565 tl->addWidget(mandns, 2, 1);
566 566
567 dns_label = new QLabel(tr("DNS IP address:"), this); 567 dns_label = new QLabel(tr("DNS IP address:"), this);
568 tl->addWidget(dns_label, 3, 0); 568 tl->addWidget(dns_label, 3, 0);
569 569
570 QHBoxLayout *l2 = new QHBoxLayout; 570 QHBoxLayout *l2 = new QHBoxLayout;
571 tl->addLayout(l2, 3, 1); 571 tl->addLayout(l2, 3, 1);
572 dnsipaddr = new IPLineEdit(this); 572 dnsipaddr = new IPLineEdit(this);
573 connect(dnsipaddr, SIGNAL(returnPressed()), 573 connect(dnsipaddr, SIGNAL(returnPressed()),
574 SLOT(adddns())); 574 SLOT(adddns()));
575 connect(dnsipaddr, SIGNAL(textChanged(const QString &)), 575 connect(dnsipaddr, SIGNAL(textChanged(const QString&)),
576 SLOT(DNS_Edit_Changed(const QString &))); 576 SLOT(DNS_Edit_Changed(const QString&)));
577 l2->addWidget(dnsipaddr, 1); 577 l2->addWidget(dnsipaddr, 1);
578 l2->addStretch(1); 578 l2->addStretch(1);
579 tmp = tr("<p>Allows you to specify a new DNS server to be\n" 579 tmp = tr("<p>Allows you to specify a new DNS server to be\n"
580 "used while you are connected. When the\n" 580 "used while you are connected. When the\n"
581 "connection is closed, this DNS entry will be\n" 581 "connection is closed, this DNS entry will be\n"
582 "removed again.\n" 582 "removed again.\n"
583 "\n" 583 "\n"
584 "To add a DNS server, type in the IP address of\n" 584 "To add a DNS server, type in the IP address of\n"
585 "the DNS server here and click on <b>Add</b>"); 585 "the DNS server here and click on <b>Add</b>");
586 586
587 QWhatsThis::add(dns_label, tmp); 587 QWhatsThis::add(dns_label, tmp);
588 QWhatsThis::add(dnsipaddr, tmp); 588 QWhatsThis::add(dnsipaddr, tmp);
589 589
590 QHBoxLayout *l1 = new QHBoxLayout; 590 QHBoxLayout *l1 = new QHBoxLayout;
591 tl->addLayout(l1, 4, 1); 591 tl->addLayout(l1, 4, 1);
592 add = new QPushButton(tr("Add"), this); 592 add = new QPushButton(tr("Add"), this);
593 connect(add, SIGNAL(clicked()), SLOT(adddns())); 593 connect(add, SIGNAL(clicked()), SLOT(adddns()));
594 l1->addWidget(add); 594 l1->addWidget(add);
595 // l1->addStretch(1); 595 // l1->addStretch(1);
596 QWhatsThis::add(add, 596 QWhatsThis::add(add,
597 tr("Click this button to add the DNS server\n" 597 tr("Click this button to add the DNS server\n"
598 "specified in the field above. The entry\n" 598 "specified in the field above. The entry\n"
599 "will then be added to the list below")); 599 "will then be added to the list below"));
600 600
601 remove = new QPushButton(tr("Remove"), this); 601 remove = new QPushButton(tr("Remove"), this);
602 connect(remove, SIGNAL(clicked()), SLOT(removedns())); 602 connect(remove, SIGNAL(clicked()), SLOT(removedns()));
603 l1->addWidget(remove); 603 l1->addWidget(remove);
604 QWhatsThis::add(remove, 604 QWhatsThis::add(remove,
605 tr("Click this button to remove the selected DNS\n" 605 tr("Click this button to remove the selected DNS\n"
606 "server entry from the list below")); 606 "server entry from the list below"));
607 607
608 servers_label = new QLabel(tr("DNS address list:"), this); 608 servers_label = new QLabel(tr("DNS address list:"), this);
609 servers_label->setAlignment(AlignTop|AlignLeft); 609 servers_label->setAlignment(AlignTop|AlignLeft);
610 tl->addWidget(servers_label, 5, 0); 610 tl->addWidget(servers_label, 5, 0);
611 611
612 dnsservers = new QListBox(this); 612 dnsservers = new QListBox(this);
613 dnsservers->setMinimumSize(150, 80); 613 dnsservers->setMinimumSize(150, 80);
614 connect(dnsservers, SIGNAL(highlighted(int)), 614 connect(dnsservers, SIGNAL(highlighted(int)),
615 SLOT(DNS_Entry_Selected(int))); 615 SLOT(DNS_Entry_Selected(int)));
616 tl->addWidget(dnsservers, 5, 1); 616 tl->addWidget(dnsservers, 5, 1);
617 tmp = tr("<p>This shows all defined DNS servers to use\n" 617 tmp = tr("<p>This shows all defined DNS servers to use\n"
618 "while you are connected. Use the <b>Add</b> and\n" 618 "while you are connected. Use the <b>Add</b> and\n"
619 "<b>Remove</b> buttons to modify the list"); 619 "<b>Remove</b> buttons to modify the list");
620 620
621 QWhatsThis::add(servers_label,tmp); 621 QWhatsThis::add(servers_label,tmp);
622 QWhatsThis::add(dnsservers,tmp); 622 QWhatsThis::add(dnsservers,tmp);
623 623
624 exdnsdisabled_toggle = new QCheckBox(tr("Disable DNS servers during connection"), this); 624 exdnsdisabled_toggle = new QCheckBox(tr("Disable DNS servers during connection"), this);
625 // exdnsdisabled_toggle = new QCheckBox(tr("Disable existing DNS servers during connection"), this); 625 // exdnsdisabled_toggle = new QCheckBox(tr("Disable existing DNS servers during connection"), this);
626 exdnsdisabled_toggle->setChecked(_pppdata->exDNSDisabled()); 626 exdnsdisabled_toggle->setChecked(_pppdata->exDNSDisabled());
627 tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter); 627 tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter);
628 QWhatsThis::add(exdnsdisabled_toggle, 628 QWhatsThis::add(exdnsdisabled_toggle,
629 tr("<p>When this option is selected, all DNS\n" 629 tr("<p>When this option is selected, all DNS\n"
630 "servers specified in <tt>/etc/resolv.conf</tt> are\n" 630 "servers specified in <tt>/etc/resolv.conf</tt> are\n"
631 "temporary disabled while the dialup connection\n" 631 "temporary disabled while the dialup connection\n"
632 "is established. After the connection is\n" 632 "is established. After the connection is\n"
633 "closed, the servers will be re-enabled\n" 633 "closed, the servers will be re-enabled\n"
634 "\n" 634 "\n"
635 "Typically, there is no reason to use this\n" 635 "Typically, there is no reason to use this\n"
636 "option, but it may become useful under \n" 636 "option, but it may become useful under \n"
637 "some circumstances.")); 637 "some circumstances."));
638 638
639 639
640 // restore data if editing 640 // restore data if editing
@@ -1123,89 +1123,89 @@ void ScriptWidget::insertButton()
1123 case ScriptEdit::LoopEnd: 1123 case ScriptEdit::LoopEnd:
1124 stl->insertItem("LoopEnd", stl->currentItem()); 1124 stl->insertItem("LoopEnd", stl->currentItem());
1125 sl->insertItem(se->text(), sl->currentItem()); 1125 sl->insertItem(se->text(), sl->currentItem());
1126 break; 1126 break;
1127 1127
1128 case ScriptEdit::Scan: 1128 case ScriptEdit::Scan:
1129 stl->insertItem("Scan", stl->currentItem()); 1129 stl->insertItem("Scan", stl->currentItem());
1130 sl->insertItem(se->text(), sl->currentItem()); 1130 sl->insertItem(se->text(), sl->currentItem());
1131 break; 1131 break;
1132 1132
1133 case ScriptEdit::Save: 1133 case ScriptEdit::Save:
1134 stl->insertItem("Save", stl->currentItem()); 1134 stl->insertItem("Save", stl->currentItem());
1135 sl->insertItem(se->text(), sl->currentItem()); 1135 sl->insertItem(se->text(), sl->currentItem());
1136 break; 1136 break;
1137 1137
1138 default: 1138 default:
1139 break; 1139 break;
1140 } 1140 }
1141 adjustScrollBar(); 1141 adjustScrollBar();
1142 se->setText(""); 1142 se->setText("");
1143} 1143}
1144 1144
1145 1145
1146void ScriptWidget::removeButton() 1146void ScriptWidget::removeButton()
1147{ 1147{
1148 if(sl->currentItem() >= 0) 1148 if(sl->currentItem() >= 0)
1149 { 1149 {
1150 int stlc = stl->currentItem(); 1150 int stlc = stl->currentItem();
1151 sl->removeItem(sl->currentItem()); 1151 sl->removeItem(sl->currentItem());
1152 stl->removeItem(stlc); 1152 stl->removeItem(stlc);
1153 adjustScrollBar(); 1153 adjustScrollBar();
1154 insert->setEnabled(sl->currentItem() != -1); 1154 insert->setEnabled(sl->currentItem() != -1);
1155 remove->setEnabled(sl->currentItem() != -1); 1155 remove->setEnabled(sl->currentItem() != -1);
1156 } 1156 }
1157} 1157}
1158 1158
1159 1159
1160 1160
1161///////////////////////////////////////////////////////////////////////////// 1161/////////////////////////////////////////////////////////////////////////////
1162// 1162//
1163// Used to specify a new phone number 1163// Used to specify a new phone number
1164// 1164//
1165///////////////////////////////////////////////////////////////////////////// 1165/////////////////////////////////////////////////////////////////////////////
1166PhoneNumberDialog::PhoneNumberDialog(QWidget *parent) 1166PhoneNumberDialog::PhoneNumberDialog(QWidget *parent)
1167 : QDialog(parent,"PhoneNumberDialog",true) 1167 : QDialog(parent,"PhoneNumberDialog",true)
1168{ 1168{
1169 setCaption( tr("Add Phone Number") ); 1169 setCaption( tr("Add Phone Number") );
1170 1170
1171 1171
1172 QVBoxLayout *layout = new QVBoxLayout( this ); 1172 QVBoxLayout *layout = new QVBoxLayout( this );
1173 layout->setSpacing( 3 ); 1173 layout->setSpacing( 3 );
1174 layout->setMargin( 3 ); 1174 layout->setMargin( 3 );
1175 1175
1176 // QHBox *hbox = new QHBox(this); 1176 // QHBox *hbox = new QHBox(this);
1177 // setMainWidget(hbox); 1177 // setMainWidget(hbox);
1178 1178
1179 // hbox->setSpacing( 2 );//KDialog::spacingHint()); 1179 // hbox->setSpacing( 2 );//KDialog::spacingHint());
1180 1180
1181 QLabel *label = new QLabel(this, tr("Enter a phone number:")); 1181 QLabel *label = new QLabel(this, tr("Enter a phone number:"));
1182 layout->addWidget( label ); 1182 layout->addWidget( label );
1183 1183
1184 le = new QLineEdit(this, "lineEdit"); 1184 le = new QLineEdit(this, "lineEdit");
1185 layout->addWidget( le ); 1185 layout->addWidget( le );
1186 1186
1187 connect(le, SIGNAL(textChanged(const QString &)), 1187 connect(le, SIGNAL(textChanged(const QString&)),
1188 this, SLOT(textChanged(const QString &))); 1188 this, SLOT(textChanged(const QString&)));
1189 1189
1190 le->setFocus(); 1190 le->setFocus();
1191 textChanged(""); 1191 textChanged("");
1192 1192
1193 1193
1194} 1194}
1195 1195
1196 1196
1197QString PhoneNumberDialog::phoneNumber() 1197QString PhoneNumberDialog::phoneNumber()
1198{ 1198{
1199 QString s = le->text(); 1199 QString s = le->text();
1200 1200
1201 return s; 1201 return s;
1202} 1202}
1203 1203
1204 1204
1205void PhoneNumberDialog::textChanged(const QString &s) 1205void PhoneNumberDialog::textChanged(const QString &s)
1206{ 1206{
1207 // enableButtonOK(s.length() > 0); 1207 // enableButtonOK(s.length() > 0);
1208} 1208}
1209 1209
1210 1210
1211//#include "edit.moc" 1211//#include "edit.moc"
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp
index ff1b11b..81dab38 100644
--- a/noncore/settings/networksettings/ppp/general.cpp
+++ b/noncore/settings/networksettings/ppp/general.cpp
@@ -23,130 +23,130 @@
23 * License along with this program; if not, write to the Free 23 * License along with this program; if not, write to the Free
24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */ 25 */
26 26
27#include "general.h" 27#include "general.h"
28#include "interfaceppp.h" 28#include "interfaceppp.h"
29#include "modeminfo.h" 29#include "modeminfo.h"
30#include "modemcmds.h" 30#include "modemcmds.h"
31#include "pppdata.h" 31#include "pppdata.h"
32 32
33/* OPIE */ 33/* OPIE */
34#include <qpe/config.h> 34#include <qpe/config.h>
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36 36
37/* QT */ 37/* QT */
38#include <qcheckbox.h> 38#include <qcheckbox.h>
39#include <qcombobox.h> 39#include <qcombobox.h>
40#include <qlabel.h> 40#include <qlabel.h>
41#include <qlayout.h> 41#include <qlayout.h>
42#include <qpushbutton.h> 42#include <qpushbutton.h>
43#include <qslider.h> 43#include <qslider.h>
44#include <qspinbox.h> 44#include <qspinbox.h>
45#include <qwhatsthis.h> 45#include <qwhatsthis.h>
46 46
47/* STD */ 47/* STD */
48#include <termios.h> 48#include <termios.h>
49#include <string.h> 49#include <string.h>
50 50
51 51
52ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name ) 52ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name )
53 : QWidget(parent, name), _pppdata(pd) 53 : QWidget(parent, name), _pppdata(pd)
54{ 54{
55 int k; 55 int k;
56 56
57 QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint()); 57 QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint());
58 58
59 QLabel *label1; 59 QLabel *label1;
60 60
61 label1 = new QLabel(tr("Modem &name:"), this); 61 label1 = new QLabel(tr("Modem &name:"), this);
62 tl->addWidget(label1, 0, 0); 62 tl->addWidget(label1, 0, 0);
63 63
64 modemname = new QLineEdit(this, "modemName"); 64 modemname = new QLineEdit(this, "modemName");
65 modemname->setText( _pppdata->devname() ); 65 modemname->setText( _pppdata->devname() );
66 label1->setBuddy(modemname); 66 label1->setBuddy(modemname);
67 tl->addWidget(modemname, 0, 1); 67 tl->addWidget(modemname, 0, 1);
68 68
69 label1 = new QLabel(tr("Modem de&vice:"), this); 69 label1 = new QLabel(tr("Modem de&vice:"), this);
70 tl->addWidget(label1, 1, 0); 70 tl->addWidget(label1, 1, 0);
71 71
72 modemdevice = new QComboBox(false, this); 72 modemdevice = new QComboBox(false, this);
73 modemdevice->setEditable( true ); 73 modemdevice->setEditable( true );
74 modemdevice->setDuplicatesEnabled ( false ); 74 modemdevice->setDuplicatesEnabled ( false );
75 modemdevice->setInsertionPolicy( QComboBox::AtTop ); 75 modemdevice->setInsertionPolicy( QComboBox::AtTop );
76 label1->setBuddy(modemdevice); 76 label1->setBuddy(modemdevice);
77 77
78 Config cfg("NetworkSetupPPP"); 78 Config cfg("NetworkSetupPPP");
79 cfg.setGroup("Devices_General"); 79 cfg.setGroup("Devices_General");
80 QStringList devs = cfg.readListEntry("devices",','); 80 QStringList devs = cfg.readListEntry("devices",',');
81 if (devs.isEmpty()) devs << "/dev/modem" << "/dev/ircomm0" << "/dev/ttyS0"; 81 if (devs.isEmpty()) devs << "/dev/modem" << "/dev/ircomm0" << "/dev/ttyS0";
82 modemdevice->insertStringList( devs ); 82 modemdevice->insertStringList( devs );
83 tl->addWidget(modemdevice, 1, 1); 83 tl->addWidget(modemdevice, 1, 1);
84 84
85 // connect(modemdevice, SIGNAL(activated(int)), 85 // connect(modemdevice, SIGNAL(activated(int)),
86 // SLOT(setmodemdc(int))); 86 // SLOT(setmodemdc(int)));
87 // connect(modemdevice, SIGNAL(textChanged( const QString & ) ), 87 // connect(modemdevice, SIGNAL(textChanged(const QString&) ),
88 // SLOT( setmodemdc( const QString &) ) ); 88 // SLOT( setmodemdc(const QString&) ) );
89 89
90 QString tmp = tr("This specifies the serial port your modem is attached \n" 90 QString tmp = tr("This specifies the serial port your modem is attached \n"
91 "to. On Linux/x86, typically this is either /dev/ttyS0 \n" 91 "to. On Linux/x86, typically this is either /dev/ttyS0 \n"
92 "(COM1 under DOS) or /dev/ttyS1 (COM2 under DOS).\n" 92 "(COM1 under DOS) or /dev/ttyS1 (COM2 under DOS).\n"
93 "\n" 93 "\n"
94 "If you have an internal ISDN card with AT command\n" 94 "If you have an internal ISDN card with AT command\n"
95 "emulation (most cards under Linux support this), you\n" 95 "emulation (most cards under Linux support this), you\n"
96 "should select one of the /dev/ttyIx devices."); 96 "should select one of the /dev/ttyIx devices.");
97 97
98 QWhatsThis::add(label1,tmp); 98 QWhatsThis::add(label1,tmp);
99 QWhatsThis::add(modemdevice,tmp); 99 QWhatsThis::add(modemdevice,tmp);
100 100
101 101
102 label1 = new QLabel(tr("&Flow control:"), this); 102 label1 = new QLabel(tr("&Flow control:"), this);
103 tl->addWidget(label1, 2, 0); 103 tl->addWidget(label1, 2, 0);
104 104
105 flowcontrol = new QComboBox(false, this); 105 flowcontrol = new QComboBox(false, this);
106 label1->setBuddy(flowcontrol); 106 label1->setBuddy(flowcontrol);
107 flowcontrol->insertItem(tr("Hardware [CRTSCTS]")); 107 flowcontrol->insertItem(tr("Hardware [CRTSCTS]"));
108 flowcontrol->insertItem(tr("Software [XON/XOFF]")); 108 flowcontrol->insertItem(tr("Software [XON/XOFF]"));
109 flowcontrol->insertItem(tr("None")); 109 flowcontrol->insertItem(tr("None"));
110 tl->addWidget(flowcontrol, 2, 1); 110 tl->addWidget(flowcontrol, 2, 1);
111 // connect(flowcontrol, SIGNAL(activated(int)), 111 // connect(flowcontrol, SIGNAL(activated(int)),
112 // SLOT(setflowcontrol(int))); 112 // SLOT(setflowcontrol(int)));
113 113
114 tmp = tr("<p>Specifies how the serial port and modem\n" 114 tmp = tr("<p>Specifies how the serial port and modem\n"
115 "communicate. You should not change this unless\n" 115 "communicate. You should not change this unless\n"
116 "you know what you are doing.\n" 116 "you know what you are doing.\n"
117 "\n" 117 "\n"
118 "<b>Default</b>: CRTSCTS"); 118 "<b>Default</b>: CRTSCTS");
119 119
120 QWhatsThis::add(label1,tmp); 120 QWhatsThis::add(label1,tmp);
121 QWhatsThis::add(flowcontrol,tmp); 121 QWhatsThis::add(flowcontrol,tmp);
122 122
123 QLabel *labelenter = new QLabel(tr("&Line termination:"), this); 123 QLabel *labelenter = new QLabel(tr("&Line termination:"), this);
124 tl->addWidget(labelenter, 3, 0); 124 tl->addWidget(labelenter, 3, 0);
125 125
126 enter = new QComboBox(false, this); 126 enter = new QComboBox(false, this);
127 labelenter->setBuddy(enter); 127 labelenter->setBuddy(enter);
128 enter->insertItem("CR"); 128 enter->insertItem("CR");
129 enter->insertItem("LF"); 129 enter->insertItem("LF");
130 enter->insertItem("CR/LF"); 130 enter->insertItem("CR/LF");
131 tl->addWidget(enter, 3, 1); 131 tl->addWidget(enter, 3, 1);
132 // connect(enter, SIGNAL(activated(int)), SLOT(setenter(int))); 132 // connect(enter, SIGNAL(activated(int)), SLOT(setenter(int)));
133 tmp = tr("<p>Specifies how AT commands are sent to your\n" 133 tmp = tr("<p>Specifies how AT commands are sent to your\n"
134 "modem. Most modems will work fine with the\n" 134 "modem. Most modems will work fine with the\n"
135 "default <i>CR/LF</i>. If your modem does not react\n" 135 "default <i>CR/LF</i>. If your modem does not react\n"
136 "to the init string, you should try different\n" 136 "to the init string, you should try different\n"
137 "settings here\n" 137 "settings here\n"
138 "\n" 138 "\n"
139 "<b>Default</b>: CR/LF"); 139 "<b>Default</b>: CR/LF");
140 140
141 QWhatsThis::add(labelenter,tmp); 141 QWhatsThis::add(labelenter,tmp);
142 QWhatsThis::add(enter, tmp); 142 QWhatsThis::add(enter, tmp);
143 143
144 QLabel *baud_label = new QLabel(tr("Co&nnection speed:"), this); 144 QLabel *baud_label = new QLabel(tr("Co&nnection speed:"), this);
145 tl->addWidget(baud_label, 4, 0); 145 tl->addWidget(baud_label, 4, 0);
146 baud_c = new QComboBox(this); 146 baud_c = new QComboBox(this);
147 baud_label->setBuddy(baud_c); 147 baud_label->setBuddy(baud_c);
148 148
149 static const char *baudrates[] = 149 static const char *baudrates[] =
150 { 150 {
151 151
152#ifdef B460800 152#ifdef B460800
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp
index e466358..e21bbc7 100644
--- a/noncore/settings/networksettings/ppp/kpppwidget.cpp
+++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp
@@ -335,133 +335,133 @@ KPPPWidget::~KPPPWidget()
335 335
336void KPPPWidget::enterPressedInID() { 336void KPPPWidget::enterPressedInID() {
337 PW_Edit->setFocus(); 337 PW_Edit->setFocus();
338} 338}
339 339
340 340
341void KPPPWidget::enterPressedInPW() { 341void KPPPWidget::enterPressedInPW() {
342 connect_b->setFocus(); 342 connect_b->setFocus();
343} 343}
344 344
345// triggered by the session manager 345// triggered by the session manager
346void KPPPWidget::saveMyself() { 346void KPPPWidget::saveMyself() {
347 _pppdata->save(); 347 _pppdata->save();
348} 348}
349 349
350void KPPPWidget::shutDown() { 350void KPPPWidget::shutDown() {
351 interruptConnection(); 351 interruptConnection();
352 saveMyself(); 352 saveMyself();
353} 353}
354 354
355void KPPPWidget::log_window_toggled(bool on) { 355void KPPPWidget::log_window_toggled(bool on) {
356 _pppdata->set_show_log_window(on); 356 _pppdata->set_show_log_window(on);
357} 357}
358 358
359 359
360 360
361 361
362// void KPPPWidget::resetaccounts() { 362// void KPPPWidget::resetaccounts() {
363// connectto_c->clear(); 363// connectto_c->clear();
364 364
365// int count = _pppdata->count(); 365// int count = _pppdata->count();
366 366
367// // enable/disable controls 367// // enable/disable controls
368// connectto_c->setEnabled(count > 0); 368// connectto_c->setEnabled(count > 0);
369// connect_b->setEnabled(count > 0); 369// connect_b->setEnabled(count > 0);
370// log->setEnabled(count > 0); 370// log->setEnabled(count > 0);
371// ID_Edit->setEnabled(count > 0); 371// ID_Edit->setEnabled(count > 0);
372// PW_Edit->setEnabled(count > 0); 372// PW_Edit->setEnabled(count > 0);
373 373
374// //load the accounts 374// //load the accounts
375// for(int i=0; i < count; i++) { 375// for(int i=0; i < count; i++) {
376// _pppdata->setAccountbyIndex(i); 376// _pppdata->setAccountbyIndex(i);
377// connectto_c->insertItem(_pppdata->accname()); 377// connectto_c->insertItem(_pppdata->accname());
378// } 378// }
379 379
380// //set the default account 380// //set the default account
381// if(!_pppdata->defaultAccount().isEmpty()) { 381// if(!_pppdata->defaultAccount().isEmpty()) {
382// for(int i=0; i < count; i++) 382// for(int i=0; i < count; i++)
383// if(_pppdata->defaultAccount() == connectto_c->text(i)) { 383// if(_pppdata->defaultAccount() == connectto_c->text(i)) {
384 // connectto_c->setCurrentItem(i); 384 // connectto_c->setCurrentItem(i);
385 // _pppdata->setAccountbyIndex(i); 385 // _pppdata->setAccountbyIndex(i);
386 386
387 // ID_Edit->setText(_pppdata->storedUsername()); 387 // ID_Edit->setText(_pppdata->storedUsername());
388 // PW_Edit->setText(_pppdata->storedPassword()); 388 // PW_Edit->setText(_pppdata->storedPassword());
389// } 389// }
390// } 390// }
391// else 391// else
392// if(count > 0) { 392// if(count > 0) {
393// _pppdata->setDefaultAccount(connectto_c->text(0)); 393// _pppdata->setDefaultAccount(connectto_c->text(0));
394// _pppdata->save(); 394// _pppdata->save();
395 // ID_Edit->setText(_pppdata->storedUsername()); 395 // ID_Edit->setText(_pppdata->storedUsername());
396 // PW_Edit->setText(_pppdata->storedPassword()); 396 // PW_Edit->setText(_pppdata->storedPassword());
397// } 397// }
398 398
399// connect(ID_Edit, SIGNAL(textChanged(const QString &)), 399// connect(ID_Edit, SIGNAL(textChanged(const QString&)),
400 // this, SLOT(usernameChanged(const QString &))); 400 // this, SLOT(usernameChanged(const QString&)));
401 401
402// connect(PW_Edit, SIGNAL(textChanged(const QString &)), 402// connect(PW_Edit, SIGNAL(textChanged(const QString&)),
403 // this, SLOT(passwordChanged(const QString &))); 403 // this, SLOT(passwordChanged(const QString&)));
404 404
405// if (ID_Edit->text().isEmpty()) 405// if (ID_Edit->text().isEmpty())
406// ID_Edit->setFocus(); 406// ID_Edit->setFocus();
407// else if (PW_Edit->text().isEmpty()) 407// else if (PW_Edit->text().isEmpty())
408// PW_Edit->setFocus(); 408// PW_Edit->setFocus();
409// } 409// }
410 410
411 411
412void KPPPWidget::interruptConnection() { 412void KPPPWidget::interruptConnection() {
413 // interrupt dial up 413 // interrupt dial up
414// 414//
415 415
416 if (con->isVisible()) 416 if (con->isVisible())
417 emit con->cancelbutton(); 417 emit con->cancelbutton();
418 418
419 // disconnect if online 419 // disconnect if online
420 if (_pppdata->pppdRunning()) 420 if (_pppdata->pppdRunning())
421 emit disconnect(); 421 emit disconnect();
422} 422}
423 423
424 424
425void KPPPWidget::sigPPPDDied() { 425void KPPPWidget::sigPPPDDied() {
426 qDebug( "Received a SIGUSR1" ); 426 qDebug( "Received a SIGUSR1" );
427 427
428 // if we are not connected pppdpid is -1 so have have to check for that 428 // if we are not connected pppdpid is -1 so have have to check for that
429 // in the followin line to make sure that we don't raise a false alarm 429 // in the followin line to make sure that we don't raise a false alarm
430 // such as would be the case when the log file viewer exits. 430 // such as would be the case when the log file viewer exits.
431 if(_pppdata->pppdRunning() || _pppdata->pppdError()) { 431 if(_pppdata->pppdRunning() || _pppdata->pppdError()) {
432 qDebug( "It was pppd that died" ); 432 qDebug( "It was pppd that died" );
433 433
434 // when we killpppd() on Cancel in ConnectWidget 434 // when we killpppd() on Cancel in ConnectWidget
435 // we set pppid to -1 so we won't 435 // we set pppid to -1 so we won't
436 // enter this block 436 // enter this block
437 437
438 // just to be sure 438 // just to be sure
439 439
440 Modem::modem->removeSecret(AUTH_PAP); 440 Modem::modem->removeSecret(AUTH_PAP);
441 Modem::modem->removeSecret(AUTH_CHAP); 441 Modem::modem->removeSecret(AUTH_CHAP);
442 442
443 _pppdata->setpppdRunning(false); 443 _pppdata->setpppdRunning(false);
444 444
445 qDebug( "Executing command on disconnect since pppd has died." ); 445 qDebug( "Executing command on disconnect since pppd has died." );
446 QApplication::flushX(); 446 QApplication::flushX();
447 execute_command(_pppdata->command_on_disconnect()); 447 execute_command(_pppdata->command_on_disconnect());
448 448
449// stopAccounting(); 449// stopAccounting();
450 450
451 con_win->stopClock(); 451 con_win->stopClock();
452// DockWidget::dock_widget->stop_stats(); 452// DockWidget::dock_widget->stop_stats();
453// DockWidget::dock_widget->hide(); 453// DockWidget::dock_widget->hide();
454 454
455 if(!_pppdata->pppdError()) 455 if(!_pppdata->pppdError())
456 _pppdata->setpppdError(E_PPPD_DIED); 456 _pppdata->setpppdError(E_PPPD_DIED);
457 removedns(); 457 removedns();
458 Modem::modem->unlockdevice(); 458 Modem::modem->unlockdevice();
459 // 459 //
460 con->pppdDied(); 460 con->pppdDied();
461 461
462 if(!_pppdata->automatic_redial()) { 462 if(!_pppdata->automatic_redial()) {
463 quit_b->setFocus(); 463 quit_b->setFocus();
464 show(); 464 show();
465 con_win->stopClock(); 465 con_win->stopClock();
466 //stopAccounting(); 466 //stopAccounting();
467 con_win->hide(); 467 con_win->hide();
@@ -660,130 +660,130 @@ void KPPPWidget::disconnect() {
660 con_win->stopClock(); 660 con_win->stopClock();
661// p_kppp->stopAccounting(); 661// p_kppp->stopAccounting();
662 con_win->hide(); 662 con_win->hide();
663 663
664// DockWidget::dock_widget->stop_stats(); 664// DockWidget::dock_widget->stop_stats();
665// DockWidget::dock_widget->hide(); 665// DockWidget::dock_widget->hide();
666 666
667// if(m_bQuitOnDisconnect) 667// if(m_bQuitOnDisconnect)
668// kapp->exit(0); 668// kapp->exit(0);
669// else { 669// else {
670 this->quit_b->setFocus(); 670 this->quit_b->setFocus();
671 this->show(); 671 this->show();
672// } 672// }
673} 673}
674 674
675 675
676// void KPPPWidget::helpbutton() { 676// void KPPPWidget::helpbutton() {
677// kapp->invokeHelp(); 677// kapp->invokeHelp();
678// } 678// }
679 679
680 680
681void KPPPWidget::quitbutton() { 681void KPPPWidget::quitbutton() {
682 if(_pppdata->pppdRunning()) { 682 if(_pppdata->pppdRunning()) {
683 int ok = QMessageBox::warning(this, 683 int ok = QMessageBox::warning(this,
684 QObject::tr("Exiting kPPP will close your PPP Session."), 684 QObject::tr("Exiting kPPP will close your PPP Session."),
685 QObject::tr("Quit kPPP?")); 685 QObject::tr("Quit kPPP?"));
686 if(ok == QMessageBox::Yes) { 686 if(ok == QMessageBox::Yes) {
687 Modem::modem->killPPPDaemon(); 687 Modem::modem->killPPPDaemon();
688 QApplication::flushX(); 688 QApplication::flushX();
689 execute_command(_pppdata->command_on_disconnect()); 689 execute_command(_pppdata->command_on_disconnect());
690 removedns(); 690 removedns();
691 Modem::modem->unlockdevice(); 691 Modem::modem->unlockdevice();
692 } 692 }
693 } else { 693 } else {
694 if (!_pppdata->accname().isEmpty() && !_pppdata->storePassword()) 694 if (!_pppdata->accname().isEmpty() && !_pppdata->storePassword())
695 _pppdata->setStoredPassword(""); 695 _pppdata->setStoredPassword("");
696 } 696 }
697 _pppdata->save(); 697 _pppdata->save();
698 qApp->quit(); 698 qApp->quit();
699} 699}
700 700
701 701
702// void KPPPWidget::rulesetLoadError() { 702// void KPPPWidget::rulesetLoadError() {
703// QMessageBox::warning(this,"error", ruleset_load_errmsg); 703// QMessageBox::warning(this,"error", ruleset_load_errmsg);
704// } 704// }
705 705
706 706
707// void KPPPWidget::startAccounting() { 707// void KPPPWidget::startAccounting() {
708// // volume accounting 708// // volume accounting
709// stats->totalbytes = 0; 709// stats->totalbytes = 0;
710 710
711// kdDebug() << "AcctEnabled: " << _pppdata->AcctEnabled() << endl; 711// kdDebug() << "AcctEnabled: " << _pppdata->AcctEnabled() << endl;
712 712
713// // load the ruleset 713// // load the ruleset
714// if(!_pppdata->AcctEnabled()) 714// if(!_pppdata->AcctEnabled())
715// return; 715// return;
716 716
717// QString d = AccountingBase::getAccountingFile(_pppdata->accountingFile()); 717// QString d = AccountingBase::getAccountingFile(_pppdata->accountingFile());
718// // if(::access(d.data(), X_OK) != 0) 718// // if(::access(d.data(), X_OK) != 0)
719// acct = new Accounting(this, stats); 719// acct = new Accounting(this, stats);
720// // else 720// // else
721// // acct = new ExecutableAccounting(this); 721// // acct = new ExecutableAccounting(this);
722 722
723// // connect to the accounting object 723// // connect to the accounting object
724// connect(acct, SIGNAL(changed(QString, QString)), 724// connect(acct, SIGNAL(changed(QString,QString)),
725 // con_win, SLOT(slotAccounting(QString, QString))); 725 // con_win, SLOT(slotAccounting(QString,QString)));
726 726
727// // if(!acct->loadRuleSet(_pppdata->accountingFile())) { 727// // if(!acct->loadRuleSet(_pppdata->accountingFile())) {
728// // QString s= QObject::tr("Can not load the accounting " 728// // QString s= QObject::tr("Can not load the accounting "
729 // // "ruleset \"%1\"!").arg(_pppdata->accountingFile()); 729 // // "ruleset \"%1\"!").arg(_pppdata->accountingFile());
730 730
731// // starting the messagebox with a timer will prevent us 731// // starting the messagebox with a timer will prevent us
732// // from blocking the calling function ConnectWidget::timerEvent 732// // from blocking the calling function ConnectWidget::timerEvent
733// ruleset_load_errmsg = s; 733// ruleset_load_errmsg = s;
734// QTimer::singleShot(0, this, SLOT(rulesetLoadError())); 734// QTimer::singleShot(0, this, SLOT(rulesetLoadError()));
735// return; 735// return;
736// } 736// }
737// //else 737// //else
738// // acct->slotStart(); 738// // acct->slotStart();
739// } 739// }
740 740
741// void KPPPWidget::stopAccounting() { 741// void KPPPWidget::stopAccounting() {
742// // store volume accounting 742// // store volume accounting
743// // if(stats->totalbytes != 0) 743// // if(stats->totalbytes != 0)
744// // _pppdata->setTotalBytes(stats->totalbytes); 744// // _pppdata->setTotalBytes(stats->totalbytes);
745 745
746// if(!_pppdata->AcctEnabled()) 746// if(!_pppdata->AcctEnabled())
747// return; 747// return;
748 748
749// // if(acct != 0) { 749// // if(acct != 0) {
750// // acct->slotStop(); 750// // acct->slotStop();
751// // delete acct; 751// // delete acct;
752// // acct = 0; 752// // acct = 0;
753// // } 753// // }
754// } 754// }
755 755
756 756
757// void KPPPWidget::showStats() { 757// void KPPPWidget::showStats() {
758// if(statdlg) { 758// if(statdlg) {
759// statdlg->show(); 759// statdlg->show();
760// statdlg->raise(); 760// statdlg->raise();
761// } 761// }
762// } 762// }
763 763
764 764
765void KPPPWidget::usernameChanged(const QString &) { 765void KPPPWidget::usernameChanged(const QString &) {
766 // store username for later use 766 // store username for later use
767 _pppdata->setStoredUsername(ID_Edit->text()); 767 _pppdata->setStoredUsername(ID_Edit->text());
768} 768}
769 769
770 770
771void KPPPWidget::passwordChanged(const QString &) { 771void KPPPWidget::passwordChanged(const QString &) {
772 // store the password if so requested 772 // store the password if so requested
773 if(_pppdata->storePassword()) 773 if(_pppdata->storePassword())
774 _pppdata->setStoredPassword(PW_Edit->text()); 774 _pppdata->setStoredPassword(PW_Edit->text());
775 else 775 else
776 _pppdata->setStoredPassword(""); 776 _pppdata->setStoredPassword("");
777} 777}
778 778
779 779
780void KPPPWidget::setPW_Edit(const QString &pw) { 780void KPPPWidget::setPW_Edit(const QString &pw) {
781 PW_Edit->setText(pw); 781 PW_Edit->setText(pw);
782} 782}
783 783
784 784
785// void KPPPWidget::resetCosts(const QString &s) { 785// void KPPPWidget::resetCosts(const QString &s) {
786// AccountingBase::resetCosts(s); 786// AccountingBase::resetCosts(s);
787// } 787// }
788 788
789 789
diff --git a/noncore/settings/networksettings/ppp/pppdargs.cpp b/noncore/settings/networksettings/ppp/pppdargs.cpp
index 66a4d82..d6d8d88 100644
--- a/noncore/settings/networksettings/ppp/pppdargs.cpp
+++ b/noncore/settings/networksettings/ppp/pppdargs.cpp
@@ -1,123 +1,123 @@
1/* 1/*
2 * kPPP: A pppd front end for the KDE project 2 * kPPP: A pppd front end for the KDE project
3 * 3 *
4 * $Id$ 4 * $Id$
5 * 5 *
6 * Copyright (C) 1997 Bernd Johannes Wuebben 6 * Copyright (C) 1997 Bernd Johannes Wuebben
7 * wuebben@math.cornell.edu 7 * wuebben@math.cornell.edu
8 * 8 *
9 * based on EzPPP: 9 * based on EzPPP:
10 * Copyright (C) 1997 Jay Painter 10 * Copyright (C) 1997 Jay Painter
11 * 11 *
12 * 12 *
13 * This library is free software; you can redistribute it and/or 13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public 14 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either 15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version. 16 * version 2 of the License, or (at your option) any later version.
17 * 17 *
18 * This library is distributed in the hope that it will be useful, 18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details. 21 * Library General Public License for more details.
22 * 22 *
23 * You should have received a copy of the GNU Library General Public 23 * You should have received a copy of the GNU Library General Public
24 * License along with this program; if not, write to the Free 24 * License along with this program; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */ 26 */
27 27
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qbuttongroup.h> 29#include <qbuttongroup.h>
30#include <qapplication.h> 30#include <qapplication.h>
31#include "pppdargs.h" 31#include "pppdargs.h"
32#include "pppdata.h" 32#include "pppdata.h"
33 33
34 34
35PPPdArguments::PPPdArguments( PPPData *pd, QWidget *parent, const char *name) 35PPPdArguments::PPPdArguments( PPPData *pd, QWidget *parent, const char *name)
36 : QDialog(parent, name, TRUE), _pppdata(pd) 36 : QDialog(parent, name, TRUE), _pppdata(pd)
37{ 37{
38 setCaption(tr("Customize pppd Arguments")); 38 setCaption(tr("Customize pppd Arguments"));
39// KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); 39// KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon());
40 QVBoxLayout *l = new QVBoxLayout(this, 10, 10); 40 QVBoxLayout *l = new QVBoxLayout(this, 10, 10);
41 QHBoxLayout *tl = new QHBoxLayout(10); 41 QHBoxLayout *tl = new QHBoxLayout(10);
42 l->addLayout(tl); 42 l->addLayout(tl);
43 QVBoxLayout *l1 = new QVBoxLayout(); 43 QVBoxLayout *l1 = new QVBoxLayout();
44 QVBoxLayout *l2 = new QVBoxLayout(); 44 QVBoxLayout *l2 = new QVBoxLayout();
45 tl->addLayout(l1, 1); 45 tl->addLayout(l1, 1);
46 tl->addLayout(l2, 0); 46 tl->addLayout(l2, 0);
47 47
48 QHBoxLayout *l11 = new QHBoxLayout(10); 48 QHBoxLayout *l11 = new QHBoxLayout(10);
49 l1->addLayout(l11); 49 l1->addLayout(l11);
50 50
51 argument_label = new QLabel(tr("Argument:"), this); 51 argument_label = new QLabel(tr("Argument:"), this);
52 l11->addWidget(argument_label); 52 l11->addWidget(argument_label);
53 53
54 argument = new QLineEdit(this); 54 argument = new QLineEdit(this);
55 connect(argument, SIGNAL(returnPressed()), 55 connect(argument, SIGNAL(returnPressed()),
56 SLOT(addbutton())); 56 SLOT(addbutton()));
57 l11->addWidget(argument); 57 l11->addWidget(argument);
58 connect(argument, SIGNAL(textChanged(const QString &)), 58 connect(argument, SIGNAL(textChanged(const QString&)),
59 this, SLOT(textChanged(const QString &))); 59 this, SLOT(textChanged(const QString&)));
60 60
61 arguments = new QListBox(this); 61 arguments = new QListBox(this);
62 arguments->setMinimumSize(1, fontMetrics().lineSpacing()*10); 62 arguments->setMinimumSize(1, fontMetrics().lineSpacing()*10);
63 connect(arguments, SIGNAL(highlighted(int)), 63 connect(arguments, SIGNAL(highlighted(int)),
64 this, SLOT(itemSelected(int))); 64 this, SLOT(itemSelected(int)));
65 l1->addWidget(arguments, 1); 65 l1->addWidget(arguments, 1);
66 66
67 add = new QPushButton(tr("Add"), this); 67 add = new QPushButton(tr("Add"), this);
68 connect(add, SIGNAL(clicked()), SLOT(addbutton())); 68 connect(add, SIGNAL(clicked()), SLOT(addbutton()));
69 l2->addWidget(add); 69 l2->addWidget(add);
70 l2->addStretch(1); 70 l2->addStretch(1);
71 71
72 remove = new QPushButton(tr("Remove"), this); 72 remove = new QPushButton(tr("Remove"), this);
73 connect(remove, SIGNAL(clicked()), SLOT(removebutton())); 73 connect(remove, SIGNAL(clicked()), SLOT(removebutton()));
74 l2->addWidget(remove); 74 l2->addWidget(remove);
75 75
76 defaults = new QPushButton(tr("Defaults"), this); 76 defaults = new QPushButton(tr("Defaults"), this);
77 connect(defaults, SIGNAL(clicked()), SLOT(defaultsbutton())); 77 connect(defaults, SIGNAL(clicked()), SLOT(defaultsbutton()));
78 l2->addWidget(defaults); 78 l2->addWidget(defaults);
79 79
80 l->addSpacing(5); 80 l->addSpacing(5);
81 81
82 82
83 //load info from gpppdata 83 //load info from gpppdata
84 init(); 84 init();
85 85
86 add->setEnabled(false); 86 add->setEnabled(false);
87 remove->setEnabled(false); 87 remove->setEnabled(false);
88 argument->setFocus(); 88 argument->setFocus();
89} 89}
90 90
91 91
92void PPPdArguments::addbutton() { 92void PPPdArguments::addbutton() {
93 if(!argument->text().isEmpty() && arguments->count() < MAX_PPPD_ARGUMENTS) { 93 if(!argument->text().isEmpty() && arguments->count() < MAX_PPPD_ARGUMENTS) {
94 arguments->insertItem(argument->text()); 94 arguments->insertItem(argument->text());
95 argument->setText(""); 95 argument->setText("");
96 } 96 }
97} 97}
98 98
99 99
100void PPPdArguments::removebutton() { 100void PPPdArguments::removebutton() {
101 if(arguments->currentItem() >= 0) 101 if(arguments->currentItem() >= 0)
102 arguments->removeItem(arguments->currentItem()); 102 arguments->removeItem(arguments->currentItem());
103} 103}
104 104
105 105
106void PPPdArguments::defaultsbutton() { 106void PPPdArguments::defaultsbutton() {
107 // all of this is a hack 107 // all of this is a hack
108 // save current list 108 // save current list
109 QStringList arglist(_pppdata->pppdArgument()); 109 QStringList arglist(_pppdata->pppdArgument());
110 110
111 // get defaults 111 // get defaults
112 _pppdata->setpppdArgumentDefaults(); 112 _pppdata->setpppdArgumentDefaults();
113 init(); 113 init();
114 114
115 // restore old list 115 // restore old list
116 _pppdata->setpppdArgument(arglist); 116 _pppdata->setpppdArgument(arglist);
117} 117}
118 118
119 119
120void PPPdArguments::accept() { 120void PPPdArguments::accept() {
121 QStringList arglist; 121 QStringList arglist;
122 for(uint i=0; i < arguments->count(); i++) 122 for(uint i=0; i < arguments->count(); i++)
123 arglist.append(arguments->text(i)); 123 arglist.append(arguments->text(i));
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp
index 92339d6..dd1db28 100644
--- a/noncore/settings/networksettings/wlan/wlanimp2.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp
@@ -1,121 +1,121 @@
1#include "wlanimp2.h" 1#include "wlanimp2.h"
2#include "keyedit.h" 2#include "keyedit.h"
3#include "interfacesetupimp.h" 3#include "interfacesetupimp.h"
4 4
5#include "../interfaces/interface.h" 5#include "../interfaces/interface.h"
6 6
7#include <assert.h> 7#include <assert.h>
8#include <errno.h> 8#include <errno.h>
9#include <string.h> 9#include <string.h>
10 10
11#include <qapplication.h> 11#include <qapplication.h>
12#include <qfile.h> 12#include <qfile.h>
13#include <qdir.h> 13#include <qdir.h>
14#include <qdialog.h> 14#include <qdialog.h>
15#include <qtextstream.h> 15#include <qtextstream.h>
16#include <qmessagebox.h> 16#include <qmessagebox.h>
17#include <qlineedit.h> 17#include <qlineedit.h>
18#include <qlabel.h> 18#include <qlabel.h>
19#include <qspinbox.h> 19#include <qspinbox.h>
20#include <qradiobutton.h> 20#include <qradiobutton.h>
21#include <qpushbutton.h> 21#include <qpushbutton.h>
22#include <qcheckbox.h> 22#include <qcheckbox.h>
23#include <qtabwidget.h> 23#include <qtabwidget.h>
24#include <qcombobox.h> 24#include <qcombobox.h>
25#include <qlistview.h> 25#include <qlistview.h>
26#include <qvbox.h> 26#include <qvbox.h>
27#include <qprogressbar.h> 27#include <qprogressbar.h>
28 28
29#ifdef QWS 29#ifdef QWS
30 #include <qpe/resource.h> 30 #include <qpe/resource.h>
31 #include <opie2/oprocess.h> 31 #include <opie2/oprocess.h>
32 #include <opie2/onetwork.h> 32 #include <opie2/onetwork.h>
33 #include <opie2/opcap.h> 33 #include <opie2/opcap.h>
34#else 34#else
35 #define OProcess KProcess 35 #define OProcess KProcess
36 #include <kprocess.h> 36 #include <kprocess.h>
37#endif 37#endif
38 38
39#define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" 39#define WIRELESS_OPTS "/etc/pcmcia/wireless.opts"
40#define PREUP "/etc/network/if-pre-up.d/wireless-tools" 40#define PREUP "/etc/network/if-pre-up.d/wireless-tools"
41 41
42/** 42/**
43 * Constructor, read in the wireless.opts file for parsing later. 43 * Constructor, read in the wireless.opts file for parsing later.
44 */ 44 */
45WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") { 45WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") {
46 interfaces = new Interfaces(); 46 interfaces = new Interfaces();
47 interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces); 47 interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces);
48 tabWidget->insertTab(interfaceSetup, "TCP/IP"); 48 tabWidget->insertTab(interfaceSetup, "TCP/IP");
49 49
50 // Check sanity - the existance of the wireless-tools if-pre-up script 50 // Check sanity - the existance of the wireless-tools if-pre-up script
51 QFile file(QString(PREUP)); 51 QFile file(QString(PREUP));
52 if (file.exists()) { 52 if (file.exists()) {
53 qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools")); 53 qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools"));
54 } 54 }
55 55
56 connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) ); 56 connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) );
57 connect( netView, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( selectNetwork( QListViewItem* ) ) ); 57 connect( netView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( selectNetwork(QListViewItem*) ) );
58 netView->setColumnAlignment( col_chn, AlignCenter ); 58 netView->setColumnAlignment( col_chn, AlignCenter );
59 netView->setItemMargin( 3 ); 59 netView->setItemMargin( 3 );
60 netView->setAllColumnsShowFocus( true ); 60 netView->setAllColumnsShowFocus( true );
61 61
62} 62}
63 63
64WLANImp::~WLANImp() { 64WLANImp::~WLANImp() {
65//FIXME: delete interfaces; 65//FIXME: delete interfaces;
66} 66}
67 67
68/** 68/**
69 * Change the profile for both wireless settings and network settings. 69 * Change the profile for both wireless settings and network settings.
70 */ 70 */
71void WLANImp::setProfile(const QString &profile){ 71void WLANImp::setProfile(const QString &profile){
72 interfaceSetup->setProfile(profile); 72 interfaceSetup->setProfile(profile);
73 parseOpts(); 73 parseOpts();
74} 74}
75 75
76void WLANImp::parseOpts() { 76void WLANImp::parseOpts() {
77 bool error; 77 bool error;
78 QString opt; 78 QString opt;
79 79
80 if (! interfaces->isInterfaceSet()) 80 if (! interfaces->isInterfaceSet())
81 return; 81 return;
82 82
83 83
84 opt = interfaces->getInterfaceOption("wireless_essid", error); 84 opt = interfaces->getInterfaceOption("wireless_essid", error);
85 if(opt == "any" || opt == "off" || opt.isNull()){ 85 if(opt == "any" || opt == "off" || opt.isNull()){
86 essid->setEditText("any"); 86 essid->setEditText("any");
87 } else { 87 } else {
88 essid->setEditText(opt); 88 essid->setEditText(opt);
89 } 89 }
90 90
91 opt = interfaces->getInterfaceOption("wireless_mode", error).simplifyWhiteSpace(); 91 opt = interfaces->getInterfaceOption("wireless_mode", error).simplifyWhiteSpace();
92 92
93 for ( int i = 0; i < mode->count(); i++) 93 for ( int i = 0; i < mode->count(); i++)
94 if ( mode->text( i ) == opt ) mode->setCurrentItem( i ); 94 if ( mode->text( i ) == opt ) mode->setCurrentItem( i );
95 95
96 opt = interfaces->getInterfaceOption("wireless_ap", error).simplifyWhiteSpace(); 96 opt = interfaces->getInterfaceOption("wireless_ap", error).simplifyWhiteSpace();
97 if (! opt.isNull()) { 97 if (! opt.isNull()) {
98 specifyAp->setChecked(true); 98 specifyAp->setChecked(true);
99 macEdit->setText(opt); 99 macEdit->setText(opt);
100 } 100 }
101 101
102 opt = interfaces->getInterfaceOption("wireless_channel", error).simplifyWhiteSpace(); 102 opt = interfaces->getInterfaceOption("wireless_channel", error).simplifyWhiteSpace();
103 if (! opt.isNull()) { 103 if (! opt.isNull()) {
104 specifyChan->setChecked(true); 104 specifyChan->setChecked(true);
105 networkChannel->setValue(opt.toInt()); 105 networkChannel->setValue(opt.toInt());
106 } 106 }
107 107
108 opt = interfaces->getInterfaceOption("wireless_key", error).simplifyWhiteSpace(); 108 opt = interfaces->getInterfaceOption("wireless_key", error).simplifyWhiteSpace();
109 if (opt.isNull()) 109 if (opt.isNull())
110 opt = interfaces->getInterfaceOption("wireless_enc", error).simplifyWhiteSpace(); 110 opt = interfaces->getInterfaceOption("wireless_enc", error).simplifyWhiteSpace();
111 parseKeyStr(opt); 111 parseKeyStr(opt);
112} 112}
113 113
114void WLANImp::parseKeyStr(QString keystr) { 114void WLANImp::parseKeyStr(QString keystr) {
115 int loc = 0; 115 int loc = 0;
116 int index = 1; 116 int index = 1;
117 QString key; 117 QString key;
118 QStringList keys = QStringList::split(QRegExp("\\s+"), keystr); 118 QStringList keys = QStringList::split(QRegExp("\\s+"), keystr);
119 int enc = -1; // encryption state 119 int enc = -1; // encryption state
120 120
121 for (QStringList::Iterator it = keys.begin(); it != keys.end(); ++it) { 121 for (QStringList::Iterator it = keys.begin(); it != keys.end(); ++it) {
diff --git a/noncore/settings/packagemanager/filterdlg.cpp b/noncore/settings/packagemanager/filterdlg.cpp
index 0da9d19..eeed398 100644
--- a/noncore/settings/packagemanager/filterdlg.cpp
+++ b/noncore/settings/packagemanager/filterdlg.cpp
@@ -7,129 +7,129 @@
7 _;:,     .>    :=|. This file is free software; you can 7 _;:,     .>    :=|. This file is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public 9:`=1 )Y*s>-.--   : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that 14    .i_,=:_.      -<s. This file is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.=       =       ; Public License for more details. 19..}^=.=       =       ; Public License for more details.
20++=   -.     .`     .: 20++=   -.     .`     .:
21 :     =  ...= . :.=- You should have received a copy of the GNU 21 :     =  ...= . :.=- You should have received a copy of the GNU
22 -.   .:....=;==+<; General Public License along with this file; 22 -.   .:....=;==+<; General Public License along with this file;
23  -_. . .   )=.  = see the file COPYING. If not, write to the 23  -_. . .   )=.  = see the file COPYING. If not, write to the
24    --        :-=` Free Software Foundation, Inc., 24    --        :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330, 25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30#include "filterdlg.h" 30#include "filterdlg.h"
31 31
32FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name, 32FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name,
33 const QString &server, const QString &destination, 33 const QString &server, const QString &destination,
34 OPackageManager::Status status, const QString &category ) 34 OPackageManager::Status status, const QString &category )
35 : QDialog( parent, QString::null, true ) 35 : QDialog( parent, QString::null, true )
36{ 36{
37 setCaption( tr( "Filter packages" ) ); 37 setCaption( tr( "Filter packages" ) );
38 38
39 QVBoxLayout *layout = new QVBoxLayout( this ); 39 QVBoxLayout *layout = new QVBoxLayout( this );
40 QScrollView *sv = new QScrollView( this ); 40 QScrollView *sv = new QScrollView( this );
41 layout->addWidget( sv, 0, 0 ); 41 layout->addWidget( sv, 0, 0 );
42 sv->setResizePolicy( QScrollView::AutoOneFit ); 42 sv->setResizePolicy( QScrollView::AutoOneFit );
43 sv->setFrameStyle( QFrame::NoFrame ); 43 sv->setFrameStyle( QFrame::NoFrame );
44 QWidget *container = new QWidget( sv->viewport() ); 44 QWidget *container = new QWidget( sv->viewport() );
45 sv->addChild( container ); 45 sv->addChild( container );
46 layout = new QVBoxLayout( container, 4, 4 ); 46 layout = new QVBoxLayout( container, 4, 4 );
47 47
48 // Category 48 // Category
49 m_categoryCB = new QCheckBox( tr( "Category:" ), container ); 49 m_categoryCB = new QCheckBox( tr( "Category:" ), container );
50 connect( m_categoryCB, SIGNAL(toggled(bool)), this, SLOT(slotCategorySelected(bool)) ); 50 connect( m_categoryCB, SIGNAL(toggled(bool)), this, SLOT(slotCategorySelected(bool)) );
51 m_category = new QComboBox( container ); 51 m_category = new QComboBox( container );
52 m_category->insertStringList( pm->categories() ); 52 m_category->insertStringList( pm->categories() );
53 initItem( m_category, m_categoryCB, category ); 53 initItem( m_category, m_categoryCB, category );
54 layout->addWidget( m_categoryCB ); 54 layout->addWidget( m_categoryCB );
55 layout->addWidget( m_category ); 55 layout->addWidget( m_category );
56 56
57 // Package name 57 // Package name
58 m_nameCB = new QCheckBox( tr( "Names containing:" ), container ); 58 m_nameCB = new QCheckBox( tr( "Names containing:" ), container );
59 connect( m_nameCB, SIGNAL(toggled(bool)), this, SLOT(slotNameSelected(bool)) ); 59 connect( m_nameCB, SIGNAL(toggled(bool)), this, SLOT(slotNameSelected(bool)) );
60 m_name = new QLineEdit( name, container ); 60 m_name = new QLineEdit( name, container );
61 if ( !name.isNull() ) 61 if ( !name.isNull() )
62 m_nameCB->setChecked( true ); 62 m_nameCB->setChecked( true );
63 m_name->setEnabled( !name.isNull() ); 63 m_name->setEnabled( !name.isNull() );
64 layout->addWidget( m_nameCB ); 64 layout->addWidget( m_nameCB );
65 layout->addWidget( m_name ); 65 layout->addWidget( m_name );
66 66
67 // Status 67 // Status
68 m_statusCB = new QCheckBox( tr( "With the status:" ), container ); 68 m_statusCB = new QCheckBox( tr( "With the status:" ), container );
69 connect( m_statusCB, SIGNAL(toggled(bool)), this, SLOT(slotStatusSelected(bool)) ); 69 connect( m_statusCB, SIGNAL(toggled(bool)), this, SLOT(slotStatusSelected(bool)) );
70 m_status = new QComboBox( container ); 70 m_status = new QComboBox( container );
71 connect( m_status, SIGNAL(activated(const QString &)), this, SLOT(slotStatusChanged(const QString &)) ); 71 connect( m_status, SIGNAL(activated(const QString&)), this, SLOT(slotStatusChanged(const QString&)) );
72 QString currStatus; 72 QString currStatus;
73 switch ( status ) 73 switch ( status )
74 { 74 {
75 case OPackageManager::All : currStatus = tr( "All" ); 75 case OPackageManager::All : currStatus = tr( "All" );
76 break; 76 break;
77 case OPackageManager::Installed : currStatus = tr( "Installed" ); 77 case OPackageManager::Installed : currStatus = tr( "Installed" );
78 break; 78 break;
79 case OPackageManager::NotInstalled : currStatus = tr( "Not installed" ); 79 case OPackageManager::NotInstalled : currStatus = tr( "Not installed" );
80 break; 80 break;
81 case OPackageManager::Updated : currStatus = tr( "Updated" ); 81 case OPackageManager::Updated : currStatus = tr( "Updated" );
82 break; 82 break;
83 default : currStatus = QString::null; 83 default : currStatus = QString::null;
84 }; 84 };
85 m_status->insertItem( tr( "All" ) ); 85 m_status->insertItem( tr( "All" ) );
86 m_status->insertItem( tr( "Installed" ) ); 86 m_status->insertItem( tr( "Installed" ) );
87 m_status->insertItem( tr( "Not installed" ) ); 87 m_status->insertItem( tr( "Not installed" ) );
88 m_status->insertItem( tr( "Updated" ) ); 88 m_status->insertItem( tr( "Updated" ) );
89 initItem( m_status, m_statusCB, currStatus ); 89 initItem( m_status, m_statusCB, currStatus );
90 layout->addWidget( m_statusCB ); 90 layout->addWidget( m_statusCB );
91 layout->addWidget( m_status ); 91 layout->addWidget( m_status );
92 92
93 // Server 93 // Server
94 m_serverCB = new QCheckBox( tr( "Available from the following server:" ), container ); 94 m_serverCB = new QCheckBox( tr( "Available from the following server:" ), container );
95 connect( m_serverCB, SIGNAL(toggled(bool)), this, SLOT(slotServerSelected(bool)) ); 95 connect( m_serverCB, SIGNAL(toggled(bool)), this, SLOT(slotServerSelected(bool)) );
96 m_server = new QComboBox( container ); 96 m_server = new QComboBox( container );
97 m_server->insertStringList( *(pm->servers()) ); 97 m_server->insertStringList( *(pm->servers()) );
98 initItem( m_server, m_serverCB, server ); 98 initItem( m_server, m_serverCB, server );
99 layout->addWidget( m_serverCB ); 99 layout->addWidget( m_serverCB );
100 layout->addWidget( m_server ); 100 layout->addWidget( m_server );
101 101
102 // Destination 102 // Destination
103 m_destCB = new QCheckBox( tr( "Installed on device at:" ), container ); 103 m_destCB = new QCheckBox( tr( "Installed on device at:" ), container );
104 connect( m_destCB, SIGNAL(toggled(bool)), this, SLOT(slotDestSelected(bool)) ); 104 connect( m_destCB, SIGNAL(toggled(bool)), this, SLOT(slotDestSelected(bool)) );
105 m_destination = new QComboBox( container ); 105 m_destination = new QComboBox( container );
106 m_destination->insertStringList( *(pm->destinations()) ); 106 m_destination->insertStringList( *(pm->destinations()) );
107 initItem( m_destination, m_destCB, destination ); 107 initItem( m_destination, m_destCB, destination );
108 layout->addWidget( m_destCB ); 108 layout->addWidget( m_destCB );
109 layout->addWidget( m_destination ); 109 layout->addWidget( m_destination );
110 110
111 //showMaximized(); 111 //showMaximized();
112} 112}
113 113
114void FilterDlg::initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection ) 114void FilterDlg::initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection )
115{ 115{
116 if ( !selection.isNull() ) 116 if ( !selection.isNull() )
117 { 117 {
118 checkBox->setChecked( true ); 118 checkBox->setChecked( true );
119 119
120 for ( int i = 0; i < comboBox->count(); i++ ) 120 for ( int i = 0; i < comboBox->count(); i++ )
121 { 121 {
122 if ( comboBox->text( i ) == selection ) 122 if ( comboBox->text( i ) == selection )
123 { 123 {
124 comboBox->setCurrentItem( i ); 124 comboBox->setCurrentItem( i );
125 return; 125 return;
126 } 126 }
127 } 127 }
128 } 128 }
129 comboBox->setEnabled( !selection.isNull() ); 129 comboBox->setEnabled( !selection.isNull() );
130} 130}
131 131
132void FilterDlg::slotNameSelected( bool selected ) 132void FilterDlg::slotNameSelected( bool selected )
133{ 133{
134 m_name->setEnabled( selected ); 134 m_name->setEnabled( selected );
135} 135}
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp
index 8fd960f..b334bca 100644
--- a/noncore/settings/packagemanager/mainwindow.cpp
+++ b/noncore/settings/packagemanager/mainwindow.cpp
@@ -57,162 +57,162 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ )
57 , m_toolBar( this ) 57 , m_toolBar( this )
58 , m_findBar( this ) 58 , m_findBar( this )
59 , m_widgetStack( this ) 59 , m_widgetStack( this )
60 , m_packageList( this ) 60 , m_packageList( this )
61 , m_statusWidget( this ) 61 , m_statusWidget( this )
62 , m_statusText( &m_statusWidget ) 62 , m_statusText( &m_statusWidget )
63 , m_statusBar( &m_statusWidget ) 63 , m_statusBar( &m_statusWidget )
64 , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) 64 , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) )
65 , m_iconInstalled( Resource::loadPixmap( "installed" ) ) 65 , m_iconInstalled( Resource::loadPixmap( "installed" ) )
66 , m_iconNull( m_iconUpdated.size() ) 66 , m_iconNull( m_iconUpdated.size() )
67 , m_filterName( QString::null ) 67 , m_filterName( QString::null )
68 , m_filterServer( QString::null ) 68 , m_filterServer( QString::null )
69 , m_filterDest( QString::null ) 69 , m_filterDest( QString::null )
70 , m_filterStatus( OPackageManager::NotDefined ) 70 , m_filterStatus( OPackageManager::NotDefined )
71 , m_filterCategory( QString::null ) 71 , m_filterCategory( QString::null )
72 72
73{ 73{
74// setCaption( tr( "Package Manager" ) ); 74// setCaption( tr( "Package Manager" ) );
75 75
76 m_iconNull.fill( colorGroup().base() ); 76 m_iconNull.fill( colorGroup().base() );
77 77
78 connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) ); 78 connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) );
79 79
80 // Initialize widget stack, package list and status widget 80 // Initialize widget stack, package list and status widget
81 initStatusWidget(); 81 initStatusWidget();
82 initPackageList(); 82 initPackageList();
83 83
84 m_widgetStack.addWidget( &m_statusWidget, 2 ); 84 m_widgetStack.addWidget( &m_statusWidget, 2 );
85 m_widgetStack.addWidget( &m_packageList, 1 ); 85 m_widgetStack.addWidget( &m_packageList, 1 );
86 setCentralWidget( &m_widgetStack ); 86 setCentralWidget( &m_widgetStack );
87 87
88 // Initialize remaining user interface items 88 // Initialize remaining user interface items
89 initUI(); 89 initUI();
90 90
91 // Initialize package information 91 // Initialize package information
92 QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) ); 92 QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) );
93} 93}
94 94
95void MainWindow::closeEvent( QCloseEvent *event ) 95void MainWindow::closeEvent( QCloseEvent *event )
96{ 96{
97 // Close app only if either the package or status widgets are currently active 97 // Close app only if either the package or status widgets are currently active
98 bool close = m_widgetStack.visibleWidget() == &m_packageList || 98 bool close = m_widgetStack.visibleWidget() == &m_packageList ||
99 m_widgetStack.visibleWidget() == &m_statusWidget; 99 m_widgetStack.visibleWidget() == &m_statusWidget;
100 if ( close ) 100 if ( close )
101 { 101 {
102 // TODO - write out application configuration settings 102 // TODO - write out application configuration settings
103 103
104 // Write out package manager configuration settings 104 // Write out package manager configuration settings
105 m_packman.saveSettings(); 105 m_packman.saveSettings();
106 event->accept(); 106 event->accept();
107 } 107 }
108 else 108 else
109 { 109 {
110 delete m_widgetStack.visibleWidget(); 110 delete m_widgetStack.visibleWidget();
111 m_widgetStack.raiseWidget( &m_packageList ); 111 m_widgetStack.raiseWidget( &m_packageList );
112 event->ignore(); 112 event->ignore();
113 } 113 }
114} 114}
115 115
116void MainWindow::initPackageList() 116void MainWindow::initPackageList()
117{ 117{
118 m_packageList.addColumn( tr( "Packages" ) ); 118 m_packageList.addColumn( tr( "Packages" ) );
119 QWhatsThis::add( &m_packageList, tr( "This is a listing of all packages.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); 119 QWhatsThis::add( &m_packageList, tr( "This is a listing of all packages.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) );
120 QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold ); 120 QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold );
121 connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), 121 connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)),
122 this, SLOT(slotDisplayPackageInfo(QListViewItem *)) ); 122 this, SLOT(slotDisplayPackageInfo(QListViewItem*)) );
123} 123}
124 124
125void MainWindow::initStatusWidget() 125void MainWindow::initStatusWidget()
126{ 126{
127 QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 ); 127 QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 );
128 128
129 m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); 129 m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
130 layout->addWidget( &m_statusText ); 130 layout->addWidget( &m_statusText );
131 131
132 connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) ); 132 connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) );
133 connect( &m_packman, SIGNAL(statusText(const QString &)), this, SLOT(slotStatusText(const QString &)) ); 133 connect( &m_packman, SIGNAL(statusText(const QString&)), this, SLOT(slotStatusText(const QString&)) );
134 connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) ); 134 connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) );
135 135
136 layout->addWidget( &m_statusBar ); 136 layout->addWidget( &m_statusBar );
137} 137}
138 138
139void MainWindow::initUI() 139void MainWindow::initUI()
140{ 140{
141 // Build menu and tool bars 141 // Build menu and tool bars
142 setToolBarsMovable( false ); 142 setToolBarsMovable( false );
143 143
144 m_menuBar.setHorizontalStretchable( true ); 144 m_menuBar.setHorizontalStretchable( true );
145 QMenuBar *mb = new QMenuBar( &m_menuBar ); 145 QMenuBar *mb = new QMenuBar( &m_menuBar );
146 mb->setMargin( 0 ); 146 mb->setMargin( 0 );
147 147
148 // Find toolbar 148 // Find toolbar
149 addToolBar( &m_findBar, QMainWindow::Top, true ); 149 addToolBar( &m_findBar, QMainWindow::Top, true );
150 m_findBar.setHorizontalStretchable( true ); 150 m_findBar.setHorizontalStretchable( true );
151 m_findEdit = new QLineEdit( &m_findBar ); 151 m_findEdit = new QLineEdit( &m_findBar );
152 QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) ); 152 QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) );
153 m_findBar.setStretchableWidget( m_findEdit ); 153 m_findBar.setStretchableWidget( m_findEdit );
154 connect( m_findEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotFindChanged(const QString &)) ); 154 connect( m_findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotFindChanged(const QString&)) );
155 155
156 // Packages menu 156 // Packages menu
157 QPopupMenu *popup = new QPopupMenu( this ); 157 QPopupMenu *popup = new QPopupMenu( this );
158 158
159 QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 ); 159 QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 );
160 a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); 160 a->setWhatsThis( tr( "Click here to update package lists from servers." ) );
161 connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); 161 connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) );
162 a->addTo( popup ); 162 a->addTo( popup );
163 a->addTo( &m_toolBar ); 163 a->addTo( &m_toolBar );
164 164
165 QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 ); 165 QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 );
166 actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); 166 actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) );
167 connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); 167 connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) );
168 actionUpgrade->addTo( popup ); 168 actionUpgrade->addTo( popup );
169 actionUpgrade->addTo( &m_toolBar ); 169 actionUpgrade->addTo( &m_toolBar );
170 170
171 QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); 171 QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" );
172 QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); 172 QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" );
173 QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); 173 QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 );
174 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); 174 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) );
175 connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); 175 connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) );
176 actionDownload->addTo( popup ); 176 actionDownload->addTo( popup );
177 actionDownload->addTo( &m_toolBar ); 177 actionDownload->addTo( &m_toolBar );
178 178
179 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); 179 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 );
180 a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); 180 a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) );
181 connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); 181 connect( a, SIGNAL(activated()), this, SLOT(slotApply()) );
182 a->addTo( popup ); 182 a->addTo( popup );
183 a->addTo( &m_toolBar ); 183 a->addTo( &m_toolBar );
184 184
185 popup->insertSeparator(); 185 popup->insertSeparator();
186 186
187 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); 187 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 );
188 a->setWhatsThis( tr( "Click here to configure this application." ) ); 188 a->setWhatsThis( tr( "Click here to configure this application." ) );
189 connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); 189 connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) );
190 a->addTo( popup ); 190 a->addTo( popup );
191 mb->insertItem( tr( "Actions" ), popup ); 191 mb->insertItem( tr( "Actions" ), popup );
192 192
193 // View menu 193 // View menu
194 popup = new QPopupMenu( this ); 194 popup = new QPopupMenu( this );
195 195
196 m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); 196 m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 );
197 m_actionShowNotInstalled->setToggleAction( true ); 197 m_actionShowNotInstalled->setToggleAction( true );
198 m_actionShowNotInstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); 198 m_actionShowNotInstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) );
199 connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); 199 connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) );
200 m_actionShowNotInstalled->addTo( popup ); 200 m_actionShowNotInstalled->addTo( popup );
201 201
202 m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); 202 m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 );
203 m_actionShowInstalled->setToggleAction( true ); 203 m_actionShowInstalled->setToggleAction( true );
204 m_actionShowInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); 204 m_actionShowInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) );
205 connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); 205 connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) );
206 m_actionShowInstalled->addTo( popup ); 206 m_actionShowInstalled->addTo( popup );
207 207
208 m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); 208 m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 );
209 m_actionShowUpdated->setToggleAction( true ); 209 m_actionShowUpdated->setToggleAction( true );
210 m_actionShowUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); 210 m_actionShowUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) );
211 connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); 211 connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) );
212 m_actionShowUpdated->addTo( popup ); 212 m_actionShowUpdated->addTo( popup );
213 213
214 popup->insertSeparator(); 214 popup->insertSeparator();
215 215
216 m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), 216 m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ),
217 QString::null, 0, this, 0 ); 217 QString::null, 0, this, 0 );
218 m_actionFilter->setToggleAction( true ); 218 m_actionFilter->setToggleAction( true );
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp
index 086e91b..1dc23a4 100644
--- a/noncore/settings/packagemanager/oipkg.cpp
+++ b/noncore/settings/packagemanager/oipkg.cpp
@@ -255,178 +255,178 @@ OPackageList *OIpkg::installedPackages( const QString &destName, const QString &
255 pl->append( new OPackage( name, QString::null, version, QString::null, destName ) ); 255 pl->append( new OPackage( name, QString::null, version, QString::null, destName ) );
256 name = QString::null; 256 name = QString::null;
257 version = QString::null; 257 version = QString::null;
258 status = QString::null; 258 status = QString::null;
259 259
260 newPackage = false; 260 newPackage = false;
261 } 261 }
262 } 262 }
263 263
264 // Update package data 264 // Update package data
265 if ( key == "Package" ) 265 if ( key == "Package" )
266 name = value; 266 name = value;
267 else if ( key == "Version" ) 267 else if ( key == "Version" )
268 version = value; 268 version = value;
269 else if ( key == "Status" ) 269 else if ( key == "Status" )
270 status = value; 270 status = value;
271 else if ( key.isEmpty() && value.isEmpty() ) 271 else if ( key.isEmpty() && value.isEmpty() )
272 newPackage = true; 272 newPackage = true;
273 273
274 // Skip past all description lines 274 // Skip past all description lines
275 if ( key == "Description" ) 275 if ( key == "Description" )
276 { 276 {
277 line = t.readLine(); 277 line = t.readLine();
278 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) 278 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() )
279 line = t.readLine(); 279 line = t.readLine();
280 } 280 }
281 else 281 else
282 line = t.readLine(); 282 line = t.readLine();
283 } 283 }
284 284
285 f.close(); 285 f.close();
286 286
287 return pl; 287 return pl;
288} 288}
289 289
290bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, const QString &destination, 290bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, const QString &destination,
291 const QObject *receiver, const char *slotOutput, bool rawOutput ) 291 const QObject *receiver, const char *slotOutput, bool rawOutput )
292{ 292{
293 if ( command == OPackage::NotDefined ) 293 if ( command == OPackage::NotDefined )
294 return false; 294 return false;
295 295
296 // Set ipkg run-time options/arguments 296 // Set ipkg run-time options/arguments
297 m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS ); 297 m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS );
298 m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL ); 298 m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL );
299 // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE ); 299 // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE );
300 m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE ); 300 m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE );
301 m_ipkgArgs.verbosity = m_ipkgExecVerbosity; 301 m_ipkgArgs.verbosity = m_ipkgExecVerbosity;
302 if ( m_ipkgArgs.dest ) 302 if ( m_ipkgArgs.dest )
303 free( m_ipkgArgs.dest ); 303 free( m_ipkgArgs.dest );
304 if ( !destination.isNull() ) 304 if ( !destination.isNull() )
305 { 305 {
306 int len = destination.length() + 1; 306 int len = destination.length() + 1;
307 m_ipkgArgs.dest = (char *)malloc( len ); 307 m_ipkgArgs.dest = (char *)malloc( len );
308 strncpy( m_ipkgArgs.dest, destination, destination.length() ); 308 strncpy( m_ipkgArgs.dest, destination, destination.length() );
309 m_ipkgArgs.dest[ len - 1 ] = '\0'; 309 m_ipkgArgs.dest[ len - 1 ] = '\0';
310 } 310 }
311 else 311 else
312 m_ipkgArgs.dest = 0x0; 312 m_ipkgArgs.dest = 0x0;
313 313
314 // Connect output signal to widget 314 // Connect output signal to widget
315 315
316 if ( rawOutput ) 316 if ( rawOutput )
317 { 317 {
318// if ( slotOutput ) 318// if ( slotOutput )
319// connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput ); 319// connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput );
320 } 320 }
321 else 321 else
322 { 322 {
323 // TODO - connect to local slot and parse output before emitting signalIpkgMessage 323 // TODO - connect to local slot and parse output before emitting signalIpkgMessage
324 } 324 }
325 325
326 switch( command ) 326 switch( command )
327 { 327 {
328 case OPackage::Update : { 328 case OPackage::Update : {
329 connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput ); 329 connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput );
330 ipkg_lists_update( &m_ipkgArgs ); 330 ipkg_lists_update( &m_ipkgArgs );
331 }; 331 };
332 break; 332 break;
333 case OPackage::Upgrade : { 333 case OPackage::Upgrade : {
334 connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput ); 334 connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput );
335 ipkg_packages_upgrade( &m_ipkgArgs ); 335 ipkg_packages_upgrade( &m_ipkgArgs );
336 }; 336 };
337 break; 337 break;
338 case OPackage::Install : { 338 case OPackage::Install : {
339 connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput ); 339 connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput );
340 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) 340 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
341 { 341 {
342 ipkg_packages_install( &m_ipkgArgs, (*it) ); 342 ipkg_packages_install( &m_ipkgArgs, (*it) );
343 } 343 }
344 }; 344 };
345 break; 345 break;
346 case OPackage::Remove : { 346 case OPackage::Remove : {
347 connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput ); 347 connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput );
348 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) 348 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
349 { 349 {
350 ipkg_packages_remove( &m_ipkgArgs, (*it), true ); 350 ipkg_packages_remove( &m_ipkgArgs, (*it), true );
351 } 351 }
352 }; 352 };
353 break; 353 break;
354 case OPackage::Download : { 354 case OPackage::Download : {
355 connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput ); 355 connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput );
356 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) 356 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
357 { 357 {
358 ipkg_packages_download( &m_ipkgArgs, (*it) ); 358 ipkg_packages_download( &m_ipkgArgs, (*it) );
359 } 359 }
360 }; 360 };
361 break; 361 break;
362 case OPackage::Info : { 362 case OPackage::Info : {
363 connect( this, SIGNAL(signalIpkgStatus(char *)), receiver, slotOutput ); 363 connect( this, SIGNAL(signalIpkgStatus(char*)), receiver, slotOutput );
364 ipkg_packages_info( &m_ipkgArgs, (*parameters->begin()), &fIpkgStatus, 0x0 ); 364 ipkg_packages_info( &m_ipkgArgs, (*parameters->begin()), &fIpkgStatus, 0x0 );
365 }; 365 };
366 break; 366 break;
367 case OPackage::Files : { 367 case OPackage::Files : {
368 connect( this, SIGNAL(signalIpkgList(char *)), receiver, slotOutput ); 368 connect( this, SIGNAL(signalIpkgList(char*)), receiver, slotOutput );
369 ipkg_package_files( &m_ipkgArgs, (*parameters->begin()), &fIpkgFiles, 0x0 ); 369 ipkg_package_files( &m_ipkgArgs, (*parameters->begin()), &fIpkgFiles, 0x0 );
370 }; 370 };
371 break; 371 break;
372 default : break; 372 default : break;
373 }; 373 };
374 374
375 return true; 375 return true;
376} 376}
377 377
378void OIpkg::ipkgMessage( char *msg ) 378void OIpkg::ipkgMessage( char *msg )
379{ 379{
380 emit signalIpkgMessage( msg ); 380 emit signalIpkgMessage( msg );
381} 381}
382 382
383void OIpkg::ipkgStatus( char *status ) 383void OIpkg::ipkgStatus( char *status )
384{ 384{
385 emit signalIpkgStatus( status ); 385 emit signalIpkgStatus( status );
386} 386}
387 387
388void OIpkg::ipkgList( char *filelist ) 388void OIpkg::ipkgList( char *filelist )
389{ 389{
390 emit signalIpkgList( filelist ); 390 emit signalIpkgList( filelist );
391} 391}
392 392
393void OIpkg::loadConfiguration() 393void OIpkg::loadConfiguration()
394{ 394{
395 if ( m_confInfo ) 395 if ( m_confInfo )
396 delete m_confInfo; 396 delete m_confInfo;
397 397
398 // Load configuration item list 398 // Load configuration item list
399 m_confInfo = new OConfItemList(); 399 m_confInfo = new OConfItemList();
400 400
401 QStringList confFiles; 401 QStringList confFiles;
402 QDir confDir( IPKG_CONF_DIR ); 402 QDir confDir( IPKG_CONF_DIR );
403 if ( confDir.exists() ) 403 if ( confDir.exists() )
404 { 404 {
405 confDir.setNameFilter( "*.conf" ); 405 confDir.setNameFilter( "*.conf" );
406 confDir.setFilter( QDir::Files ); 406 confDir.setFilter( QDir::Files );
407 confFiles = confDir.entryList( "*.conf", QDir::Files ); 407 confFiles = confDir.entryList( "*.conf", QDir::Files );
408 confFiles << IPKG_CONF; 408 confFiles << IPKG_CONF;
409 409
410 for ( QStringList::Iterator it = confFiles.begin(); it != confFiles.end(); ++it ) 410 for ( QStringList::Iterator it = confFiles.begin(); it != confFiles.end(); ++it )
411 { 411 {
412 // Create absolute file path if necessary 412 // Create absolute file path if necessary
413 QString absFile = (*it); 413 QString absFile = (*it);
414 if ( !absFile.startsWith( "/" ) ) 414 if ( !absFile.startsWith( "/" ) )
415 absFile.prepend( QString( IPKG_CONF_DIR ) + "/" ); 415 absFile.prepend( QString( IPKG_CONF_DIR ) + "/" );
416 416
417 // Read in file 417 // Read in file
418 QFile f( absFile ); 418 QFile f( absFile );
419 if ( f.open( IO_ReadOnly ) ) 419 if ( f.open( IO_ReadOnly ) )
420 { 420 {
421 QTextStream s( &f ); 421 QTextStream s( &f );
422 while ( !s.eof() ) 422 while ( !s.eof() )
423 { 423 {
424 424
425 QString line = s.readLine().simplifyWhiteSpace(); 425 QString line = s.readLine().simplifyWhiteSpace();
426 426
427 // Parse line and save info to the conf options list 427 // Parse line and save info to the conf options list
428 if ( !line.isEmpty() ) 428 if ( !line.isEmpty() )
429 { 429 {
430 if ( !line.startsWith( "#" ) || 430 if ( !line.startsWith( "#" ) ||
431 line.startsWith( "#src" ) || 431 line.startsWith( "#src" ) ||
432 line.startsWith( "#dest" ) || 432 line.startsWith( "#dest" ) ||
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp
index 4bc86fa..8ad0a3f 100644
--- a/noncore/settings/sound/soundsettings.cpp
+++ b/noncore/settings/sound/soundsettings.cpp
@@ -50,138 +50,138 @@ SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl )
50 AlertCheckBox->setChecked(cfg.readBoolEntry("Alert")); 50 AlertCheckBox->setChecked(cfg.readBoolEntry("Alert"));
51 51
52 cfg.setGroup("Record"); 52 cfg.setGroup("Record");
53 int rate=config.readNumEntry("SampleRate", 22050); 53 int rate=config.readNumEntry("SampleRate", 22050);
54 if(rate == 8000) 54 if(rate == 8000)
55 sampleRate->setCurrentItem(0); 55 sampleRate->setCurrentItem(0);
56 else if(rate == 11025) 56 else if(rate == 11025)
57 sampleRate->setCurrentItem(1); 57 sampleRate->setCurrentItem(1);
58 else if(rate == 22050) 58 else if(rate == 22050)
59 sampleRate->setCurrentItem(2); 59 sampleRate->setCurrentItem(2);
60 else if(rate == 33075) 60 else if(rate == 33075)
61 sampleRate->setCurrentItem(3); 61 sampleRate->setCurrentItem(3);
62 else if(rate==44100) 62 else if(rate==44100)
63 sampleRate->setCurrentItem(4); 63 sampleRate->setCurrentItem(4);
64 64
65 stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); 65 stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0));
66//TODO hide if zaurus- mono only 66//TODO hide if zaurus- mono only
67 67
68#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) 68#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
69//since ipaq and zaurus have particular 69//since ipaq and zaurus have particular
70//devices 70//devices
71 bool systemZaurus=FALSE; 71 bool systemZaurus=FALSE;
72 struct utsname name; /* check for embedix kernel running on the zaurus*/ 72 struct utsname name; /* check for embedix kernel running on the zaurus*/
73 if (uname(&name) != -1) {// TODO change this here,... 73 if (uname(&name) != -1) {// TODO change this here,...
74 QString release=name.release; 74 QString release=name.release;
75 if( release.find("embedix",0,TRUE) != -1) { 75 if( release.find("embedix",0,TRUE) != -1) {
76 qDebug("IS System Zaurus"); 76 qDebug("IS System Zaurus");
77 systemZaurus=TRUE; 77 systemZaurus=TRUE;
78 } 78 }
79 } 79 }
80 if(!systemZaurus) { 80 if(!systemZaurus) {
81 stereoCheckBox->setChecked(TRUE); 81 stereoCheckBox->setChecked(TRUE);
82 } 82 }
83 stereoCheckBox->setEnabled(FALSE); 83 stereoCheckBox->setEnabled(FALSE);
84 sixteenBitCheckBox->setEnabled(FALSE); 84 sixteenBitCheckBox->setEnabled(FALSE);
85#else 85#else
86#endif 86#endif
87 int sRate=cfg.readNumEntry("SizeLimit", 30); 87 int sRate=cfg.readNumEntry("SizeLimit", 30);
88 qDebug("%d",sRate); 88 qDebug("%d",sRate);
89 89
90 if(sRate ==30) 90 if(sRate ==30)
91 timeLimitComboBox->setCurrentItem(0); 91 timeLimitComboBox->setCurrentItem(0);
92 else if(sRate==20) 92 else if(sRate==20)
93 timeLimitComboBox->setCurrentItem(1); 93 timeLimitComboBox->setCurrentItem(1);
94 else if(sRate == 15) 94 else if(sRate == 15)
95 timeLimitComboBox->setCurrentItem(2); 95 timeLimitComboBox->setCurrentItem(2);
96 else if(sRate == 10) 96 else if(sRate == 10)
97 timeLimitComboBox->setCurrentItem(3); 97 timeLimitComboBox->setCurrentItem(3);
98 else if(sRate == 5) 98 else if(sRate == 5)
99 timeLimitComboBox->setCurrentItem(4); 99 timeLimitComboBox->setCurrentItem(4);
100 else 100 else
101 timeLimitComboBox->setCurrentItem(5); 101 timeLimitComboBox->setCurrentItem(5);
102 102
103 sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); 103 sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1));
104 104
105 cfg.setGroup("Defaults"); 105 cfg.setGroup("Defaults");
106 keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); 106 keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") );
107 107
108 updateStorageCombo(); 108 updateStorageCombo();
109 109
110 Config vmCfg("Vmemo"); 110 Config vmCfg("Vmemo");
111 vmCfg.setGroup("Defaults"); 111 vmCfg.setGroup("Defaults");
112 adpcmCheckBox->setChecked( vmCfg.readBoolEntry("use_ADPCM", 0)); 112 adpcmCheckBox->setChecked( vmCfg.readBoolEntry("use_ADPCM", 0));
113 113
114 connect( LocationComboBox,SIGNAL(activated(const QString &)), this, 114 connect( LocationComboBox,SIGNAL(activated(const QString&)), this,
115 SLOT( setLocation(const QString &))); 115 SLOT( setLocation(const QString&)));
116 connect( keyComboBox,SIGNAL(activated( int)), this, 116 connect( keyComboBox,SIGNAL(activated(int)), this,
117 SLOT( setKeyButton( int))); 117 SLOT( setKeyButton(int)));
118 connect( timeLimitComboBox,SIGNAL(activated( const QString &)), this, 118 connect( timeLimitComboBox,SIGNAL(activated(const QString&)), this,
119 SLOT( setSizeLimitButton(const QString &))); 119 SLOT( setSizeLimitButton(const QString&)));
120 connect( restartCheckBox,SIGNAL( toggled( bool)), this, 120 connect( restartCheckBox,SIGNAL( toggled(bool)), this,
121 SLOT( restartOpie( bool))); 121 SLOT( restartOpie(bool)));
122 connect( adpcmCheckBox,SIGNAL( toggled( bool)), this, 122 connect( adpcmCheckBox,SIGNAL( toggled(bool)), this,
123 SLOT( slotAdpcm( bool))); 123 SLOT( slotAdpcm(bool)));
124 124
125 // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 125 // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
126} 126}
127 127
128void SoundSettings::updateStorageCombo() { 128void SoundSettings::updateStorageCombo() {
129 129
130 Config config( "Vmemo" ); 130 Config config( "Vmemo" );
131 config.setGroup( "System" ); 131 config.setGroup( "System" );
132 QString loc = config.readEntry("RecLocation","/"); 132 QString loc = config.readEntry("RecLocation","/");
133 int i=0; 133 int i=0;
134 int set=0; 134 int set=0;
135 StorageInfo storageInfo; 135 StorageInfo storageInfo;
136 QString sName, sPath; 136 QString sName, sPath;
137 QStringList list; 137 QStringList list;
138 list << "Documents : "+QPEApplication::documentDir(); 138 list << "Documents : "+QPEApplication::documentDir();
139 list << "tmp : /tmp"; 139 list << "tmp : /tmp";
140 140
141 const QList<FileSystem> &fs = storageInfo.fileSystems(); 141 const QList<FileSystem> &fs = storageInfo.fileSystems();
142 QListIterator<FileSystem> it ( fs ); 142 QListIterator<FileSystem> it ( fs );
143 for( ; it.current(); ++it ){ 143 for( ; it.current(); ++it ){
144 const QString name = (*it)->name(); 144 const QString name = (*it)->name();
145 const QString path = (*it)->path(); 145 const QString path = (*it)->path();
146 qDebug("storage name "+name +" storage path is "+path); 146 qDebug("storage name "+name +" storage path is "+path);
147 list << name + ": " +path; 147 list << name + ": " +path;
148 if( loc.find( path,0,TRUE) != -1) 148 if( loc.find( path,0,TRUE) != -1)
149 set = i; 149 set = i;
150// if(dit.current()->file().find(path) != -1 ) storage=name; 150// if(dit.current()->file().find(path) != -1 ) storage=name;
151 i++; 151 i++;
152 } 152 }
153 153
154 LocationComboBox->insertStringList(list); 154 LocationComboBox->insertStringList(list);
155 qDebug("set item %d", set); 155 qDebug("set item %d", set);
156 LocationComboBox->setCurrentItem(set); 156 LocationComboBox->setCurrentItem(set);
157} 157}
158 158
159void SoundSettings::setLocation(const QString & string) { 159void SoundSettings::setLocation(const QString & string) {
160 Config config( "Vmemo" ); 160 Config config( "Vmemo" );
161 config.setGroup( "System" ); 161 config.setGroup( "System" );
162 config.writeEntry("RecLocation",string); 162 config.writeEntry("RecLocation",string);
163 qDebug("set location "+string); 163 qDebug("set location "+string);
164 config.write(); 164 config.write();
165} 165}
166 166
167void SoundSettings::cleanUp() { 167void SoundSettings::cleanUp() {
168 Config cfg("Vmemo"); 168 Config cfg("Vmemo");
169 cfg.writeEntry("Alert",AlertCheckBox->isChecked()); 169 cfg.writeEntry("Alert",AlertCheckBox->isChecked());
170 170
171 cfg.setGroup("Record"); 171 cfg.setGroup("Record");
172 cfg.writeEntry("SampleRate",sampleRate->currentText()); 172 cfg.writeEntry("SampleRate",sampleRate->currentText());
173 cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); 173 cfg.writeEntry("Stereo",stereoCheckBox->isChecked());
174 cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); 174 cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked());
175 if(keyReset && noWarning) { 175 if(keyReset && noWarning) {
176 QCopEnvelope ("QPE/System", "restart()"); 176 QCopEnvelope ("QPE/System", "restart()");
177 } 177 }
178} 178}
179 179
180void SoundSettings::setKeyButton( int index) { 180void SoundSettings::setKeyButton( int index) {
181 Config cfg("Vmemo"); 181 Config cfg("Vmemo");
182 cfg.setGroup("Defaults"); 182 cfg.setGroup("Defaults");
183 cfg.writeEntry( "toggleKey", index ); 183 cfg.writeEntry( "toggleKey", index );
184 keyReset = TRUE; 184 keyReset = TRUE;
185 if( index == 1) { 185 if( index == 1) {
186 cfg.writeEntry( "hideIcon", 0 ); 186 cfg.writeEntry( "hideIcon", 0 );
187 keyLabel->setText(tr("Shows icon")); 187 keyLabel->setText(tr("Shows icon"));
diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp
index 0aeb251..d6ecec5 100644
--- a/noncore/settings/sysinfo/benchmarkinfo.cpp
+++ b/noncore/settings/sysinfo/benchmarkinfo.cpp
@@ -84,129 +84,129 @@ class BenchmarkPaintWidget : public QWidget
84BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags ) 84BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags )
85 : QWidget( parent, name, wFlags ) 85 : QWidget( parent, name, wFlags )
86{ 86{
87 87
88 setMinimumSize( 200, 150 ); 88 setMinimumSize( 200, 150 );
89 89
90 QVBoxLayout* vb = new QVBoxLayout( this ); 90 QVBoxLayout* vb = new QVBoxLayout( this );
91 vb->setSpacing( 4 ); 91 vb->setSpacing( 4 );
92 vb->setMargin( 4 ); 92 vb->setMargin( 4 );
93 93
94 tests = new QListView( this ); 94 tests = new QListView( this );
95 tests->setMargin( 0 ); 95 tests->setMargin( 0 );
96 tests->addColumn( tr( "Tests" ) ); 96 tests->addColumn( tr( "Tests" ) );
97 tests->addColumn( tr( "Results" ) ); 97 tests->addColumn( tr( "Results" ) );
98 tests->addColumn( tr( "Comparison" ) ); 98 tests->addColumn( tr( "Comparison" ) );
99 tests->setShowSortIndicator( true ); 99 tests->setShowSortIndicator( true );
100 100
101 test_alu = new QCheckListItem( tests, tr( "1. Integer Arithmetic " ), QCheckListItem::CheckBox ); 101 test_alu = new QCheckListItem( tests, tr( "1. Integer Arithmetic " ), QCheckListItem::CheckBox );
102 test_fpu = new QCheckListItem( tests, tr( "2. Floating Point Unit " ), QCheckListItem::CheckBox ); 102 test_fpu = new QCheckListItem( tests, tr( "2. Floating Point Unit " ), QCheckListItem::CheckBox );
103 test_txt = new QCheckListItem( tests, tr( "3. Text Rendering " ), QCheckListItem::CheckBox ); 103 test_txt = new QCheckListItem( tests, tr( "3. Text Rendering " ), QCheckListItem::CheckBox );
104 test_gfx = new QCheckListItem( tests, tr( "4. Gfx Rendering " ), QCheckListItem::CheckBox ); 104 test_gfx = new QCheckListItem( tests, tr( "4. Gfx Rendering " ), QCheckListItem::CheckBox );
105 test_ram = new QCheckListItem( tests, tr( "5. RAM Performance " ), QCheckListItem::CheckBox ); 105 test_ram = new QCheckListItem( tests, tr( "5. RAM Performance " ), QCheckListItem::CheckBox );
106 test_sd = new QCheckListItem( tests, tr( "6. SD Card Performance " ), QCheckListItem::CheckBox ); 106 test_sd = new QCheckListItem( tests, tr( "6. SD Card Performance " ), QCheckListItem::CheckBox );
107 test_cf = new QCheckListItem( tests, tr( "7. CF Card Performance " ), QCheckListItem::CheckBox ); 107 test_cf = new QCheckListItem( tests, tr( "7. CF Card Performance " ), QCheckListItem::CheckBox );
108 108
109 test_alu->setText( 1, "n/a" ); 109 test_alu->setText( 1, "n/a" );
110 test_fpu->setText( 1, "n/a" ); 110 test_fpu->setText( 1, "n/a" );
111 test_txt->setText( 1, "n/a" ); 111 test_txt->setText( 1, "n/a" );
112 test_gfx->setText( 1, "n/a" ); 112 test_gfx->setText( 1, "n/a" );
113 test_ram->setText( 1, "n/a" ); 113 test_ram->setText( 1, "n/a" );
114 test_sd->setText( 1, "n/a" ); 114 test_sd->setText( 1, "n/a" );
115 test_cf->setText( 1, "n/a" ); 115 test_cf->setText( 1, "n/a" );
116 116
117 test_alu->setText( 2, "n/a" ); 117 test_alu->setText( 2, "n/a" );
118 test_fpu->setText( 2, "n/a" ); 118 test_fpu->setText( 2, "n/a" );
119 test_txt->setText( 2, "n/a" ); 119 test_txt->setText( 2, "n/a" );
120 test_gfx->setText( 2, "n/a" ); 120 test_gfx->setText( 2, "n/a" );
121 test_ram->setText( 2, "n/a" ); 121 test_ram->setText( 2, "n/a" );
122 test_sd->setText( 2, "n/a" ); 122 test_sd->setText( 2, "n/a" );
123 test_cf->setText( 2, "n/a" ); 123 test_cf->setText( 2, "n/a" );
124 124
125 startButton = new QPushButton( tr( "&Start Tests!" ), this ); 125 startButton = new QPushButton( tr( "&Start Tests!" ), this );
126 connect( startButton, SIGNAL( clicked() ), this, SLOT( run() ) ); 126 connect( startButton, SIGNAL( clicked() ), this, SLOT( run() ) );
127 127
128 vb->addWidget( tests, 2 ); 128 vb->addWidget( tests, 2 );
129 129
130 QFile f( QPEApplication::qpeDir() + "/share/sysinfo/results" ); 130 QFile f( QPEApplication::qpeDir() + "/share/sysinfo/results" );
131 if ( f.open( IO_ReadOnly ) ) 131 if ( f.open( IO_ReadOnly ) )
132 { 132 {
133 machineCombo = new QComboBox( this ); 133 machineCombo = new QComboBox( this );
134 134
135 QTextStream ts( &f ); 135 QTextStream ts( &f );
136 while( !ts.eof() ) 136 while( !ts.eof() )
137 { 137 {
138 QString machline = ts.readLine(); 138 QString machline = ts.readLine();
139 qDebug( "sysinfo: parsing benchmark results for '%s'", (const char*) machline ); 139 qDebug( "sysinfo: parsing benchmark results for '%s'", (const char*) machline );
140 QString resline = ts.readLine(); 140 QString resline = ts.readLine();
141 machines.insert( machline, new QStringList( QStringList::split( ",", resline ) ) ); 141 machines.insert( machline, new QStringList( QStringList::split( ",", resline ) ) );
142 machineCombo->insertItem( machline ); 142 machineCombo->insertItem( machline );
143 } 143 }
144 144
145 QHBoxLayout* hb = new QHBoxLayout( vb ); 145 QHBoxLayout* hb = new QHBoxLayout( vb );
146 hb->addWidget( new QLabel( tr( "Compare To:" ), this ) ); 146 hb->addWidget( new QLabel( tr( "Compare To:" ), this ) );
147 hb->addWidget( machineCombo, 2 ); 147 hb->addWidget( machineCombo, 2 );
148 connect( machineCombo, SIGNAL( activated( int ) ), this, SLOT( machineActivated( int ) ) ); 148 connect( machineCombo, SIGNAL( activated(int) ), this, SLOT( machineActivated(int) ) );
149 } 149 }
150 150
151 vb->addWidget( startButton, 2 ); 151 vb->addWidget( startButton, 2 );
152} 152}
153 153
154 154
155BenchmarkInfo::~BenchmarkInfo() 155BenchmarkInfo::~BenchmarkInfo()
156{} 156{}
157 157
158 158
159void BenchmarkInfo::machineActivated( int index ) 159void BenchmarkInfo::machineActivated( int index )
160{ 160{
161 QStringList* results = machines[ machineCombo->text( index ) ]; 161 QStringList* results = machines[ machineCombo->text( index ) ];
162 if ( !results ) 162 if ( !results )
163 { 163 {
164 qDebug( "sysinfo: no results available." ); 164 qDebug( "sysinfo: no results available." );
165 return; 165 return;
166 } 166 }
167 QStringList::Iterator it = results->begin(); 167 QStringList::Iterator it = results->begin();
168 test_alu->setText( 2, *(it++) ); 168 test_alu->setText( 2, *(it++) );
169 test_fpu->setText( 2, *(it++) ); 169 test_fpu->setText( 2, *(it++) );
170 test_txt->setText( 2, *(it++) ); 170 test_txt->setText( 2, *(it++) );
171 test_gfx->setText( 2, *(it++) ); 171 test_gfx->setText( 2, *(it++) );
172 test_ram->setText( 2, *(it++) ); 172 test_ram->setText( 2, *(it++) );
173 test_sd->setText( 2, *(it++) ); 173 test_sd->setText( 2, *(it++) );
174 test_cf->setText( 2, *(it++) ); 174 test_cf->setText( 2, *(it++) );
175} 175}
176 176
177 177
178void BenchmarkInfo::run() 178void BenchmarkInfo::run()
179{ 179{
180 startButton->setText( "> Don't touch! Running Tests! Don't touch! <" ); 180 startButton->setText( "> Don't touch! Running Tests! Don't touch! <" );
181 qApp->processEvents(); 181 qApp->processEvents();
182 QTime t; 182 QTime t;
183 183
184 if ( test_alu->isOn() ) 184 if ( test_alu->isOn() )
185 { 185 {
186 int d = round( dhry_main( DHRYSTONE_RUNS ) ); 186 int d = round( dhry_main( DHRYSTONE_RUNS ) );
187 test_alu->setText( 1, QString( "%1 dhrys" ).arg( QString::number( d ) ) ); 187 test_alu->setText( 1, QString( "%1 dhrys" ).arg( QString::number( d ) ) );
188 test_alu->setOn( false ); 188 test_alu->setOn( false );
189 } 189 }
190 190
191 if ( test_fpu->isOn() ) 191 if ( test_fpu->isOn() )
192 { 192 {
193 t.start(); 193 t.start();
194 BenchFFT(); 194 BenchFFT();
195 test_fpu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); 195 test_fpu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) );
196 test_fpu->setOn( false ); 196 test_fpu->setOn( false );
197 } 197 }
198 198
199 if ( test_txt->isOn() ) 199 if ( test_txt->isOn() )
200 { 200 {
201 int value = textRendering( TEST_DURATION ); 201 int value = textRendering( TEST_DURATION );
202 test_txt->setText( 1, QString( "%1 chars/sec" ).arg( QString::number( value / TEST_DURATION ) ) ); 202 test_txt->setText( 1, QString( "%1 chars/sec" ).arg( QString::number( value / TEST_DURATION ) ) );
203 test_txt->setOn( false ); 203 test_txt->setOn( false );
204 } 204 }
205 205
206 if ( test_gfx->isOn() ) 206 if ( test_gfx->isOn() )
207 { 207 {
208 int value = gfxRendering( TEST_DURATION ); 208 int value = gfxRendering( TEST_DURATION );
209 test_gfx->setText( 1, QString( "%1 gops/sec" ).arg( QString::number( value / 4 / TEST_DURATION ) ) ); // 4 tests 209 test_gfx->setText( 1, QString( "%1 gops/sec" ).arg( QString::number( value / 4 / TEST_DURATION ) ) ); // 4 tests
210 test_gfx->setOn( false ); 210 test_gfx->setOn( false );
211 } 211 }
212 212
diff --git a/noncore/settings/sysinfo/modulesinfo.cpp b/noncore/settings/sysinfo/modulesinfo.cpp
index 9cb8ad2..e688a29 100644
--- a/noncore/settings/sysinfo/modulesinfo.cpp
+++ b/noncore/settings/sysinfo/modulesinfo.cpp
@@ -1,122 +1,122 @@
1/********************************************************************** 1/**********************************************************************
2** ModulesInfo 2** ModulesInfo
3** 3**
4** Display Modules information 4** Display Modules information
5** 5**
6** Copyright (C) 2002, Michael Lauer 6** Copyright (C) 2002, Michael Lauer
7** mickey@tm.informatik.uni-frankfurt.de 7** mickey@tm.informatik.uni-frankfurt.de
8** http://www.Vanille.de 8** http://www.Vanille.de
9** 9**
10** Based on ProcessInfo by Dan Williams <williamsdr@acm.org> 10** Based on ProcessInfo by Dan Williams <williamsdr@acm.org>
11** 11**
12** This file may be distributed and/or modified under the terms of the 12** This file may be distributed and/or modified under the terms of the
13** GNU General Public License version 2 as published by the Free Software 13** GNU General Public License version 2 as published by the Free Software
14** Foundation and appearing in the file LICENSE.GPL included in the 14** Foundation and appearing in the file LICENSE.GPL included in the
15** packaging of this file. 15** packaging of this file.
16** 16**
17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19** 19**
20**********************************************************************/ 20**********************************************************************/
21 21
22#include "modulesinfo.h" 22#include "modulesinfo.h"
23#include "detail.h" 23#include "detail.h"
24 24
25/* OPIE */ 25/* OPIE */
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27 27
28/* QT */ 28/* QT */
29#include <qfile.h> 29#include <qfile.h>
30#include <qlayout.h> 30#include <qlayout.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qwhatsthis.h> 33#include <qwhatsthis.h>
34 34
35ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) 35ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
36 : QWidget( parent, name, fl ) 36 : QWidget( parent, name, fl )
37{ 37{
38 QGridLayout *layout = new QGridLayout( this ); 38 QGridLayout *layout = new QGridLayout( this );
39 layout->setSpacing( 4 ); 39 layout->setSpacing( 4 );
40 layout->setMargin( 4 ); 40 layout->setMargin( 4 );
41 41
42 ModulesView = new QListView( this ); 42 ModulesView = new QListView( this );
43 int colnum = ModulesView->addColumn( tr( "Module" ) ); 43 int colnum = ModulesView->addColumn( tr( "Module" ) );
44 colnum = ModulesView->addColumn( tr( "Size" ) ); 44 colnum = ModulesView->addColumn( tr( "Size" ) );
45 ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); 45 ModulesView->setColumnAlignment( colnum, Qt::AlignRight );
46 colnum = ModulesView->addColumn( tr( "Use#" ) ); 46 colnum = ModulesView->addColumn( tr( "Use#" ) );
47 ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); 47 ModulesView->setColumnAlignment( colnum, Qt::AlignRight );
48 colnum = ModulesView->addColumn( tr( "Used by" ) ); 48 colnum = ModulesView->addColumn( tr( "Used by" ) );
49 ModulesView->setAllColumnsShowFocus( TRUE ); 49 ModulesView->setAllColumnsShowFocus( TRUE );
50 layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 ); 50 layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 );
51 QWhatsThis::add( ModulesView, tr( "This is a list of all the kernel modules currently loaded on this handheld device.\n\nClick and hold on a module to see additional information about the module, or to unload it." ) ); 51 QWhatsThis::add( ModulesView, tr( "This is a list of all the kernel modules currently loaded on this handheld device.\n\nClick and hold on a module to see additional information about the module, or to unload it." ) );
52 52
53 // Test if we have /sbin/modinfo, and if so, allow module detail window 53 // Test if we have /sbin/modinfo, and if so, allow module detail window
54 if ( QFile::exists( "/sbin/modinfo" ) ) 54 if ( QFile::exists( "/sbin/modinfo" ) )
55 { 55 {
56 QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold ); 56 QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold );
57 connect( ModulesView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), 57 connect( ModulesView, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ),
58 this, SLOT( viewModules( QListViewItem * ) ) ); 58 this, SLOT( viewModules(QListViewItem*) ) );
59 } 59 }
60 60
61 CommandCB = new QComboBox( FALSE, this ); 61 CommandCB = new QComboBox( FALSE, this );
62 CommandCB->insertItem( "modprobe -r" ); 62 CommandCB->insertItem( "modprobe -r" );
63 CommandCB->insertItem( "rmmod" ); 63 CommandCB->insertItem( "rmmod" );
64 // I can't think of other useful commands yet. Anyone? 64 // I can't think of other useful commands yet. Anyone?
65 layout->addWidget( CommandCB, 1, 0 ); 65 layout->addWidget( CommandCB, 1, 0 );
66 QWhatsThis::add( CommandCB, tr( "Select a command here and then click the Send button to the right to send the command to module selected above." ) ); 66 QWhatsThis::add( CommandCB, tr( "Select a command here and then click the Send button to the right to send the command to module selected above." ) );
67 67
68 QPushButton *btn = new QPushButton( this ); 68 QPushButton *btn = new QPushButton( this );
69 btn->setMinimumSize( QSize( 50, 24 ) ); 69 btn->setMinimumSize( QSize( 50, 24 ) );
70 btn->setMaximumSize( QSize( 50, 24 ) ); 70 btn->setMaximumSize( QSize( 50, 24 ) );
71 btn->setText( tr( "Send" ) ); 71 btn->setText( tr( "Send" ) );
72 connect( btn, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); 72 connect( btn, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
73 layout->addWidget( btn, 1, 1 ); 73 layout->addWidget( btn, 1, 1 );
74 QWhatsThis::add( btn, tr( "Click here to send the selected command to the module selected above." ) ); 74 QWhatsThis::add( btn, tr( "Click here to send the selected command to the module selected above." ) );
75 75
76 QTimer *t = new QTimer( this ); 76 QTimer *t = new QTimer( this );
77 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); 77 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
78 t->start( 5000 ); 78 t->start( 5000 );
79 79
80 updateData(); 80 updateData();
81 81
82 ModulesDtl = new Detail(); 82 ModulesDtl = new Detail();
83 QWhatsThis::add( ModulesDtl->detailView, tr( "This area shows detailed information about this module." ) ); 83 QWhatsThis::add( ModulesDtl->detailView, tr( "This area shows detailed information about this module." ) );
84} 84}
85 85
86ModulesInfo::~ModulesInfo() 86ModulesInfo::~ModulesInfo()
87{} 87{}
88 88
89void ModulesInfo::updateData() 89void ModulesInfo::updateData()
90{ 90{
91 char modname[64]; 91 char modname[64];
92 char usage[200]; 92 char usage[200];
93 int modsize, usecount; 93 int modsize, usecount;
94 94
95 QString selectedmod; 95 QString selectedmod;
96 QListViewItem *curritem = ModulesView->currentItem(); 96 QListViewItem *curritem = ModulesView->currentItem();
97 if ( curritem ) 97 if ( curritem )
98 { 98 {
99 selectedmod = curritem->text( 0 ); 99 selectedmod = curritem->text( 0 );
100 } 100 }
101 101
102 ModulesView->clear(); 102 ModulesView->clear();
103 103
104 FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r"); 104 FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r");
105 105
106 if ( procfile ) 106 if ( procfile )
107 { 107 {
108 QListViewItem *newitem; 108 QListViewItem *newitem;
109 QListViewItem *selecteditem = 0x0; 109 QListViewItem *selecteditem = 0x0;
110 while ( true ) 110 while ( true )
111 { 111 {
112 modname[0] = '\0'; 112 modname[0] = '\0';
113 usage[0] = '\0'; 113 usage[0] = '\0';
114 int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage ); 114 int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage );
115 115
116 if ( success == EOF ) 116 if ( success == EOF )
117 break; 117 break;
118 118
119 QString qmodname = QString( modname ); 119 QString qmodname = QString( modname );
120 QString qmodsize = QString::number( modsize ).rightJustify( 6, ' ' ); 120 QString qmodsize = QString::number( modsize ).rightJustify( 6, ' ' );
121 QString qusecount = QString::number( usecount ).rightJustify( 2, ' ' ); 121 QString qusecount = QString::number( usecount ).rightJustify( 2, ' ' );
122 QString qusage = QString( usage ); 122 QString qusage = QString( usage );
diff --git a/noncore/settings/sysinfo/processinfo.cpp b/noncore/settings/sysinfo/processinfo.cpp
index 2a90b0f..69b4ab5 100644
--- a/noncore/settings/sysinfo/processinfo.cpp
+++ b/noncore/settings/sysinfo/processinfo.cpp
@@ -1,119 +1,119 @@
1/********************************************************************** 1/**********************************************************************
2** ProcessInfo 2** ProcessInfo
3** 3**
4** Display process information 4** Display process information
5** 5**
6** Copyright (C) 2002, Dan Williams 6** Copyright (C) 2002, Dan Williams
7** williamsdr@acm.org 7** williamsdr@acm.org
8** http://draknor.net 8** http://draknor.net
9** 9**
10** This file may be distributed and/or modified under the terms of the 10** This file may be distributed and/or modified under the terms of the
11** GNU General Public License version 2 as published by the Free Software 11** GNU General Public License version 2 as published by the Free Software
12** Foundation and appearing in the file LICENSE.GPL included in the 12** Foundation and appearing in the file LICENSE.GPL included in the
13** packaging of this file. 13** packaging of this file.
14** 14**
15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17** 17**
18**********************************************************************/ 18**********************************************************************/
19 19
20#include "processinfo.h" 20#include "processinfo.h"
21#include "detail.h" 21#include "detail.h"
22 22
23/* OPIE */ 23/* OPIE */
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25 25
26/* QT */ 26/* QT */
27#include <qdir.h> 27#include <qdir.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qmessagebox.h> 29#include <qmessagebox.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qwhatsthis.h> 31#include <qwhatsthis.h>
32 32
33/* STD */ 33/* STD */
34#include <sys/types.h> 34#include <sys/types.h>
35#include <signal.h> 35#include <signal.h>
36 36
37ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl ) 37ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
38 : QWidget( parent, name, fl ) 38 : QWidget( parent, name, fl )
39{ 39{
40 QGridLayout *layout = new QGridLayout( this ); 40 QGridLayout *layout = new QGridLayout( this );
41 layout->setSpacing( 4 ); 41 layout->setSpacing( 4 );
42 layout->setMargin( 4 ); 42 layout->setMargin( 4 );
43 43
44 44
45 ProcessView = new QListView( this, "ProcessView" ); 45 ProcessView = new QListView( this, "ProcessView" );
46 int colnum = ProcessView->addColumn( tr( "PID" ) ); 46 int colnum = ProcessView->addColumn( tr( "PID" ) );
47 ProcessView->setColumnAlignment( colnum, Qt::AlignRight ); 47 ProcessView->setColumnAlignment( colnum, Qt::AlignRight );
48 colnum = ProcessView->addColumn( tr( "Command" ),96 ); 48 colnum = ProcessView->addColumn( tr( "Command" ),96 );
49 colnum = ProcessView->addColumn( tr( "Status" ) ); 49 colnum = ProcessView->addColumn( tr( "Status" ) );
50 colnum = ProcessView->addColumn( tr( "Time" ) ); 50 colnum = ProcessView->addColumn( tr( "Time" ) );
51 ProcessView->setColumnAlignment( colnum, Qt::AlignRight ); 51 ProcessView->setColumnAlignment( colnum, Qt::AlignRight );
52 ProcessView->setAllColumnsShowFocus( TRUE ); 52 ProcessView->setAllColumnsShowFocus( TRUE );
53 QPEApplication::setStylusOperation( ProcessView->viewport(), QPEApplication::RightOnHold ); 53 QPEApplication::setStylusOperation( ProcessView->viewport(), QPEApplication::RightOnHold );
54 connect( ProcessView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), 54 connect( ProcessView, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ),
55 this, SLOT( viewProcess( QListViewItem * ) ) ); 55 this, SLOT( viewProcess(QListViewItem*) ) );
56 layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 ); 56 layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 );
57 QWhatsThis::add( ProcessView, tr( "This is a list of all the processes on this handheld device.\n\nClick and hold on a process to see additional information about the process, or to send a signal to it." ) ); 57 QWhatsThis::add( ProcessView, tr( "This is a list of all the processes on this handheld device.\n\nClick and hold on a process to see additional information about the process, or to send a signal to it." ) );
58 58
59 SignalCB = new QComboBox( FALSE, this, "SignalCB" ); 59 SignalCB = new QComboBox( FALSE, this, "SignalCB" );
60 SignalCB->insertItem( " 1: SIGHUP" ); 60 SignalCB->insertItem( " 1: SIGHUP" );
61 SignalCB->insertItem( " 2: SIGINT" ); 61 SignalCB->insertItem( " 2: SIGINT" );
62 SignalCB->insertItem( " 3: SIGQUIT" ); 62 SignalCB->insertItem( " 3: SIGQUIT" );
63 SignalCB->insertItem( " 5: SIGTRAP" ); 63 SignalCB->insertItem( " 5: SIGTRAP" );
64 SignalCB->insertItem( " 6: SIGABRT" ); 64 SignalCB->insertItem( " 6: SIGABRT" );
65 SignalCB->insertItem( " 9: SIGKILL" ); 65 SignalCB->insertItem( " 9: SIGKILL" );
66 SignalCB->insertItem( "14: SIGALRM" ); 66 SignalCB->insertItem( "14: SIGALRM" );
67 SignalCB->insertItem( "15: SIGTERM" ); 67 SignalCB->insertItem( "15: SIGTERM" );
68 SignalCB->insertItem( "18: SIGCONT" ); 68 SignalCB->insertItem( "18: SIGCONT" );
69 SignalCB->insertItem( "19: SIGSTOP" ); 69 SignalCB->insertItem( "19: SIGSTOP" );
70 layout->addWidget( SignalCB, 1, 0 ); 70 layout->addWidget( SignalCB, 1, 0 );
71 QWhatsThis::add( SignalCB, tr( "Select a signal here and then click the Send button to the right to send to this process." ) ); 71 QWhatsThis::add( SignalCB, tr( "Select a signal here and then click the Send button to the right to send to this process." ) );
72 72
73 SendButton = new QPushButton( this, "SendButton" ); 73 SendButton = new QPushButton( this, "SendButton" );
74 SendButton->setMinimumSize( QSize( 50, 24 ) ); 74 SendButton->setMinimumSize( QSize( 50, 24 ) );
75 SendButton->setMaximumSize( QSize( 50, 24 ) ); 75 SendButton->setMaximumSize( QSize( 50, 24 ) );
76 SendButton->setText( tr( "Send" ) ); 76 SendButton->setText( tr( "Send" ) );
77 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); 77 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
78 layout->addWidget( SendButton, 1, 1 ); 78 layout->addWidget( SendButton, 1, 1 );
79 QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) ); 79 QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) );
80 80
81 QTimer *t = new QTimer( this ); 81 QTimer *t = new QTimer( this );
82 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); 82 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
83 t->start( 5000 ); 83 t->start( 5000 );
84 84
85 updateData(); 85 updateData();
86 86
87 ProcessDtl = new Detail(); 87 ProcessDtl = new Detail();
88 QWhatsThis::add( ProcessDtl->detailView, tr( "This area shows detailed information about this process." ) ); 88 QWhatsThis::add( ProcessDtl->detailView, tr( "This area shows detailed information about this process." ) );
89} 89}
90 90
91ProcessInfo::~ProcessInfo() 91ProcessInfo::~ProcessInfo()
92{} 92{}
93 93
94void ProcessInfo::updateData() 94void ProcessInfo::updateData()
95{ 95{
96 int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime, 96 int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime,
97 signal, blocked, sigignore, sigcatch; 97 signal, blocked, sigignore, sigcatch;
98 uint flags, minflt, cminflt, majflt, cmajflt, timeout, itrealvalue, vsize, rss, rlim, startcode, 98 uint flags, minflt, cminflt, majflt, cmajflt, timeout, itrealvalue, vsize, rss, rlim, startcode,
99 endcode, startstack, kstkesp, kstkeip, wchan; 99 endcode, startstack, kstkesp, kstkeip, wchan;
100 char state; 100 char state;
101 char comm[64]; 101 char comm[64];
102 102
103 QString selectedpid; 103 QString selectedpid;
104 QListViewItem *curritem = ProcessView->currentItem(); 104 QListViewItem *curritem = ProcessView->currentItem();
105 if ( curritem ) 105 if ( curritem )
106 { 106 {
107 selectedpid = curritem->text( 0 ); 107 selectedpid = curritem->text( 0 );
108 } 108 }
109 109
110 ProcessView->clear(); 110 ProcessView->clear();
111 111
112 QListViewItem *newitem; 112 QListViewItem *newitem;
113 QListViewItem *selecteditem = 0x0; 113 QListViewItem *selecteditem = 0x0;
114 QDir *procdir = new QDir("/proc", 0, QDir::Name, QDir::Dirs); 114 QDir *procdir = new QDir("/proc", 0, QDir::Name, QDir::Dirs);
115 QFileInfoList *proclist = new QFileInfoList(*(procdir->entryInfoList())); 115 QFileInfoList *proclist = new QFileInfoList(*(procdir->entryInfoList()));
116 if ( proclist ) 116 if ( proclist )
117 { 117 {
118 QFileInfoListIterator it(*proclist); 118 QFileInfoListIterator it(*proclist);
119 QFileInfo *f; 119 QFileInfo *f;
diff --git a/noncore/settings/tabmanager/tabmanager.cpp b/noncore/settings/tabmanager/tabmanager.cpp
index ff5957c..15aeaf5 100644
--- a/noncore/settings/tabmanager/tabmanager.cpp
+++ b/noncore/settings/tabmanager/tabmanager.cpp
@@ -1,103 +1,103 @@
1#include "tabmanager.h" 1#include "tabmanager.h"
2#include "app.h" 2#include "app.h"
3#include "wait.h" 3#include "wait.h"
4#include "tabapplnk.h" 4#include "tabapplnk.h"
5 5
6#include <qpe/applnk.h> 6#include <qpe/applnk.h>
7#include <qdir.h> 7#include <qdir.h>
8#include <qfile.h> 8#include <qfile.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qlistview.h> 10#include <qlistview.h>
11#include <qheader.h> 11#include <qheader.h>
12#include <qcombobox.h> 12#include <qcombobox.h>
13#include <qlineedit.h> 13#include <qlineedit.h>
14#include <qlabel.h> 14#include <qlabel.h>
15#include <qmessagebox.h> 15#include <qmessagebox.h>
16#include <stdlib.h> 16#include <stdlib.h>
17#include <qpe/qcopenvelope_qws.h> 17#include <qpe/qcopenvelope_qws.h>
18#include <qpe/qpeapplication.h> 18#include <qpe/qpeapplication.h>
19#include <qpe/resource.h> 19#include <qpe/resource.h>
20 20
21 21
22#define HOME_APP_DIR QPEApplication::qpeDir()+"/apps" 22#define HOME_APP_DIR QPEApplication::qpeDir()+"/apps"
23#define HOME_APP_INSTALL_DIR "/usr/lib/ipkg/info" 23#define HOME_APP_INSTALL_DIR "/usr/lib/ipkg/info"
24#define NEW_FOLDER "EmptyTab" 24#define NEW_FOLDER "EmptyTab"
25#define NEW_APPLICATION "NewApp" 25#define NEW_APPLICATION "NewApp"
26#define APPLICATION_EXTENSION ".desktop" 26#define APPLICATION_EXTENSION ".desktop"
27#define APPLICATION_EXTENSION_LENGTH 8 27#define APPLICATION_EXTENSION_LENGTH 8
28 28
29/** 29/**
30 * Constructor. Sets up signals. Performs initial scan of applications 30 * Constructor. Sets up signals. Performs initial scan of applications
31 * and tabs 31 * and tabs
32 */ 32 */
33TabManager::TabManager( QWidget* parent, const char* name):TabManagerBase(parent, name), changed(false), application(NULL){ 33TabManager::TabManager( QWidget* parent, const char* name):TabManagerBase(parent, name), changed(false), application(NULL){
34 rescanFolder(HOME_APP_DIR); 34 rescanFolder(HOME_APP_DIR);
35 35
36 // Connect the signals and slots 36 // Connect the signals and slots
37 connect(tabList, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(editItem(QListViewItem*))); 37 connect(tabList, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(editItem(QListViewItem*)));
38 (tabList->header())->hide(); 38 (tabList->header())->hide();
39 connect(tabList, SIGNAL(moveItem(QListViewItem *, QListViewItem *)), this, SLOT(moveApplication(QListViewItem *, QListViewItem *))); 39 connect(tabList, SIGNAL(moveItem(QListViewItem*,QListViewItem*)), this, SLOT(moveApplication(QListViewItem*,QListViewItem*)));
40} 40}
41 41
42/** 42/**
43 * If anything in the tab's have been changed then update the system or alert 43 * If anything in the tab's have been changed then update the system or alert
44 * the user. 44 * the user.
45 */ 45 */
46TabManager::~TabManager(){ 46TabManager::~TabManager(){
47 if(changed){ 47 if(changed){
48 // Prompt. 48 // Prompt.
49 //int answer = QMessageBox::warning(this, "Message", "Should your desktop be","Yes", "Cancel", 0, 1 ); 49 //int answer = QMessageBox::warning(this, "Message", "Should your desktop be","Yes", "Cancel", 0, 1 );
50 //if (answer) 50 //if (answer)
51 // return; 51 // return;
52 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 52 QCopEnvelope e("QPE/System", "linkChanged(QString)");
53 QString link; //we'll just send an empty string 53 QString link; //we'll just send an empty string
54 e << link; 54 e << link;
55 } 55 }
56} 56}
57 57
58/** 58/**
59 * Scans root directory for any tabs or applications. Will recursivly go down, 59 * Scans root directory for any tabs or applications. Will recursivly go down,
60 * but will not follow symlinks. 60 * but will not follow symlinks.
61 * @param directory - the directory to look in. 61 * @param directory - the directory to look in.
62 * @param parent - the parent to place any new tabs or apps into. If parent is 62 * @param parent - the parent to place any new tabs or apps into. If parent is
63 * NULL then the item is a tab and should be placed as a child of the window. 63 * NULL then the item is a tab and should be placed as a child of the window.
64 */ 64 */
65void TabManager::rescanFolder(QString directory, QListViewItem* parent){ 65void TabManager::rescanFolder(QString directory, QListViewItem* parent){
66 //qDebug(QString("rescanFolder: ") + directory.latin1()); 66 //qDebug(QString("rescanFolder: ") + directory.latin1());
67 67
68 QDir d; 68 QDir d;
69 d.setPath(directory); 69 d.setPath(directory);
70 // Show hidden files for .directories 70 // Show hidden files for .directories
71 d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); 71 d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs);
72 72
73 const QFileInfoList *list = d.entryInfoList(); 73 const QFileInfoList *list = d.entryInfoList();
74 QFileInfoListIterator it( *list ); // create list iterator 74 QFileInfoListIterator it( *list ); // create list iterator
75 QFileInfo *fi; // pointer for traversing 75 QFileInfo *fi; // pointer for traversing
76 76
77 while ( (fi=it.current()) ) { // for each file... 77 while ( (fi=it.current()) ) { // for each file...
78 // If it is a dir and not .. or . then add it as a tab and go down. 78 // If it is a dir and not .. or . then add it as a tab and go down.
79 if(fi->isDir()){ 79 if(fi->isDir()){
80 if(fi->fileName() != ".." && fi->fileName() != ".") { 80 if(fi->fileName() != ".." && fi->fileName() != ".") {
81 QListViewItem* newItem; 81 QListViewItem* newItem;
82 if(!parent) 82 if(!parent)
83 newItem = new QListViewItem(tabList, fi->fileName()); 83 newItem = new QListViewItem(tabList, fi->fileName());
84 else 84 else
85 newItem = new QListViewItem(parent, fi->fileName()); 85 newItem = new QListViewItem(parent, fi->fileName());
86 itemList.insert(newItem, directory + "/" + fi->fileName() + "/.directory" ); 86 itemList.insert(newItem, directory + "/" + fi->fileName() + "/.directory" );
87 rescanFolder(directory + "/" + fi->fileName(), newItem); 87 rescanFolder(directory + "/" + fi->fileName(), newItem);
88 } 88 }
89 } 89 }
90 else{ 90 else{
91 // it is a file, if not a .directory add to parent. 91 // it is a file, if not a .directory add to parent.
92 92
93 // Change parents name and icon to reflect icon. 93 // Change parents name and icon to reflect icon.
94 if(fi->fileName() == ".directory"){ 94 if(fi->fileName() == ".directory"){
95 AppLnk app(directory + "/" + fi->fileName()); 95 AppLnk app(directory + "/" + fi->fileName());
96 if(parent){ 96 if(parent){
97 parent->setPixmap(0,app.pixmap()); 97 parent->setPixmap(0,app.pixmap());
98 parent->setText(0, app.name()); 98 parent->setText(0, app.name());
99 } 99 }
100 } 100 }
101 else{ 101 else{
102 // Add any desktop files found. 102 // Add any desktop files found.
103 QListViewItem* newItem; 103 QListViewItem* newItem;
diff --git a/noncore/settings/usermanager/usermanager.cpp b/noncore/settings/usermanager/usermanager.cpp
index 5411995..a1130d4 100644
--- a/noncore/settings/usermanager/usermanager.cpp
+++ b/noncore/settings/usermanager/usermanager.cpp
@@ -16,129 +16,129 @@
16#include <qpe/resource.h> 16#include <qpe/resource.h>
17 17
18#include <qregexp.h> 18#include <qregexp.h>
19 19
20/** 20/**
21 * The mainwindow constructor. 21 * The mainwindow constructor.
22 * 22 *
23 * @param QWidget *parent 23 * @param QWidget *parent
24 * @param const char *name 24 * @param const char *name
25 * @ param WFlags fl 25 * @ param WFlags fl
26 * 26 *
27 */ 27 */
28UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) { 28UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) {
29 setCaption(tr("Opie User Manager")); 29 setCaption(tr("Opie User Manager"));
30 30
31 // Create an instance of the global object 'accounts'. This holds all user/group info, and functions to modify them. 31 // Create an instance of the global object 'accounts'. This holds all user/group info, and functions to modify them.
32 accounts=new Passwd(); 32 accounts=new Passwd();
33 accounts->open();// This actually loads the files /etc/passwd & /etc/group into memory. 33 accounts->open();// This actually loads the files /etc/passwd & /etc/group into memory.
34 34
35 // Create the toolbar. 35 // Create the toolbar.
36 QToolBar *toolbar = new QToolBar(this,"Toolbar"); 36 QToolBar *toolbar = new QToolBar(this,"Toolbar");
37 toolbar->setHorizontalStretchable(1); // Is there any other way to get the toolbar to stretch of the full screen!? 37 toolbar->setHorizontalStretchable(1); // Is there any other way to get the toolbar to stretch of the full screen!?
38 adduserToolButton = new QToolButton(Resource::loadPixmap("usermanager/adduser"),"Add User",0,this,SLOT(addUser()),toolbar,"Add User"); 38 adduserToolButton = new QToolButton(Resource::loadPixmap("usermanager/adduser"),"Add User",0,this,SLOT(addUser()),toolbar,"Add User");
39 edituserToolButton = new QToolButton(Resource::loadPixmap("usermanager/edituser"),"Edit User",0,this,SLOT(editUser()),toolbar,"Edit User"); 39 edituserToolButton = new QToolButton(Resource::loadPixmap("usermanager/edituser"),"Edit User",0,this,SLOT(editUser()),toolbar,"Edit User");
40 deleteuserToolButton = new QToolButton(Resource::loadPixmap("usermanager/deleteuser"),"Delete User",0,this,SLOT(delUser()),toolbar,"Delete User"); 40 deleteuserToolButton = new QToolButton(Resource::loadPixmap("usermanager/deleteuser"),"Delete User",0,this,SLOT(delUser()),toolbar,"Delete User");
41 QToolButton *userstext = new QToolButton(0,"User",0,0,0,toolbar,"User"); 41 QToolButton *userstext = new QToolButton(0,"User",0,0,0,toolbar,"User");
42 userstext->setUsesTextLabel(true); 42 userstext->setUsesTextLabel(true);
43 toolbar->addSeparator(); 43 toolbar->addSeparator();
44 addgroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/addgroup"),"Add Group",0,this,SLOT(addGroup()),toolbar,"Add Group"); 44 addgroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/addgroup"),"Add Group",0,this,SLOT(addGroup()),toolbar,"Add Group");
45 editgroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/editgroup"),"Edit Group",0,this,SLOT(editGroup()),toolbar,"Edit Group"); 45 editgroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/editgroup"),"Edit Group",0,this,SLOT(editGroup()),toolbar,"Edit Group");
46 deletegroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/deletegroup"),"Delete Group",0,this,SLOT(delGroup()),toolbar,"Delete Group"); 46 deletegroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/deletegroup"),"Delete Group",0,this,SLOT(delGroup()),toolbar,"Delete Group");
47 QToolButton *groupstext = new QToolButton(0,"Group",0,0,0,toolbar,"Group"); 47 QToolButton *groupstext = new QToolButton(0,"Group",0,0,0,toolbar,"Group");
48 groupstext->setUsesTextLabel(true); 48 groupstext->setUsesTextLabel(true);
49 addToolBar(toolbar,"myToolBar"); 49 addToolBar(toolbar,"myToolBar");
50 50
51 // Add a tabwidget and all the tabs. 51 // Add a tabwidget and all the tabs.
52 myTabWidget = new QTabWidget(this,"My Tab Widget"); 52 myTabWidget = new QTabWidget(this,"My Tab Widget");
53 setupTabAccounts(); 53 setupTabAccounts();
54 setupTabAllUsers(); 54 setupTabAllUsers();
55 setupTabAllGroups(); 55 setupTabAllGroups();
56 userPopupMenu.insertItem("Copy",0); 56 userPopupMenu.insertItem("Copy",0);
57 57
58 getUsers(); // Fill out the iconview & listview with all users. 58 getUsers(); // Fill out the iconview & listview with all users.
59 getGroups(); // Fill out the group listview with all groups. 59 getGroups(); // Fill out the group listview with all groups.
60 60
61 setCentralWidget(myTabWidget); 61 setCentralWidget(myTabWidget);
62} 62}
63 63
64UserConfig::~UserConfig() { 64UserConfig::~UserConfig() {
65 accounts->close(); 65 accounts->close();
66 delete accounts; 66 delete accounts;
67} 67}
68 68
69void UserConfig::setupTabAccounts() { 69void UserConfig::setupTabAccounts() {
70 QWidget *tabpage = new QWidget(this); 70 QWidget *tabpage = new QWidget(this);
71 QVBoxLayout *layout = new QVBoxLayout(tabpage); 71 QVBoxLayout *layout = new QVBoxLayout(tabpage);
72 layout->setMargin(5); 72 layout->setMargin(5);
73 73
74 usersIconView=new QListView(tabpage,"users"); 74 usersIconView=new QListView(tabpage,"users");
75 usersIconView->addColumn("Icon"); 75 usersIconView->addColumn("Icon");
76 usersIconView->addColumn("Username"); 76 usersIconView->addColumn("Username");
77 usersIconView->setAllColumnsShowFocus(true); 77 usersIconView->setAllColumnsShowFocus(true);
78 layout->addWidget(usersIconView); 78 layout->addWidget(usersIconView);
79 79
80 connect(usersIconView,SIGNAL(returnPressed(QListViewItem *)),this,SLOT(showUserMenu(QListViewItem *))); 80 connect(usersIconView,SIGNAL(returnPressed(QListViewItem*)),this,SLOT(showUserMenu(QListViewItem*)));
81 81
82 myTabWidget->addTab(tabpage,"Users"); 82 myTabWidget->addTab(tabpage,"Users");
83} 83}
84 84
85void UserConfig::setupTabAllUsers() { 85void UserConfig::setupTabAllUsers() {
86 QWidget *tabpage = new QWidget(this); 86 QWidget *tabpage = new QWidget(this);
87 QVBoxLayout *layout = new QVBoxLayout(tabpage); 87 QVBoxLayout *layout = new QVBoxLayout(tabpage);
88 layout->setMargin(5); 88 layout->setMargin(5);
89 89
90 usersListView=new QListView(tabpage,"allusers"); 90 usersListView=new QListView(tabpage,"allusers");
91 usersListView->addColumn("UID"); 91 usersListView->addColumn("UID");
92 usersListView->addColumn("Login"); 92 usersListView->addColumn("Login");
93 usersListView->addColumn("Username"); 93 usersListView->addColumn("Username");
94 layout->addWidget(usersListView); 94 layout->addWidget(usersListView);
95 usersListView->setSorting(1,1); 95 usersListView->setSorting(1,1);
96 usersListView->setAllColumnsShowFocus(true); 96 usersListView->setAllColumnsShowFocus(true);
97 97
98 myTabWidget->addTab(tabpage,"All Users"); 98 myTabWidget->addTab(tabpage,"All Users");
99} 99}
100 100
101void UserConfig::setupTabAllGroups() { 101void UserConfig::setupTabAllGroups() {
102 QWidget *tabpage = new QWidget(this); 102 QWidget *tabpage = new QWidget(this);
103 QVBoxLayout *layout = new QVBoxLayout(tabpage); 103 QVBoxLayout *layout = new QVBoxLayout(tabpage);
104 layout->setMargin(5); 104 layout->setMargin(5);
105 105
106 groupsListView=new QListView(tabpage,"groups"); 106 groupsListView=new QListView(tabpage,"groups");
107 groupsListView->addColumn("GID"); 107 groupsListView->addColumn("GID");
108 groupsListView->addColumn("Groupname"); 108 groupsListView->addColumn("Groupname");
109 layout->addWidget(groupsListView); 109 layout->addWidget(groupsListView);
110 groupsListView->setSorting(1,1); 110 groupsListView->setSorting(1,1);
111 groupsListView->setAllColumnsShowFocus(true); 111 groupsListView->setAllColumnsShowFocus(true);
112 112
113 myTabWidget->addTab(tabpage,"All Groups"); 113 myTabWidget->addTab(tabpage,"All Groups");
114} 114}
115void UserConfig::getUsers() { 115void UserConfig::getUsers() {
116 QString mytext; 116 QString mytext;
117 QPixmap mypixmap; 117 QPixmap mypixmap;
118 QListViewItem *listviewitem; 118 QListViewItem *listviewitem;
119 119
120 // Empty the iconview & the listview. 120 // Empty the iconview & the listview.
121 usersIconView->clear(); 121 usersIconView->clear();
122 usersListView->clear(); 122 usersListView->clear();
123 123
124 // availableUID is used as a deposite for the next available UID on the system, this should start at an ID over 500. 124 // availableUID is used as a deposite for the next available UID on the system, this should start at an ID over 500.
125 availableUID=500; 125 availableUID=500;
126 for(QStringList::Iterator it=accounts->passwdStringList.begin(); it!=accounts->passwdStringList.end(); ++it) { 126 for(QStringList::Iterator it=accounts->passwdStringList.begin(); it!=accounts->passwdStringList.end(); ++it) {
127 accounts->splitPasswdEntry(*it); // Split the string into it's components and store in variables in the accounts object. ("pr_name" and so on.) 127 accounts->splitPasswdEntry(*it); // Split the string into it's components and store in variables in the accounts object. ("pr_name" and so on.)
128 if(accounts->pw_name.find(QRegExp("^#"),0)) {// Skip commented lines. 128 if(accounts->pw_name.find(QRegExp("^#"),0)) {// Skip commented lines.
129 new QListViewItem(usersListView,QString::number(accounts->pw_uid),accounts->pw_name,accounts->pw_gecos); 129 new QListViewItem(usersListView,QString::number(accounts->pw_uid),accounts->pw_name,accounts->pw_gecos);
130 if((accounts->pw_uid>=500) && (accounts->pw_uid<65000)) {// Is this user a "normal" user ? 130 if((accounts->pw_uid>=500) && (accounts->pw_uid<65000)) {// Is this user a "normal" user ?
131 mytext=QString(accounts->pw_name)+" - ("+QString(accounts->pw_gecos)+")"; // The string displayed next to the icon. 131 mytext=QString(accounts->pw_name)+" - ("+QString(accounts->pw_gecos)+")"; // The string displayed next to the icon.
132 if(!(mypixmap.load("/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"))) { // Is there an icon for this user? Resource::loadPixmap is caching, doesn't work. 132 if(!(mypixmap.load("/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"))) { // Is there an icon for this user? Resource::loadPixmap is caching, doesn't work.
133 mypixmap=Resource::loadPixmap(QString("usermanager/usericon"));// If this user has no icon, load the default icon. 133 mypixmap=Resource::loadPixmap(QString("usermanager/usericon"));// If this user has no icon, load the default icon.
134 } 134 }
135 listviewitem=new QListViewItem(usersIconView,"",mytext);// Add the icon+text to the qiconview. 135 listviewitem=new QListViewItem(usersIconView,"",mytext);// Add the icon+text to the qiconview.
136 listviewitem->setPixmap(0,mypixmap); 136 listviewitem->setPixmap(0,mypixmap);
137 } 137 }
138 if((accounts->pw_uid>=availableUID) && (accounts->pw_uid<65000)) availableUID=accounts->pw_uid+1; // Increase 1 to the latest know UID to get a free uid. 138 if((accounts->pw_uid>=availableUID) && (accounts->pw_uid<65000)) availableUID=accounts->pw_uid+1; // Increase 1 to the latest know UID to get a free uid.
139 } 139 }
140 } 140 }
141 usersIconView->sort(); 141 usersIconView->sort();
142} 142}
143 143
144void UserConfig::addUser() { 144void UserConfig::addUser() {
diff --git a/noncore/styles/liquid/liquidset.cpp b/noncore/styles/liquid/liquidset.cpp
index 7747da7..a7cfccc 100644
--- a/noncore/styles/liquid/liquidset.cpp
+++ b/noncore/styles/liquid/liquidset.cpp
@@ -59,111 +59,111 @@ LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl )
59 vbox-> setMargin ( 4 ); 59 vbox-> setMargin ( 4 );
60 60
61 QComboBox *cb = new QComboBox ( this ); 61 QComboBox *cb = new QComboBox ( this );
62 cb-> insertItem ( tr( "No translucency" ), None ); 62 cb-> insertItem ( tr( "No translucency" ), None );
63 cb-> insertItem ( tr( "Stippled, background color" ), StippledBg ); 63 cb-> insertItem ( tr( "Stippled, background color" ), StippledBg );
64 cb-> insertItem ( tr( "Stippled, button color" ), StippledBtn ); 64 cb-> insertItem ( tr( "Stippled, button color" ), StippledBtn );
65 cb-> insertItem ( tr( "Translucent stippled, background color" ), TransStippleBg ); 65 cb-> insertItem ( tr( "Translucent stippled, background color" ), TransStippleBg );
66 cb-> insertItem ( tr( "Translucent stippled, button color" ), TransStippleBtn ); 66 cb-> insertItem ( tr( "Translucent stippled, button color" ), TransStippleBtn );
67 cb-> insertItem ( tr( "Custom translucency" ), Custom ); 67 cb-> insertItem ( tr( "Custom translucency" ), Custom );
68 68
69 cb-> setCurrentItem ( m_type ); 69 cb-> setCurrentItem ( m_type );
70 vbox-> addWidget ( cb ); 70 vbox-> addWidget ( cb );
71 71
72 72
73 QGridLayout *grid = new QGridLayout ( vbox ); 73 QGridLayout *grid = new QGridLayout ( vbox );
74 grid-> addColSpacing ( 0, 16 ); 74 grid-> addColSpacing ( 0, 16 );
75 grid-> addColSpacing ( 3, 8 ); 75 grid-> addColSpacing ( 3, 8 );
76 76
77 grid-> addWidget ( m_menulbl = new QLabel ( tr( "Menu color" ), this ), 0, 1 ); 77 grid-> addWidget ( m_menulbl = new QLabel ( tr( "Menu color" ), this ), 0, 1 );
78 grid-> addWidget ( m_textlbl = new QLabel ( tr( "Text color" ), this ), 0, 4 ); 78 grid-> addWidget ( m_textlbl = new QLabel ( tr( "Text color" ), this ), 0, 4 );
79 grid-> addWidget ( m_opaclbl = new QLabel ( tr( "Opacity" ), this ), 1, 1 ); 79 grid-> addWidget ( m_opaclbl = new QLabel ( tr( "Opacity" ), this ), 1, 1 );
80 80
81 m_menubtn = new OColorButton ( this, mcol ); 81 m_menubtn = new OColorButton ( this, mcol );
82 grid-> addWidget ( m_menubtn, 0, 2 ); 82 grid-> addWidget ( m_menubtn, 0, 2 );
83 83
84 m_textbtn = new OColorButton ( this, tcol ); 84 m_textbtn = new OColorButton ( this, tcol );
85 grid-> addWidget ( m_textbtn, 0, 5 ); 85 grid-> addWidget ( m_textbtn, 0, 5 );
86 86
87 m_opacsld = new QSlider ( Horizontal, this ); 87 m_opacsld = new QSlider ( Horizontal, this );
88 m_opacsld-> setRange ( -20, 20 ); 88 m_opacsld-> setRange ( -20, 20 );
89 m_opacsld-> setSteps ( 1, 1 ); 89 m_opacsld-> setSteps ( 1, 1 );
90 m_opacsld-> setValue ( opacity ); 90 m_opacsld-> setValue ( opacity );
91 m_opacsld-> setTickmarks ( QSlider::Below ); 91 m_opacsld-> setTickmarks ( QSlider::Below );
92 grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 ); 92 grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 );
93 93
94 vbox-> addSpacing ( 4 ); 94 vbox-> addSpacing ( 4 );
95 95
96 QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed menu text" ), this ); 96 QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed menu text" ), this );
97 shadow-> setChecked ( m_shadow ); 97 shadow-> setChecked ( m_shadow );
98 vbox-> addWidget ( shadow ); 98 vbox-> addWidget ( shadow );
99 99
100 vbox-> addSpacing ( 4 ); 100 vbox-> addSpacing ( 4 );
101 101
102 QCheckBox *flattb = new QCheckBox ( tr( "Make toolbar buttons appear flat" ), this ); 102 QCheckBox *flattb = new QCheckBox ( tr( "Make toolbar buttons appear flat" ), this );
103 flattb-> setChecked ( m_flat ); 103 flattb-> setChecked ( m_flat );
104 vbox-> addWidget ( flattb ); 104 vbox-> addWidget ( flattb );
105 105
106 vbox-> addSpacing ( 4 ); 106 vbox-> addSpacing ( 4 );
107 107
108 QHBoxLayout *hbox = new QHBoxLayout ( vbox ); 108 QHBoxLayout *hbox = new QHBoxLayout ( vbox );
109 109
110 hbox-> addWidget ( new QLabel ( tr( "Stipple contrast" ), this )); 110 hbox-> addWidget ( new QLabel ( tr( "Stipple contrast" ), this ));
111 111
112 m_contsld = new QSlider ( Horizontal, this ); 112 m_contsld = new QSlider ( Horizontal, this );
113 m_contsld-> setRange ( 0, 10 ); 113 m_contsld-> setRange ( 0, 10 );
114 m_contsld-> setSteps ( 1, 1 ); 114 m_contsld-> setSteps ( 1, 1 );
115 m_contsld-> setValue ( contrast ); 115 m_contsld-> setValue ( contrast );
116 m_contsld-> setTickmarks ( QSlider::Below ); 116 m_contsld-> setTickmarks ( QSlider::Below );
117 hbox-> addWidget ( m_contsld, 10 ); 117 hbox-> addWidget ( m_contsld, 10 );
118 118
119 vbox-> addStretch ( 10 ); 119 vbox-> addStretch ( 10 );
120 120
121 changeType ( m_type ); 121 changeType ( m_type );
122 122
123 connect ( cb, SIGNAL( highlighted ( int ) ), this, SLOT( changeType ( int ) ) ); 123 connect ( cb, SIGNAL( highlighted(int) ), this, SLOT( changeType(int) ) );
124 connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) ); 124 connect ( shadow, SIGNAL( toggled(bool) ), this, SLOT( changeShadow(bool) ) );
125 connect ( flattb, SIGNAL( toggled ( bool ) ), this, SLOT( changeFlat ( bool ) ) ); 125 connect ( flattb, SIGNAL( toggled(bool) ), this, SLOT( changeFlat(bool) ) );
126} 126}
127 127
128void LiquidSettings::changeType ( int t ) 128void LiquidSettings::changeType ( int t )
129{ 129{
130 bool custom = ( t == Custom ); 130 bool custom = ( t == Custom );
131 131
132 m_menulbl-> setEnabled ( custom ); 132 m_menulbl-> setEnabled ( custom );
133 m_textlbl-> setEnabled ( custom ); 133 m_textlbl-> setEnabled ( custom );
134 m_opaclbl-> setEnabled ( custom ); 134 m_opaclbl-> setEnabled ( custom );
135 m_menubtn-> setEnabled ( custom ); 135 m_menubtn-> setEnabled ( custom );
136 m_textbtn-> setEnabled ( custom ); 136 m_textbtn-> setEnabled ( custom );
137 m_opacsld-> setEnabled ( custom ); 137 m_opacsld-> setEnabled ( custom );
138 138
139 m_type = t; 139 m_type = t;
140} 140}
141 141
142void LiquidSettings::changeShadow ( bool b ) 142void LiquidSettings::changeShadow ( bool b )
143{ 143{
144 m_shadow = b; 144 m_shadow = b;
145} 145}
146 146
147void LiquidSettings::changeFlat ( bool b ) 147void LiquidSettings::changeFlat ( bool b )
148{ 148{
149 m_flat = b; 149 m_flat = b;
150} 150}
151 151
152 152
153bool LiquidSettings::writeConfig ( ) 153bool LiquidSettings::writeConfig ( )
154{ 154{
155 Config config ( "qpe" ); 155 Config config ( "qpe" );
156 config. setGroup ( "Liquid-Style" ); 156 config. setGroup ( "Liquid-Style" );
157 157
158 config. writeEntry ( "Type", m_type ); 158 config. writeEntry ( "Type", m_type );
159 config. writeEntry ( "Color", m_menubtn-> color ( ). name ( )); 159 config. writeEntry ( "Color", m_menubtn-> color ( ). name ( ));
160 config. writeEntry ( "TextColor", m_textbtn-> color ( ). name ( )); 160 config. writeEntry ( "TextColor", m_textbtn-> color ( ). name ( ));
161 config. writeEntry ( "Opacity", m_opacsld-> value ( )); 161 config. writeEntry ( "Opacity", m_opacsld-> value ( ));
162 config. writeEntry ( "ShadowText", m_shadow ); 162 config. writeEntry ( "ShadowText", m_shadow );
163 config. writeEntry ( "StippleContrast", m_contsld-> value ( )); 163 config. writeEntry ( "StippleContrast", m_contsld-> value ( ));
164 config. writeEntry ( "FlatToolButtons", m_flat ); 164 config. writeEntry ( "FlatToolButtons", m_flat );
165 config. write ( ); 165 config. write ( );
166 166
167 return true; 167 return true;
168} 168}
169 169
diff --git a/noncore/todayplugins/fortune/fortunepluginwidget.cpp b/noncore/todayplugins/fortune/fortunepluginwidget.cpp
index b210fa9..e6a0d09 100644
--- a/noncore/todayplugins/fortune/fortunepluginwidget.cpp
+++ b/noncore/todayplugins/fortune/fortunepluginwidget.cpp
@@ -3,82 +3,82 @@
3 * 3 *
4 * copyright : (c) 2002 by Maximilian Reiß 4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#include "fortunepluginwidget.h" 17#include "fortunepluginwidget.h"
18 18
19#include <qvaluelist.h> 19#include <qvaluelist.h>
20#include <qtl.h> 20#include <qtl.h>
21#include <qstring.h> 21#include <qstring.h>
22#include <qscrollview.h> 22#include <qscrollview.h>
23#include <qobject.h> 23#include <qobject.h>
24#include <qlayout.h> 24#include <qlayout.h>
25 25
26#include <qpe/config.h> 26#include <qpe/config.h>
27#include <qpe/qcopenvelope_qws.h> 27#include <qpe/qcopenvelope_qws.h>
28 28
29#include <opie/oprocess.h> 29#include <opie/oprocess.h>
30#include <opie/oticker.h> 30#include <opie/oticker.h>
31 31
32FortunePluginWidget::FortunePluginWidget( QWidget *parent, const char* name ) 32FortunePluginWidget::FortunePluginWidget( QWidget *parent, const char* name )
33 : QWidget( parent, name ) 33 : QWidget( parent, name )
34{ 34{
35 35
36 fortune = NULL; 36 fortune = NULL;
37 getFortune(); 37 getFortune();
38} 38}
39 39
40FortunePluginWidget::~FortunePluginWidget() { 40FortunePluginWidget::~FortunePluginWidget() {
41 if( fortuneProcess ){ 41 if( fortuneProcess ){
42 delete fortuneProcess; 42 delete fortuneProcess;
43 } 43 }
44} 44}
45 45
46/** 46/**
47 * Get the fortunes 47 * Get the fortunes
48 */ 48 */
49void FortunePluginWidget::getFortune() { 49void FortunePluginWidget::getFortune() {
50 50
51 QVBoxLayout* layoutFortune = new QVBoxLayout( this ); 51 QVBoxLayout* layoutFortune = new QVBoxLayout( this );
52 52
53 if ( fortune ) { 53 if ( fortune ) {
54 delete fortune; 54 delete fortune;
55 } 55 }
56 56
57 fortune = new OTicker( this ); 57 fortune = new OTicker( this );
58 //fortune->setReadOnly( TRUE ); 58 //fortune->setReadOnly( TRUE );
59 //fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); 59 //fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
60 60
61 fortune->setText( QString("Obtaining fortune...") ); 61 fortune->setText( QString("Obtaining fortune...") );
62 layoutFortune->addWidget( fortune ); 62 layoutFortune->addWidget( fortune );
63 63
64 fortuneProcess = new OProcess(); 64 fortuneProcess = new OProcess();
65 *fortuneProcess << "fortune"; 65 *fortuneProcess << "fortune";
66 66
67 connect(fortuneProcess, SIGNAL(receivedStdout(OProcess*, char*, int ) ), 67 connect(fortuneProcess, SIGNAL(receivedStdout(OProcess*,char*,int) ),
68 this, SLOT(slotStdOut(OProcess*, char*, int) ) ); 68 this, SLOT(slotStdOut(OProcess*,char*,int) ) );
69 69
70 if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 70 if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
71 qWarning("could not start :("); 71 qWarning("could not start :(");
72 fortune->setText( QString("Failed to obtain fortune.") ); 72 fortune->setText( QString("Failed to obtain fortune.") );
73 delete fortuneProcess; 73 delete fortuneProcess;
74 fortuneProcess = 0; 74 fortuneProcess = 0;
75 } 75 }
76 76
77} 77}
78 78
79void FortunePluginWidget::slotStdOut( OProcess* proc, char* buf, int len ) 79void FortunePluginWidget::slotStdOut( OProcess* proc, char* buf, int len )
80{ 80{
81 QCString s( buf, len ); 81 QCString s( buf, len );
82 s.replace( QRegExp("\n"), "" ); 82 s.replace( QRegExp("\n"), "" );
83 fortune->setText( s ); 83 fortune->setText( s );
84} 84}
diff --git a/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp b/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp
index 2274402..db662e8 100644
--- a/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp
+++ b/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp
@@ -1,180 +1,180 @@
1/**************************************************************************** 1/****************************************************************************
2** 2**
3** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 3** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
4** 4**
5** This file is part of an example program for Qt. This example 5** This file is part of an example program for Qt. This example
6** program may be used, distributed and modified without limitation. 6** program may be used, distributed and modified without limitation.
7** 7**
8*****************************************************************************/ 8*****************************************************************************/
9 9
10#include "helpwindow.h" 10#include "helpwindow.h"
11#include <qstatusbar.h> 11#include <qstatusbar.h>
12 12
13#include <qmenubar.h> 13#include <qmenubar.h>
14#include <qtoolbar.h> 14#include <qtoolbar.h>
15#include <qtoolbutton.h> 15#include <qtoolbutton.h>
16#include <qcombobox.h> 16#include <qcombobox.h>
17 17
18#include <ctype.h> 18#include <ctype.h>
19 19
20HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name ) 20HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name )
21 : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL() 21 : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL()
22{ 22{
23 readHistory(); 23 readHistory();
24 readBookmarks(); 24 readBookmarks();
25 25
26 browser = new QTextBrowser( this ); 26 browser = new QTextBrowser( this );
27 QStringList Strlist; 27 QStringList Strlist;
28 Strlist.append( home_); 28 Strlist.append( home_);
29 29
30 browser->mimeSourceFactory()->setFilePath( Strlist ); 30 browser->mimeSourceFactory()->setFilePath( Strlist );
31 31
32 browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 32 browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );
33 33
34 connect( browser, SIGNAL( textChanged() ), 34 connect( browser, SIGNAL( textChanged() ),
35 35
36 this, SLOT( textChanged() ) ); 36 this, SLOT( textChanged() ) );
37 37
38 setCentralWidget( browser ); 38 setCentralWidget( browser );
39 39
40 if ( !home_.isEmpty() ) 40 if ( !home_.isEmpty() )
41 41
42//////////////////////////////// 42////////////////////////////////
43 browser->setSource( home_ ); 43 browser->setSource( home_ );
44 44
45//////////////////////////////// 45////////////////////////////////
46 connect( browser, SIGNAL( highlighted( const QString&) ), 46 connect( browser, SIGNAL( highlighted(const QString&) ),
47 statusBar(), SLOT( message( const QString&)) ); 47 statusBar(), SLOT( message(const QString&)) );
48 48
49 setGeometry( 0,0,236,280); 49 setGeometry( 0,0,236,280);
50 50
51 QPopupMenu* file = new QPopupMenu( this ); 51 QPopupMenu* file = new QPopupMenu( this );
52// file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N ); 52// file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N );
53 file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O ); 53 file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O );
54// file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P ); 54// file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P );
55 file->insertSeparator(); 55 file->insertSeparator();
56 file->insertItem( tr("&Close"), this, SLOT( close() ), ALT | Key_Q ); 56 file->insertItem( tr("&Close"), this, SLOT( close() ), ALT | Key_Q );
57// file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), ALT | Key_X ); 57// file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), ALT | Key_X );
58 58
59 // The same three icons are used twice each. 59 // The same three icons are used twice each.
60////F FIXME 60////F FIXME
61 QString pixs=(QDir::homeDirPath ()) +"/Applications/gutenbrowser/pix/"; 61 QString pixs=(QDir::homeDirPath ()) +"/Applications/gutenbrowser/pix/";
62 QIconSet icon_back( QPixmap(pixs+"back.png") ); 62 QIconSet icon_back( QPixmap(pixs+"back.png") );
63 QIconSet icon_forward( QPixmap(pixs+"forward.png") ); 63 QIconSet icon_forward( QPixmap(pixs+"forward.png") );
64 QIconSet icon_home( QPixmap(pixs+"home.png") ); 64 QIconSet icon_home( QPixmap(pixs+"home.png") );
65 65
66 QPopupMenu* go = new QPopupMenu( this ); 66 QPopupMenu* go = new QPopupMenu( this );
67 backwardId = go->insertItem( icon_back, tr("&Backward"), browser, SLOT( backward() ), ALT | Key_Left ); 67 backwardId = go->insertItem( icon_back, tr("&Backward"), browser, SLOT( backward() ), ALT | Key_Left );
68 forwardId = go->insertItem( icon_forward, tr("&Forward"), browser, SLOT( forward() ), ALT | Key_Right ); 68 forwardId = go->insertItem( icon_forward, tr("&Forward"), browser, SLOT( forward() ), ALT | Key_Right );
69 go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) ); 69 go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) );
70 70
71 71
72 hist = new QPopupMenu( this ); 72 hist = new QPopupMenu( this );
73 QStringList::Iterator it = history.begin(); 73 QStringList::Iterator it = history.begin();
74 for ( ; it != history.end(); ++it ) 74 for ( ; it != history.end(); ++it )
75 mHistory[ hist->insertItem( *it ) ] = *it; 75 mHistory[ hist->insertItem( *it ) ] = *it;
76 connect( hist, SIGNAL( activated( int ) ), this, SLOT( histChosen( int ) ) ); 76 connect( hist, SIGNAL( activated(int) ), this, SLOT( histChosen(int) ) );
77 77
78 bookm = new QPopupMenu( this ); 78 bookm = new QPopupMenu( this );
79 bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); 79 bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) );
80 bookm->insertSeparator(); 80 bookm->insertSeparator();
81 81
82 QStringList::Iterator it2 = bookmarks.begin(); 82 QStringList::Iterator it2 = bookmarks.begin();
83 for ( ; it2 != bookmarks.end(); ++it2 ) 83 for ( ; it2 != bookmarks.end(); ++it2 )
84 mBookmarks[ bookm->insertItem( *it2 ) ] = *it2; 84 mBookmarks[ bookm->insertItem( *it2 ) ] = *it2;
85 connect( bookm, SIGNAL( activated( int ) ), 85 connect( bookm, SIGNAL( activated(int) ),
86 this, SLOT( bookmChosen( int ) ) ); 86 this, SLOT( bookmChosen(int) ) );
87 87
88 menuBar()->insertItem( tr("&File"), file ); 88 menuBar()->insertItem( tr("&File"), file );
89 menuBar()->insertItem( tr("&Go"), go ); 89 menuBar()->insertItem( tr("&Go"), go );
90 menuBar()->insertItem( tr( "History" ), hist ); 90 menuBar()->insertItem( tr( "History" ), hist );
91 menuBar()->insertItem( tr( "Bookmarks" ), bookm ); 91 menuBar()->insertItem( tr( "Bookmarks" ), bookm );
92// menuBar()->insertSeparator(); 92// menuBar()->insertSeparator();
93// menuBar()->insertItem( tr("&Help"), help ); 93// menuBar()->insertItem( tr("&Help"), help );
94 94
95 menuBar()->setItemEnabled( forwardId, FALSE); 95 menuBar()->setItemEnabled( forwardId, FALSE);
96 menuBar()->setItemEnabled( backwardId, FALSE); 96 menuBar()->setItemEnabled( backwardId, FALSE);
97 connect( browser, SIGNAL( backwardAvailable( bool ) ), this, SLOT( setBackwardAvailable( bool ) ) ); 97 connect( browser, SIGNAL( backwardAvailable(bool) ), this, SLOT( setBackwardAvailable(bool) ) );
98 connect( browser, SIGNAL( forwardAvailable( bool ) ), this, SLOT( setForwardAvailable( bool ) ) ); 98 connect( browser, SIGNAL( forwardAvailable(bool) ), this, SLOT( setForwardAvailable(bool) ) );
99 99
100 100
101 QToolBar* toolbar = new QToolBar( this ); 101 QToolBar* toolbar = new QToolBar( this );
102 addToolBar( toolbar, "Toolbar"); 102 addToolBar( toolbar, "Toolbar");
103 QToolButton* button; 103 QToolButton* button;
104 104
105 button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar ); 105 button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar );
106 connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); 106 connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
107 button->setEnabled( FALSE ); 107 button->setEnabled( FALSE );
108 button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar ); 108 button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar );
109 connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); 109 connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
110 button->setEnabled( FALSE ); 110 button->setEnabled( FALSE );
111 button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar ); 111 button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar );
112 112
113 toolbar->addSeparator(); 113 toolbar->addSeparator();
114 114
115 pathCombo = new QComboBox( TRUE, toolbar ); 115 pathCombo = new QComboBox( TRUE, toolbar );
116 connect( pathCombo, SIGNAL( activated( const QString & ) ), this, SLOT( pathSelected( const QString & ) ) ); 116 connect( pathCombo, SIGNAL( activated(const QString&) ), this, SLOT( pathSelected(const QString&) ) );
117 toolbar->setStretchableWidget( pathCombo ); 117 toolbar->setStretchableWidget( pathCombo );
118 118
119// pathCombo->setMaximumWidth(190); 119// pathCombo->setMaximumWidth(190);
120// setRightJustification( TRUE ); 120// setRightJustification( TRUE );
121// setDockEnabled( Left, FALSE ); 121// setDockEnabled( Left, FALSE );
122// setDockEnabled( Right, FALSE ); 122// setDockEnabled( Right, FALSE );
123 123
124 pathCombo->insertItem( home_ ); 124 pathCombo->insertItem( home_ );
125 125
126 browser->setFocus(); 126 browser->setFocus();
127 127
128 128
129} 129}
130 130
131 131
132void HelpWindow::setBackwardAvailable( bool b) 132void HelpWindow::setBackwardAvailable( bool b)
133{ 133{
134 menuBar()->setItemEnabled( backwardId, b); 134 menuBar()->setItemEnabled( backwardId, b);
135} 135}
136 136
137void HelpWindow::setForwardAvailable( bool b) 137void HelpWindow::setForwardAvailable( bool b)
138{ 138{
139 menuBar()->setItemEnabled( forwardId, b); 139 menuBar()->setItemEnabled( forwardId, b);
140} 140}
141 141
142 142
143void HelpWindow::textChanged() 143void HelpWindow::textChanged()
144{ 144{
145 if ( browser->documentTitle().isNull() ) { 145 if ( browser->documentTitle().isNull() ) {
146 setCaption( "Stockticker Lookup - " + browser->context() ); 146 setCaption( "Stockticker Lookup - " + browser->context() );
147 selectedURL = browser->context(); 147 selectedURL = browser->context();
148 } 148 }
149 else { 149 else {
150 setCaption( "Stockticker Lookup - " + browser->documentTitle() ) ; 150 setCaption( "Stockticker Lookup - " + browser->documentTitle() ) ;
151 selectedURL = browser->documentTitle(); 151 selectedURL = browser->documentTitle();
152 } 152 }
153 153
154 if ( !selectedURL.isEmpty() && pathCombo ) { 154 if ( !selectedURL.isEmpty() && pathCombo ) {
155 bool exists = FALSE; 155 bool exists = FALSE;
156 int i; 156 int i;
157 for ( i = 0; i < pathCombo->count(); ++i ) { 157 for ( i = 0; i < pathCombo->count(); ++i ) {
158 if ( pathCombo->text( i ) == selectedURL ) { 158 if ( pathCombo->text( i ) == selectedURL ) {
159 exists = TRUE; 159 exists = TRUE;
160 break; 160 break;
161 } 161 }
162 } 162 }
163 if ( !exists ) { 163 if ( !exists ) {
164 pathCombo->insertItem( selectedURL, 0 ); 164 pathCombo->insertItem( selectedURL, 0 );
165 pathCombo->setCurrentItem( 0 ); 165 pathCombo->setCurrentItem( 0 );
166 mHistory[ hist->insertItem( selectedURL ) ] = selectedURL; 166 mHistory[ hist->insertItem( selectedURL ) ] = selectedURL;
167 } else 167 } else
168 pathCombo->setCurrentItem( i ); 168 pathCombo->setCurrentItem( i );
169 selectedURL = QString::null; 169 selectedURL = QString::null;
170 } 170 }
171} 171}
172 172
173HelpWindow::~HelpWindow() 173HelpWindow::~HelpWindow()
174{ 174{
175 history.clear(); 175 history.clear();
176 QMap<int, QString>::Iterator it = mHistory.begin(); 176 QMap<int, QString>::Iterator it = mHistory.begin();
177 for ( ; it != mHistory.end(); ++it ) 177 for ( ; it != mHistory.end(); ++it )
178 history.append( *it ); 178 history.append( *it );
179 179
180 QFile f( QDir::currentDirPath() + "/.history" ); 180 QFile f( QDir::currentDirPath() + "/.history" );
diff --git a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp
index 73f8bb3..64798f4 100644
--- a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp
+++ b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp
@@ -2,88 +2,88 @@
2 2
3#include <qapplication.h> 3#include <qapplication.h>
4 4
5#include <qlayout.h> 5#include <qlayout.h>
6#include <qcheckbox.h> 6#include <qcheckbox.h>
7#include <qlineedit.h> 7#include <qlineedit.h>
8#include <qvariant.h> 8#include <qvariant.h>
9#include <qpushbutton.h> 9#include <qpushbutton.h>
10#include <qwhatsthis.h> 10#include <qwhatsthis.h>
11#include <qlabel.h> 11#include <qlabel.h>
12#include <qlayout.h> 12#include <qlayout.h>
13#include <qpe/config.h> 13#include <qpe/config.h>
14#include <qstringlist.h> 14#include <qstringlist.h>
15#include <qmainwindow.h> 15#include <qmainwindow.h>
16#include "helpwindow.h" 16#include "helpwindow.h"
17 17
18#include <opie/oprocess.h> 18#include <opie/oprocess.h>
19 19
20#include <stdlib.h> 20#include <stdlib.h>
21// #include <sys/stat.h> 21// #include <sys/stat.h>
22// #include <unistd.h> 22// #include <unistd.h>
23 23
24InputDialog::InputDialog( ) 24InputDialog::InputDialog( )
25 : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) { 25 : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) {
26 setCaption( tr("Symbol Lookup")); 26 setCaption( tr("Symbol Lookup"));
27 27
28 QGridLayout *layout = new QGridLayout( this ); 28 QGridLayout *layout = new QGridLayout( this );
29 layout->setSpacing(6); 29 layout->setSpacing(6);
30 layout->setMargin( 2); 30 layout->setMargin( 2);
31 31
32 LineEdit1 = new QLineEdit( this, "LineEdit1" ); 32 LineEdit1 = new QLineEdit( this, "LineEdit1" );
33 LineEdit1->setFocus(); 33 LineEdit1->setFocus();
34 34
35 layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 3); 35 layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 3);
36 36
37 QLabel *label; 37 QLabel *label;
38 label = new QLabel(this); 38 label = new QLabel(this);
39 label->setText( tr("Enter something to lookup / search.")); 39 label->setText( tr("Enter something to lookup / search."));
40 label->setMaximumHeight(60); 40 label->setMaximumHeight(60);
41 layout->addMultiCellWidget( label, 1, 1, 0, 3); 41 layout->addMultiCellWidget( label, 1, 1, 0, 3);
42 42
43 connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(doLookup())); 43 connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(doLookup()));
44 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); 44 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding );
45 layout->addItem( spacer, 8, 0 ); 45 layout->addItem( spacer, 8, 0 );
46 46
47} 47}
48 48
49InputDialog::~InputDialog() { 49InputDialog::~InputDialog() {
50} 50}
51 51
52void InputDialog::doLookup() { 52void InputDialog::doLookup() {
53// http://finance.yahoo.com/l?m=&s=siemens&t= 53// http://finance.yahoo.com/l?m=&s=siemens&t=
54 54
55 QString url = "\"http://finance.yahoo.com/l?m=&s="+LineEdit1->text()+"\""; 55 QString url = "\"http://finance.yahoo.com/l?m=&s="+LineEdit1->text()+"\"";
56 QString tempHtml = "/tmp/stockticker.html"; 56 QString tempHtml = "/tmp/stockticker.html";
57 QString cmd = "wget -O "+tempHtml+" "+url; 57 QString cmd = "wget -O "+tempHtml+" "+url;
58 qDebug(cmd); 58 qDebug(cmd);
59 59
60 60
61/* 61/*
62 OProcess proc; 62 OProcess proc;
63 proc << "/usr/bin/wget"; 63 proc << "/usr/bin/wget";
64 proc<<"-O"<< tempHtml<< url; 64 proc<<"-O"<< tempHtml<< url;
65 65
66 connect( &proc, SIGNAL( processExited( OProcess *)),this, SLOT( showBrowser(OProcess *))); 66 connect( &proc, SIGNAL( processExited(OProcess*)),this, SLOT( showBrowser(OProcess*)));
67 proc.start( OProcess::NotifyOnExit); 67 proc.start( OProcess::NotifyOnExit);
68*/ 68*/
69 system(cmd.latin1()); 69 system(cmd.latin1());
70 HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); 70 HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup");
71 StockLookup->setCaption("Symbol"); 71 StockLookup->setCaption("Symbol");
72 StockLookup->showMaximized(); 72 StockLookup->showMaximized();
73 StockLookup->show(); 73 StockLookup->show();
74 LineEdit1->text(); 74 LineEdit1->text();
75 75
76 76
77} 77}
78 78
79void InputDialog::showBrowser(OProcess*) { 79void InputDialog::showBrowser(OProcess*) {
80 qDebug("BLAH"); 80 qDebug("BLAH");
81 QString tempHtml = "/tmp/stockticker.html"; 81 QString tempHtml = "/tmp/stockticker.html";
82 82
83 HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); 83 HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup");
84 StockLookup->setCaption("Symbol"); 84 StockLookup->setCaption("Symbol");
85 StockLookup->showMaximized(); 85 StockLookup->showMaximized();
86 StockLookup->show(); 86 StockLookup->show();
87 LineEdit1->text(); 87 LineEdit1->text();
88 88
89} 89}
diff --git a/noncore/todayplugins/weather/weatherpluginwidget.cpp b/noncore/todayplugins/weather/weatherpluginwidget.cpp
index 4491b91..15d1c6e 100644
--- a/noncore/todayplugins/weather/weatherpluginwidget.cpp
+++ b/noncore/todayplugins/weather/weatherpluginwidget.cpp
@@ -44,129 +44,129 @@ WeatherPluginWidget::WeatherPluginWidget( QWidget *parent, const char* name )
44 : QWidget( parent, name ) 44 : QWidget( parent, name )
45{ 45{
46 QHBoxLayout *layout = new QHBoxLayout( this ); 46 QHBoxLayout *layout = new QHBoxLayout( this );
47 layout->setAutoAdd( TRUE ); 47 layout->setAutoAdd( TRUE );
48 layout->setSpacing( 2 ); 48 layout->setSpacing( 2 );
49 49
50 weatherIcon = new QLabel( this ); 50 weatherIcon = new QLabel( this );
51 weatherIcon->setMaximumWidth( 32 ); 51 weatherIcon->setMaximumWidth( 32 );
52 QImage logo1 = Resource::loadImage( "Clock" ); 52 QImage logo1 = Resource::loadImage( "Clock" );
53 QPixmap pic; 53 QPixmap pic;
54 pic.convertFromImage( logo1 ); 54 pic.convertFromImage( logo1 );
55 weatherIcon->setPixmap( pic ); 55 weatherIcon->setPixmap( pic );
56 56
57 weatherLabel = new QLabel( tr( "Retreiving current weather information." ), this ); 57 weatherLabel = new QLabel( tr( "Retreiving current weather information." ), this );
58 weatherLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ) ); 58 weatherLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ) );
59 59
60 startTimer(1000); 60 startTimer(1000);
61} 61}
62 62
63WeatherPluginWidget::~WeatherPluginWidget() 63WeatherPluginWidget::~WeatherPluginWidget()
64{ 64{
65 QFile file( localFile ); 65 QFile file( localFile );
66 if ( file.exists() ) 66 if ( file.exists() )
67 { 67 {
68 file.remove(); 68 file.remove();
69 } 69 }
70} 70}
71 71
72void WeatherPluginWidget::timerEvent( QTimerEvent *e ) 72void WeatherPluginWidget::timerEvent( QTimerEvent *e )
73{ 73{
74 killTimer( e->timerId() ); 74 killTimer( e->timerId() );
75 retreiveData(); 75 retreiveData();
76} 76}
77 77
78 78
79 79
80void WeatherPluginWidget::retreiveData() 80void WeatherPluginWidget::retreiveData()
81{ 81{
82 Config config( "todayweatherplugin"); 82 Config config( "todayweatherplugin");
83 config.setGroup( "Config" ); 83 config.setGroup( "Config" );
84 84
85 location = config.readEntry( "Location", "" ); 85 location = config.readEntry( "Location", "" );
86 useMetric = config.readBoolEntry( "Metric", TRUE ); 86 useMetric = config.readBoolEntry( "Metric", TRUE );
87 frequency = config.readNumEntry( "Frequency", 5 ); 87 frequency = config.readNumEntry( "Frequency", 5 );
88 88
89 startTimer( frequency * 60000 ); 89 startTimer( frequency * 60000 );
90 90
91 localFile = "/tmp/"; 91 localFile = "/tmp/";
92 localFile.append( location ); 92 localFile.append( location );
93 localFile.append( ".TXT" ); 93 localFile.append( ".TXT" );
94 94
95 remoteFile = "http://weather.noaa.gov/pub/data/observations/metar/stations/"; 95 remoteFile = "http://weather.noaa.gov/pub/data/observations/metar/stations/";
96 remoteFile.append( location ); 96 remoteFile.append( location );
97 remoteFile.append( ".TXT" ); 97 remoteFile.append( ".TXT" );
98 98
99 QFile file( localFile ); 99 QFile file( localFile );
100 if ( file.exists() ) 100 if ( file.exists() )
101 { 101 {
102 file.remove(); 102 file.remove();
103 } 103 }
104 104
105 OProcess *proc = new OProcess; 105 OProcess *proc = new OProcess;
106 106
107 *proc << "wget" << "-q" << remoteFile << "-O" << localFile; 107 *proc << "wget" << "-q" << remoteFile << "-O" << localFile;
108 connect( proc, SIGNAL( processExited( OProcess * ) ), this, SLOT( dataRetrieved( OProcess * ) ) ); 108 connect( proc, SIGNAL( processExited(OProcess*) ), this, SLOT( dataRetrieved(OProcess*) ) );
109 proc->start(); 109 proc->start();
110} 110}
111 111
112void WeatherPluginWidget::displayWeather() 112void WeatherPluginWidget::displayWeather()
113{ 113{
114 weatherData = QString::null; 114 weatherData = QString::null;
115 115
116 QFile file( localFile ); 116 QFile file( localFile );
117 117
118 if ( file.size() > 0 && file.open( IO_ReadOnly ) ) 118 if ( file.size() > 0 && file.open( IO_ReadOnly ) )
119 { 119 {
120 QTextStream data( &file ); 120 QTextStream data( &file );
121 while ( !data.eof() ) 121 while ( !data.eof() )
122 { 122 {
123 weatherData.append( data.readLine() ); 123 weatherData.append( data.readLine() );
124 } 124 }
125 file.close(); 125 file.close();
126 weatherData = weatherData.simplifyWhiteSpace(); 126 weatherData = weatherData.simplifyWhiteSpace();
127 127
128 QString tmpstr; 128 QString tmpstr;
129 129
130 tmpstr.append( tr( "Temp: " ) ); 130 tmpstr.append( tr( "Temp: " ) );
131 getTemp( weatherData ); 131 getTemp( weatherData );
132 tmpstr.append( dataStr ); 132 tmpstr.append( dataStr );
133 133
134 tmpstr.append( tr( " Wind: " ) ); 134 tmpstr.append( tr( " Wind: " ) );
135 getWind( weatherData ); 135 getWind( weatherData );
136 tmpstr.append( dataStr ); 136 tmpstr.append( dataStr );
137 137
138 tmpstr.append( tr( "\nPres: " ) ); 138 tmpstr.append( tr( "\nPres: " ) );
139 getPressure( weatherData ); 139 getPressure( weatherData );
140 tmpstr.append( dataStr ); 140 tmpstr.append( dataStr );
141 141
142 weatherLabel->setText( tmpstr ); 142 weatherLabel->setText( tmpstr );
143 143
144 tmpstr = "todayweatherplugin/"; 144 tmpstr = "todayweatherplugin/";
145 getIcon( weatherData ); 145 getIcon( weatherData );
146 tmpstr.append( dataStr ); 146 tmpstr.append( dataStr );
147 QImage logo1 = Resource::loadImage( tmpstr ); 147 QImage logo1 = Resource::loadImage( tmpstr );
148 QPixmap pic; 148 QPixmap pic;
149 pic.convertFromImage( logo1 ); 149 pic.convertFromImage( logo1 );
150 weatherIcon->setPixmap( pic ); 150 weatherIcon->setPixmap( pic );
151 } 151 }
152 else 152 else
153 { 153 {
154 weatherLabel->setText( tr( "Current weather data not available." ) ); 154 weatherLabel->setText( tr( "Current weather data not available." ) );
155 } 155 }
156} 156}
157 157
158void WeatherPluginWidget::getTemp( const QString &data ) 158void WeatherPluginWidget::getTemp( const QString &data )
159{ 159{
160 int value; 160 int value;
161 bool ok; 161 bool ok;
162 162
163 int pos = data.find( QRegExp( "M?[0-9]+/M?[0-9]+" ), 20 ); 163 int pos = data.find( QRegExp( "M?[0-9]+/M?[0-9]+" ), 20 );
164 if ( pos > -1 ) 164 if ( pos > -1 )
165 { 165 {
166 if ( data.at( pos ) == 'M' ) 166 if ( data.at( pos ) == 'M' )
167 { 167 {
168 value = -1 * data.mid( pos + 1, 2 ).toInt( &ok ); 168 value = -1 * data.mid( pos + 1, 2 ).toInt( &ok );
169 } 169 }
170 else 170 else
171 { 171 {
172 value = data.mid( pos, 2 ).toInt( &ok ); 172 value = data.mid( pos, 2 ).toInt( &ok );
diff --git a/noncore/tools/calc2/calc.cpp b/noncore/tools/calc2/calc.cpp
index f75eb69..3dcdf6e 100644
--- a/noncore/tools/calc2/calc.cpp
+++ b/noncore/tools/calc2/calc.cpp
@@ -1,104 +1,104 @@
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 <qvaluelist.h> 21#include <qvaluelist.h>
22#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
23#include <qdir.h> 23#include <qdir.h>
24#include <qwidgetstack.h> 24#include <qwidgetstack.h>
25 25
26#include "calc.h" 26#include "calc.h"
27#include "plugininterface.h" 27#include "plugininterface.h"
28 28
29calc::calc (QWidget * p, const char *n):QWidget (p, n) 29calc::calc (QWidget * p, const char *n):QWidget (p, n)
30{ 30{
31 setCaption (tr ("Calculator")); 31 setCaption (tr ("Calculator"));
32 32
33// widgets 33// widgets
34 LCD = new QLCDNumber (this); 34 LCD = new QLCDNumber (this);
35 LCD->setMaximumSize (QSize (240, 30)); 35 LCD->setMaximumSize (QSize (240, 30));
36 LCD->setNumDigits(12); 36 LCD->setNumDigits(12);
37LCD->setSegmentStyle(QLCDNumber::Filled); 37LCD->setSegmentStyle(QLCDNumber::Filled);
38 pluginWidgetStack = new QWidgetStack (this); 38 pluginWidgetStack = new QWidgetStack (this);
39 39
40// layout widgets 40// layout widgets
41 calculatorLayout = new QVBoxLayout (this); 41 calculatorLayout = new QVBoxLayout (this);
42 calculatorLayout->addWidget (LCD); 42 calculatorLayout->addWidget (LCD);
43 calculatorLayout->addWidget (pluginWidgetStack); 43 calculatorLayout->addWidget (pluginWidgetStack);
44 44
45// no formatting of display for now 45// no formatting of display for now
46 connect (&engine, SIGNAL(display (double)), LCD, SLOT(display (double))); 46 connect (&engine, SIGNAL(display(double)), LCD, SLOT(display(double)));
47 connect (&engine, SIGNAL(display (const QString &)), LCD, SLOT(display (const QString &))); 47 connect (&engine, SIGNAL(display(const QString&)), LCD, SLOT(display(const QString&)));
48 connect (&engine, SIGNAL(setBinMode()), LCD, SLOT(setBinMode())); 48 connect (&engine, SIGNAL(setBinMode()), LCD, SLOT(setBinMode()));
49 connect (&engine, SIGNAL(setOctMode()), LCD, SLOT(setOctMode())); 49 connect (&engine, SIGNAL(setOctMode()), LCD, SLOT(setOctMode()));
50 connect (&engine, SIGNAL(setDecMode()), LCD, SLOT(setDecMode())); 50 connect (&engine, SIGNAL(setDecMode()), LCD, SLOT(setDecMode()));
51 connect (&engine, SIGNAL(setHexMode()), LCD, SLOT(setHexMode())); 51 connect (&engine, SIGNAL(setHexMode()), LCD, SLOT(setHexMode()));
52 52
53#ifndef NO_PLUGINS 53#ifndef NO_PLUGINS
54// load plugins 54// load plugins
55 QValueList < Plugin >::Iterator mit; 55 QValueList < Plugin >::Iterator mit;
56 for (mit = pluginList.begin (); mit != pluginList.end (); ++mit) { 56 for (mit = pluginList.begin (); mit != pluginList.end (); ++mit) {
57 (*mit).interface->release (); 57 (*mit).interface->release ();
58 (*mit).library->unload (); 58 (*mit).library->unload ();
59 delete (*mit).library; 59 delete (*mit).library;
60 } 60 }
61 pluginList.clear (); 61 pluginList.clear ();
62 62
63 QString path = QPEApplication::qpeDir() + "/plugins/calculator"; 63 QString path = QPEApplication::qpeDir() + "/plugins/calculator";
64 QDir dir (path, "lib*.so"); 64 QDir dir (path, "lib*.so");
65 QStringList list = dir.entryList (); 65 QStringList list = dir.entryList ();
66 66
67 QStringList::Iterator it; 67 QStringList::Iterator it;
68 for (it = list.begin (); it != list.end (); ++it) { 68 for (it = list.begin (); it != list.end (); ++it) {
69 CalcInterface *iface = 0; 69 CalcInterface *iface = 0;
70 QLibrary *lib = new QLibrary (path + "/" + *it); 70 QLibrary *lib = new QLibrary (path + "/" + *it);
71 71
72 Plugin plugin; 72 Plugin plugin;
73 plugin.pluginWidget = 0; 73 plugin.pluginWidget = 0;
74 74
75 if (lib->queryInterface (IID_Calc, (QUnknownInterface **) & iface) == 75 if (lib->queryInterface (IID_Calc, (QUnknownInterface **) & iface) ==
76 QS_OK) { 76 QS_OK) {
77 plugin.library = lib; 77 plugin.library = lib;
78 plugin.interface = iface; 78 plugin.interface = iface;
79 plugin.pluginWidget = plugin.interface->getPlugin(&engine,pluginWidgetStack); 79 plugin.pluginWidget = plugin.interface->getPlugin(&engine,pluginWidgetStack);
80 if (plugin.pluginWidget) 80 if (plugin.pluginWidget)
81 pluginWidgetStack->addWidget (plugin.pluginWidget, pluginList.count()); 81 pluginWidgetStack->addWidget (plugin.pluginWidget, pluginList.count());
82 pluginList.append (plugin); 82 pluginList.append (plugin);
83 } else { 83 } else {
84 delete lib; 84 delete lib;
85 } 85 }
86 } 86 }
87 setMode (1); 87 setMode (1);
88#else 88#else
89// load simple interface 89// load simple interface
90#endif 90#endif
91} 91}
92 92
93calc::~calc () 93calc::~calc ()
94{ 94{
95#ifndef NO_PLUGINS 95#ifndef NO_PLUGINS
96 QValueList < Plugin >::Iterator mit; 96 QValueList < Plugin >::Iterator mit;
97 for (mit = pluginList.begin (); mit != pluginList.end (); ++mit) { 97 for (mit = pluginList.begin (); mit != pluginList.end (); ++mit) {
98 (*mit).interface->release (); 98 (*mit).interface->release ();
99 (*mit).library->unload (); 99 (*mit).library->unload ();
100 delete (*mit).library; 100 delete (*mit).library;
101 } 101 }
102#endif 102#endif
103} 103}
104 104
diff --git a/noncore/tools/calculator/calculatorimpl.cpp b/noncore/tools/calculator/calculatorimpl.cpp
index 163b4da..dead03d 100644
--- a/noncore/tools/calculator/calculatorimpl.cpp
+++ b/noncore/tools/calculator/calculatorimpl.cpp
@@ -159,129 +159,129 @@ CalculatorImpl::CalculatorImpl( QWidget * parent, const char * name,
159 QObject::tr("sq in"); 159 QObject::tr("sq in");
160 QObject::tr("sq km"); 160 QObject::tr("sq km");
161 QObject::tr("sq m"); 161 QObject::tr("sq m");
162 QObject::tr("sq mi"); 162 QObject::tr("sq mi");
163 QObject::tr("sq mm"); 163 QObject::tr("sq mm");
164 QObject::tr("sq yd"); 164 QObject::tr("sq yd");
165 QObject::tr("st"); 165 QObject::tr("st");
166 QObject::tr("St tons"); 166 QObject::tr("St tons");
167 QObject::tr("tblspoon"); 167 QObject::tr("tblspoon");
168 QObject::tr("teaspoons"); 168 QObject::tr("teaspoons");
169 QObject::tr("tonnes"); 169 QObject::tr("tonnes");
170 QObject::tr("yd"); 170 QObject::tr("yd");
171 171
172 172
173//bgr_command.insert( PushButtonFunction); 173//bgr_command.insert( PushButtonFunction);
174 bgr_command.insert( PushButtonMPlus); 174 bgr_command.insert( PushButtonMPlus);
175 bgr_command.insert( PushButtonMR); 175 bgr_command.insert( PushButtonMR);
176 bgr_command.insert( PushButtonMC); 176 bgr_command.insert( PushButtonMC);
177 bgr_command.insert( PushButtonCE); 177 bgr_command.insert( PushButtonCE);
178 connect( &bgr_command, SIGNAL(clicked(int) ), this, SLOT(command_buttons(int))); 178 connect( &bgr_command, SIGNAL(clicked(int) ), this, SLOT(command_buttons(int)));
179 179
180 bgr_digits.insert(PushButton0); 180 bgr_digits.insert(PushButton0);
181 bgr_digits.insert(PushButton1); 181 bgr_digits.insert(PushButton1);
182 bgr_digits.insert(PushButton2); 182 bgr_digits.insert(PushButton2);
183 bgr_digits.insert(PushButton3); 183 bgr_digits.insert(PushButton3);
184 bgr_digits.insert(PushButton4); 184 bgr_digits.insert(PushButton4);
185 bgr_digits.insert(PushButton5); 185 bgr_digits.insert(PushButton5);
186 bgr_digits.insert(PushButton6); 186 bgr_digits.insert(PushButton6);
187 bgr_digits.insert(PushButton7); 187 bgr_digits.insert(PushButton7);
188 bgr_digits.insert(PushButton8); 188 bgr_digits.insert(PushButton8);
189 bgr_digits.insert(PushButton9); 189 bgr_digits.insert(PushButton9);
190 connect( &bgr_digits, SIGNAL(clicked(int) ), this, SLOT(enterNumber(int))); 190 connect( &bgr_digits, SIGNAL(clicked(int) ), this, SLOT(enterNumber(int)));
191 191
192 192
193 bgr_std.insert(PushButtonEquals); 193 bgr_std.insert(PushButtonEquals);
194 bgr_std.insert(PushButtonDecimal); 194 bgr_std.insert(PushButtonDecimal);
195 bgr_std.insert(PushButtonAdd); 195 bgr_std.insert(PushButtonAdd);
196 bgr_std.insert(PushButtonMinus); 196 bgr_std.insert(PushButtonMinus);
197 bgr_std.insert(PushButtonDivide); 197 bgr_std.insert(PushButtonDivide);
198 bgr_std.insert(PushButtonTimes); 198 bgr_std.insert(PushButtonTimes);
199 connect( &bgr_std, SIGNAL(clicked(int) ), this, SLOT(std_buttons(int))); 199 connect( &bgr_std, SIGNAL(clicked(int) ), this, SLOT(std_buttons(int)));
200 200
201// change the / to a proper division signal 201// change the / to a proper division signal
202 PushButtonDivide->setText(QChar(0xF7)); 202 PushButtonDivide->setText(QChar(0xF7));
203 203
204 func_buttons[0] = PushButtonF1; 204 func_buttons[0] = PushButtonF1;
205 func_buttons[1] = PushButtonF2; 205 func_buttons[1] = PushButtonF2;
206 func_buttons[2] = PushButtonF3; 206 func_buttons[2] = PushButtonF3;
207 func_buttons[3] = PushButtonF4; 207 func_buttons[3] = PushButtonF4;
208 func_buttons[4] = PushButtonF5; 208 func_buttons[4] = PushButtonF5;
209 func_buttons[5] = PushButtonF6; 209 func_buttons[5] = PushButtonF6;
210 func_buttons[6] = PushButtonF7; 210 func_buttons[6] = PushButtonF7;
211 func_buttons[7] = PushButtonF8; 211 func_buttons[7] = PushButtonF8;
212 func_buttons[8] = PushButtonF9; 212 func_buttons[8] = PushButtonF9;
213 func_buttons[9] = PushButtonF10; 213 func_buttons[9] = PushButtonF10;
214 func_buttons[10] = PushButtonF11; 214 func_buttons[10] = PushButtonF11;
215 func_buttons[11] = PushButtonF12; 215 func_buttons[11] = PushButtonF12;
216 216
217 for ( int x = 0 ; x < func_button_count ; x++ ) { 217 for ( int x = 0 ; x < func_button_count ; x++ ) {
218 QPushButton* tmpbutton = func_buttons[x]; 218 QPushButton* tmpbutton = func_buttons[x];
219 faces << tmpbutton->text(); 219 faces << tmpbutton->text();
220 bgr_function.insert(tmpbutton); 220 bgr_function.insert(tmpbutton);
221 } 221 }
222 connect( &bgr_function, SIGNAL(clicked(int) ) , this, SLOT(do_convert(int) ) ); 222 connect( &bgr_function, SIGNAL(clicked(int) ) , this, SLOT(do_convert(int) ) );
223 connect( &bgr_function, SIGNAL(clicked(int) ) , this, SLOT(std_funcs (int) ) ); 223 connect( &bgr_function, SIGNAL(clicked(int) ) , this, SLOT(std_funcs(int) ) );
224 224
225 connect(ComboBoxFunction, SIGNAL(activated(int) ), this, SLOT(function_button(int) ) ); 225 connect(ComboBoxFunction, SIGNAL(activated(int) ), this, SLOT(function_button(int) ) );
226 226
227 captions.append(tr("Standard")); 227 captions.append(tr("Standard"));
228 ComboBoxFunction->insertItem(captions.last()); 228 ComboBoxFunction->insertItem(captions.last());
229 229
230 // now add in the conversion modes 230 // now add in the conversion modes
231 // when the menu gets done, these should be in a submenu 231 // when the menu gets done, these should be in a submenu
232 QString tmp = QPEApplication::qpeDir(); 232 QString tmp = QPEApplication::qpeDir();
233 tmp += "etc/unit_conversion.dat"; 233 tmp += "etc/unit_conversion.dat";
234 QFile myfile(tmp); 234 QFile myfile(tmp);
235 if ( !myfile.open( IO_Translate | IO_ReadOnly ) ) { 235 if ( !myfile.open( IO_Translate | IO_ReadOnly ) ) {
236 qDebug("Data file unit_conversion.dat not found\nNo conversion features will be available\n"+tmp); 236 qDebug("Data file unit_conversion.dat not found\nNo conversion features will be available\n"+tmp);
237 // disable the f button if no conv file available 237 // disable the f button if no conv file available
238 ComboBoxFunction->setEnabled(FALSE); 238 ComboBoxFunction->setEnabled(FALSE);
239 } 239 }
240 else { 240 else {
241 QString line, line2; 241 QString line, line2;
242 QTextStream ts(&myfile); 242 QTextStream ts(&myfile);
243 243
244 // first pass, see how many conversion types there are in order to allocate for them 244 // first pass, see how many conversion types there are in order to allocate for them
245 while ( ! ts.eof() ) { 245 while ( ! ts.eof() ) {
246 line = ts.readLine(); 246 line = ts.readLine();
247 if ( line.contains ("STARTTYPE" ) ) 247 if ( line.contains ("STARTTYPE" ) )
248 conversion_mode_count++; 248 conversion_mode_count++;
249 } 249 }
250 250
251 entry_list = new double[conversion_mode_count*func_button_count]; 251 entry_list = new double[conversion_mode_count*func_button_count];
252 preoffset_list = new double[conversion_mode_count*func_button_count]; 252 preoffset_list = new double[conversion_mode_count*func_button_count];
253 postoffset_list = new double[conversion_mode_count*func_button_count]; 253 postoffset_list = new double[conversion_mode_count*func_button_count];
254 myfile.close(); 254 myfile.close();
255 myfile.open( IO_Translate | IO_ReadOnly ); 255 myfile.open( IO_Translate | IO_ReadOnly );
256 QTextStream ts2(&myfile); 256 QTextStream ts2(&myfile);
257 257
258 // second pass, read in values 258 // second pass, read in values
259 int x = 0; 259 int x = 0;
260 while ( ! ts2.eof() ) { 260 while ( ! ts2.eof() ) {
261 line = ts2.readLine(); 261 line = ts2.readLine();
262 if ( line.contains("STARTTYPE") ) { 262 if ( line.contains("STARTTYPE") ) {
263 captions << tr( line.remove(0,10) ); 263 captions << tr( line.remove(0,10) );
264 ComboBoxFunction->insertItem(captions.last()); 264 ComboBoxFunction->insertItem(captions.last());
265 while ( !line.contains("ENDTYPE") ) { 265 while ( !line.contains("ENDTYPE") ) {
266 line = ts2.readLine(); 266 line = ts2.readLine();
267 if ( line.contains("NAME") ) { 267 if ( line.contains("NAME") ) {
268 faces << tr( line.remove(0,5) ); 268 faces << tr( line.remove(0,5) );
269 line2 = ts2.readLine(); 269 line2 = ts2.readLine();
270 line2.remove(0,6); 270 line2.remove(0,6);
271 entry_list[x] = line2.toDouble(); 271 entry_list[x] = line2.toDouble();
272 line2 = ts2.readLine(); 272 line2 = ts2.readLine();
273 line2.remove(0,7); 273 line2.remove(0,7);
274 preoffset_list[x] = line2.toDouble(); 274 preoffset_list[x] = line2.toDouble();
275 line2 = ts2.readLine(); 275 line2 = ts2.readLine();
276 line2.remove(0,8); 276 line2.remove(0,8);
277 postoffset_list[x] = line2.toDouble(); 277 postoffset_list[x] = line2.toDouble();
278 x++; 278 x++;
279 } 279 }
280 } 280 }
281 } 281 }
282 } 282 }
283 } 283 }
284 myfile.close(); 284 myfile.close();
285 clear(); 285 clear();
286 max_mode = pre_conv_modes_count + conversion_mode_count + post_conv_modes_count - 1; 286 max_mode = pre_conv_modes_count + conversion_mode_count + post_conv_modes_count - 1;
287 display_pixmap_faces(); 287 display_pixmap_faces();
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp
index 4d92683..118cf1f 100644
--- a/noncore/tools/clock/clock.cpp
+++ b/noncore/tools/clock/clock.cpp
@@ -60,177 +60,177 @@ void startPlayer()
60{ 60{
61 Config config( "qpe" ); 61 Config config( "qpe" );
62 config.setGroup( "Time" ); 62 config.setGroup( "Time" );
63 sleep(15); 63 sleep(15);
64 QCopEnvelope e( "QPE/Application/opieplayer", "setDocument(QString)" ); 64 QCopEnvelope e( "QPE/Application/opieplayer", "setDocument(QString)" );
65 e << config.readEntry( "mp3File", "" ); 65 e << config.readEntry( "mp3File", "" );
66} 66}
67 67
68 68
69static void toggleScreenSaver( bool on ) 69static void toggleScreenSaver( bool on )
70{ 70{
71 QCopEnvelope e( "QPE/System", "setScreenSaverMode(int)" ); 71 QCopEnvelope e( "QPE/System", "setScreenSaverMode(int)" );
72 e << ( on ? QPEApplication::Enable : QPEApplication::DisableSuspend ); 72 e << ( on ? QPEApplication::Enable : QPEApplication::DisableSuspend );
73} 73}
74 74
75Clock::Clock( QWidget * parent, const char * name, WFlags f ) 75Clock::Clock( QWidget * parent, const char * name, WFlags f )
76 : QVBox( parent, name , f ) 76 : QVBox( parent, name , f )
77{ 77{
78 setSpacing( 4 ); 78 setSpacing( 4 );
79 setMargin( 1 ); 79 setMargin( 1 );
80 80
81 81
82 snoozeBtn = new QPushButton ( this ); 82 snoozeBtn = new QPushButton ( this );
83 snoozeBtn->setText( tr( "Snooze" ) ); 83 snoozeBtn->setText( tr( "Snooze" ) );
84 84
85 aclock = new AnalogClock( this ); 85 aclock = new AnalogClock( this );
86 aclock->display( QTime::currentTime() ); 86 aclock->display( QTime::currentTime() );
87 aclock->setLineWidth( 2 ); 87 aclock->setLineWidth( 2 );
88 88
89 QHBox *hb = new QHBox( this ); 89 QHBox *hb = new QHBox( this );
90 hb->setMargin( 0 ); 90 hb->setMargin( 0 );
91 QWidget *space = new QWidget( hb ); 91 QWidget *space = new QWidget( hb );
92 lcd = new QLCDNumber( hb ); 92 lcd = new QLCDNumber( hb );
93 lcd->setSegmentStyle( QLCDNumber::Flat ); 93 lcd->setSegmentStyle( QLCDNumber::Flat );
94 lcd->setFrameStyle( QFrame::NoFrame ); 94 lcd->setFrameStyle( QFrame::NoFrame );
95 lcd->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); 95 lcd->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
96 lcd->setFixedHeight( 23 ); 96 lcd->setFixedHeight( 23 );
97 97
98 ampmLabel = new QLabel( tr( "PM" ), hb ); 98 ampmLabel = new QLabel( tr( "PM" ), hb );
99 ampmLabel->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); 99 ampmLabel->setFont( QFont( "Helvetica", 14, QFont::Bold ) );
100 ampmLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred ) ); 100 ampmLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred ) );
101 ampmLabel->setAlignment( AlignLeft | AlignBottom ); 101 ampmLabel->setAlignment( AlignLeft | AlignBottom );
102 space = new QWidget( hb ); 102 space = new QWidget( hb );
103 103
104 date = new QLabel( this ); 104 date = new QLabel( this );
105 date->setAlignment( AlignHCenter | AlignVCenter ); 105 date->setAlignment( AlignHCenter | AlignVCenter );
106 date->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); 106 date->setFont( QFont( "Helvetica", 14, QFont::Bold ) );
107 date->setText( TimeString::longDateString( QDate::currentDate() ) ); 107 date->setText( TimeString::longDateString( QDate::currentDate() ) );
108 108
109 QWidget *controls = new QWidget( this ); 109 QWidget *controls = new QWidget( this );
110 QGridLayout *gl = new QGridLayout( controls, 3, 2, 6, 4 ); 110 QGridLayout *gl = new QGridLayout( controls, 3, 2, 6, 4 );
111 111
112 QButtonGroup *grp = new QButtonGroup( controls ); 112 QButtonGroup *grp = new QButtonGroup( controls );
113 grp->setRadioButtonExclusive( true ); 113 grp->setRadioButtonExclusive( true );
114 grp->hide(); 114 grp->hide();
115 115
116 clockRB = new QRadioButton ( tr( "Clock" ), controls ); 116 clockRB = new QRadioButton ( tr( "Clock" ), controls );
117 gl->addWidget( clockRB, 0, 0 ); 117 gl->addWidget( clockRB, 0, 0 );
118 grp->insert( clockRB ); 118 grp->insert( clockRB );
119 119
120 swatchRB = new QRadioButton ( tr( "Stopwatch" ), controls ); 120 swatchRB = new QRadioButton ( tr( "Stopwatch" ), controls );
121 gl->addWidget( swatchRB, 1, 0 ); 121 gl->addWidget( swatchRB, 1, 0 );
122 grp->insert( swatchRB ); 122 grp->insert( swatchRB );
123 123
124 connect( grp, SIGNAL( clicked( int ) ), this, SLOT( modeSelect( int ) ) ); 124 connect( grp, SIGNAL( clicked(int) ), this, SLOT( modeSelect(int) ) );
125 grp->setButton( 0 ); 125 grp->setButton( 0 );
126 126
127 set = new QPushButton ( controls ); 127 set = new QPushButton ( controls );
128 set->setMaximumSize( 50, 30 ); 128 set->setMaximumSize( 50, 30 );
129 gl->addWidget( set , 0, 1 ); 129 gl->addWidget( set , 0, 1 );
130 set->setText( tr( "Start" ) ); 130 set->setText( tr( "Start" ) );
131 set->setEnabled( FALSE ); 131 set->setEnabled( FALSE );
132 grp->insert( set ); 132 grp->insert( set );
133 133
134 reset = new QPushButton ( controls ); 134 reset = new QPushButton ( controls );
135 gl->addWidget( reset, 1, 1 ); 135 gl->addWidget( reset, 1, 1 );
136 reset->setText( tr( "Reset" ) ); 136 reset->setText( tr( "Reset" ) );
137 reset->setEnabled( FALSE ); 137 reset->setEnabled( FALSE );
138 grp->insert( reset ); 138 grp->insert( reset );
139 139
140 alarmOffBtn = new QPushButton ( controls ); 140 alarmOffBtn = new QPushButton ( controls );
141 gl->addWidget( alarmOffBtn, 0, 2 ); 141 gl->addWidget( alarmOffBtn, 0, 2 );
142 142
143 alarmBtn = new QPushButton ( controls ); 143 alarmBtn = new QPushButton ( controls );
144 gl->addWidget( alarmBtn, 1, 2 ); 144 gl->addWidget( alarmBtn, 1, 2 );
145 145
146 alarmBtn->setText( tr( "Set Alarm" ) ); 146 alarmBtn->setText( tr( "Set Alarm" ) );
147 147
148 OClickableLabel *click = new OClickableLabel( controls, "label" ); 148 OClickableLabel *click = new OClickableLabel( controls, "label" );
149 click->setText( tr( "Set date and time." ) ); 149 click->setText( tr( "Set date and time." ) );
150 gl->addMultiCellWidget( click, 3, 3, 0, 2, AlignHCenter ); 150 gl->addMultiCellWidget( click, 3, 3, 0, 2, AlignHCenter );
151 connect( click, SIGNAL( clicked() ), this, SLOT( slotAdjustTime() ) ); 151 connect( click, SIGNAL( clicked() ), this, SLOT( slotAdjustTime() ) );
152 152
153 connect( set , SIGNAL( pressed() ), SLOT( slotSet() ) ); 153 connect( set , SIGNAL( pressed() ), SLOT( slotSet() ) );
154 connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) ); 154 connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) );
155 155
156 connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) ); 156 connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) );
157 connect( snoozeBtn, SIGNAL( clicked() ), SLOT( slotSnooze() ) ); 157 connect( snoozeBtn, SIGNAL( clicked() ), SLOT( slotSnooze() ) );
158 connect( alarmOffBtn, SIGNAL( clicked() ), SLOT( slotToggleAlarm() ) ); 158 connect( alarmOffBtn, SIGNAL( clicked() ), SLOT( slotToggleAlarm() ) );
159 159
160 connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ), 160 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
161 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); 161 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
162 162
163 t = new QTimer( this ); 163 t = new QTimer( this );
164 connect( t, SIGNAL( timeout() ), SLOT( updateClock() ) ); 164 connect( t, SIGNAL( timeout() ), SLOT( updateClock() ) );
165 t->start( 1000 ); 165 t->start( 1000 );
166 166
167 connect( qApp, SIGNAL( timeChanged() ), SLOT( updateClock() ) ); 167 connect( qApp, SIGNAL( timeChanged() ), SLOT( updateClock() ) );
168 168
169 swatch_running = FALSE; 169 swatch_running = FALSE;
170 swatch_totalms = 0; 170 swatch_totalms = 0;
171 171
172 connect( qApp, SIGNAL( clockChanged( bool ) ), this, SLOT( changeClock( bool ) ) ); 172 connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( changeClock(bool) ) );
173 173
174 174
175 Config config( "qpe" ); 175 Config config( "qpe" );
176 config.setGroup( "Time" ); 176 config.setGroup( "Time" );
177 ampm = config.readBoolEntry( "AMPM", TRUE ); 177 ampm = config.readBoolEntry( "AMPM", TRUE );
178 178
179 QString tmp = config.readEntry( "clockAlarmHour", "" ); 179 QString tmp = config.readEntry( "clockAlarmHour", "" );
180 bool ok; 180 bool ok;
181 hour = tmp.toInt( &ok, 10 ); 181 hour = tmp.toInt( &ok, 10 );
182 tmp = config.readEntry( "clockAlarmMinute", "" ); 182 tmp = config.readEntry( "clockAlarmMinute", "" );
183 minute = tmp.toInt( &ok, 10 ); 183 minute = tmp.toInt( &ok, 10 );
184 184
185 if ( config.readEntry( "clockAlarmSet", "FALSE" ) == "TRUE" ) 185 if ( config.readEntry( "clockAlarmSet", "FALSE" ) == "TRUE" )
186 { 186 {
187 alarmOffBtn->setText( tr( "Alarm Is On" ) ); 187 alarmOffBtn->setText( tr( "Alarm Is On" ) );
188 alarmBool = TRUE; 188 alarmBool = TRUE;
189 snoozeBtn->show(); 189 snoozeBtn->show();
190 } 190 }
191 else 191 else
192 { 192 {
193 alarmOffBtn->setText( tr( "Alarm Is Off" ) ); 193 alarmOffBtn->setText( tr( "Alarm Is Off" ) );
194 alarmBool = FALSE; 194 alarmBool = FALSE;
195 snoozeBtn->hide(); 195 snoozeBtn->hide();
196 } 196 }
197 197
198 QTimer::singleShot( 0, this, SLOT( updateClock() ) ); 198 QTimer::singleShot( 0, this, SLOT( updateClock() ) );
199 199
200 Config cfg( "Clock" ); 200 Config cfg( "Clock" );
201 cfg.setGroup( "Mode" ); 201 cfg.setGroup( "Mode" );
202 int mode = cfg.readBoolEntry( "clockMode"); 202 int mode = cfg.readBoolEntry( "clockMode");
203 setSwatchMode( mode); 203 setSwatchMode( mode);
204 modeSelect( mode); 204 modeSelect( mode);
205} 205}
206 206
207Clock::~Clock() 207Clock::~Clock()
208{ 208{
209 toggleScreenSaver( true ); 209 toggleScreenSaver( true );
210} 210}
211 211
212void Clock::updateClock() 212void Clock::updateClock()
213{ 213{
214 if ( clockRB->isChecked() ) 214 if ( clockRB->isChecked() )
215 { 215 {
216 QTime tm = QDateTime::currentDateTime().time(); 216 QTime tm = QDateTime::currentDateTime().time();
217 QString s; 217 QString s;
218 if ( ampm ) 218 if ( ampm )
219 { 219 {
220 int hour = tm.hour(); 220 int hour = tm.hour();
221 if ( hour == 0 ) 221 if ( hour == 0 )
222 hour = 12; 222 hour = 12;
223 if ( hour > 12 ) 223 if ( hour > 12 )
224 hour -= 12; 224 hour -= 12;
225 s.sprintf( "%2d%c%02d", hour, ':', tm.minute() ); 225 s.sprintf( "%2d%c%02d", hour, ':', tm.minute() );
226 ampmLabel->setText( ( tm.hour() >= 12 ) ? "PM" : "AM" ); 226 ampmLabel->setText( ( tm.hour() >= 12 ) ? "PM" : "AM" );
227 ampmLabel->show(); 227 ampmLabel->show();
228 } 228 }
229 else 229 else
230 { 230 {
231 s.sprintf( "%2d%c%02d", tm.hour(), ':', tm.minute() ); 231 s.sprintf( "%2d%c%02d", tm.hour(), ':', tm.minute() );
232 ampmLabel->hide(); 232 ampmLabel->hide();
233 } 233 }
234 lcd->display( s ); 234 lcd->display( s );
235 lcd->repaint( FALSE ); 235 lcd->repaint( FALSE );
236 aclock->display( QTime::currentTime() ); 236 aclock->display( QTime::currentTime() );
diff --git a/noncore/tools/formatter/formatter.cpp b/noncore/tools/formatter/formatter.cpp
index e869317..77e1790 100644
--- a/noncore/tools/formatter/formatter.cpp
+++ b/noncore/tools/formatter/formatter.cpp
@@ -99,131 +99,131 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, WFlags fl, bool
99 formatPushButton = new QPushButton( tab, "formatPushButton" ); 99 formatPushButton = new QPushButton( tab, "formatPushButton" );
100 formatPushButton->setText( tr( "Format" ) ); 100 formatPushButton->setText( tr( "Format" ) );
101 formatPushButton->setMaximumWidth(170); 101 formatPushButton->setMaximumWidth(170);
102 102
103 tabLayout->addMultiCellWidget( formatPushButton, 6, 6, 0, 1); 103 tabLayout->addMultiCellWidget( formatPushButton, 6, 6, 0, 1);
104 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); 104 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum );
105 tabLayout->addItem( spacer_2, 5, 0 ); 105 tabLayout->addItem( spacer_2, 5, 0 );
106 106
107 TabWidget->insertTab( tab, tr( "Main" ) ); 107 TabWidget->insertTab( tab, tr( "Main" ) );
108 108
109 tab_2 = new QWidget( TabWidget, "tab_2" ); 109 tab_2 = new QWidget( TabWidget, "tab_2" );
110 tabLayout_2 = new QGridLayout( tab_2 ); 110 tabLayout_2 = new QGridLayout( tab_2 );
111 tabLayout_2->setSpacing(3); 111 tabLayout_2->setSpacing(3);
112 tabLayout_2->setMargin(2); 112 tabLayout_2->setMargin(2);
113 113
114 mountPointLineEdit = new QLineEdit( tab_2, "mountPointLineEdit" ); 114 mountPointLineEdit = new QLineEdit( tab_2, "mountPointLineEdit" );
115 115
116 tabLayout_2->addMultiCellWidget( mountPointLineEdit, 0, 0, 0, 1); 116 tabLayout_2->addMultiCellWidget( mountPointLineEdit, 0, 0, 0, 1);
117 117
118 deviceComboBox = new QComboBox( FALSE, tab_2, "deviceComboBox" ); 118 deviceComboBox = new QComboBox( FALSE, tab_2, "deviceComboBox" );
119 119
120 tabLayout_2->addMultiCellWidget( deviceComboBox, 3, 3, 0, 1); 120 tabLayout_2->addMultiCellWidget( deviceComboBox, 3, 3, 0, 1);
121 121
122 TextLabel5 = new QLabel( tab_2, "TextLabel5" ); 122 TextLabel5 = new QLabel( tab_2, "TextLabel5" );
123 TextLabel5->setText( tr( "CAUTION:\n" 123 TextLabel5->setText( tr( "CAUTION:\n"
124 "Changing parameters on this\n" 124 "Changing parameters on this\n"
125 "page may cause your system\n" 125 "page may cause your system\n"
126 "to stop functioning properly!" ) );//idiot message 126 "to stop functioning properly!" ) );//idiot message
127 127
128 tabLayout_2->addMultiCellWidget( TextLabel5, 6, 6, 0, 1); 128 tabLayout_2->addMultiCellWidget( TextLabel5, 6, 6, 0, 1);
129 129
130 editPushButton = new QPushButton( tab_2, "editPushButton" ); 130 editPushButton = new QPushButton( tab_2, "editPushButton" );
131 editPushButton->setText( tr( "Edit fstab" ) ); 131 editPushButton->setText( tr( "Edit fstab" ) );
132 editPushButton->setMaximumWidth(100); 132 editPushButton->setMaximumWidth(100);
133 133
134 tabLayout_2->addMultiCellWidget( editPushButton, 7, 7, 0, 0 ); 134 tabLayout_2->addMultiCellWidget( editPushButton, 7, 7, 0, 0 );
135 135
136 fsckButton = new QPushButton( tab_2, "fsckPushButton" ); 136 fsckButton = new QPushButton( tab_2, "fsckPushButton" );
137 fsckButton->setText( tr( "Check Disk" ) ); 137 fsckButton->setText( tr( "Check Disk" ) );
138 fsckButton->setMaximumWidth(100); 138 fsckButton->setMaximumWidth(100);
139 139
140 tabLayout_2->addMultiCellWidget( fsckButton, 7, 7, 1, 1); 140 tabLayout_2->addMultiCellWidget( fsckButton, 7, 7, 1, 1);
141 141
142 TextLabel3 = new QLabel( tab_2, "TextLabel3" ); 142 TextLabel3 = new QLabel( tab_2, "TextLabel3" );
143 TextLabel3->setText( tr( "Device" ) ); 143 TextLabel3->setText( tr( "Device" ) );
144 144
145 tabLayout_2->addMultiCellWidget( TextLabel3, 4, 4, 0, 1 ); 145 tabLayout_2->addMultiCellWidget( TextLabel3, 4, 4, 0, 1 );
146 QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 146 QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
147 tabLayout_2->addItem( spacer_3, 5, 0 ); 147 tabLayout_2->addItem( spacer_3, 5, 0 );
148 148
149 TextLabel1 = new QLabel( tab_2, "TextLabel1" ); 149 TextLabel1 = new QLabel( tab_2, "TextLabel1" );
150 TextLabel1->setText( tr( "Mount Point" ) ); 150 TextLabel1->setText( tr( "Mount Point" ) );
151 151
152 tabLayout_2->addMultiCellWidget( TextLabel1, 1, 1, 0, 1 ); 152 tabLayout_2->addMultiCellWidget( TextLabel1, 1, 1, 0, 1 );
153 QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 153 QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
154 tabLayout_2->addItem( spacer_4, 2, 1 ); 154 tabLayout_2->addItem( spacer_4, 2, 1 );
155 TabWidget->insertTab( tab_2, tr( "Advanced" ) ); 155 TabWidget->insertTab( tab_2, tr( "Advanced" ) );
156 156
157 FormatterAppLayout->addWidget( TabWidget, 0, 1 ); 157 FormatterAppLayout->addWidget( TabWidget, 0, 1 );
158 158
159 connect( formatPushButton ,SIGNAL(released()),this,SLOT( doFormat()) ); 159 connect( formatPushButton ,SIGNAL(released()),this,SLOT( doFormat()) );
160 connect( editPushButton ,SIGNAL(released()),this,SLOT( editFstab()) ); 160 connect( editPushButton ,SIGNAL(released()),this,SLOT( editFstab()) );
161 connect( fsckButton ,SIGNAL(released()),this,SLOT( doFsck()) ); 161 connect( fsckButton ,SIGNAL(released()),this,SLOT( doFsck()) );
162 162
163 connect( fileSystemsCombo,SIGNAL(activated(int)),this,SLOT( fsComboSelected(int ) )); 163 connect( fileSystemsCombo,SIGNAL(activated(int)),this,SLOT( fsComboSelected(int) ));
164 connect( storageComboBox,SIGNAL(activated(int)),this,SLOT( storageComboSelected(int ) )); 164 connect( storageComboBox,SIGNAL(activated(int)),this,SLOT( storageComboSelected(int) ));
165 connect( deviceComboBox,SIGNAL(activated(int)),this,SLOT( deviceComboSelected(int ) )); 165 connect( deviceComboBox,SIGNAL(activated(int)),this,SLOT( deviceComboSelected(int) ));
166 166
167 167
168 fillCombos(); 168 fillCombos();
169} 169}
170 170
171FormatterApp::~FormatterApp() 171FormatterApp::~FormatterApp()
172{} 172{}
173 173
174void FormatterApp::doFormat() 174void FormatterApp::doFormat()
175{ 175{
176 int err=0; 176 int err=0;
177 Output *outDlg; 177 Output *outDlg;
178 QString umountS, remountS; 178 QString umountS, remountS;
179 QString text = storageComboBox->currentText(); 179 QString text = storageComboBox->currentText();
180 QString currentText = storageComboBox->currentText(); 180 QString currentText = storageComboBox->currentText();
181 QString cmd; 181 QString cmd;
182 QString diskDevice = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); 182 QString diskDevice = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4);
183 QString diskName = currentText.left(currentText.find(" -> ",0,TRUE)); 183 QString diskName = currentText.left(currentText.find(" -> ",0,TRUE));
184 QString fs = fileSystemsCombo->currentText(); 184 QString fs = fileSystemsCombo->currentText();
185 185
186#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // lets test on something cheap 186#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // lets test on something cheap
187#else 187#else
188 currentText = diskDevice = "/dev/fd0"; 188 currentText = diskDevice = "/dev/fd0";
189 umountS = "umount -v /floppy 2>&1"; 189 umountS = "umount -v /floppy 2>&1";
190 remountS = "mount -v /floppy 2>&1"; 190 remountS = "mount -v /floppy 2>&1";
191#endif 191#endif
192 192
193 if( currentText.find("CF",0,TRUE) != -1) 193 if( currentText.find("CF",0,TRUE) != -1)
194 { 194 {
195 umountS = "umount "; 195 umountS = "umount ";
196 remountS = "mount "; 196 remountS = "mount ";
197 197
198 // umountS = "/sbin/cardctl eject"; 198 // umountS = "/sbin/cardctl eject";
199 // remountS = "/sbin/cardctl insert"; 199 // remountS = "/sbin/cardctl insert";
200 } 200 }
201 if( currentText.find("SD",0,TRUE) != -1) 201 if( currentText.find("SD",0,TRUE) != -1)
202 { 202 {
203 umountS = "umount "; 203 umountS = "umount ";
204 remountS = "mount "; 204 remountS = "mount ";
205 // umountS = "/etc/sdcontrol compeject"; 205 // umountS = "/etc/sdcontrol compeject";
206 // remountS = "/etc/sdcontrol insert"; 206 // remountS = "/etc/sdcontrol insert";
207 } 207 }
208 208
209 switch ( QMessageBox::warning(this,tr("Format?") 209 switch ( QMessageBox::warning(this,tr("Format?")
210 , tr("Really format\n") +diskName+" "+ currentText + 210 , tr("Really format\n") +diskName+" "+ currentText +
211 tr("\nwith %1 filesystem?\nYou will loose all data!!").arg( fs ) 211 tr("\nwith %1 filesystem?\nYou will loose all data!!").arg( fs )
212 ,tr("Yes") 212 ,tr("Yes")
213 ,tr("No") 213 ,tr("No")
214 ,0 214 ,0
215 ,1 215 ,1
216 ,1) ) 216 ,1) )
217 { 217 {
218 case 0: 218 case 0:
219 { 219 {
220 if(fs == "vfat") 220 if(fs == "vfat")
221 cmd = "mkdosfs -v " + diskDevice+" 2>&1"; 221 cmd = "mkdosfs -v " + diskDevice+" 2>&1";
222 else if(fs == "ext2") 222 else if(fs == "ext2")
223 cmd = "mke2fs -v " + diskDevice+" 2>&1"; 223 cmd = "mke2fs -v " + diskDevice+" 2>&1";
224 else 224 else
225 { 225 {
226 QMessageBox::warning(this, tr("Formatter"),tr("Could not format.\nUnknown type"), tr("Ok")); 226 QMessageBox::warning(this, tr("Formatter"),tr("Could not format.\nUnknown type"), tr("Ok"));
227 break; 227 break;
228 } 228 }
229 // cmd = "ls -l"; 229 // cmd = "ls -l";
diff --git a/noncore/tools/remote/buttondialog.cpp b/noncore/tools/remote/buttondialog.cpp
index 6ea4801..580f101 100644
--- a/noncore/tools/remote/buttondialog.cpp
+++ b/noncore/tools/remote/buttondialog.cpp
@@ -1,120 +1,120 @@
1/* 1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. 2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens 3Copyright (C) 2002 Thomas Stephens
4 4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public 5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later 6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version. 7version.
8 8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details. 11Public License for more details.
12 12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free 13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/ 15*/
16 16
17#include "buttondialog.h" 17#include "buttondialog.h"
18 18
19ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent, const char*name, bool modal, WFlags f):QDialog(parent, name, modal, f) 19ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent, const char*name, bool modal, WFlags f):QDialog(parent, name, modal, f)
20{ 20{
21 setCaption(tr(buttonName)); 21 setCaption(tr(buttonName));
22 22
23 QVBoxLayout *layout = new QVBoxLayout(this); 23 QVBoxLayout *layout = new QVBoxLayout(this);
24 24
25 QHBoxLayout *hlayout1 = new QHBoxLayout(this); 25 QHBoxLayout *hlayout1 = new QHBoxLayout(this);
26 QHBoxLayout *hlayout2 = new QHBoxLayout(this); 26 QHBoxLayout *hlayout2 = new QHBoxLayout(this);
27 QHBoxLayout *hlayout3 = new QHBoxLayout(this); 27 QHBoxLayout *hlayout3 = new QHBoxLayout(this);
28 28
29 layout->addSpacing(5); 29 layout->addSpacing(5);
30 layout->addLayout(hlayout1); 30 layout->addLayout(hlayout1);
31 layout->addSpacing(5); 31 layout->addSpacing(5);
32 layout->addLayout(hlayout2); 32 layout->addLayout(hlayout2);
33 layout->addSpacing(5); 33 layout->addSpacing(5);
34 layout->addLayout(hlayout3); 34 layout->addLayout(hlayout3);
35 layout->addSpacing(5); 35 layout->addSpacing(5);
36 36
37 remote = new QComboBox(false, this, "remote"); 37 remote = new QComboBox(false, this, "remote");
38 QLabel *remoteLabel = new QLabel(remote, "Remote: ", this, "remoteLabel"); 38 QLabel *remoteLabel = new QLabel(remote, "Remote: ", this, "remoteLabel");
39 hlayout1->addSpacing(5); 39 hlayout1->addSpacing(5);
40 hlayout1->addWidget(remoteLabel); 40 hlayout1->addWidget(remoteLabel);
41 hlayout1->addSpacing(5); 41 hlayout1->addSpacing(5);
42 hlayout1->addWidget(remote); 42 hlayout1->addWidget(remote);
43 hlayout1->addSpacing(5); 43 hlayout1->addSpacing(5);
44 remote->insertItem("Remote "); 44 remote->insertItem("Remote ");
45 remote->insertStringList(getRemotes()); 45 remote->insertStringList(getRemotes());
46 connect(remote, SIGNAL(activated(const QString &)), this, SLOT(remoteSelected(const QString&)) ); 46 connect(remote, SIGNAL(activated(const QString&)), this, SLOT(remoteSelected(const QString&)) );
47 47
48 button = new QComboBox(false, this, "button"); 48 button = new QComboBox(false, this, "button");
49 QLabel *buttonLabel = new QLabel(remote, "Button: ", this, "buttonLabel"); 49 QLabel *buttonLabel = new QLabel(remote, "Button: ", this, "buttonLabel");
50 hlayout2->addSpacing(5); 50 hlayout2->addSpacing(5);
51 hlayout2->addWidget(buttonLabel); 51 hlayout2->addWidget(buttonLabel);
52 hlayout2->addSpacing(5); 52 hlayout2->addSpacing(5);
53 hlayout2->addWidget(button); 53 hlayout2->addWidget(button);
54 hlayout2->addSpacing(5); 54 hlayout2->addSpacing(5);
55 button->insertItem("Button "); 55 button->insertItem("Button ");
56 connect(button, SIGNAL(activated(const QString &)), this, SLOT(buttonSelected(const QString&)) ); 56 connect(button, SIGNAL(activated(const QString&)), this, SLOT(buttonSelected(const QString&)) );
57 57
58 label = new QLineEdit(this, "label"); 58 label = new QLineEdit(this, "label");
59 label->setText(buttonName); 59 label->setText(buttonName);
60 QLabel *labelLabel = new QLabel(label, "Label: ", this, "labelLabel"); 60 QLabel *labelLabel = new QLabel(label, "Label: ", this, "labelLabel");
61 hlayout3->addSpacing(5); 61 hlayout3->addSpacing(5);
62 hlayout3->addWidget(labelLabel); 62 hlayout3->addWidget(labelLabel);
63 hlayout3->addSpacing(5); 63 hlayout3->addSpacing(5);
64 hlayout3->addWidget(label); 64 hlayout3->addWidget(label);
65 hlayout3->addSpacing(5); 65 hlayout3->addSpacing(5);
66} 66}
67 67
68void ButtonDialog::remoteSelected(const QString &string) 68void ButtonDialog::remoteSelected(const QString &string)
69{ 69{
70 button->insertStringList(getButtons(string.latin1()) ); 70 button->insertStringList(getButtons(string.latin1()) );
71 list="SEND_ONCE"; 71 list="SEND_ONCE";
72 list+=string; 72 list+=string;
73} 73}
74 74
75void ButtonDialog::buttonSelected(const QString &string) 75void ButtonDialog::buttonSelected(const QString &string)
76{ 76{
77 list+=string; 77 list+=string;
78} 78}
79 79
80QStringList ButtonDialog::getList() 80QStringList ButtonDialog::getList()
81{ 81{
82 return list; 82 return list;
83} 83}
84 84
85QString ButtonDialog::getLabel() 85QString ButtonDialog::getLabel()
86{ 86{
87 return label->text(); 87 return label->text();
88} 88}
89 89
90QStringList ButtonDialog::getRemotes() 90QStringList ButtonDialog::getRemotes()
91{ 91{
92 const char write_buffer[] = "LIST\n"; 92 const char write_buffer[] = "LIST\n";
93 const char *readbuffer; 93 const char *readbuffer;
94 int i, numlines; 94 int i, numlines;
95 QStringList list; 95 QStringList list;
96 96
97 addr.sun_family=AF_UNIX; 97 addr.sun_family=AF_UNIX;
98 strcpy(addr.sun_path,"/dev/lircd"); 98 strcpy(addr.sun_path,"/dev/lircd");
99 99
100 fd = socket(AF_UNIX, SOCK_STREAM, 0); 100 fd = socket(AF_UNIX, SOCK_STREAM, 0);
101 if(fd == -1) 101 if(fd == -1)
102 { 102 {
103 QMessageBox *mb = new QMessageBox("Error!", 103 QMessageBox *mb = new QMessageBox("Error!",
104 "couldnt connect to socket", 104 "couldnt connect to socket",
105 QMessageBox::NoIcon, 105 QMessageBox::NoIcon,
106 QMessageBox::Ok, 106 QMessageBox::Ok,
107 QMessageBox::NoButton, 107 QMessageBox::NoButton,
108 QMessageBox::NoButton); 108 QMessageBox::NoButton);
109 mb->exec(); 109 mb->exec();
110 perror("ButtonDialog::GetRemotes"); 110 perror("ButtonDialog::GetRemotes");
111 return NULL; 111 return NULL;
112 } 112 }
113 113
114 if(::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) 114 if(::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
115 { 115 {
116 QMessageBox *mb = new QMessageBox("Error!", 116 QMessageBox *mb = new QMessageBox("Error!",
117 "couldnt connect to socket", 117 "couldnt connect to socket",
118 QMessageBox::NoIcon, 118 QMessageBox::NoIcon,
119 QMessageBox::Ok, 119 QMessageBox::Ok,
120 QMessageBox::NoButton, 120 QMessageBox::NoButton,
diff --git a/noncore/tools/remote/recorddialog.cpp b/noncore/tools/remote/recorddialog.cpp
index cfab730..1ce5472 100644
--- a/noncore/tools/remote/recorddialog.cpp
+++ b/noncore/tools/remote/recorddialog.cpp
@@ -1,82 +1,82 @@
1/* 1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. 2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens 3Copyright (C) 2002 Thomas Stephens
4 4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public 5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later 6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version. 7version.
8 8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details. 11Public License for more details.
12 12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free 13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/ 15*/
16 16
17#include "recorddialog.h" 17#include "recorddialog.h"
18 18
19RecordDialog::RecordDialog(QWidget *parent, const char *name) 19RecordDialog::RecordDialog(QWidget *parent, const char *name)
20 :QDialog(parent, name) 20 :QDialog(parent, name)
21{ 21{
22 QVBoxLayout *layout = new QVBoxLayout(this); 22 QVBoxLayout *layout = new QVBoxLayout(this);
23 QHBoxLayout *hlayout = new QHBoxLayout(this); 23 QHBoxLayout *hlayout = new QHBoxLayout(this);
24 24
25 layout->insertSpacing(0,5); 25 layout->insertSpacing(0,5);
26 output = new QTextView("Please enter the name of the new remote, and press Return\n", 0, this, "output"); 26 output = new QTextView("Please enter the name of the new remote, and press Return\n", 0, this, "output");
27 layout->insertWidget(-1, output); 27 layout->insertWidget(-1, output);
28 layout->insertSpacing(-1, 5); 28 layout->insertSpacing(-1, 5);
29 layout->insertLayout(-1, hlayout); 29 layout->insertLayout(-1, hlayout);
30 layout->insertSpacing(-1, 5); 30 layout->insertSpacing(-1, 5);
31 31
32 hlayout->insertSpacing(0, 5); 32 hlayout->insertSpacing(0, 5);
33 input = new QLineEdit(this, "input"); 33 input = new QLineEdit(this, "input");
34 hlayout->insertWidget(-1, input, 1); 34 hlayout->insertWidget(-1, input, 1);
35 hlayout->insertSpacing(-1, 5); 35 hlayout->insertSpacing(-1, 5);
36 36
37 QPushButton *ret = new QPushButton("Return", this, "return"); 37 QPushButton *ret = new QPushButton("Return", this, "return");
38 hlayout->insertWidget(-1, ret); 38 hlayout->insertWidget(-1, ret);
39 hlayout->insertSpacing(-1, 5); 39 hlayout->insertSpacing(-1, 5);
40 connect(ret, SIGNAL(clicked()), this, SLOT(retPressed()) ); 40 connect(ret, SIGNAL(clicked()), this, SLOT(retPressed()) );
41 where = 0; 41 where = 0;
42 42
43 record = new OProcess; 43 record = new OProcess;
44} 44}
45 45
46void RecordDialog::retPressed() 46void RecordDialog::retPressed()
47{ 47{
48 printf("RecordDialog::retPressed: ret pressed\n"); 48 printf("RecordDialog::retPressed: ret pressed\n");
49 49
50 if(where == 0) 50 if(where == 0)
51 { 51 {
52 connect(record, SIGNAL(receivedStdout(OProcess *, char *, int)), this, SLOT(incoming(OProcess *, char *, int)) ); 52 connect(record, SIGNAL(receivedStdout(OProcess*,char*,int)), this, SLOT(incoming(OProcess*,char*,int)) );
53 connect(record, SIGNAL(receivedStderr(OProcess *, char *, int)), this, SLOT(incoming(OProcess *, char *, int)) ); 53 connect(record, SIGNAL(receivedStderr(OProcess*,char*,int)), this, SLOT(incoming(OProcess*,char*,int)) );
54 connect(record, SIGNAL(processExited(OProcess *)), this, SLOT(done(OProcess *)) ); 54 connect(record, SIGNAL(processExited(OProcess*)), this, SLOT(done(OProcess*)) );
55 printf("RecordDialog::retPressed: starting irrecord\n"); 55 printf("RecordDialog::retPressed: starting irrecord\n");
56 QString file = "/tmp/" + input->text(); 56 QString file = "/tmp/" + input->text();
57 *record<<"irrecord"<<file.latin1(); 57 *record<<"irrecord"<<file.latin1();
58 if(!record->start(OProcess::NotifyOnExit, OProcess::AllOutput)) 58 if(!record->start(OProcess::NotifyOnExit, OProcess::AllOutput))
59 { 59 {
60 QMessageBox *mb = new QMessageBox("Error!", 60 QMessageBox *mb = new QMessageBox("Error!",
61 "Could not start irrecord. You must<br>use an lirc ipkg that includes<br>irrecord", 61 "Could not start irrecord. You must<br>use an lirc ipkg that includes<br>irrecord",
62 QMessageBox::NoIcon, 62 QMessageBox::NoIcon,
63 QMessageBox::Ok, 63 QMessageBox::Ok,
64 QMessageBox::NoButton, 64 QMessageBox::NoButton,
65 QMessageBox::NoButton); 65 QMessageBox::NoButton);
66 mb->exec(); 66 mb->exec();
67 return; 67 return;
68 } 68 }
69 // record->resume(); 69 // record->resume();
70 where = 1; 70 where = 1;
71 } 71 }
72} 72}
73 73
74void RecordDialog::incoming(OProcess *proc, char *buffer, int len) 74void RecordDialog::incoming(OProcess *proc, char *buffer, int len)
75{ 75{
76 //output->setText(output->text() + QString(buffer).truncate(len-1)); 76 //output->setText(output->text() + QString(buffer).truncate(len-1));
77 printf("RecordDialog::incoming: got text from irrecord\n"); 77 printf("RecordDialog::incoming: got text from irrecord\n");
78} 78}
79 79
80void RecordDialog::done(OProcess *proc) 80void RecordDialog::done(OProcess *proc)
81{ 81{
82} 82}
diff --git a/noncore/tools/remote/topgroup.cpp b/noncore/tools/remote/topgroup.cpp
index 93cffbb..427cb8f 100644
--- a/noncore/tools/remote/topgroup.cpp
+++ b/noncore/tools/remote/topgroup.cpp
@@ -1,54 +1,54 @@
1/* 1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. 2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens 3Copyright (C) 2002 Thomas Stephens
4 4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public 5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later 6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version. 7version.
8 8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details. 11Public License for more details.
12 12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free 13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/ 15*/
16 16
17#include "topgroup.h" 17#include "topgroup.h"
18 18
19TopGroup::TopGroup(QWidget *parent, const char *name):QWidget(parent,name) 19TopGroup::TopGroup(QWidget *parent, const char *name):QWidget(parent,name)
20{ 20{
21 QHBoxLayout *layout = new QHBoxLayout(this, 0, -1, 0); 21 QHBoxLayout *layout = new QHBoxLayout(this, 0, -1, 0);
22 22
23 QPushButton *power = new QPushButton("Power",this,"power"); 23 QPushButton *power = new QPushButton("Power",this,"power");
24 layout->addWidget(power); 24 layout->addWidget(power);
25 connect(power, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); 25 connect(power, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
26 //power->setGeometry(5, 5,40, 20); 26 //power->setGeometry(5, 5,40, 20);
27 27
28 layout->addSpacing(5); 28 layout->addSpacing(5);
29 29
30 QPushButton *source = new QPushButton("Source",this,"source"); 30 QPushButton *source = new QPushButton("Source",this,"source");
31 layout->addWidget(source); 31 layout->addWidget(source);
32 connect(source, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); 32 connect(source, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
33 //source->setGeometry(50,5,40,20); 33 //source->setGeometry(50,5,40,20);
34 34
35 remotes = new QComboBox(false, this, "remotes"); 35 remotes = new QComboBox(false, this, "remotes");
36 connect(remotes, SIGNAL(activated(const QString &)), this->parentWidget(), SLOT(remoteSelected(const QString &)) ); 36 connect(remotes, SIGNAL(activated(const QString&)), this->parentWidget(), SLOT(remoteSelected(const QString&)) );
37 remotes->insertItem("Select Remote"); 37 remotes->insertItem("Select Remote");
38 //remotes->setGeometry(135,5,95,20); 38 //remotes->setGeometry(135,5,95,20);
39 39
40 QLabel *remoteLabel = new QLabel(remotes, "Remote: ",this,"remoteLabel"); 40 QLabel *remoteLabel = new QLabel(remotes, "Remote: ",this,"remoteLabel");
41 //remoteLabel->setGeometry(90,5,40,20); 41 //remoteLabel->setGeometry(90,5,40,20);
42 remoteLabel->setAlignment(AlignRight | AlignVCenter); 42 remoteLabel->setAlignment(AlignRight | AlignVCenter);
43 43
44 layout->addWidget(remoteLabel); 44 layout->addWidget(remoteLabel);
45 layout->addWidget(remotes); 45 layout->addWidget(remotes);
46} 46}
47 47
48void TopGroup::updateRemotes(Config *cfg) 48void TopGroup::updateRemotes(Config *cfg)
49{ 49{
50 remotes->clear(); 50 remotes->clear();
51 remotes->insertItem(QString("SelectRemote")); 51 remotes->insertItem(QString("SelectRemote"));
52 cfg->setGroup("Remotes"); 52 cfg->setGroup("Remotes");
53 remotes->insertStringList(cfg->readListEntry("remoteList", ',') ); 53 remotes->insertStringList(cfg->readListEntry("remoteList", ',') );
54} 54}
diff --git a/noncore/tools/remote/topgroupconf.cpp b/noncore/tools/remote/topgroupconf.cpp
index d763a3a..0419a65 100644
--- a/noncore/tools/remote/topgroupconf.cpp
+++ b/noncore/tools/remote/topgroupconf.cpp
@@ -1,70 +1,70 @@
1/* 1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. 2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens 3Copyright (C) 2002 Thomas Stephens
4 4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public 5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later 6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version. 7version.
8 8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details. 11Public License for more details.
12 12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free 13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/ 15*/
16 16
17#include "topgroupconf.h" 17#include "topgroupconf.h"
18 18
19TopGroupConf::TopGroupConf(QWidget *parent, const char *name):QWidget(parent,name) 19TopGroupConf::TopGroupConf(QWidget *parent, const char *name):QWidget(parent,name)
20{ 20{
21 QHBoxLayout *layout = new QHBoxLayout(this); 21 QHBoxLayout *layout = new QHBoxLayout(this);
22 22
23 QPushButton *power = new QPushButton("Power",this,"power"); 23 QPushButton *power = new QPushButton("Power",this,"power");
24 layout->addWidget(power); 24 layout->addWidget(power);
25 connect(power, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); 25 connect(power, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
26 //power->setGeometry(5, 5,40, 20); 26 //power->setGeometry(5, 5,40, 20);
27 27
28 layout->addSpacing(5); 28 layout->addSpacing(5);
29 29
30 QPushButton *source = new QPushButton("Source",this,"source"); 30 QPushButton *source = new QPushButton("Source",this,"source");
31 layout->addWidget(source); 31 layout->addWidget(source);
32 connect(source, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); 32 connect(source, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
33 //source->setGeometry(50,5,40,20); 33 //source->setGeometry(50,5,40,20);
34 34
35 remotes = new QComboBox(true, this, "remotes"); 35 remotes = new QComboBox(true, this, "remotes");
36 remotes->insertItem(QString("Remotes")); 36 remotes->insertItem(QString("Remotes"));
37 layout->addWidget(remotes); 37 layout->addWidget(remotes);
38 layout->setStretchFactor(remotes, 1); 38 layout->setStretchFactor(remotes, 1);
39 connect(remotes, SIGNAL(activated(const QString &)), this->parentWidget(), SLOT(remoteSelected(const QString &)) ); 39 connect(remotes, SIGNAL(activated(const QString&)), this->parentWidget(), SLOT(remoteSelected(const QString&)) );
40 40
41 41
42 QPushButton *newrem = new QPushButton("New", this, "new"); 42 QPushButton *newrem = new QPushButton("New", this, "new");
43 layout->addWidget(newrem); 43 layout->addWidget(newrem);
44 connect(newrem, SIGNAL(pressed()), this->parentWidget(), SLOT(newPressed()) ); 44 connect(newrem, SIGNAL(pressed()), this->parentWidget(), SLOT(newPressed()) );
45 45
46 46
47 /*remotes = new QComboBox(false, this, "remotes"); 47 /*remotes = new QComboBox(false, this, "remotes");
48 connect(remotes, SIGNAL(activated(const QString &)), this->parentWidget(), SLOT(remoteSelected(const QString &)) ); 48 connect(remotes, SIGNAL(activated(const QString&)), this->parentWidget(), SLOT(remoteSelected(const QString&)) );
49 remotes->insertItem("Select Remote"); 49 remotes->insertItem("Select Remote");
50 //remotes->setGeometry(135,5,95,20); 50 //remotes->setGeometry(135,5,95,20);
51 51
52 QLabel *remoteLabel = new QLabel(remotes, "Remote: ",this,"remoteLabel"); 52 QLabel *remoteLabel = new QLabel(remotes, "Remote: ",this,"remoteLabel");
53 //remoteLabel->setGeometry(90,5,40,20); 53 //remoteLabel->setGeometry(90,5,40,20);
54 remoteLabel->setAlignment(AlignRight | AlignVCenter); 54 remoteLabel->setAlignment(AlignRight | AlignVCenter);
55 55
56 layout->addWidget(remoteLabel); 56 layout->addWidget(remoteLabel);
57 layout->addWidget(remotes); 57 layout->addWidget(remotes);
58*/ 58*/
59} 59}
60 60
61void TopGroupConf::updateRemotes(QStringList list) 61void TopGroupConf::updateRemotes(QStringList list)
62{ 62{
63 remotes->insertStringList(list); 63 remotes->insertStringList(list);
64} 64}
65 65
66QString TopGroupConf::getRemotesText() 66QString TopGroupConf::getRemotesText()
67{ 67{
68 return remotes->currentText(); 68 return remotes->currentText();
69} 69}
70 70
diff --git a/noncore/unsupported/filebrowser/filebrowser.cpp b/noncore/unsupported/filebrowser/filebrowser.cpp
index 8cf8a60..92a688a 100644
--- a/noncore/unsupported/filebrowser/filebrowser.cpp
+++ b/noncore/unsupported/filebrowser/filebrowser.cpp
@@ -199,132 +199,132 @@ QPixmap FileItem::drawThumbnail(const QFileInfo &file) {
199 199
200 // if inside of cache dir, don't render thumbnails! recursive error! 200 // if inside of cache dir, don't render thumbnails! recursive error!
201 if (image.isNull() || file.filePath().contains(QRegExp("^" + cacheDir))) { 201 if (image.isNull() || file.filePath().contains(QRegExp("^" + cacheDir))) {
202 DocLnk doc (file.filePath()); 202 DocLnk doc (file.filePath());
203 return doc.pixmap(); 203 return doc.pixmap();
204 } 204 }
205 Config cfg("Filebrowser"); 205 Config cfg("Filebrowser");
206 cfg.setGroup("View"); 206 cfg.setGroup("View");
207 int size; 207 int size;
208 size =cfg.readNumEntry("ThumbSize", 72); 208 size =cfg.readNumEntry("ThumbSize", 72);
209 QPixmap thumb (size, size); 209 QPixmap thumb (size, size);
210 210
211 double scale = (double)image.height() / (double)image.width(); 211 double scale = (double)image.height() / (double)image.width();
212 int newHeight = int(size * scale); 212 int newHeight = int(size * scale);
213 thumb.convertFromImage (image.smoothScale(size, newHeight)); 213 thumb.convertFromImage (image.smoothScale(size, newHeight));
214 214
215 if (!cachedFile.dir().exists()) { 215 if (!cachedFile.dir().exists()) {
216 QString cmd = "/bin/mkdir -p \"" + cachedFile.dirPath() +"\""; 216 QString cmd = "/bin/mkdir -p \"" + cachedFile.dirPath() +"\"";
217 system( (const char *) cmd ); 217 system( (const char *) cmd );
218 } 218 }
219 219
220 if (thumb.save(cachedFile.filePath(), QPixmap::imageFormat(file.filePath()), 70)) { 220 if (thumb.save(cachedFile.filePath(), QPixmap::imageFormat(file.filePath()), 70)) {
221 // make thumbnail modify time the same as the image 221 // make thumbnail modify time the same as the image
222 QString cmd = "/bin/touch -r \"" + file.filePath() +"\" " + 222 QString cmd = "/bin/touch -r \"" + file.filePath() +"\" " +
223 "\"" + cachedFile.filePath() + "\""; 223 "\"" + cachedFile.filePath() + "\"";
224 system( (const char *) cmd ); 224 system( (const char *) cmd );
225 225
226 } 226 }
227 227
228 return thumb; 228 return thumb;
229 } 229 }
230} 230}
231 231
232// 232//
233// FileView 233// FileView
234// 234//
235FileView::FileView( const QString & dir, QWidget * parent, 235FileView::FileView( const QString & dir, QWidget * parent,
236 const char * name, 236 const char * name,
237 bool hidden, bool symlinks, bool thumbnails ) 237 bool hidden, bool symlinks, bool thumbnails )
238 : QListView( parent, name ), 238 : QListView( parent, name ),
239 menuTimer( this ), 239 menuTimer( this ),
240 le( NULL ), 240 le( NULL ),
241 itemToRename( NULL ), 241 itemToRename( NULL ),
242 showHidden( hidden ), 242 showHidden( hidden ),
243 showSymlinks( symlinks ), 243 showSymlinks( symlinks ),
244 showThumbnails( thumbnails ), 244 showThumbnails( thumbnails ),
245 menuKeepsOpen( FALSE ) 245 menuKeepsOpen( FALSE )
246{ 246{
247 addColumn( "Name" ); 247 addColumn( "Name" );
248 addColumn( "Size" ); 248 addColumn( "Size" );
249 addColumn( "Date" ); 249 addColumn( "Date" );
250 addColumn( "Type" ); 250 addColumn( "Type" );
251 251
252 setMultiSelection( TRUE ); 252 setMultiSelection( TRUE );
253 //header()->hide(); 253 //header()->hide();
254 254
255 setColumnWidthMode( 0, Manual ); 255 setColumnWidthMode( 0, Manual );
256 setColumnWidthMode( 3, Manual ); 256 setColumnWidthMode( 3, Manual );
257 257
258 // right align yize column 258 // right align yize column
259 setColumnAlignment( 1, AlignRight ); 259 setColumnAlignment( 1, AlignRight );
260 260
261 generateDir( dir ); 261 generateDir( dir );
262 262
263 connect( this, SIGNAL( clicked( QListViewItem * )), 263 connect( this, SIGNAL( clicked(QListViewItem*)),
264 SLOT( itemClicked( QListViewItem * )) ); 264 SLOT( itemClicked(QListViewItem*)) );
265 connect( this, SIGNAL( doubleClicked( QListViewItem * )), 265 connect( this, SIGNAL( doubleClicked(QListViewItem*)),
266 SLOT( itemDblClicked( QListViewItem * )) ); 266 SLOT( itemDblClicked(QListViewItem*)) );
267 connect( this, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); 267 connect( this, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) );
268 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); 268 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) );
269} 269}
270 270
271void FileView::resizeEvent( QResizeEvent *e ) 271void FileView::resizeEvent( QResizeEvent *e )
272{ 272{
273 setColumnWidth( 0, width() - 2 * lineWidth() - 20 - columnWidth( 1 ) - columnWidth( 2 ) ); 273 setColumnWidth( 0, width() - 2 * lineWidth() - 20 - columnWidth( 1 ) - columnWidth( 2 ) );
274 274
275 // hide type column, we use it for "sort by type" only 275 // hide type column, we use it for "sort by type" only
276 //setColumnWidth( 3, 0 ); 276 //setColumnWidth( 3, 0 );
277 QListView::resizeEvent( e ); 277 QListView::resizeEvent( e );
278} 278}
279 279
280void FileView::updateDir() 280void FileView::updateDir()
281{ 281{
282 generateDir( currentDir ); 282 generateDir( currentDir );
283} 283}
284 284
285void FileView::setDir( const QString & dir ) 285void FileView::setDir( const QString & dir )
286{ 286{
287 if ( dir.startsWith( "/dev" ) ) { 287 if ( dir.startsWith( "/dev" ) ) {
288 QMessageBox::warning( this, tr( "File Manager" ), 288 QMessageBox::warning( this, tr( "File Manager" ),
289 tr( "Can't show /dev/ directory." ), tr( "&Ok" ) ); 289 tr( "Can't show /dev/ directory." ), tr( "&Ok" ) );
290 return; 290 return;
291 } 291 }
292 dirHistory += currentDir; 292 dirHistory += currentDir;
293 generateDir( dir ); 293 generateDir( dir );
294} 294}
295 295
296void FileView::generateDir( const QString & dir ) 296void FileView::generateDir( const QString & dir )
297{ 297{
298 if(menuKeepsOpen){ 298 if(menuKeepsOpen){
299 cancelMenuTimer(); 299 cancelMenuTimer();
300 } 300 }
301 QDir d( dir ); 301 QDir d( dir );
302 302
303 if( d.exists() && !d.isReadable() ) return; 303 if( d.exists() && !d.isReadable() ) return;
304 304
305 currentDir = d.canonicalPath(); 305 currentDir = d.canonicalPath();
306 306
307 if( !showHidden) 307 if( !showHidden)
308 d.setFilter( QDir::Dirs | QDir::Files ); 308 d.setFilter( QDir::Dirs | QDir::Files );
309 else 309 else
310 d.setFilter( QDir::Dirs | QDir::Files |QDir::Hidden | QDir::All); 310 d.setFilter( QDir::Dirs | QDir::Files |QDir::Hidden | QDir::All);
311 311
312 d.setSorting( QDir::Name | QDir::DirsFirst | QDir::IgnoreCase | QDir::Reversed ); 312 d.setSorting( QDir::Name | QDir::DirsFirst | QDir::IgnoreCase | QDir::Reversed );
313 313
314 const QFileInfoList * list = d.entryInfoList(); 314 const QFileInfoList * list = d.entryInfoList();
315 QFileInfoListIterator it( *list ); 315 QFileInfoListIterator it( *list );
316 QFileInfo *fi; 316 QFileInfo *fi;
317 317
318 QProgressBar *thumbProgress = 0; 318 QProgressBar *thumbProgress = 0;
319 if (showThumbnails) { 319 if (showThumbnails) {
320 320
321 thumbProgress = new QProgressBar(it.count(), this); 321 thumbProgress = new QProgressBar(it.count(), this);
322 thumbProgress->show(); 322 thumbProgress->show();
323 } 323 }
324 324
325 clear(); 325 clear();
326 326
327 int fileCount = 1; // used in the thumbnail progress meter 327 int fileCount = 1; // used in the thumbnail progress meter
328 while( (fi = it.current()) ){ 328 while( (fi = it.current()) ){
329 if( (fi->fileName() == ".") || (fi->fileName() == "..") ){ 329 if( (fi->fileName() == ".") || (fi->fileName() == "..") ){
330 ++it; 330 ++it;
@@ -847,130 +847,130 @@ void FileBrowser::init(const QString & dir)
847 dirMenu = new QPopupMenu( this ); 847 dirMenu = new QPopupMenu( this );
848 menuBar->insertItem( tr( "Dir" ), dirMenu ); 848 menuBar->insertItem( tr( "Dir" ), dirMenu );
849 849
850 sortMenu = new QPopupMenu( this ); 850 sortMenu = new QPopupMenu( this );
851 menuBar->insertItem( tr( "Sort" ), sortMenu ); 851 menuBar->insertItem( tr( "Sort" ), sortMenu );
852 sortMenu->insertItem( tr( "by Name "), this, SLOT( sortName() ) ); 852 sortMenu->insertItem( tr( "by Name "), this, SLOT( sortName() ) );
853 sortMenu->insertItem( tr( "by Size "), this, SLOT( sortSize() ) ); 853 sortMenu->insertItem( tr( "by Size "), this, SLOT( sortSize() ) );
854 sortMenu->insertItem( tr( "by Date "), this, SLOT( sortDate() ) ); 854 sortMenu->insertItem( tr( "by Date "), this, SLOT( sortDate() ) );
855 sortMenu->insertItem( tr( "by Type "), this, SLOT( sortType() ) ); 855 sortMenu->insertItem( tr( "by Type "), this, SLOT( sortType() ) );
856 sortMenu->insertSeparator(); 856 sortMenu->insertSeparator();
857 sortMenu->insertItem( tr( "Ascending" ), this, SLOT( updateSorting() ) ); 857 sortMenu->insertItem( tr( "Ascending" ), this, SLOT( updateSorting() ) );
858 858
859 sortMenu->setItemChecked( sortMenu->idAt( 5 ), TRUE ); 859 sortMenu->setItemChecked( sortMenu->idAt( 5 ), TRUE );
860 sortMenu->setItemChecked( sortMenu->idAt( 0 ), TRUE ); 860 sortMenu->setItemChecked( sortMenu->idAt( 0 ), TRUE );
861 861
862 viewMenu = new QPopupMenu( this); 862 viewMenu = new QPopupMenu( this);
863 viewMenu->insertItem( tr( "Hidden"), this, SLOT( updateShowHidden() ) ); 863 viewMenu->insertItem( tr( "Hidden"), this, SLOT( updateShowHidden() ) );
864 viewMenu->insertItem( tr( "Symlinks"), this, SLOT( updateShowSymlinks() ) ); 864 viewMenu->insertItem( tr( "Symlinks"), this, SLOT( updateShowSymlinks() ) );
865 viewMenu->insertItem( tr( "Thumbnails"), this, SLOT( updateShowThumbnails() ) ); 865 viewMenu->insertItem( tr( "Thumbnails"), this, SLOT( updateShowThumbnails() ) );
866 viewMenu->setItemChecked( viewMenu->idAt( 0 ), showHidden ); 866 viewMenu->setItemChecked( viewMenu->idAt( 0 ), showHidden );
867 viewMenu->setItemChecked( viewMenu->idAt( 1 ), showSymlinks ); 867 viewMenu->setItemChecked( viewMenu->idAt( 1 ), showSymlinks );
868 viewMenu->setItemChecked( viewMenu->idAt( 2 ), showThumbnails ); 868 viewMenu->setItemChecked( viewMenu->idAt( 2 ), showThumbnails );
869 869
870 menuBar->insertItem( tr("View"), viewMenu ); 870 menuBar->insertItem( tr("View"), viewMenu );
871 871
872 toolBar = new QToolBar( this ); 872 toolBar = new QToolBar( this );
873 873
874 lastAction = new QAction( tr("Previous dir"), Resource::loadIconSet( "back" ), 874 lastAction = new QAction( tr("Previous dir"), Resource::loadIconSet( "back" ),
875 QString::null, 0, this, 0 ); 875 QString::null, 0, this, 0 );
876 connect( lastAction, SIGNAL( activated() ), fileView, SLOT( lastDir() ) ); 876 connect( lastAction, SIGNAL( activated() ), fileView, SLOT( lastDir() ) );
877 lastAction->addTo( toolBar ); 877 lastAction->addTo( toolBar );
878 lastAction->setEnabled( FALSE ); 878 lastAction->setEnabled( FALSE );
879 879
880 upAction = new QAction( tr("Parent dir"), Resource::loadIconSet( "up" ), 880 upAction = new QAction( tr("Parent dir"), Resource::loadIconSet( "up" ),
881 QString::null, 0, this, 0 ); 881 QString::null, 0, this, 0 );
882 connect( upAction, SIGNAL( activated() ), fileView, SLOT( parentDir() ) ); 882 connect( upAction, SIGNAL( activated() ), fileView, SLOT( parentDir() ) );
883 upAction->addTo( toolBar ); 883 upAction->addTo( toolBar );
884 884
885 QAction *a = new QAction( tr("New folder"), Resource::loadPixmap( "newfolder" ), 885 QAction *a = new QAction( tr("New folder"), Resource::loadPixmap( "newfolder" ),
886 QString::null, 0, this, 0 ); 886 QString::null, 0, this, 0 );
887 connect( a, SIGNAL( activated() ), fileView, SLOT( newFolder() ) ); 887 connect( a, SIGNAL( activated() ), fileView, SLOT( newFolder() ) );
888 a->addTo( toolBar ); 888 a->addTo( toolBar );
889 889
890 a = new QAction( tr("Cut"), Resource::loadPixmap( "cut" ), 890 a = new QAction( tr("Cut"), Resource::loadPixmap( "cut" ),
891 QString::null, 0, this, 0 ); 891 QString::null, 0, this, 0 );
892 connect( a, SIGNAL( activated() ), fileView, SLOT( cut() ) ); 892 connect( a, SIGNAL( activated() ), fileView, SLOT( cut() ) );
893 a->addTo( toolBar ); 893 a->addTo( toolBar );
894 894
895 a = new QAction( tr("Copy"), Resource::loadPixmap( "copy" ), 895 a = new QAction( tr("Copy"), Resource::loadPixmap( "copy" ),
896 QString::null, 0, this, 0 ); 896 QString::null, 0, this, 0 );
897 connect( a, SIGNAL( activated() ), fileView, SLOT( copy() ) ); 897 connect( a, SIGNAL( activated() ), fileView, SLOT( copy() ) );
898 a->addTo( toolBar ); 898 a->addTo( toolBar );
899 899
900 pasteAction = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), 900 pasteAction = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ),
901 QString::null, 0, this, 0 ); 901 QString::null, 0, this, 0 );
902 connect( pasteAction, SIGNAL( activated() ), fileView, SLOT( paste() ) ); 902 connect( pasteAction, SIGNAL( activated() ), fileView, SLOT( paste() ) );
903 pasteAction->addTo( toolBar ); 903 pasteAction->addTo( toolBar );
904 904
905// dirLabel = new QLabel(this, "DirLabel"); 905// dirLabel = new QLabel(this, "DirLabel");
906 906
907 connect( fileView, SIGNAL( dirChanged() ), SLOT( updateDirMenu() ) ); 907 connect( fileView, SIGNAL( dirChanged() ), SLOT( updateDirMenu() ) );
908 updateDirMenu(); 908 updateDirMenu();
909 909
910 QCopChannel* pcmciaChannel = new QCopChannel( "QPE/Card", this ); 910 QCopChannel* pcmciaChannel = new QCopChannel( "QPE/Card", this );
911 connect( pcmciaChannel, SIGNAL(received(const QCString &, const QByteArray &)), 911 connect( pcmciaChannel, SIGNAL(received(const QCString&,const QByteArray&)),
912 this, SLOT(pcmciaMessage( const QCString &, const QByteArray &)) ); 912 this, SLOT(pcmciaMessage(const QCString&,const QByteArray&)) );
913} 913}
914 914
915void FileBrowser::pcmciaMessage( const QCString &msg, const QByteArray &) 915void FileBrowser::pcmciaMessage( const QCString &msg, const QByteArray &)
916{ 916{
917 if ( msg == "mtabChanged()" ) { 917 if ( msg == "mtabChanged()" ) {
918 // ## Only really needed if current dir is on a card 918 // ## Only really needed if current dir is on a card
919 fileView->updateDir(); 919 fileView->updateDir();
920 } 920 }
921} 921}
922 922
923void FileBrowser::changeCaption(const QString & dir) { 923void FileBrowser::changeCaption(const QString & dir) {
924 setCaption( dir); 924 setCaption( dir);
925} 925}
926 926
927void FileBrowser::dirSelected( int id ) 927void FileBrowser::dirSelected( int id )
928{ 928{
929 int i = 0, j; 929 int i = 0, j;
930 QString dir; 930 QString dir;
931 931
932 // Bulid target dir from menu 932 // Bulid target dir from menu
933 while( (j = dirMenu->idAt( i )) != id ){ 933 while( (j = dirMenu->idAt( i )) != id ){
934 dir += dirMenu->text( j ).stripWhiteSpace(); 934 dir += dirMenu->text( j ).stripWhiteSpace();
935 if( dirMenu->text( j ) != "/" ) dir += "/"; 935 if( dirMenu->text( j ) != "/" ) dir += "/";
936 i++; 936 i++;
937 } 937 }
938 dir += dirMenu->text( dirMenu->idAt( i ) ).stripWhiteSpace(); 938 dir += dirMenu->text( dirMenu->idAt( i ) ).stripWhiteSpace();
939 939
940 fileView->setDir( dir ); 940 fileView->setDir( dir );
941} 941}
942 942
943void FileBrowser::updateDirMenu() 943void FileBrowser::updateDirMenu()
944{ 944{
945 QString spc, cd = fileView->cd(); 945 QString spc, cd = fileView->cd();
946 QStringList l = QStringList::split( "/", cd ); 946 QStringList l = QStringList::split( "/", cd );
947 int i = 0; 947 int i = 0;
948 948
949 dirMenu->clear(); 949 dirMenu->clear();
950 dirMenu->insertItem( tr( "/" ), this, SLOT( dirSelected(int) ) ); 950 dirMenu->insertItem( tr( "/" ), this, SLOT( dirSelected(int) ) );
951 951
952 for ( QStringList::Iterator it = l.begin(); it != l.end(); ++it ) { 952 for ( QStringList::Iterator it = l.begin(); it != l.end(); ++it ) {
953 spc.fill( ' ', i++); 953 spc.fill( ' ', i++);
954 dirMenu->insertItem( spc + (*it), this, 954 dirMenu->insertItem( spc + (*it), this,
955 SLOT( dirSelected(int) ) ); 955 SLOT( dirSelected(int) ) );
956 } 956 }
957 dirMenu->setItemChecked( dirMenu->idAt( l.count() ), TRUE ); 957 dirMenu->setItemChecked( dirMenu->idAt( l.count() ), TRUE );
958 958
959 lastAction->setEnabled( fileView->history().count() != 0 ); 959 lastAction->setEnabled( fileView->history().count() != 0 );
960 upAction->setEnabled( cd != "/" ); 960 upAction->setEnabled( cd != "/" );
961} 961}
962 962
963void FileBrowser::sortName() 963void FileBrowser::sortName()
964{ 964{
965 fileView->setSorting( 0, sortMenu->isItemChecked( sortMenu->idAt( 5 ) ) ); 965 fileView->setSorting( 0, sortMenu->isItemChecked( sortMenu->idAt( 5 ) ) );
966 fileView->sort(); 966 fileView->sort();
967 sortMenu->setItemChecked( sortMenu->idAt( 0 ), TRUE ); 967 sortMenu->setItemChecked( sortMenu->idAt( 0 ), TRUE );
968 sortMenu->setItemChecked( sortMenu->idAt( 1 ), FALSE ); 968 sortMenu->setItemChecked( sortMenu->idAt( 1 ), FALSE );
969 sortMenu->setItemChecked( sortMenu->idAt( 2 ), FALSE ); 969 sortMenu->setItemChecked( sortMenu->idAt( 2 ), FALSE );
970 sortMenu->setItemChecked( sortMenu->idAt( 3 ), FALSE ); 970 sortMenu->setItemChecked( sortMenu->idAt( 3 ), FALSE );
971} 971}
972 972
973void FileBrowser::sortSize() 973void FileBrowser::sortSize()
974{ 974{
975 fileView->setSorting( 1, sortMenu->isItemChecked( sortMenu->idAt( 5 ) ) ); 975 fileView->setSorting( 1, sortMenu->isItemChecked( sortMenu->idAt( 5 ) ) );
976 fileView->sort(); 976 fileView->sort();
diff --git a/noncore/unsupported/gsmtool/gsmtool.cpp b/noncore/unsupported/gsmtool/gsmtool.cpp
index 5940b0e..47920e5 100644
--- a/noncore/unsupported/gsmtool/gsmtool.cpp
+++ b/noncore/unsupported/gsmtool/gsmtool.cpp
@@ -1,107 +1,107 @@
1#include "gsmtool.h" 1#include "gsmtool.h"
2#include <qpushbutton.h> 2#include <qpushbutton.h>
3#include <qcombobox.h> 3#include <qcombobox.h>
4#include <qlineedit.h> 4#include <qlineedit.h>
5#include <qlabel.h> 5#include <qlabel.h>
6#include <qtabwidget.h> 6#include <qtabwidget.h>
7#include <qlistview.h> 7#include <qlistview.h>
8#include <qtextbrowser.h> 8#include <qtextbrowser.h>
9#include <qmultilineedit.h> 9#include <qmultilineedit.h>
10 10
11#include <termios.h> 11#include <termios.h>
12 12
13#include <gsmlib/gsm_me_ta.h> 13#include <gsmlib/gsm_me_ta.h>
14#include <gsmlib/gsm_unix_serial.h> 14#include <gsmlib/gsm_unix_serial.h>
15#include <gsmlib/gsm_sms.h> 15#include <gsmlib/gsm_sms.h>
16#include <gsmlib/gsm_sorted_sms_store.h> 16#include <gsmlib/gsm_sorted_sms_store.h>
17 17
18using namespace gsmlib; 18using namespace gsmlib;
19 19
20 20
21/* 21/*
22 * Constructs a GSMTool which is a child of 'parent', with the 22 * Constructs a GSMTool which is a child of 'parent', with the
23 * name 'name' and widget flags set to 'f' 23 * name 'name' and widget flags set to 'f'
24 */ 24 */
25GSMTool::GSMTool( QWidget* parent, const char* name, WFlags fl ) 25GSMTool::GSMTool( QWidget* parent, const char* name, WFlags fl )
26 : GSMToolBase( parent, name, fl ) 26 : GSMToolBase( parent, name, fl )
27{ 27{
28 devicelocked = 0; 28 devicelocked = 0;
29 me = NULL; 29 me = NULL;
30 sms_store = NULL; 30 sms_store = NULL;
31 setConnected(FALSE); 31 setConnected(FALSE);
32 /* FIXME: Persistent settings for device/baudrate */ 32 /* FIXME: Persistent settings for device/baudrate */
33 connect(ConnectButton, SIGNAL(clicked()), this, SLOT(doConnectButton())); 33 connect(ConnectButton, SIGNAL(clicked()), this, SLOT(doConnectButton()));
34 connect(SMSDeleteButton, SIGNAL(clicked()), this, SLOT(doSMSDeleteButton())); 34 connect(SMSDeleteButton, SIGNAL(clicked()), this, SLOT(doSMSDeleteButton()));
35 connect(SMSSendButton, SIGNAL(clicked()), this, SLOT(doSMSSendButton())); 35 connect(SMSSendButton, SIGNAL(clicked()), this, SLOT(doSMSSendButton()));
36 connect(NewSMSClearButton, SIGNAL(clicked()), this, SLOT(doNewSMSClearButton())); 36 connect(NewSMSClearButton, SIGNAL(clicked()), this, SLOT(doNewSMSClearButton()));
37 connect(NewSMSSaveButton, SIGNAL(clicked()), this, SLOT(doNewSMSSaveButton())); 37 connect(NewSMSSaveButton, SIGNAL(clicked()), this, SLOT(doNewSMSSaveButton()));
38 connect(NewSMSSendButton, SIGNAL(clicked()), this, SLOT(doNewSMSSendButton())); 38 connect(NewSMSSendButton, SIGNAL(clicked()), this, SLOT(doNewSMSSendButton()));
39 connect(ScanButton, SIGNAL(clicked()), this, SLOT(doScanButton())); 39 connect(ScanButton, SIGNAL(clicked()), this, SLOT(doScanButton()));
40 connect(TabWidget2, SIGNAL(currentChanged(QWidget *)), this, SLOT(doTabChanged())); 40 connect(TabWidget2, SIGNAL(currentChanged(QWidget*)), this, SLOT(doTabChanged()));
41 connect(SMSStoreList, SIGNAL(activated(int)), this, SLOT(doSMSStoreChanged())); 41 connect(SMSStoreList, SIGNAL(activated(int)), this, SLOT(doSMSStoreChanged()));
42 connect(SMSViewType, SIGNAL(activated(int)), this, SLOT(doSMSTypeChanged())); 42 connect(SMSViewType, SIGNAL(activated(int)), this, SLOT(doSMSTypeChanged()));
43 connect(SMSList, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(doSelectedSMSChanged(QListViewItem *))); 43 connect(SMSList, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(doSelectedSMSChanged(QListViewItem*)));
44 timerid = -1; // Is this not possible normally? 44 timerid = -1; // Is this not possible normally?
45} 45}
46 46
47/* 47/*
48 * Destroys the object and frees any allocated resources 48 * Destroys the object and frees any allocated resources
49 */ 49 */
50GSMTool::~GSMTool() 50GSMTool::~GSMTool()
51{ 51{
52 // no need to delete child widgets, Qt does it all for us 52 // no need to delete child widgets, Qt does it all for us
53 if (devicelocked) 53 if (devicelocked)
54 unlockDevice(); 54 unlockDevice();
55} 55}
56const speed_t GSMTool::baudrates[12] = { 56const speed_t GSMTool::baudrates[12] = {
57 B300, B600, B1200, B2400, B4800, B9600, B19200, 57 B300, B600, B1200, B2400, B4800, B9600, B19200,
58 B38400, B57600, B115200, B230400, B460800 58 B38400, B57600, B115200, B230400, B460800
59}; 59};
60 60
61int GSMTool::lockDevice( ) 61int GSMTool::lockDevice( )
62{ 62{
63 devicelocked = 1; 63 devicelocked = 1;
64 /* FIXME */ 64 /* FIXME */
65 return 0; 65 return 0;
66} 66}
67 67
68void GSMTool::unlockDevice( ) 68void GSMTool::unlockDevice( )
69{ 69{
70 devicelocked = 0; 70 devicelocked = 0;
71} 71}
72 72
73void GSMTool::setConnected( bool conn ) 73void GSMTool::setConnected( bool conn )
74{ 74{
75 TabWidget2->setTabEnabled(tab_2, conn); 75 TabWidget2->setTabEnabled(tab_2, conn);
76 TabWidget2->setTabEnabled(tab_3, conn); 76 TabWidget2->setTabEnabled(tab_3, conn);
77 //TabWidget2->setTabEnabled(tab_4, conn); 77 //TabWidget2->setTabEnabled(tab_4, conn);
78 NewSMSSendButton->setEnabled(conn); 78 NewSMSSendButton->setEnabled(conn);
79 MfrLabel->setEnabled(conn); 79 MfrLabel->setEnabled(conn);
80 MfrText->setEnabled(conn); 80 MfrText->setEnabled(conn);
81 ModelLabel->setEnabled(conn); 81 ModelLabel->setEnabled(conn);
82 ModelText->setEnabled(conn); 82 ModelText->setEnabled(conn);
83 RevisionLabel->setEnabled(conn); 83 RevisionLabel->setEnabled(conn);
84 RevisionText->setEnabled(conn); 84 RevisionText->setEnabled(conn);
85 SerialLabel->setEnabled(conn); 85 SerialLabel->setEnabled(conn);
86 SerialText->setEnabled(conn); 86 SerialText->setEnabled(conn);
87 87
88} 88}
89void GSMTool::doTabChanged() 89void GSMTool::doTabChanged()
90{ 90{
91 int index = TabWidget2->currentPageIndex(); 91 int index = TabWidget2->currentPageIndex();
92 qDebug("tab changed to %d", index); 92 qDebug("tab changed to %d", index);
93 93
94 if (index == 1) { 94 if (index == 1) {
95 timerid = startTimer(5000); 95 timerid = startTimer(5000);
96 timerEvent(NULL); 96 timerEvent(NULL);
97 } else if (timerid != -1) { 97 } else if (timerid != -1) {
98 killTimer(timerid); 98 killTimer(timerid);
99 timerid = -1; 99 timerid = -1;
100 } 100 }
101} 101}
102 102
103void GSMTool::timerEvent( QTimerEvent * ) 103void GSMTool::timerEvent( QTimerEvent * )
104{ 104{
105 OPInfo opi; 105 OPInfo opi;
106 106
107 opi = me->getCurrentOPInfo(); 107 opi = me->getCurrentOPInfo();
diff --git a/noncore/unsupported/mail2/bend/bend.cpp b/noncore/unsupported/mail2/bend/bend.cpp
index e2ece2a..ab6eb45 100644
--- a/noncore/unsupported/mail2/bend/bend.cpp
+++ b/noncore/unsupported/mail2/bend/bend.cpp
@@ -25,100 +25,100 @@ BenD::BenD(QWidget *parent, const char *name, WFlags fl)
25 _config->setGroup("Settings"); 25 _config->setGroup("Settings");
26 26
27 QVBoxLayout *layout = new QVBoxLayout(this); 27 QVBoxLayout *layout = new QVBoxLayout(this);
28 layout->addItem(new QSpacerItem(0,0)); 28 layout->addItem(new QSpacerItem(0,0));
29 29
30 QLabel *pixmap = new QLabel(this); 30 QLabel *pixmap = new QLabel(this);
31 pixmap->setPixmap(Resource::loadPixmap("mail/mailchecker")); 31 pixmap->setPixmap(Resource::loadPixmap("mail/mailchecker"));
32 layout->addWidget(pixmap); 32 layout->addWidget(pixmap);
33 33
34 layout->addItem(new QSpacerItem(0,0)); 34 layout->addItem(new QSpacerItem(0,0));
35 35
36 hide(); 36 hide();
37 37
38 connect(this, SIGNAL(clicked()), SLOT(slotClicked())); 38 connect(this, SIGNAL(clicked()), SLOT(slotClicked()));
39 39
40 if (!_config->readBoolEntry("Disabled", false)) { 40 if (!_config->readBoolEntry("Disabled", false)) {
41 _intervalMs = _config->readNumEntry("CheckEvery", 5) * 60000; 41 _intervalMs = _config->readNumEntry("CheckEvery", 5) * 60000;
42 _intervalTimer = new QTimer(); 42 _intervalTimer = new QTimer();
43 _intervalTimer->start(_intervalMs); 43 _intervalTimer->start(_intervalMs);
44 connect(_intervalTimer, SIGNAL(timeout()), SLOT(slotCheck())); 44 connect(_intervalTimer, SIGNAL(timeout()), SLOT(slotCheck()));
45 45
46 QTimer::singleShot(0, this, SLOT(slotCheck())); 46 QTimer::singleShot(0, this, SLOT(slotCheck()));
47 } 47 }
48} 48}
49 49
50void BenD::drawButton(QPainter *) { } 50void BenD::drawButton(QPainter *) { }
51void BenD::drawButtonText(QPainter *) { } 51void BenD::drawButtonText(QPainter *) { }
52 52
53void BenD::slotClicked() 53void BenD::slotClicked()
54{ 54{
55 QCopEnvelope e("QPE/System", "execute(QString)"); 55 QCopEnvelope e("QPE/System", "execute(QString)");
56 e << QString("mail"); 56 e << QString("mail");
57 57
58 ODevice *device = ODevice::inst(); 58 ODevice *device = ODevice::inst();
59 if ( !device-> ledList ( ). isEmpty ( )) { 59 if ( !device-> ledList ( ). isEmpty ( )) {
60 OLed led = ( device-> ledList ( ). contains ( Led_Mail )) ? Led_Mail : device-> ledList ( ) [0]; 60 OLed led = ( device-> ledList ( ). contains ( Led_Mail )) ? Led_Mail : device-> ledList ( ) [0];
61 61
62 device->setLedState(led, Led_Off); 62 device->setLedState(led, Led_Off);
63 } 63 }
64} 64}
65 65
66void BenD::slotCheck() 66void BenD::slotCheck()
67{ 67{
68 // Check wether the check interval has been changed. 68 // Check wether the check interval has been changed.
69 int newIntervalMs = _config->readNumEntry("CheckEvery", 5) * 60000; 69 int newIntervalMs = _config->readNumEntry("CheckEvery", 5) * 60000;
70 if (newIntervalMs != _intervalMs) { 70 if (newIntervalMs != _intervalMs) {
71 _intervalTimer->changeInterval(newIntervalMs); 71 _intervalTimer->changeInterval(newIntervalMs);
72 _intervalMs = newIntervalMs; 72 _intervalMs = newIntervalMs;
73#ifndef QT_NO_DEBUG 73#ifndef QT_NO_DEBUG
74 qWarning("BenD: Detected interval change"); 74 qWarning("BenD: Detected interval change");
75#endif 75#endif
76 } 76 }
77 77
78 QValueList<Account> acList = ConfigFile::getAccounts(); 78 QValueList<Account> acList = ConfigFile::getAccounts();
79 QValueList<Account>::Iterator ot; 79 QValueList<Account>::Iterator ot;
80 for (ot = acList.begin(); ot != acList.end(); ot++) { 80 for (ot = acList.begin(); ot != acList.end(); ot++) {
81 if (!((*ot).imapServer().isEmpty() || 81 if (!((*ot).imapServer().isEmpty() ||
82 (*ot).imapPort().isEmpty() || 82 (*ot).imapPort().isEmpty() ||
83 (*ot).user().isEmpty() || 83 (*ot).user().isEmpty() ||
84 (*ot).pass().isEmpty())) { 84 (*ot).pass().isEmpty())) {
85 if (!((*ot).imapSsl() && 85 if (!((*ot).imapSsl() &&
86 (*ot).imapSslPort().isEmpty())) { 86 (*ot).imapSslPort().isEmpty())) {
87 IMAPHandler *handler = new IMAPHandler(*ot); 87 IMAPHandler *handler = new IMAPHandler(*ot);
88 handler->iStatus("INBOX", "RECENT"); 88 handler->iStatus("INBOX", "RECENT");
89 connect(handler, SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPStatus(IMAPResponse &))); 89 connect(handler, SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPStatus(IMAPResponse&)));
90 } 90 }
91 } 91 }
92 } 92 }
93} 93}
94 94
95void BenD::slotIMAPStatus(IMAPResponse &response) 95void BenD::slotIMAPStatus(IMAPResponse &response)
96{ 96{
97 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPStatus(IMAPResponse &))); 97 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPStatus(IMAPResponse&)));
98 98
99 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 99 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
100 if (response.STATUS()[0].recent().toInt() > 0) { 100 if (response.STATUS()[0].recent().toInt() > 0) {
101 ODevice *device = ODevice::inst(); 101 ODevice *device = ODevice::inst();
102 if (isHidden()) show(); 102 if (isHidden()) show();
103 if (_config->readBoolEntry("BlinkLed", true)) { 103 if (_config->readBoolEntry("BlinkLed", true)) {
104 if ( !device-> ledList ( ). isEmpty ( )) { 104 if ( !device-> ledList ( ). isEmpty ( )) {
105 OLed led = ( device-> ledList ( ). contains ( Led_Mail )) ? Led_Mail : device-> ledList ( ) [0]; 105 OLed led = ( device-> ledList ( ). contains ( Led_Mail )) ? Led_Mail : device-> ledList ( ) [0];
106 106
107 device->setLedState(led, device-> ledStateList ( led ). contains ( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On ); 107 device->setLedState(led, device-> ledStateList ( led ). contains ( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On );
108 } 108 }
109 } 109 }
110 if (_config->readBoolEntry("PlaySound", false)) 110 if (_config->readBoolEntry("PlaySound", false))
111 device->alarmSound(); 111 device->alarmSound();
112 } else { 112 } else {
113 ODevice *device = ODevice::inst(); 113 ODevice *device = ODevice::inst();
114 if (!isHidden()) hide(); 114 if (!isHidden()) hide();
115 if ( !device-> ledList ( ). isEmpty ( )) { 115 if ( !device-> ledList ( ). isEmpty ( )) {
116 OLed led = ( device-> ledList ( ). contains ( Led_Mail )) ? Led_Mail : device-> ledList ( ) [0]; 116 OLed led = ( device-> ledList ( ). contains ( Led_Mail )) ? Led_Mail : device-> ledList ( ) [0];
117 117
118 device->setLedState(led, Led_Off); 118 device->setLedState(led, Led_Off);
119 } 119 }
120 } 120 }
121 response.imapHandler()->iLogout(); 121 response.imapHandler()->iLogout();
122 } else qWarning("BenD: WARNING: Couldn't retrieve INBOX status."); 122 } else qWarning("BenD: WARNING: Couldn't retrieve INBOX status.");
123} 123}
124 124
diff --git a/noncore/unsupported/mail2/composer.cpp b/noncore/unsupported/mail2/composer.cpp
index cb80299..da1aee9 100644
--- a/noncore/unsupported/mail2/composer.cpp
+++ b/noncore/unsupported/mail2/composer.cpp
@@ -97,219 +97,219 @@ void Composer::slotResizing()
97 from->resize(width() - fromBox->width(), y()); 97 from->resize(width() - fromBox->width(), y());
98 if (_sendQueued) slotSendQueued(); 98 if (_sendQueued) slotSendQueued();
99} 99}
100 100
101void Composer::slotPopupHandler(int itemid) 101void Composer::slotPopupHandler(int itemid)
102{ 102{
103 if (attachView->currentItem() == NULL) { 103 if (attachView->currentItem() == NULL) {
104 QMessageBox::information(this, tr("Error"), tr("Please select an entry first."), tr("Ok")); 104 QMessageBox::information(this, tr("Error"), tr("Please select an entry first."), tr("Ok"));
105 return; 105 return;
106 } 106 }
107 107
108 if (itemid == POPUP_ATTACH_RENAME) { 108 if (itemid == POPUP_ATTACH_RENAME) {
109 QString tmp = Rename::rename(attachView->currentItem()->text(0), this); 109 QString tmp = Rename::rename(attachView->currentItem()->text(0), this);
110 if (tmp != QString(0)) attachView->currentItem()->setText(0, tmp); 110 if (tmp != QString(0)) attachView->currentItem()->setText(0, tmp);
111 } else if (itemid == POPUP_ATTACH_DESC) { 111 } else if (itemid == POPUP_ATTACH_DESC) {
112 QString tmp = Rename::getText(tr("Set Description"), tr("<div align=center>Description"), this); 112 QString tmp = Rename::getText(tr("Set Description"), tr("<div align=center>Description"), this);
113 if (tmp != QString(0)) attachView->currentItem()->setText(1, tmp); 113 if (tmp != QString(0)) attachView->currentItem()->setText(1, tmp);
114 } else if (itemid == POPUP_ATTACH_REMOVE) { 114 } else if (itemid == POPUP_ATTACH_REMOVE) {
115 attachView->takeItem(attachView->currentItem()); 115 attachView->takeItem(attachView->currentItem());
116 } 116 }
117} 117}
118 118
119void Composer::slotSendMail() 119void Composer::slotSendMail()
120{ 120{
121 if (to->text().find(QRegExp(".*\\@.*\\..*")) == -1) { 121 if (to->text().find(QRegExp(".*\\@.*\\..*")) == -1) {
122 QMessageBox::information(this, tr("Error"), tr("<p>You have to specify a recipient.<br>(eg: foo@bar.org)</p>"), tr("Ok")); 122 QMessageBox::information(this, tr("Error"), tr("<p>You have to specify a recipient.<br>(eg: foo@bar.org)</p>"), tr("Ok"));
123 return; 123 return;
124 } 124 }
125 125
126 SendMail smail; 126 SendMail smail;
127 smail.setFrom(from->currentText()); 127 smail.setFrom(from->currentText());
128 smail.setReplyTo(replyto->text()); 128 smail.setReplyTo(replyto->text());
129 smail.setTo(to->text()); 129 smail.setTo(to->text());
130 smail.setCc(cc->text()); 130 smail.setCc(cc->text());
131 smail.setBcc(bcc->text()); 131 smail.setBcc(bcc->text());
132 smail.setSubject(subject->text()); 132 smail.setSubject(subject->text());
133 smail.setMessage(message->text()); 133 smail.setMessage(message->text());
134 smail.setNeedsMime(attachView->childCount() == 0 ? false : true); 134 smail.setNeedsMime(attachView->childCount() == 0 ? false : true);
135 smail.setAccount(accountsLoaded[from->currentItem()]); 135 smail.setAccount(accountsLoaded[from->currentItem()]);
136 136
137 if (priority->currentItem() == POPUP_PRIO_LOW) { 137 if (priority->currentItem() == POPUP_PRIO_LOW) {
138 smail.setPriority("Low");// No i18n on purpose 138 smail.setPriority("Low");// No i18n on purpose
139 } else if (priority->currentItem() == POPUP_PRIO_NORMAL) { 139 } else if (priority->currentItem() == POPUP_PRIO_NORMAL) {
140 smail.setPriority("Normal");// No i18n on purpose 140 smail.setPriority("Normal");// No i18n on purpose
141 } else if (priority->currentItem() == POPUP_PRIO_HIGH) { 141 } else if (priority->currentItem() == POPUP_PRIO_HIGH) {
142 smail.setPriority("High");// No i18n on purpose 142 smail.setPriority("High");// No i18n on purpose
143 } 143 }
144 144
145 QValueList<Attachment> attachments; 145 QValueList<Attachment> attachments;
146 QListViewItem *item; 146 QListViewItem *item;
147 for (item = attachView->firstChild(); item != 0; item = item->itemBelow()) { 147 for (item = attachView->firstChild(); item != 0; item = item->itemBelow()) {
148 attachments.append(((AttachViewItem *)item)->attachment()); 148 attachments.append(((AttachViewItem *)item)->attachment());
149 } 149 }
150 150
151 smail.setAttachments(attachments); 151 smail.setAttachments(attachments);
152 152
153 QString header, message; 153 QString header, message;
154 MailFactory::genMail(header, message, smail, this); 154 MailFactory::genMail(header, message, smail, this);
155 if (header.isNull() || message.isNull()) return;// Aborted. 155 if (header.isNull() || message.isNull()) return;// Aborted.
156 156
157 status->setStopEnabled(true); 157 status->setStopEnabled(true);
158 158
159 SmtpHandler *handler = new SmtpHandler(header, message, accountsLoaded[from->currentItem()], to->text()); 159 SmtpHandler *handler = new SmtpHandler(header, message, accountsLoaded[from->currentItem()], to->text());
160 connect(handler, SIGNAL(finished()), SLOT(slotSendFinished())); 160 connect(handler, SIGNAL(finished()), SLOT(slotSendFinished()));
161 connect(handler, SIGNAL(error(const QString &)), SLOT(slotSendError(const QString &))); 161 connect(handler, SIGNAL(error(const QString&)), SLOT(slotSendError(const QString&)));
162 connect(handler, SIGNAL(status(const QString &)), status, SLOT(setStatusText(const QString &))); 162 connect(handler, SIGNAL(status(const QString&)), status, SLOT(setStatusText(const QString&)));
163} 163}
164 164
165void Composer::slotSendQueued() 165void Composer::slotSendQueued()
166{ 166{
167 int effSendCount = 0; 167 int effSendCount = 0;
168 qDebug("Sending queued messages"); 168 qDebug("Sending queued messages");
169 Config cfg( "mailqueue", Config::User ); 169 Config cfg( "mailqueue", Config::User );
170 cfg.setGroup( "Settings" ); 170 cfg.setGroup( "Settings" );
171 _sendCount = 0; 171 _sendCount = 0;
172 _sendError = 0; 172 _sendError = 0;
173 _toSend = cfg.readNumEntry( "count", 0 ); 173 _toSend = cfg.readNumEntry( "count", 0 );
174 174
175 if (_toSend == 0) close(); 175 if (_toSend == 0) close();
176 176
177 qDebug("%i messages to send", _toSend); 177 qDebug("%i messages to send", _toSend);
178 QString str; 178 QString str;
179 for (int i=1;i<=_toSend;i++) 179 for (int i=1;i<=_toSend;i++)
180 { 180 {
181 qDebug("sending message %i",i); 181 qDebug("sending message %i",i);
182 cfg.setGroup( "Mail_" + QString::number(i) ); 182 cfg.setGroup( "Mail_" + QString::number(i) );
183 SendMail smail; 183 SendMail smail;
184 str = cfg.readEntry("from"); 184 str = cfg.readEntry("from");
185 qDebug("setFrom %s",str.latin1()); 185 qDebug("setFrom %s",str.latin1());
186 smail.setFrom( str ); 186 smail.setFrom( str );
187 str = cfg.readEntry("reply"); 187 str = cfg.readEntry("reply");
188 qDebug("setReplyTo %s",str.latin1()); 188 qDebug("setReplyTo %s",str.latin1());
189 smail.setReplyTo( str ); 189 smail.setReplyTo( str );
190 QString toAdr = cfg.readEntry("to"); 190 QString toAdr = cfg.readEntry("to");
191 qDebug("to %s",toAdr.latin1()); 191 qDebug("to %s",toAdr.latin1());
192 smail.setTo( toAdr ); //to->text()); 192 smail.setTo( toAdr ); //to->text());
193 str = cfg.readEntry("cc"); 193 str = cfg.readEntry("cc");
194 qDebug("setCc %s",str.latin1()); 194 qDebug("setCc %s",str.latin1());
195 smail.setCc( str ); //cc->text()); 195 smail.setCc( str ); //cc->text());
196 smail.setBcc( cfg.readEntry("bcc") ); //bcc->text()); 196 smail.setBcc( cfg.readEntry("bcc") ); //bcc->text());
197 str = cfg.readEntry("subject"); 197 str = cfg.readEntry("subject");
198 qDebug("setSubject %s",str.latin1()); 198 qDebug("setSubject %s",str.latin1());
199 smail.setSubject( str ); //subject->text()); 199 smail.setSubject( str ); //subject->text());
200 str = cfg.readEntryCrypt("message"); 200 str = cfg.readEntryCrypt("message");
201 qDebug("setMessage %s",str.latin1()); 201 qDebug("setMessage %s",str.latin1());
202 smail.setMessage( str ); //message->text()); 202 smail.setMessage( str ); //message->text());
203 smail.setNeedsMime( cfg.readBoolEntry("mime") ); //attachView->childCount() == 0 ? false : true); 203 smail.setNeedsMime( cfg.readBoolEntry("mime") ); //attachView->childCount() == 0 ? false : true);
204 204
205 qDebug("setting account [%i]",cfg.readNumEntry("account")); 205 qDebug("setting account [%i]",cfg.readNumEntry("account"));
206 Account accnt = accountsLoaded[ cfg.readNumEntry("account") ]; 206 Account accnt = accountsLoaded[ cfg.readNumEntry("account") ];
207 smail.setAccount( accnt ); //accountsLoaded[from->currentItem()]); 207 smail.setAccount( accnt ); //accountsLoaded[from->currentItem()]);
208 208
209 209
210 int prio = cfg.readNumEntry( "priority" ); 210 int prio = cfg.readNumEntry( "priority" );
211 qDebug("setting priority %i",prio); 211 qDebug("setting priority %i",prio);
212 if (prio == POPUP_PRIO_LOW) { 212 if (prio == POPUP_PRIO_LOW) {
213 smail.setPriority("Low");// No i18n on purpose 213 smail.setPriority("Low");// No i18n on purpose
214 } else if (prio == POPUP_PRIO_NORMAL) { 214 } else if (prio == POPUP_PRIO_NORMAL) {
215 smail.setPriority("Normal");// No i18n on purpose 215 smail.setPriority("Normal");// No i18n on purpose
216 } else if (prio == POPUP_PRIO_HIGH) { 216 } else if (prio == POPUP_PRIO_HIGH) {
217 smail.setPriority("High");// No i18n on purpose 217 smail.setPriority("High");// No i18n on purpose
218 } 218 }
219 219
220 QValueList<Attachment> attachments; 220 QValueList<Attachment> attachments;
221 Attachment a; 221 Attachment a;
222 QString an; 222 QString an;
223 223
224 int ac = cfg.readNumEntry( "attachments", 0 ); 224 int ac = cfg.readNumEntry( "attachments", 0 );
225 qDebug("%i Attachments",ac); 225 qDebug("%i Attachments",ac);
226 for (int j = 0; i < ac; ac++) { 226 for (int j = 0; i < ac; ac++) {
227 an = "Attachment_" + QString::number( j ); 227 an = "Attachment_" + QString::number( j );
228 qDebug(an.latin1()); 228 qDebug(an.latin1());
229 a.setFileName(cfg.readEntry( an + "fileName" )); 229 a.setFileName(cfg.readEntry( an + "fileName" ));
230 a.setNewName(cfg.readEntry( an + "newName" )); 230 a.setNewName(cfg.readEntry( an + "newName" ));
231 a.setDescription(cfg.readEntry( an + "description" )); 231 a.setDescription(cfg.readEntry( an + "description" ));
232 a.setDocLnk( DocLnk( cfg.readEntry( an + "docLnk" )) ); 232 a.setDocLnk( DocLnk( cfg.readEntry( an + "docLnk" )) );
233 attachments.append( a ); 233 attachments.append( a );
234 } 234 }
235 235
236 smail.setAttachments(attachments); 236 smail.setAttachments(attachments);
237 237
238 qDebug("putting mail together"); 238 qDebug("putting mail together");
239 239
240 QString header, message; 240 QString header, message;
241 MailFactory::genMail(header, message, smail, this); 241 MailFactory::genMail(header, message, smail, this);
242 if (header.isNull() || message.isNull()) continue;//return;// Aborted. 242 if (header.isNull() || message.isNull()) continue;//return;// Aborted.
243 243
244 // abort->setEnabled(true); 244 // abort->setEnabled(true);
245 245
246 qDebug("Sending to %s",toAdr.latin1()); 246 qDebug("Sending to %s",toAdr.latin1());
247 SmtpHandler *handler = new SmtpHandler(header, message, accnt ,toAdr); 247 SmtpHandler *handler = new SmtpHandler(header, message, accnt ,toAdr);
248 effSendCount++; 248 effSendCount++;
249 connect(handler, SIGNAL(finished()), SLOT(slotSendQueuedFinished())); 249 connect(handler, SIGNAL(finished()), SLOT(slotSendQueuedFinished()));
250 connect(handler, SIGNAL(error(const QString &)), SLOT(slotSendQueuedError(const QString &))); 250 connect(handler, SIGNAL(error(const QString&)), SLOT(slotSendQueuedError(const QString&)));
251 connect(handler, SIGNAL(status(const QString &)), status, SLOT(setStatusText(const QString &))); 251 connect(handler, SIGNAL(status(const QString&)), status, SLOT(setStatusText(const QString&)));
252 252
253 } 253 }
254 if (effSendCount < _toSend) 254 if (effSendCount < _toSend)
255 { 255 {
256 _toSend = effSendCount; 256 _toSend = effSendCount;
257 QMessageBox::information(this, tr("Error"), tr("<p>There was a problem sending some of the queued mails.</p>"), tr("Ok")); 257 QMessageBox::information(this, tr("Error"), tr("<p>There was a problem sending some of the queued mails.</p>"), tr("Ok"));
258 } 258 }
259} 259}
260 260
261void Composer::slotQueueMail() 261void Composer::slotQueueMail()
262{ 262{
263 if (to->text().find(QRegExp(".*\\@.*\\..*")) == -1) { 263 if (to->text().find(QRegExp(".*\\@.*\\..*")) == -1) {
264 QMessageBox::information(this, tr("Error"), tr("<p>You have to specify a recipient.<br>(eg: foo@bar.org)</p>"), tr("Ok")); 264 QMessageBox::information(this, tr("Error"), tr("<p>You have to specify a recipient.<br>(eg: foo@bar.org)</p>"), tr("Ok"));
265 return; 265 return;
266 } 266 }
267 267
268 Config cfg( "mailqueue", Config::User ); 268 Config cfg( "mailqueue", Config::User );
269 269
270 cfg.setGroup( "Settings" ); 270 cfg.setGroup( "Settings" );
271 int count = cfg.readNumEntry( "count", 0 ); 271 int count = cfg.readNumEntry( "count", 0 );
272 count++; 272 count++;
273 cfg.writeEntry( "count", count ); 273 cfg.writeEntry( "count", count );
274 qDebug("queueing mail %i",count); 274 qDebug("queueing mail %i",count);
275 275
276 cfg.setGroup( "Mail_" + QString::number( count )); 276 cfg.setGroup( "Mail_" + QString::number( count ));
277 cfg.writeEntry( "from", from->currentText() ); 277 cfg.writeEntry( "from", from->currentText() );
278 cfg.writeEntry( "reply", replyto->text()); 278 cfg.writeEntry( "reply", replyto->text());
279 cfg.writeEntry( "to", to->text()); 279 cfg.writeEntry( "to", to->text());
280 cfg.writeEntry( "cc", cc->text()); 280 cfg.writeEntry( "cc", cc->text());
281 cfg.writeEntry( "bcc", bcc->text()); 281 cfg.writeEntry( "bcc", bcc->text());
282 cfg.writeEntry( "subject", subject->text()); 282 cfg.writeEntry( "subject", subject->text());
283 cfg.writeEntryCrypt( "message", message->text()); 283 cfg.writeEntryCrypt( "message", message->text());
284 cfg.writeEntry( "mime", attachView->childCount() == 0 ); 284 cfg.writeEntry( "mime", attachView->childCount() == 0 );
285 cfg.writeEntry( "account", from->currentItem()); 285 cfg.writeEntry( "account", from->currentItem());
286 cfg.writeEntry( "priority", priority->currentItem() ); 286 cfg.writeEntry( "priority", priority->currentItem() );
287 cfg.writeEntry( "attachments", attachView->childCount() ); 287 cfg.writeEntry( "attachments", attachView->childCount() );
288 288
289 Attachment a; 289 Attachment a;
290 QListViewItem *item; 290 QListViewItem *item;
291 QString an; 291 QString an;
292 int i = 0; 292 int i = 0;
293 for (item = attachView->firstChild(); item != 0; item = item->itemBelow()) { 293 for (item = attachView->firstChild(); item != 0; item = item->itemBelow()) {
294 a = ((AttachViewItem *)item)->attachment(); 294 a = ((AttachViewItem *)item)->attachment();
295 an = "Attachment_" + QString::number( i++ ); 295 an = "Attachment_" + QString::number( i++ );
296 cfg.writeEntry( an + "fileName", a.fileName() ); 296 cfg.writeEntry( an + "fileName", a.fileName() );
297 cfg.writeEntry( an + "newName", a.newName() ); 297 cfg.writeEntry( an + "newName", a.newName() );
298 cfg.writeEntry( an + "description", a.description() ); 298 cfg.writeEntry( an + "description", a.description() );
299 cfg.writeEntry( an + "docLnk", a.docLnk().file() ); 299 cfg.writeEntry( an + "docLnk", a.docLnk().file() );
300 } 300 }
301 301
302 QMessageBox::information(this, tr("Success"), tr("<p>The mail was queued successfully.</p><p>The queue contains ")+QString::number(count)+tr(" mails.</p>"), tr("Ok")); 302 QMessageBox::information(this, tr("Success"), tr("<p>The mail was queued successfully.</p><p>The queue contains ")+QString::number(count)+tr(" mails.</p>"), tr("Ok"));
303 303
304} 304}
305 305
306void Composer::slotSendError(const QString &error) 306void Composer::slotSendError(const QString &error)
307{ 307{
308 status->setStatusText(tr("<font color=#ff0000>Error occoured during sending.</font>")); 308 status->setStatusText(tr("<font color=#ff0000>Error occoured during sending.</font>"));
309 QMessageBox::warning(this, tr("Error"), tr("<p>%1</p").arg(error), tr("Ok")); 309 QMessageBox::warning(this, tr("Error"), tr("<p>%1</p").arg(error), tr("Ok"));
310} 310}
311 311
312void Composer::slotSendQueuedError(const QString &error) 312void Composer::slotSendQueuedError(const QString &error)
313{ 313{
314 _sendError++; 314 _sendError++;
315 qDebug("error send mail %i",_sendCount); 315 qDebug("error send mail %i",_sendCount);
diff --git a/noncore/unsupported/mail2/folderwidget.cpp b/noncore/unsupported/mail2/folderwidget.cpp
index d27968b..a0520b1 100644
--- a/noncore/unsupported/mail2/folderwidget.cpp
+++ b/noncore/unsupported/mail2/folderwidget.cpp
@@ -1,314 +1,314 @@
1#include <qmessagebox.h> 1#include <qmessagebox.h>
2#include <qtextstream.h> 2#include <qtextstream.h>
3#include <qpopupmenu.h> 3#include <qpopupmenu.h>
4#include <qheader.h> 4#include <qheader.h>
5#include <qfile.h> 5#include <qfile.h>
6#include <qdir.h> 6#include <qdir.h>
7 7
8#include <qpe/resource.h> 8#include <qpe/resource.h>
9 9
10#include <stdlib.h> 10#include <stdlib.h>
11 11
12#include "folderwidget.h" 12#include "folderwidget.h"
13#include "imaphandler.h" 13#include "imaphandler.h"
14#include "imapbase.h" 14#include "imapbase.h"
15#include "rename.h" 15#include "rename.h"
16 16
17FolderWidgetItem::FolderWidgetItem(Folder &folder, QListView *parent) 17FolderWidgetItem::FolderWidgetItem(Folder &folder, QListView *parent)
18 : QListViewItem(parent), _folder(folder) 18 : QListViewItem(parent), _folder(folder)
19{ 19{
20 setPixmap(0, QPixmap(Resource::loadPixmap("mail/inbox"))); 20 setPixmap(0, QPixmap(Resource::loadPixmap("mail/inbox")));
21 setText(0, _folder.topFolder().account().user() + " (" + _folder.topFolder().account().imapServer() + ")"); 21 setText(0, _folder.topFolder().account().user() + " (" + _folder.topFolder().account().imapServer() + ")");
22 setOpen(true); 22 setOpen(true);
23} 23}
24 24
25FolderWidgetItem::FolderWidgetItem(Folder &folder, FolderWidgetItem *parent) 25FolderWidgetItem::FolderWidgetItem(Folder &folder, FolderWidgetItem *parent)
26 : QListViewItem(parent), _folder(folder) 26 : QListViewItem(parent), _folder(folder)
27{ 27{
28 if (_folder.noCache()) { 28 if (_folder.noCache()) {
29 setText(0, QObject::tr("<Foldertree not known.>")); 29 setText(0, QObject::tr("<Foldertree not known.>"));
30 } else { 30 } else {
31 if (folder.fullName().upper() == "INBOX") { 31 if (folder.fullName().upper() == "INBOX") {
32 setPixmap(0, QPixmap(Resource::loadPixmap("mail/inbox"))); 32 setPixmap(0, QPixmap(Resource::loadPixmap("mail/inbox")));
33 setText(0, QObject::tr("Inbox")); 33 setText(0, QObject::tr("Inbox"));
34 } else { 34 } else {
35 setPixmap(0, QPixmap(Resource::loadPixmap("mail/folder"))); 35 setPixmap(0, QPixmap(Resource::loadPixmap("mail/folder")));
36 setText(0, folder.fullName()); 36 setText(0, folder.fullName());
37 } 37 }
38 setOpen(true); 38 setOpen(true);
39 } 39 }
40} 40}
41 41
42FolderWidget::FolderWidget(QWidget *parent, const char *name, WFlags fl) 42FolderWidget::FolderWidget(QWidget *parent, const char *name, WFlags fl)
43 : ListViewPlus(parent, name, fl) 43 : ListViewPlus(parent, name, fl)
44{ 44{
45 header()->hide(); 45 header()->hide();
46 addColumn(""); 46 addColumn("");
47 setSorting(-1); 47 setSorting(-1);
48 48
49 QPopupMenu *menu = new QPopupMenu(); 49 QPopupMenu *menu = new QPopupMenu();
50 menu->insertItem(tr("Rename"), MENU_RENAME); 50 menu->insertItem(tr("Rename"), MENU_RENAME);
51 menu->insertItem(tr("Delete"), MENU_DELETE); 51 menu->insertItem(tr("Delete"), MENU_DELETE);
52 menu->insertItem(tr("Move"), MENU_MOVE); 52 menu->insertItem(tr("Move"), MENU_MOVE);
53 menu->insertItem(tr("Copy"), MENU_COPY); 53 menu->insertItem(tr("Copy"), MENU_COPY);
54 menu->insertSeparator(); 54 menu->insertSeparator();
55 menu->insertItem(tr("Create folder"), MENU_CREATE); 55 menu->insertItem(tr("Create folder"), MENU_CREATE);
56 menu->insertSeparator(); 56 menu->insertSeparator();
57 menu->insertItem(tr("Rescan folder list"), MENU_RESCAN); 57 menu->insertItem(tr("Rescan folder list"), MENU_RESCAN);
58 setPopup(menu); 58 setPopup(menu);
59 59
60 getAccounts(); 60 getAccounts();
61 61
62 connect(menu, SIGNAL(activated(int)), SLOT(slotMenuActivated(int))); 62 connect(menu, SIGNAL(activated(int)), SLOT(slotMenuActivated(int)));
63 connect(this, SIGNAL(clicked(QListViewItem *)), SLOT(slotItemClicked(QListViewItem *))); 63 connect(this, SIGNAL(clicked(QListViewItem*)), SLOT(slotItemClicked(QListViewItem*)));
64} 64}
65 65
66FolderWidget::~FolderWidget() 66FolderWidget::~FolderWidget()
67{ 67{
68 // TODO: Save folder tree. 68 // TODO: Save folder tree.
69} 69}
70 70
71void FolderWidget::update() 71void FolderWidget::update()
72{ 72{
73 getAccounts(); 73 getAccounts();
74} 74}
75 75
76void FolderWidget::getAccounts() 76void FolderWidget::getAccounts()
77{ 77{
78 clear(); 78 clear();
79 79
80 QValueList<Account> accounts = ConfigFile::getAccounts(); 80 QValueList<Account> accounts = ConfigFile::getAccounts();
81 QValueList<Account>::Iterator it; 81 QValueList<Account>::Iterator it;
82 for (it = accounts.begin(); it != accounts.end(); it++) { 82 for (it = accounts.begin(); it != accounts.end(); it++) {
83 FolderWidgetItem *item = addAccount(*it); 83 FolderWidgetItem *item = addAccount(*it);
84 QFile f((QString) getenv("HOME") + "/Applications/mail/foldercache/foldercache-" + (*it).accountName()); 84 QFile f((QString) getenv("HOME") + "/Applications/mail/foldercache/foldercache-" + (*it).accountName());
85 if (!f.open(IO_ReadOnly)) { 85 if (!f.open(IO_ReadOnly)) {
86 Folder folder; 86 Folder folder;
87 folder.setNoCache(true); 87 folder.setNoCache(true);
88 addFolder(folder, item); 88 addFolder(folder, item);
89 } else { 89 } else {
90 QTextStream t(&f); 90 QTextStream t(&f);
91 while (!t.atEnd()) { 91 while (!t.atEnd()) {
92 QString separator = t.readLine(); 92 QString separator = t.readLine();
93 QString fullname = t.readLine(); 93 QString fullname = t.readLine();
94 Folder folder; 94 Folder folder;
95 folder.setSeparator(separator); 95 folder.setSeparator(separator);
96 folder.setFullName(fullname); 96 folder.setFullName(fullname);
97 folder.setTopFolder(item->folder().topFolder()); 97 folder.setTopFolder(item->folder().topFolder());
98 addFolder(folder, item); 98 addFolder(folder, item);
99 } 99 }
100 f.close(); 100 f.close();
101 } 101 }
102 } 102 }
103} 103}
104 104
105FolderWidgetItem *FolderWidget::addAccount(Account &account) 105FolderWidgetItem *FolderWidget::addAccount(Account &account)
106{ 106{
107 TopFolder tf; 107 TopFolder tf;
108 tf.setAccount(account); 108 tf.setAccount(account);
109 109
110 // XXX This has to change!!! The folderwidget may not create an 110 // XXX This has to change!!! The folderwidget may not create an
111 // XXX IMAPHandler!!!! Do this in IMAPHandler! 111 // XXX IMAPHandler!!!! Do this in IMAPHandler!
112 tf.setIMAPHandler(new IMAPHandler(account)); 112 tf.setIMAPHandler(new IMAPHandler(account));
113 113
114 Folder folder; 114 Folder folder;
115 folder.setTopFolder(tf); 115 folder.setTopFolder(tf);
116 116
117 connect(tf.handler(), SIGNAL(IMAPLookingUpHost()), SLOT(slotIMAPLookingUpHost())); 117 connect(tf.handler(), SIGNAL(IMAPLookingUpHost()), SLOT(slotIMAPLookingUpHost()));
118 connect(tf.handler(), SIGNAL(IMAPHostFound()), SLOT(slotIMAPHostFound())); 118 connect(tf.handler(), SIGNAL(IMAPHostFound()), SLOT(slotIMAPHostFound()));
119 connect(tf.handler(), SIGNAL(IMAPConnected()), SLOT(slotIMAPConnected())); 119 connect(tf.handler(), SIGNAL(IMAPConnected()), SLOT(slotIMAPConnected()));
120 connect(tf.handler(), SIGNAL(IMAPDisconnected()), SLOT(slotIMAPDisconnected())); 120 connect(tf.handler(), SIGNAL(IMAPDisconnected()), SLOT(slotIMAPDisconnected()));
121 connect(tf.handler(), SIGNAL(IMAPError(int)), SLOT(slotIMAPError(int))); 121 connect(tf.handler(), SIGNAL(IMAPError(int)), SLOT(slotIMAPError(int)));
122 122
123 return new FolderWidgetItem(folder, this); 123 return new FolderWidgetItem(folder, this);
124} 124}
125 125
126FolderWidgetItem *FolderWidget::addFolder(Folder &folder, FolderWidgetItem *folderWidgetItem) 126FolderWidgetItem *FolderWidget::addFolder(Folder &folder, FolderWidgetItem *folderWidgetItem)
127{ 127{
128 return new FolderWidgetItem(folder, folderWidgetItem); 128 return new FolderWidgetItem(folder, folderWidgetItem);
129} 129}
130 130
131void FolderWidget::slotMenuActivated(int itemid) 131void FolderWidget::slotMenuActivated(int itemid)
132{ 132{
133 if (currentItem() == NULL) { 133 if (currentItem() == NULL) {
134 QMessageBox::information(this, tr("Error"), tr("<p>Please select an item first.</p>"), tr("Ok")); 134 QMessageBox::information(this, tr("Error"), tr("<p>Please select an item first.</p>"), tr("Ok"));
135 return; 135 return;
136 } 136 }
137 137
138 if (itemid == MENU_RENAME) { 138 if (itemid == MENU_RENAME) {
139 if (((FolderWidgetItem *)currentItem())->folder().fullName().isEmpty()) return; 139 if (((FolderWidgetItem *)currentItem())->folder().fullName().isEmpty()) return;
140 140
141 Folder folder = ((FolderWidgetItem *)currentItem())->folder(); 141 Folder folder = ((FolderWidgetItem *)currentItem())->folder();
142 QString newName = Rename::rename(folder.fullName(), this); 142 QString newName = Rename::rename(folder.fullName(), this);
143 if (newName.isNull()) return; 143 if (newName.isNull()) return;
144 144
145 folder.topFolder().handler()->iRename(folder.fullName(), newName); 145 folder.topFolder().handler()->iRename(folder.fullName(), newName);
146 connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPRename(IMAPResponse &))); 146 connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPRename(IMAPResponse&)));
147 } else if (itemid == MENU_DELETE) { 147 } else if (itemid == MENU_DELETE) {
148 if (((FolderWidgetItem *)currentItem())->folder().fullName().isEmpty()) return; 148 if (((FolderWidgetItem *)currentItem())->folder().fullName().isEmpty()) return;
149 149
150 Folder folder = ((FolderWidgetItem *)currentItem())->folder(); 150 Folder folder = ((FolderWidgetItem *)currentItem())->folder();
151 151
152 int ret = QMessageBox::information(this, tr("Question"), tr("<p>Do you really want to delete <pre>%1</pre>?").arg(folder.fullName()), tr("Yes"), tr("No")); 152 int ret = QMessageBox::information(this, tr("Question"), tr("<p>Do you really want to delete <pre>%1</pre>?").arg(folder.fullName()), tr("Yes"), tr("No"));
153 if (ret == 1) return; 153 if (ret == 1) return;
154 154
155 _createFolder = folder; 155 _createFolder = folder;
156 156
157 folder.topFolder().handler()->iDelete(folder.fullName()); 157 folder.topFolder().handler()->iDelete(folder.fullName());
158 connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPDelete(IMAPResponse &))); 158 connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPDelete(IMAPResponse&)));
159 } else if (itemid == MENU_MOVE) { 159 } else if (itemid == MENU_MOVE) {
160 160
161 } else if (itemid == MENU_COPY) { 161 } else if (itemid == MENU_COPY) {
162 162
163 } else if (itemid == MENU_CREATE) { 163 } else if (itemid == MENU_CREATE) {
164 Folder folder = (((FolderWidgetItem *)currentItem())->folder()); 164 Folder folder = (((FolderWidgetItem *)currentItem())->folder());
165 _createFolder = folder; 165 _createFolder = folder;
166 166
167 QString folderName = Rename::getText(tr("Foldername"), tr("<p>Please enter the name of the new folder.</p>"), this); 167 QString folderName = Rename::getText(tr("Foldername"), tr("<p>Please enter the name of the new folder.</p>"), this);
168 if (folderName.isNull()) return; 168 if (folderName.isNull()) return;
169 169
170 folder.topFolder().handler()->iCreate(folder.fullName() + folder.separator() + folderName); 170 folder.topFolder().handler()->iCreate(folder.fullName() + folder.separator() + folderName);
171 connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPCreate(IMAPResponse &))); 171 connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPCreate(IMAPResponse&)));
172 } else if (itemid == MENU_RESCAN) { 172 } else if (itemid == MENU_RESCAN) {
173 Folder folder = (((FolderWidgetItem *)currentItem())->folder()); 173 Folder folder = (((FolderWidgetItem *)currentItem())->folder());
174 _rescanAccount = folder.topFolder().account(); 174 _rescanAccount = folder.topFolder().account();
175 175
176 folder.topFolder().handler()->iList("", "*"); 176 folder.topFolder().handler()->iList("", "*");
177 connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPList(IMAPResponse &))); 177 connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPList(IMAPResponse&)));
178 } 178 }
179} 179}
180 180
181void FolderWidget::slotItemClicked(QListViewItem *item) 181void FolderWidget::slotItemClicked(QListViewItem *item)
182{ 182{
183 if (item == NULL) return; 183 if (item == NULL) return;
184 Folder folder = ((FolderWidgetItem *)item)->folder(); 184 Folder folder = ((FolderWidgetItem *)item)->folder();
185 if (folder.fullName().isEmpty()) return; 185 if (folder.fullName().isEmpty()) return;
186 186
187 emit folderSelected(folder); 187 emit folderSelected(folder);
188} 188}
189 189
190void FolderWidget::slotIMAPLookingUpHost() 190void FolderWidget::slotIMAPLookingUpHost()
191{ 191{
192 emit status(tr("Looking up host...")); 192 emit status(tr("Looking up host..."));
193 emit connecting(); 193 emit connecting();
194} 194}
195 195
196void FolderWidget::slotIMAPHostFound() 196void FolderWidget::slotIMAPHostFound()
197{ 197{
198 emit status(tr("Host found.")); 198 emit status(tr("Host found."));
199} 199}
200 200
201void FolderWidget::slotIMAPConnected() 201void FolderWidget::slotIMAPConnected()
202{ 202{
203 emit status(tr("Connected to host.")); 203 emit status(tr("Connected to host."));
204 emit connected(); 204 emit connected();
205} 205}
206 206
207void FolderWidget::slotIMAPError(int error) 207void FolderWidget::slotIMAPError(int error)
208{ 208{
209 if (error == IMAPBase::IMAPErrConnectionRefused) { 209 if (error == IMAPBase::IMAPErrConnectionRefused) {
210 QMessageBox::warning(this, tr("Error"), tr("<p>The IMAP connection was refused.</p>"), tr("Ok")); 210 QMessageBox::warning(this, tr("Error"), tr("<p>The IMAP connection was refused.</p>"), tr("Ok"));
211 } else if (error == IMAPBase::IMAPErrHostNotFound) { 211 } else if (error == IMAPBase::IMAPErrHostNotFound) {
212 QMessageBox::warning(this, tr("Error"), tr("<p>The host was not found.</p>"), tr("Ok")); 212 QMessageBox::warning(this, tr("Error"), tr("<p>The host was not found.</p>"), tr("Ok"));
213 } else if (error == IMAPBase::IMAPErrSocketRead) { 213 } else if (error == IMAPBase::IMAPErrSocketRead) {
214 QMessageBox::warning(this, tr("Error"), tr("<p>There was an error while reading from the socket.</p>"), tr("Ok")); 214 QMessageBox::warning(this, tr("Error"), tr("<p>There was an error while reading from the socket.</p>"), tr("Ok"));
215 } else if (error == IMAPBase::IMAPErrLoginFailed) { 215 } else if (error == IMAPBase::IMAPErrLoginFailed) {
216 QMessageBox::warning(this, tr("Error"), tr("<p>Login failed. Check your password/username.</p>"), tr("Ok")); 216 QMessageBox::warning(this, tr("Error"), tr("<p>Login failed. Check your password/username.</p>"), tr("Ok"));
217 } else { 217 } else {
218 QMessageBox::warning(this, tr("Error"), tr("<p>An unknown error was encountered.</p>"), tr("Ok")); 218 QMessageBox::warning(this, tr("Error"), tr("<p>An unknown error was encountered.</p>"), tr("Ok"));
219 } 219 }
220} 220}
221 221
222void FolderWidget::slotIMAPDisconnected() 222void FolderWidget::slotIMAPDisconnected()
223{ 223{
224 emit status(tr("Disconnected.")); 224 emit status(tr("Disconnected."));
225 emit disconnected(); 225 emit disconnected();
226} 226}
227 227
228void FolderWidget::slotIMAPLogin(IMAPResponse &response) 228void FolderWidget::slotIMAPLogin(IMAPResponse &response)
229{ 229{
230 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPLogin(IMAPResponse &))); 230 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPLogin(IMAPResponse&)));
231 231
232 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 232 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
233 emit status(tr("Login successful!")); 233 emit status(tr("Login successful!"));
234 } else { 234 } else {
235 QMessageBox::warning(this, tr("Error"), tr("<p>Login failed. Go away.</p>"), tr("Ok")); 235 QMessageBox::warning(this, tr("Error"), tr("<p>Login failed. Go away.</p>"), tr("Ok"));
236 } 236 }
237} 237}
238 238
239void FolderWidget::slotIMAPRename(IMAPResponse &response) 239void FolderWidget::slotIMAPRename(IMAPResponse &response)
240{ 240{
241 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPRename(IMAPResponse &))); 241 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPRename(IMAPResponse&)));
242 242
243 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 243 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
244 emit status(tr("Renaming successful!")); 244 emit status(tr("Renaming successful!"));
245 } else { 245 } else {
246 QMessageBox::warning(this, tr("Error"), tr("<p>Renaming failed. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok")); 246 QMessageBox::warning(this, tr("Error"), tr("<p>Renaming failed. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok"));
247 } 247 }
248} 248}
249 249
250void FolderWidget::slotIMAPDelete(IMAPResponse &response) 250void FolderWidget::slotIMAPDelete(IMAPResponse &response)
251{ 251{
252 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPDelete(IMAPResponse &))); 252 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPDelete(IMAPResponse&)));
253 253
254 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 254 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
255 emit status(tr("Deletion successful!")); 255 emit status(tr("Deletion successful!"));
256 256
257 _rescanAccount = _createFolder.topFolder().account(); 257 _rescanAccount = _createFolder.topFolder().account();
258 258
259 _createFolder.topFolder().handler()->iList(".", "*"); 259 _createFolder.topFolder().handler()->iList(".", "*");
260 connect(_createFolder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPList(IMAPResponse &))); 260 connect(_createFolder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPList(IMAPResponse&)));
261 } else { 261 } else {
262 QMessageBox::warning(this, tr("Error"), tr("<p>Delete failed. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok")); 262 QMessageBox::warning(this, tr("Error"), tr("<p>Delete failed. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok"));
263 } 263 }
264} 264}
265 265
266void FolderWidget::slotIMAPCreate(IMAPResponse &response) 266void FolderWidget::slotIMAPCreate(IMAPResponse &response)
267{ 267{
268 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPCreate(IMAPResponse &))); 268 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPCreate(IMAPResponse&)));
269 269
270 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 270 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
271 emit status(tr("Folder created. Rescanning...")); 271 emit status(tr("Folder created. Rescanning..."));
272 272
273 _rescanAccount = _createFolder.topFolder().account(); 273 _rescanAccount = _createFolder.topFolder().account();
274 274
275 _createFolder.topFolder().handler()->iList(".", "*"); 275 _createFolder.topFolder().handler()->iList(".", "*");
276 connect(_createFolder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPList(IMAPResponse &))); 276 connect(_createFolder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPList(IMAPResponse&)));
277 } else { 277 } else {
278 QMessageBox::warning(this, tr("Error"), tr("<p>The folder could not be created. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok")); 278 QMessageBox::warning(this, tr("Error"), tr("<p>The folder could not be created. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok"));
279 } 279 }
280} 280}
281 281
282void FolderWidget::slotIMAPList(IMAPResponse &response) 282void FolderWidget::slotIMAPList(IMAPResponse &response)
283{ 283{
284 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPList(IMAPResponse &))); 284 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPList(IMAPResponse&)));
285 285
286 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 286 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
287 QDir d((QString) getenv("HOME") + "/Applications/mail/foldercache"); 287 QDir d((QString) getenv("HOME") + "/Applications/mail/foldercache");
288 if (!d.exists()) { 288 if (!d.exists()) {
289 system("mkdir -p $HOME/Applications/mail/foldercache"); 289 system("mkdir -p $HOME/Applications/mail/foldercache");
290 qWarning("Created $HOME/Applications/mail/foldercache."); 290 qWarning("Created $HOME/Applications/mail/foldercache.");
291 } 291 }
292 QFile f((QString) getenv("HOME") + "/Applications/mail/foldercache/foldercache-" + _rescanAccount.accountName()); 292 QFile f((QString) getenv("HOME") + "/Applications/mail/foldercache/foldercache-" + _rescanAccount.accountName());
293 if (!f.open(IO_WriteOnly)) { 293 if (!f.open(IO_WriteOnly)) {
294 QMessageBox::critical(this, tr("Error"), tr("<p>Couldn't open folder cache file for writing!</p>"), tr("Ok")); 294 QMessageBox::critical(this, tr("Error"), tr("<p>Couldn't open folder cache file for writing!</p>"), tr("Ok"));
295 return; 295 return;
296 } 296 }
297 QTextStream t(&f); 297 QTextStream t(&f);
298 298
299 QValueList<IMAPResponseLIST>::Iterator it; 299 QValueList<IMAPResponseLIST>::Iterator it;
300 QValueList<IMAPResponseLIST> lists = response.LIST(); 300 QValueList<IMAPResponseLIST> lists = response.LIST();
301 for (it = lists.begin(); it != lists.end(); it++) { 301 for (it = lists.begin(); it != lists.end(); it++) {
302 t << (*it).folderSeparator() << "\n"; 302 t << (*it).folderSeparator() << "\n";
303 t << (*it).folder() << "\n"; 303 t << (*it).folder() << "\n";
304 } 304 }
305 305
306 f.close(); 306 f.close();
307 307
308 emit status(tr("Got folder list.")); 308 emit status(tr("Got folder list."));
309 getAccounts(); 309 getAccounts();
310 } else { 310 } else {
311 QMessageBox::warning(this, tr("Error"), tr("<p>Couldn't retrieve the folder list. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok")); 311 QMessageBox::warning(this, tr("Error"), tr("<p>Couldn't retrieve the folder list. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok"));
312 } 312 }
313} 313}
314 314
diff --git a/noncore/unsupported/mail2/libmail/imaphandler.cpp b/noncore/unsupported/mail2/libmail/imaphandler.cpp
index dc97b28..8da0acd 100644
--- a/noncore/unsupported/mail2/libmail/imaphandler.cpp
+++ b/noncore/unsupported/mail2/libmail/imaphandler.cpp
@@ -1,78 +1,78 @@
1#include "imapresponse.h" 1#include "imapresponse.h"
2#include "imaphandler.h" 2#include "imaphandler.h"
3#include "imapbase.h" 3#include "imapbase.h"
4 4
5IMAPHandler::IMAPHandler(const Account &account) 5IMAPHandler::IMAPHandler(const Account &account)
6 : QObject(), _account(account) 6 : QObject(), _account(account)
7{ 7{
8 _ready = false; 8 _ready = false;
9 _loggingin = false; 9 _loggingin = false;
10 _loggedin = false; 10 _loggedin = false;
11 _tag = 0; 11 _tag = 0;
12 _ibase = new IMAPBase(account); 12 _ibase = new IMAPBase(account);
13 13
14 connect(_ibase, SIGNAL(dataReceived(const QString &)), SLOT(slotDataReceived(const QString &))); 14 connect(_ibase, SIGNAL(dataReceived(const QString&)), SLOT(slotDataReceived(const QString&)));
15 connect(_ibase, SIGNAL(lookingUpHost()), SLOT(slotLookingUpHost())); 15 connect(_ibase, SIGNAL(lookingUpHost()), SLOT(slotLookingUpHost()));
16 connect(_ibase, SIGNAL(hostFound()), SLOT(slotHostFound())); 16 connect(_ibase, SIGNAL(hostFound()), SLOT(slotHostFound()));
17 connect(_ibase, SIGNAL(connected()), SLOT(slotConnected())); 17 connect(_ibase, SIGNAL(connected()), SLOT(slotConnected()));
18 connect(_ibase, SIGNAL(disconnected()), SLOT(slotDisconnected())); 18 connect(_ibase, SIGNAL(disconnected()), SLOT(slotDisconnected()));
19 connect(_ibase, SIGNAL(error(int)), SLOT(slotError(int))); 19 connect(_ibase, SIGNAL(error(int)), SLOT(slotError(int)));
20} 20}
21 21
22void IMAPHandler::doLogin() 22void IMAPHandler::doLogin()
23{ 23{
24 if (_loggedin) return; 24 if (_loggedin) return;
25 if (_loggingin) return; 25 if (_loggingin) return;
26 26
27 _loggingin = true; 27 _loggingin = true;
28 iLogin(_account.user(), _account.pass()); 28 iLogin(_account.user(), _account.pass());
29} 29}
30 30
31QString IMAPHandler::iCapability() 31QString IMAPHandler::iCapability()
32{ 32{
33 _ibase->sendCommand(QString("%1 CAPABILITY\r\n") 33 _ibase->sendCommand(QString("%1 CAPABILITY\r\n")
34 .arg(tag())); 34 .arg(tag()));
35 return tag(false); 35 return tag(false);
36} 36}
37 37
38QString IMAPHandler::iNoop() 38QString IMAPHandler::iNoop()
39{ 39{
40 _ibase->sendCommand(QString("%1 NOOP\r\n") 40 _ibase->sendCommand(QString("%1 NOOP\r\n")
41 .arg(tag())); 41 .arg(tag()));
42 return tag(false); 42 return tag(false);
43} 43}
44 44
45QString IMAPHandler::iLogout() 45QString IMAPHandler::iLogout()
46{ 46{
47 _ibase->sendCommand(QString("%1 LOGOUT\r\n") 47 _ibase->sendCommand(QString("%1 LOGOUT\r\n")
48 .arg(tag())); 48 .arg(tag()));
49 return tag(false); 49 return tag(false);
50} 50}
51 51
52QString IMAPHandler::iAuthenticate(const QString &mechanism) 52QString IMAPHandler::iAuthenticate(const QString &mechanism)
53{ 53{
54 _ibase->sendCommand(QString("%1 AUTHENTICATE \"%2\"\r\n") 54 _ibase->sendCommand(QString("%1 AUTHENTICATE \"%2\"\r\n")
55 .arg(tag()) 55 .arg(tag())
56 .arg(escape(mechanism))); 56 .arg(escape(mechanism)));
57 return tag(false); 57 return tag(false);
58} 58}
59 59
60QString IMAPHandler::iLogin(const QString &user, const QString &pass) 60QString IMAPHandler::iLogin(const QString &user, const QString &pass)
61{ 61{
62 _ibase->sendCommand(QString("%1 LOGIN \"%2\" \"%3\"\r\n") 62 _ibase->sendCommand(QString("%1 LOGIN \"%2\" \"%3\"\r\n")
63 .arg(tag()) 63 .arg(tag())
64 .arg(escape(user)) 64 .arg(escape(user))
65 .arg(escape(pass))); 65 .arg(escape(pass)));
66 return tag(false); 66 return tag(false);
67} 67}
68 68
69QString IMAPHandler::iSelect(const QString &mailbox) 69QString IMAPHandler::iSelect(const QString &mailbox)
70{ 70{
71 doLogin(); 71 doLogin();
72 72
73 _ibase->sendCommand(QString("%1 SELECT \"%2\"\r\n") 73 _ibase->sendCommand(QString("%1 SELECT \"%2\"\r\n")
74 .arg(tag()) 74 .arg(tag())
75 .arg(escape(mailbox))); 75 .arg(escape(mailbox)));
76 return tag(false); 76 return tag(false);
77} 77}
78 78
@@ -238,109 +238,109 @@ QString IMAPHandler::iStore(const QString &message, const QString &items)
238 doLogin(); 238 doLogin();
239 239
240 _ibase->sendCommand(QString("%1 STORE %2 %3\r\n") 240 _ibase->sendCommand(QString("%1 STORE %2 %3\r\n")
241 .arg(tag()) 241 .arg(tag())
242 .arg(message) 242 .arg(message)
243 .arg(items)); 243 .arg(items));
244 return tag(false); 244 return tag(false);
245} 245}
246 246
247QString IMAPHandler::iCopy(const QString &message, const QString &mailbox) 247QString IMAPHandler::iCopy(const QString &message, const QString &mailbox)
248{ 248{
249 doLogin(); 249 doLogin();
250 250
251 _ibase->sendCommand(QString("%1 COPY %2 \"%3\"\r\n") 251 _ibase->sendCommand(QString("%1 COPY %2 \"%3\"\r\n")
252 .arg(tag()) 252 .arg(tag())
253 .arg(message) 253 .arg(message)
254 .arg(escape(mailbox))); 254 .arg(escape(mailbox)));
255 return tag(false); 255 return tag(false);
256} 256}
257 257
258QString IMAPHandler::iUid(const QString &command, const QString &arguments) 258QString IMAPHandler::iUid(const QString &command, const QString &arguments)
259{ 259{
260 doLogin(); 260 doLogin();
261 261
262 _ibase->sendCommand(QString("%1 UID %2 %3\r\n") 262 _ibase->sendCommand(QString("%1 UID %2 %3\r\n")
263 .arg(tag()) 263 .arg(tag())
264 .arg(command) 264 .arg(command)
265 .arg(arguments)); 265 .arg(arguments));
266 return tag(false); 266 return tag(false);
267} 267}
268 268
269QString IMAPHandler::iX(const QString &commandAtom, const QString &arguments) 269QString IMAPHandler::iX(const QString &commandAtom, const QString &arguments)
270{ 270{
271 doLogin(); 271 doLogin();
272 272
273 _ibase->sendCommand(QString("%1 X%2 %3\r\n") 273 _ibase->sendCommand(QString("%1 X%2 %3\r\n")
274 .arg(tag()) 274 .arg(tag())
275 .arg(commandAtom) 275 .arg(commandAtom)
276 .arg(arguments)); 276 .arg(arguments));
277 return tag(false); 277 return tag(false);
278} 278}
279 279
280QString IMAPHandler::escape(const QString &in) 280QString IMAPHandler::escape(const QString &in)
281{ 281{
282 QString in_ = in; 282 QString in_ = in;
283 return in_.replace(QRegExp("\""), "\\\""); 283 return in_.replace(QRegExp("\""), "\\\"");
284} 284}
285 285
286QString IMAPHandler::tag(bool count) 286QString IMAPHandler::tag(bool count)
287{ 287{
288 return QString("a%1").arg(count ? _tag++ : _tag); 288 return QString("a%1").arg(count ? _tag++ : _tag);
289} 289}
290 290
291void IMAPHandler::slotDataReceived(const QString &data) 291void IMAPHandler::slotDataReceived(const QString &data)
292{ 292{
293 if (!_ready) { 293 if (!_ready) {
294 // The first data is always the greeting string. 294 // The first data is always the greeting string.
295 // We can ignore it. 295 // We can ignore it.
296 _ready = true; 296 _ready = true;
297 return; 297 return;
298 } 298 }
299 299
300 300
301 IMAPResponseParser parser; 301 IMAPResponseParser parser;
302 //connect ( &parser, SIGNAL( needMoreData ( QString & )), _ibase, SLOT( tryRead ( QString & ))); 302 //connect ( &parser, SIGNAL( needMoreData(QString&)), _ibase, SLOT( tryRead(QString&)));
303 parser. parse ( data ); 303 parser. parse ( data );
304 IMAPResponse response = parser.response(); 304 IMAPResponse response = parser.response();
305 //disconnect ( &parser, SIGNAL( needMoreData ( QString & )), _ibase, SLOT( tryRead ( QString & ))); 305 //disconnect ( &parser, SIGNAL( needMoreData(QString&)), _ibase, SLOT( tryRead(QString&)));
306 response.setImapHandler(this); 306 response.setImapHandler(this);
307 307
308 if (!_loggingin) { qDebug("Emitting gotResponse!\n" ); emit gotResponse(response); } 308 if (!_loggingin) { qDebug("Emitting gotResponse!\n" ); emit gotResponse(response); }
309 else { 309 else {
310 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 310 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
311 _loggingin = false; 311 _loggingin = false;
312 _loggedin = true; 312 _loggedin = true;
313 qWarning("OK. Logged in. Leaving loggingin state."); 313 qWarning("OK. Logged in. Leaving loggingin state.");
314 } else { 314 } else {
315 _loggingin = false; 315 _loggingin = false;
316 emit IMAPError(IMAPBase::IMAPErrLoginFailed); 316 emit IMAPError(IMAPBase::IMAPErrLoginFailed);
317 } 317 }
318 } 318 }
319} 319}
320 320
321void IMAPHandler::slotLookingUpHost() 321void IMAPHandler::slotLookingUpHost()
322{ 322{
323 emit IMAPLookingUpHost(); 323 emit IMAPLookingUpHost();
324} 324}
325 325
326void IMAPHandler::slotHostFound() 326void IMAPHandler::slotHostFound()
327{ 327{
328 emit IMAPHostFound(); 328 emit IMAPHostFound();
329} 329}
330 330
331void IMAPHandler::slotConnected() 331void IMAPHandler::slotConnected()
332{ 332{
333 emit IMAPConnected(); 333 emit IMAPConnected();
334} 334}
335 335
336void IMAPHandler::slotDisconnected() 336void IMAPHandler::slotDisconnected()
337{ 337{
338 _loggedin = false; 338 _loggedin = false;
339 emit IMAPDisconnected(); 339 emit IMAPDisconnected();
340} 340}
341 341
342void IMAPHandler::slotError(int err) 342void IMAPHandler::slotError(int err)
343{ 343{
344 emit IMAPError(err); 344 emit IMAPError(err);
345} 345}
346 346
diff --git a/noncore/unsupported/mail2/listviewplus.cpp b/noncore/unsupported/mail2/listviewplus.cpp
index ce5f35f..722b347 100644
--- a/noncore/unsupported/mail2/listviewplus.cpp
+++ b/noncore/unsupported/mail2/listviewplus.cpp
@@ -1,54 +1,54 @@
1#include <qpopupmenu.h> 1#include <qpopupmenu.h>
2#include <qtimer.h> 2#include <qtimer.h>
3 3
4#include "listviewplus.h" 4#include "listviewplus.h"
5 5
6ListViewPlus::ListViewPlus(QWidget *parent, const char *name, WFlags fl) 6ListViewPlus::ListViewPlus(QWidget *parent, const char *name, WFlags fl)
7 : QListView(parent, name, fl) 7 : QListView(parent, name, fl)
8{ 8{
9 9
10} 10}
11 11
12void ListViewPlus::keyPressEvent(QKeyEvent *event) 12void ListViewPlus::keyPressEvent(QKeyEvent *event)
13{ 13{
14 switch(event->key()) { 14 switch(event->key()) {
15 case Qt::Key_Space: // FALLTHROUGH 15 case Qt::Key_Space: // FALLTHROUGH
16 case Qt::Key_Enter: 16 case Qt::Key_Enter:
17 if (currentItem() != 0) 17 if (currentItem() != 0)
18 emit clicked(currentItem()); 18 emit clicked(currentItem());
19 break; 19 break;
20 default: break; 20 default: break;
21 } 21 }
22 22
23 QListView::keyPressEvent(event); 23 QListView::keyPressEvent(event);
24} 24}
25 25
26void ListViewPlus::setPopup(QPopupMenu *popup, int delay) 26void ListViewPlus::setPopup(QPopupMenu *popup, int delay)
27{ 27{
28 _popup = popup; 28 _popup = popup;
29 _delay = delay; 29 _delay = delay;
30 30
31 connect(this, SIGNAL(pressed(QListViewItem *, const QPoint &, int)), SLOT(_initPopup(QListViewItem *, const QPoint &, int))); 31 connect(this, SIGNAL(pressed(QListViewItem*,const QPoint&,int)), SLOT(_initPopup(QListViewItem*,const QPoint&,int)));
32 connect(this, SIGNAL(clicked(QListViewItem *, const QPoint &, int)), SLOT(_cancelPopup(QListViewItem *, const QPoint &, int))); 32 connect(this, SIGNAL(clicked(QListViewItem*,const QPoint&,int)), SLOT(_cancelPopup(QListViewItem*,const QPoint&,int)));
33} 33}
34 34
35void ListViewPlus::_initPopup(QListViewItem *, const QPoint &point, int) 35void ListViewPlus::_initPopup(QListViewItem *, const QPoint &point, int)
36{ 36{
37 _point = point; 37 _point = point;
38 38
39 _timer = new QTimer(); 39 _timer = new QTimer();
40 _timer->start(_delay, true); 40 _timer->start(_delay, true);
41 41
42 connect(_timer, SIGNAL(timeout()), this, SLOT(_showPopup())); 42 connect(_timer, SIGNAL(timeout()), this, SLOT(_showPopup()));
43} 43}
44 44
45void ListViewPlus::_cancelPopup(QListViewItem *, const QPoint &, int) 45void ListViewPlus::_cancelPopup(QListViewItem *, const QPoint &, int)
46{ 46{
47 delete _timer; 47 delete _timer;
48} 48}
49 49
50void ListViewPlus::_showPopup() 50void ListViewPlus::_showPopup()
51{ 51{
52 _popup->popup(_point); 52 _popup->popup(_point);
53} 53}
54 54
diff --git a/noncore/unsupported/mail2/mailtable.cpp b/noncore/unsupported/mail2/mailtable.cpp
index fd179f0..56feab0 100644
--- a/noncore/unsupported/mail2/mailtable.cpp
+++ b/noncore/unsupported/mail2/mailtable.cpp
@@ -13,159 +13,159 @@ MailTableItem::MailTableItem(QListView *parent, IMAPResponseFETCH fetch)
13 _draft = false; 13 _draft = false;
14 _new = false; 14 _new = false;
15 _unseen = true; 15 _unseen = true;
16 16
17 QValueList<IMAPResponseEnums::IMAPResponseFlags>::Iterator it; 17 QValueList<IMAPResponseEnums::IMAPResponseFlags>::Iterator it;
18 QValueList<IMAPResponseEnums::IMAPResponseFlags> flags = fetch.flags(); 18 QValueList<IMAPResponseEnums::IMAPResponseFlags> flags = fetch.flags();
19 for (it = flags.begin(); it != flags.end(); it++) { 19 for (it = flags.begin(); it != flags.end(); it++) {
20 if (*it == IMAPResponseEnums::Draft) _draft = true; 20 if (*it == IMAPResponseEnums::Draft) _draft = true;
21 else if (*it == IMAPResponseEnums::Recent) _new = true; 21 else if (*it == IMAPResponseEnums::Recent) _new = true;
22 else if (*it == IMAPResponseEnums::Seen) _unseen = false; 22 else if (*it == IMAPResponseEnums::Seen) _unseen = false;
23 } 23 }
24 24
25 setText(0, fetch.envelope().from()[0].name().isEmpty() ? QObject::tr("(no from)") : fetch.envelope().from()[0].name()); 25 setText(0, fetch.envelope().from()[0].name().isEmpty() ? QObject::tr("(no from)") : fetch.envelope().from()[0].name());
26 setText(1, fetch.envelope().subject().isEmpty() ? QObject::tr("(no subject)") : fetch.envelope().subject()); 26 setText(1, fetch.envelope().subject().isEmpty() ? QObject::tr("(no subject)") : fetch.envelope().subject());
27 setText(2, fetch.envelope().mailDate().isEmpty() ? QObject::tr("(no date)") : fetch.envelope().mailDate()); 27 setText(2, fetch.envelope().mailDate().isEmpty() ? QObject::tr("(no date)") : fetch.envelope().mailDate());
28} 28}
29 29
30void MailTableItem::paintCell(QPainter *painter, const QColorGroup &cg, int col, int width, int align) 30void MailTableItem::paintCell(QPainter *painter, const QColorGroup &cg, int col, int width, int align)
31{ 31{
32 QColor color = cg.color(QColorGroup::Text); 32 QColor color = cg.color(QColorGroup::Text);
33 QFont font = painter->font(); 33 QFont font = painter->font();
34 if (_draft) { 34 if (_draft) {
35 color = QColor("#707070"); 35 color = QColor("#707070");
36 } else if (_new) { 36 } else if (_new) {
37 color = QColor("#ff0000"); 37 color = QColor("#ff0000");
38 font.setBold(true); 38 font.setBold(true);
39 } else if (_unseen) { 39 } else if (_unseen) {
40 font.setBold(true); 40 font.setBold(true);
41 } 41 }
42 42
43 painter->setFont(font); 43 painter->setFont(font);
44 QColorGroup cg_(cg); 44 QColorGroup cg_(cg);
45 cg_.setColor(QColorGroup::Text, color); 45 cg_.setColor(QColorGroup::Text, color);
46 46
47 QListViewItem::paintCell(painter, cg_, col, width, align); 47 QListViewItem::paintCell(painter, cg_, col, width, align);
48} 48}
49 49
50MailTable::MailTable(QWidget *parent, const char *name, WFlags fl) 50MailTable::MailTable(QWidget *parent, const char *name, WFlags fl)
51 : ListViewPlus(parent, name, fl), _parent(parent) 51 : ListViewPlus(parent, name, fl), _parent(parent)
52{ 52{
53 _stopped = false; 53 _stopped = false;
54 54
55 setSorting(-1); 55 setSorting(-1);
56 56
57 setAllColumnsShowFocus(true); 57 setAllColumnsShowFocus(true);
58 addColumn(tr("From"), 100); 58 addColumn(tr("From"), 100);
59 addColumn(tr("Subject"), 100); 59 addColumn(tr("Subject"), 100);
60 addColumn(tr("Date"), 100); 60 addColumn(tr("Date"), 100);
61 61
62 QPopupMenu *menu = new QPopupMenu(this); 62 QPopupMenu *menu = new QPopupMenu(this);
63 menu->insertItem(tr("Copy"), MENU_COPY); 63 menu->insertItem(tr("Copy"), MENU_COPY);
64 64
65 QPopupMenu *markMenu = new QPopupMenu(this); 65 QPopupMenu *markMenu = new QPopupMenu(this);
66 markMenu->insertItem(tr("Seen"), MENU_MARK_READ); 66 markMenu->insertItem(tr("Seen"), MENU_MARK_READ);
67 markMenu->insertItem(tr("Unseen"), MENU_MARK_UNREAD); 67 markMenu->insertItem(tr("Unseen"), MENU_MARK_UNREAD);
68 markMenu->insertSeparator(); 68 markMenu->insertSeparator();
69 markMenu->insertItem(tr("Marked"), MENU_MARK_MARKED); 69 markMenu->insertItem(tr("Marked"), MENU_MARK_MARKED);
70 markMenu->insertItem(tr("Unmarked"), MENU_MARK_UNMARKED); 70 markMenu->insertItem(tr("Unmarked"), MENU_MARK_UNMARKED);
71 71
72 menu->insertItem(tr("Mark as..."), markMenu, MENU_MARK); 72 menu->insertItem(tr("Mark as..."), markMenu, MENU_MARK);
73 menu->insertSeparator(); 73 menu->insertSeparator();
74 menu->insertItem(tr("Delete Mail"), MENU_DELETE); 74 menu->insertItem(tr("Delete Mail"), MENU_DELETE);
75 setPopup(menu); 75 setPopup(menu);
76 76
77 connect(this, SIGNAL(clicked(QListViewItem *)), SLOT(itemClicked(QListViewItem *))); 77 connect(this, SIGNAL(clicked(QListViewItem*)), SLOT(itemClicked(QListViewItem*)));
78} 78}
79 79
80void MailTable::setFolder(Folder folder) 80void MailTable::setFolder(Folder folder)
81{ 81{
82 folder.topFolder().handler()->iSelect(folder.fullName()); 82 folder.topFolder().handler()->iSelect(folder.fullName());
83 _handler = folder.topFolder().handler(); 83 _handler = folder.topFolder().handler();
84 connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPSelect(IMAPResponse &))); 84 connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPSelect(IMAPResponse&)));
85} 85}
86 86
87void MailTable::setHeaders(QValueList<IMAPResponseFETCH> response) 87void MailTable::setHeaders(QValueList<IMAPResponseFETCH> response)
88{ 88{
89 clear(); 89 clear();
90 QValueList<IMAPResponseFETCH>::Iterator it; 90 QValueList<IMAPResponseFETCH>::Iterator it;
91 for (it = response.begin(); it != response.end(); it++) { 91 for (it = response.begin(); it != response.end(); it++) {
92 (void) new MailTableItem(this, *it); 92 (void) new MailTableItem(this, *it);
93 } 93 }
94} 94}
95 95
96void MailTable::slotIMAPSelect(IMAPResponse &response) 96void MailTable::slotIMAPSelect(IMAPResponse &response)
97{ 97{
98 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPSelect(IMAPResponse &))); 98 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPSelect(IMAPResponse&)));
99 99
100 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 100 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
101 clear(); 101 clear();
102 QString mails = response.EXISTS()[0].mails(); 102 QString mails = response.EXISTS()[0].mails();
103 if (mails.toInt() == 0) { 103 if (mails.toInt() == 0) {
104 emit status(tr("Mailbox contained no mails.")); 104 emit status(tr("Mailbox contained no mails."));
105 return; 105 return;
106 } 106 }
107 int a = mails.toInt() / 5; 107 int a = mails.toInt() / 5;
108 int b = mails.toInt() % 5; 108 int b = mails.toInt() % 5;
109 109
110 _downloadSteps = a; 110 _downloadSteps = a;
111 if (b > 0) _downloadSteps++; 111 if (b > 0) _downloadSteps++;
112 _lastStep = b; 112 _lastStep = b;
113 _currentProgress = 0; 113 _currentProgress = 0;
114 114
115 emit totalSteps(_downloadSteps); 115 emit totalSteps(_downloadSteps);
116 emit progress(_currentProgress); 116 emit progress(_currentProgress);
117 emit stopEnabled(true); 117 emit stopEnabled(true);
118 118
119 response.imapHandler()->iFetch(QString("1:%1").arg((a == 0) ? b : 5), "ENVELOPE FLAGS UID"); 119 response.imapHandler()->iFetch(QString("1:%1").arg((a == 0) ? b : 5), "ENVELOPE FLAGS UID");
120 emit status(tr("Getting mail headers...")); 120 emit status(tr("Getting mail headers..."));
121 connect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPFetch(IMAPResponse &))); 121 connect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPFetch(IMAPResponse&)));
122 } else { 122 } else {
123 QMessageBox::warning(this, tr("Error"), tr("<p>An error occoured during the selection of the mailbox. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok")); 123 QMessageBox::warning(this, tr("Error"), tr("<p>An error occoured during the selection of the mailbox. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok"));
124 } 124 }
125} 125}
126 126
127void MailTable::slotIMAPFetch(IMAPResponse &response) 127void MailTable::slotIMAPFetch(IMAPResponse &response)
128{ 128{
129 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPFetch(IMAPResponse &))); 129 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPFetch(IMAPResponse&)));
130 130
131 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 131 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
132 QValueList<IMAPResponseFETCH>::Iterator it; 132 QValueList<IMAPResponseFETCH>::Iterator it;
133 QValueList<IMAPResponseFETCH> fetch = response.FETCH(); 133 QValueList<IMAPResponseFETCH> fetch = response.FETCH();
134 for (it = fetch.begin(); it != fetch.end(); it++) { 134 for (it = fetch.begin(); it != fetch.end(); it++) {
135 (void) new MailTableItem(this, *it); 135 (void) new MailTableItem(this, *it);
136 } 136 }
137 emit progress(++_currentProgress); 137 emit progress(++_currentProgress);
138 138
139 if (_currentProgress != _downloadSteps) { 139 if (_currentProgress != _downloadSteps) {
140 if (_stopped) { 140 if (_stopped) {
141 _currentProgress = 0; 141 _currentProgress = 0;
142 _downloadSteps = 0; 142 _downloadSteps = 0;
143 _lastStep = 0; 143 _lastStep = 0;
144 _stopped = false; 144 _stopped = false;
145 emit status(tr("Stopped")); 145 emit status(tr("Stopped"));
146 emit resetProgress(); 146 emit resetProgress();
147 emit stopEnabled(false); 147 emit stopEnabled(false);
148 } else { 148 } else {
149 response.imapHandler()->iFetch(QString("%1:%2").arg(_currentProgress * 5 + 1).arg((_currentProgress + 1 == _downloadSteps) ? _currentProgress * 5 + _lastStep : _currentProgress * 5 + 5), "ENVELOPE FLAGS UID"); 149 response.imapHandler()->iFetch(QString("%1:%2").arg(_currentProgress * 5 + 1).arg((_currentProgress + 1 == _downloadSteps) ? _currentProgress * 5 + _lastStep : _currentProgress * 5 + 5), "ENVELOPE FLAGS UID");
150 connect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPFetch(IMAPResponse &))); 150 connect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPFetch(IMAPResponse&)));
151 } 151 }
152 } else { 152 } else {
153 _currentProgress = 0; 153 _currentProgress = 0;
154 _downloadSteps = 0; 154 _downloadSteps = 0;
155 _lastStep = 0; 155 _lastStep = 0;
156 emit status(tr("Got all mail headers.")); 156 emit status(tr("Got all mail headers."));
157 emit resetProgress(); 157 emit resetProgress();
158 emit stopEnabled(false); 158 emit stopEnabled(false);
159 } 159 }
160 } else { 160 } else {
161 emit status(tr("<font color=#ff0000>Couldn't fetch mail.")); 161 emit status(tr("<font color=#ff0000>Couldn't fetch mail."));
162 } 162 }
163} 163}
164 164
165void MailTable::itemClicked(QListViewItem *item) 165void MailTable::itemClicked(QListViewItem *item)
166{ 166{
167 if (item == NULL) return; 167 if (item == NULL) return;
168 emit mailClicked(((MailTableItem *)item)->fetch(), _handler); 168 emit mailClicked(((MailTableItem *)item)->fetch(), _handler);
169} 169}
170 170
171 171
diff --git a/noncore/unsupported/mail2/mainwindow.cpp b/noncore/unsupported/mail2/mainwindow.cpp
index 0d09ec8..ce80391 100644
--- a/noncore/unsupported/mail2/mainwindow.cpp
+++ b/noncore/unsupported/mail2/mainwindow.cpp
@@ -1,110 +1,110 @@
1#include <qmessagebox.h> 1#include <qmessagebox.h>
2#include <qaction.h> 2#include <qaction.h>
3#include <qapplication.h> 3#include <qapplication.h>
4 4
5#include <qpe/qcopenvelope_qws.h> 5#include <qpe/qcopenvelope_qws.h>
6 6
7#include "mailstatusbar.h" 7#include "mailstatusbar.h"
8#include "folderwidget.h" 8#include "folderwidget.h"
9#include "mainwindow.h" 9#include "mainwindow.h"
10#include "configdiag.h" 10#include "configdiag.h"
11#include "configfile.h" 11#include "configfile.h"
12#include "searchdiag.h" 12#include "searchdiag.h"
13#include "mailtable.h" 13#include "mailtable.h"
14#include "composer.h" 14#include "composer.h"
15#include "viewmail.h" 15#include "viewmail.h"
16#include "mailfactory.h" 16#include "mailfactory.h"
17 17
18MainWindow::MainWindow(QWidget *parent, const char *name, WFlags fl) 18MainWindow::MainWindow(QWidget *parent, const char *name, WFlags fl)
19 : MainWindowBase(parent, name, fl) 19 : MainWindowBase(parent, name, fl)
20{ 20{
21 status->setStopEnabled(false); 21 status->setStopEnabled(false);
22 22
23 connect(folderView, SIGNAL(status(const QString &)), status, SLOT(setStatusText(const QString &))); 23 connect(folderView, SIGNAL(status(const QString&)), status, SLOT(setStatusText(const QString&)));
24 connect(folderView, SIGNAL(folderSelected(Folder)), mailView, SLOT(setFolder(Folder))); 24 connect(folderView, SIGNAL(folderSelected(Folder)), mailView, SLOT(setFolder(Folder)));
25 25
26 connect(mailView, SIGNAL(mailClicked(IMAPResponseFETCH, IMAPHandler *)), SLOT(mailClicked(IMAPResponseFETCH, IMAPHandler *))); 26 connect(mailView, SIGNAL(mailClicked(IMAPResponseFETCH,IMAPHandler*)), SLOT(mailClicked(IMAPResponseFETCH,IMAPHandler*)));
27 connect(mailView, SIGNAL(status(const QString &)), status, SLOT(setStatusText(const QString &))); 27 connect(mailView, SIGNAL(status(const QString&)), status, SLOT(setStatusText(const QString&)));
28 connect(mailView, SIGNAL(totalSteps(int)), status, SLOT(setProgressTotalSteps(int))); 28 connect(mailView, SIGNAL(totalSteps(int)), status, SLOT(setProgressTotalSteps(int)));
29 connect(mailView, SIGNAL(progress(int)), status, SLOT(setProgress(int))); 29 connect(mailView, SIGNAL(progress(int)), status, SLOT(setProgress(int)));
30 connect(mailView, SIGNAL(resetProgress()), status, SLOT(resetProgress())); 30 connect(mailView, SIGNAL(resetProgress()), status, SLOT(resetProgress()));
31 connect(mailView, SIGNAL(stopEnabled(bool)), status, SLOT(setStopEnabled(bool))); 31 connect(mailView, SIGNAL(stopEnabled(bool)), status, SLOT(setStopEnabled(bool)));
32 32
33 connect(status, SIGNAL(stop()), mailView, SLOT(stop())); 33 connect(status, SIGNAL(stop()), mailView, SLOT(stop()));
34 34
35 connect(compose, SIGNAL(activated()), SLOT(slotComposeNoParams())); 35 connect(compose, SIGNAL(activated()), SLOT(slotComposeNoParams()));
36 connect(sendQueue, SIGNAL(activated()), SLOT(slotSendQueued())); 36 connect(sendQueue, SIGNAL(activated()), SLOT(slotSendQueued()));
37 connect(findmails, SIGNAL(activated()), SLOT(slotSearch())); 37 connect(findmails, SIGNAL(activated()), SLOT(slotSearch()));
38 connect(configure, SIGNAL(activated()), SLOT(slotConfigure())); 38 connect(configure, SIGNAL(activated()), SLOT(slotConfigure()));
39 39
40 // Added by Stefan Eilers to allow starting by addressbook.. 40 // Added by Stefan Eilers to allow starting by addressbook..
41#if !defined(QT_NO_COP) 41#if !defined(QT_NO_COP)
42 // QCopChannel *addressChannel = new QCopChannel("QPE/Application/mail" , this ); 42 // QCopChannel *addressChannel = new QCopChannel("QPE/Application/mail" , this );
43 // connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), 43 // connect (addressChannel, SIGNAL( received(const QCString&,const QByteArray&)),
44 // this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); 44 // this, SLOT ( appMessage(const QCString&,const QByteArray&) ) );
45 connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ), 45 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
46 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); 46 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
47#endif 47#endif
48} 48}
49 49
50// Added by Stefan Eilers to allow starting by addressbook.. 50// Added by Stefan Eilers to allow starting by addressbook..
51void MainWindow::appMessage(const QCString &msg, const QByteArray &data) 51void MainWindow::appMessage(const QCString &msg, const QByteArray &data)
52{ 52{
53 if (msg == "writeMail(QString,QString)") { 53 if (msg == "writeMail(QString,QString)") {
54 QDataStream stream(data,IO_ReadOnly); 54 QDataStream stream(data,IO_ReadOnly);
55 QString name, email; 55 QString name, email;
56 stream >> name >> email; 56 stream >> name >> email;
57 57
58 qWarning("opie-mail:: Should send mail to %s with address %s", name.latin1(), email.latin1() ); 58 qWarning("opie-mail:: Should send mail to %s with address %s", name.latin1(), email.latin1() );
59 59
60 slotCompose( name, email ); 60 slotCompose( name, email );
61 61
62 }else{ 62 }else{
63 QString str_message = msg; 63 QString str_message = msg;
64 qWarning("opie-mail:: Received unknown QCop-Message: %s", str_message.latin1() ); 64 qWarning("opie-mail:: Received unknown QCop-Message: %s", str_message.latin1() );
65 } 65 }
66} 66}
67 67
68void MainWindow::slotCompose( const QString& name, const QString& email ) 68void MainWindow::slotCompose( const QString& name, const QString& email )
69{ 69{
70 Composer composer(this, 0, true); 70 Composer composer(this, 0, true);
71 71
72 // If there is a mailaddress given, create message.. 72 // If there is a mailaddress given, create message..
73 if ( ! name.isEmpty() ){ 73 if ( ! name.isEmpty() ){
74 qWarning("opie-mail:: Compose mail for %s with address %s", name.latin1(), email.latin1() ); 74 qWarning("opie-mail:: Compose mail for %s with address %s", name.latin1(), email.latin1() );
75 SendMail compMail; 75 SendMail compMail;
76 compMail.setTo( "\"" + name + "\"" + " " + "<"+ email + ">"); 76 compMail.setTo( "\"" + name + "\"" + " " + "<"+ email + ">");
77 composer.setSendMail( compMail ); 77 composer.setSendMail( compMail );
78 } 78 }
79 composer.showMaximized(); 79 composer.showMaximized();
80 composer.exec(); 80 composer.exec();
81} 81}
82 82
83void MainWindow::slotComposeNoParams() 83void MainWindow::slotComposeNoParams()
84{ 84{
85 slotCompose( 0l, 0l); 85 slotCompose( 0l, 0l);
86} 86}
87 87
88void MainWindow::slotSendQueued() 88void MainWindow::slotSendQueued()
89{ 89{
90 Composer composer(this, 0, true, true); 90 Composer composer(this, 0, true, true);
91 // composer.sendQueue(); 91 // composer.sendQueue();
92 composer.showMaximized(); 92 composer.showMaximized();
93 composer.exec(); 93 composer.exec();
94 //composer.close(); 94 //composer.close();
95} 95}
96 96
97void MainWindow::slotSearch() 97void MainWindow::slotSearch()
98{ 98{
99 SearchDiag searchDiag(this, 0, true); 99 SearchDiag searchDiag(this, 0, true);
100 searchDiag.showMaximized(); 100 searchDiag.showMaximized();
101 searchDiag.exec(); 101 searchDiag.exec();
102} 102}
103 103
104void MainWindow::slotConfigure() 104void MainWindow::slotConfigure()
105{ 105{
106 ConfigDiag configDiag(this, 0, true); 106 ConfigDiag configDiag(this, 0, true);
107 configDiag.showMaximized(); 107 configDiag.showMaximized();
108 configDiag.exec(); 108 configDiag.exec();
109 109
110 connect(&configDiag, SIGNAL(changed()), folderView, SLOT(update())); 110 connect(&configDiag, SIGNAL(changed()), folderView, SLOT(update()));
diff --git a/noncore/unsupported/mail2/searchdiag.cpp b/noncore/unsupported/mail2/searchdiag.cpp
index 907f6ff..6fb4e4d 100644
--- a/noncore/unsupported/mail2/searchdiag.cpp
+++ b/noncore/unsupported/mail2/searchdiag.cpp
@@ -1,128 +1,128 @@
1#include <qmessagebox.h> 1#include <qmessagebox.h>
2#include <qpushbutton.h> 2#include <qpushbutton.h>
3#include <qcombobox.h> 3#include <qcombobox.h>
4#include <qlineedit.h> 4#include <qlineedit.h>
5 5
6#include <qpe/qpeapplication.h> 6#include <qpe/qpeapplication.h>
7 7
8#include "imaphandler.h" 8#include "imaphandler.h"
9#include "searchdiag.h" 9#include "searchdiag.h"
10#include "viewmail.h" 10#include "viewmail.h"
11 11
12 #define INMENU_BODY0 12 #define INMENU_BODY0
13 #define INMENU_HEADERF1 13 #define INMENU_HEADERF1
14 #define INMENU_SUBJECT2 14 #define INMENU_SUBJECT2
15 #define INMENU_FROM3 15 #define INMENU_FROM3
16 #define INMENU_TO4 16 #define INMENU_TO4
17 17
18SearchDiag::SearchDiag(QWidget *parent, const char *name, WFlags fl) 18SearchDiag::SearchDiag(QWidget *parent, const char *name, WFlags fl)
19 : SearchDiagBase(parent, name, fl) 19 : SearchDiagBase(parent, name, fl)
20 { 20 {
21 _selected = false; 21 _selected = false;
22 22
23 in->insertItem(tr("Body"), INMENU_BODY); 23 in->insertItem(tr("Body"), INMENU_BODY);
24 in->insertItem(tr("Header Field"), INMENU_HEADERF); 24 in->insertItem(tr("Header Field"), INMENU_HEADERF);
25 in->insertItem(tr("Subject"), INMENU_SUBJECT); 25 in->insertItem(tr("Subject"), INMENU_SUBJECT);
26 in->insertItem(tr("From"), INMENU_FROM); 26 in->insertItem(tr("From"), INMENU_FROM);
27 in->insertItem(tr("To"), INMENU_TO); 27 in->insertItem(tr("To"), INMENU_TO);
28 28
29 connect(folderView, SIGNAL(folderSelected(Folder)), SLOT(folderSelected(Folder))); 29 connect(folderView, SIGNAL(folderSelected(Folder)), SLOT(folderSelected(Folder)));
30 connect(in, SIGNAL(activated(int)), SLOT(slotInItemActivated(int))); 30 connect(in, SIGNAL(activated(int)), SLOT(slotInItemActivated(int)));
31 connect(mailTable, SIGNAL(mailClicked(IMAPResponseFETCH, IMAPHandler *)), SLOT(slotMailClicked(IMAPResponseFETCH, IMAPHandler *))); 31 connect(mailTable, SIGNAL(mailClicked(IMAPResponseFETCH,IMAPHandler*)), SLOT(slotMailClicked(IMAPResponseFETCH,IMAPHandler*)));
32} 32}
33 33
34void SearchDiag::accept() 34void SearchDiag::accept()
35{ 35{
36 if (searchFor->text().isEmpty()) { 36 if (searchFor->text().isEmpty()) {
37 QMessageBox::information(this, tr("Error"), tr("<p>Please enter what to search for.</p>"), tr("Ok")); 37 QMessageBox::information(this, tr("Error"), tr("<p>Please enter what to search for.</p>"), tr("Ok"));
38 return; 38 return;
39 } 39 }
40 40
41 if (!_selected) { 41 if (!_selected) {
42 QMessageBox::information(this, tr("Error"), tr("<p>Please select a folder.</p>"), tr("Ok")); 42 QMessageBox::information(this, tr("Error"), tr("<p>Please select a folder.</p>"), tr("Ok"));
43 return; 43 return;
44 } 44 }
45 45
46 if (in->currentItem() == INMENU_HEADERF && other->currentText().isEmpty()) { 46 if (in->currentItem() == INMENU_HEADERF && other->currentText().isEmpty()) {
47 QMessageBox::information(this, tr("Error"), tr("<p>Please enter a header field to search in.</p>"), tr("Ok")); 47 QMessageBox::information(this, tr("Error"), tr("<p>Please enter a header field to search in.</p>"), tr("Ok"));
48 return; 48 return;
49 } 49 }
50 50
51 _folder.topFolder().handler()->iSelect(_folder.fullName()); 51 _folder.topFolder().handler()->iSelect(_folder.fullName());
52 connect(_folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPSelect(IMAPResponse &))); 52 connect(_folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPSelect(IMAPResponse&)));
53} 53}
54 54
55void SearchDiag::folderSelected(Folder folder) 55void SearchDiag::folderSelected(Folder folder)
56{ 56{
57 _selected = true; 57 _selected = true;
58 _folder = folder; 58 _folder = folder;
59} 59}
60 60
61void SearchDiag::slotIMAPSelect(IMAPResponse &response) 61void SearchDiag::slotIMAPSelect(IMAPResponse &response)
62{ 62{
63 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPSelect(IMAPResponse &))); 63 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPSelect(IMAPResponse&)));
64 64
65 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 65 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
66 if (in->currentItem() == INMENU_BODY) { 66 if (in->currentItem() == INMENU_BODY) {
67 response.imapHandler()->iSearch("BODY \"" + searchFor->text() + "\""); 67 response.imapHandler()->iSearch("BODY \"" + searchFor->text() + "\"");
68 } else if (in->currentItem() == INMENU_HEADERF) { 68 } else if (in->currentItem() == INMENU_HEADERF) {
69 response.imapHandler()->iSearch("HEADER \""+ other->currentText() + "\" \"" + searchFor->text() + "\""); 69 response.imapHandler()->iSearch("HEADER \""+ other->currentText() + "\" \"" + searchFor->text() + "\"");
70 } else if (in->currentItem() == INMENU_SUBJECT) { 70 } else if (in->currentItem() == INMENU_SUBJECT) {
71 response.imapHandler()->iSearch("SUBJECT \"" + searchFor->text() + "\""); 71 response.imapHandler()->iSearch("SUBJECT \"" + searchFor->text() + "\"");
72 } else if (in->currentItem() == INMENU_FROM) { 72 } else if (in->currentItem() == INMENU_FROM) {
73 response.imapHandler()->iSearch("FROM \"" + searchFor->text() + "\""); 73 response.imapHandler()->iSearch("FROM \"" + searchFor->text() + "\"");
74 } else if (in->currentItem() == INMENU_TO) { 74 } else if (in->currentItem() == INMENU_TO) {
75 response.imapHandler()->iSearch("TO \"" + searchFor->text() + "\""); 75 response.imapHandler()->iSearch("TO \"" + searchFor->text() + "\"");
76 } else return; 76 } else return;
77 77
78 connect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPSearch(IMAPResponse &))); 78 connect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPSearch(IMAPResponse&)));
79 } else { 79 } else {
80 QMessageBox::warning(this, tr("Error"), tr("<p>Could not select the folder. Aborting. (Server said: %1)").arg(response.statusResponse().comment()), tr("Ok")); 80 QMessageBox::warning(this, tr("Error"), tr("<p>Could not select the folder. Aborting. (Server said: %1)").arg(response.statusResponse().comment()), tr("Ok"));
81 } 81 }
82} 82}
83 83
84void SearchDiag::slotIMAPSearch(IMAPResponse &response) 84void SearchDiag::slotIMAPSearch(IMAPResponse &response)
85{ 85{
86 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPSearch(IMAPResponse &))); 86 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPSearch(IMAPResponse&)));
87 87
88 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 88 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
89 IMAPResponseSEARCH results = response.SEARCH()[0]; 89 IMAPResponseSEARCH results = response.SEARCH()[0];
90 if (results.mails().count() == 0) { 90 if (results.mails().count() == 0) {
91 QMessageBox::information(this, tr("Results"), tr("<p>No mails match your criteria.</p>"), tr("Ok")); 91 QMessageBox::information(this, tr("Results"), tr("<p>No mails match your criteria.</p>"), tr("Ok"));
92 return; 92 return;
93 } 93 }
94 94
95 response.imapHandler()->iFetch(results.mails().join(","), "ENVELOPE FLAGS UID"); 95 response.imapHandler()->iFetch(results.mails().join(","), "ENVELOPE FLAGS UID");
96 connect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPFetch(IMAPResponse &))); 96 connect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPFetch(IMAPResponse&)));
97 } else { 97 } else {
98 QMessageBox::warning(this, tr("Error"), tr("<p>Search failed. (Server said: %1)").arg(response.statusResponse().comment()), tr("Ok")); 98 QMessageBox::warning(this, tr("Error"), tr("<p>Search failed. (Server said: %1)").arg(response.statusResponse().comment()), tr("Ok"));
99 } 99 }
100} 100}
101 101
102void SearchDiag::slotIMAPFetch(IMAPResponse &response) 102void SearchDiag::slotIMAPFetch(IMAPResponse &response)
103{ 103{
104 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPSearch(IMAPResponse &))); 104 disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPSearch(IMAPResponse&)));
105 105
106 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 106 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
107 mailTable->setHeaders(response.FETCH()); 107 mailTable->setHeaders(response.FETCH());
108 } else { 108 } else {
109 QMessageBox::warning(this, tr("Error"), tr("<p>Couldn't fetch the mail headers. (Server said: %1)").arg(response.statusResponse().comment())); 109 QMessageBox::warning(this, tr("Error"), tr("<p>Couldn't fetch the mail headers. (Server said: %1)").arg(response.statusResponse().comment()));
110 } 110 }
111} 111}
112 112
113void SearchDiag::slotMailClicked(IMAPResponseFETCH fetch, IMAPHandler *) 113void SearchDiag::slotMailClicked(IMAPResponseFETCH fetch, IMAPHandler *)
114{ 114{
115 ViewMail viewMail(fetch, _folder.topFolder().handler(), this, 0, true); 115 ViewMail viewMail(fetch, _folder.topFolder().handler(), this, 0, true);
116 viewMail.showMaximized(); 116 viewMail.showMaximized();
117 viewMail.exec(); 117 viewMail.exec();
118} 118}
119 119
120void SearchDiag::slotInItemActivated(int index) 120void SearchDiag::slotInItemActivated(int index)
121{ 121{
122 if (index == INMENU_HEADERF) { 122 if (index == INMENU_HEADERF) {
123 other->setEnabled(true); 123 other->setEnabled(true);
124 } else { 124 } else {
125 other->setEnabled(false); 125 other->setEnabled(false);
126 } 126 }
127} 127}
128 128
diff --git a/noncore/unsupported/mail2/viewmail.cpp b/noncore/unsupported/mail2/viewmail.cpp
index da6924d..0cfb6e5 100644
--- a/noncore/unsupported/mail2/viewmail.cpp
+++ b/noncore/unsupported/mail2/viewmail.cpp
@@ -1,198 +1,198 @@
1#include <qtextbrowser.h> 1#include <qtextbrowser.h>
2#include <qmessagebox.h> 2#include <qmessagebox.h>
3#include <qaction.h> 3#include <qaction.h>
4#include <qapplication.h> 4#include <qapplication.h>
5 5
6#include "mailfactory.h" 6#include "mailfactory.h"
7#include "composer.h" 7#include "composer.h"
8#include "viewmail.h" 8#include "viewmail.h"
9 9
10AttachItem::AttachItem(QListView *parent, AttachItemStore &attachItemStore) 10AttachItem::AttachItem(QListView *parent, AttachItemStore &attachItemStore)
11 : QListViewItem(parent), _attachItemStore(attachItemStore) 11 : QListViewItem(parent), _attachItemStore(attachItemStore)
12{ 12{
13 setText(0, _attachItemStore.mimeType()); 13 setText(0, _attachItemStore.mimeType());
14 setText(1, _attachItemStore.fileName()); 14 setText(1, _attachItemStore.fileName());
15 setText(2, _attachItemStore.description()); 15 setText(2, _attachItemStore.description());
16} 16}
17 17
18AttachItem::AttachItem(QListViewItem *parent, AttachItemStore &attachItemStore) 18AttachItem::AttachItem(QListViewItem *parent, AttachItemStore &attachItemStore)
19 : QListViewItem(parent), _attachItemStore(attachItemStore) 19 : QListViewItem(parent), _attachItemStore(attachItemStore)
20{ 20{
21 setText(0, _attachItemStore.mimeType()); 21 setText(0, _attachItemStore.mimeType());
22 setText(1, _attachItemStore.fileName()); 22 setText(1, _attachItemStore.fileName());
23 setText(2, _attachItemStore.description()); 23 setText(2, _attachItemStore.description());
24} 24}
25 25
26ViewMail::ViewMail(IMAPResponseFETCH &mail, IMAPHandler *handler, QWidget *parent, const char *name, WFlags fl) 26ViewMail::ViewMail(IMAPResponseFETCH &mail, IMAPHandler *handler, QWidget *parent, const char *name, WFlags fl)
27 : ViewMailBase(parent, name, fl), _inLoop(false), _mail(mail), _handler(handler) 27 : ViewMailBase(parent, name, fl), _inLoop(false), _mail(mail), _handler(handler)
28{ 28{
29 setCaption(caption().arg(mail.envelope().from()[0].name())); 29 setCaption(caption().arg(mail.envelope().from()[0].name()));
30 30
31 _gotBody = false; 31 _gotBody = false;
32 _mailHtml = tr( 32 _mailHtml = tr(
33 "<html><body>" 33 "<html><body>"
34 "<div align=center><b>%1</b></div>" 34 "<div align=center><b>%1</b></div>"
35 "<b>From:</b> %2<br>" 35 "<b>From:</b> %2<br>"
36 "<b>To:</b> %3<br>" 36 "<b>To:</b> %3<br>"
37 "%4" 37 "%4"
38 "%5" 38 "%5"
39 "<b>Date:</b> %6<hr>" 39 "<b>Date:</b> %6<hr>"
40 "<font face=fixed>%7</font>") 40 "<font face=fixed>%7</font>")
41 .arg(deHtml(mail.envelope().subject().isNull() ? tr("(no subject)") 41 .arg(deHtml(mail.envelope().subject().isNull() ? tr("(no subject)")
42 : deHtml(mail.envelope().subject()))) 42 : deHtml(mail.envelope().subject())))
43 .arg(deHtml(mail.envelope().from().toString().isNull() ? tr("(no from)") 43 .arg(deHtml(mail.envelope().from().toString().isNull() ? tr("(no from)")
44 : mail.envelope().from().toString())) 44 : mail.envelope().from().toString()))
45 .arg(deHtml(mail.envelope().to().toString().isNull() ? tr("(no recipient)") 45 .arg(deHtml(mail.envelope().to().toString().isNull() ? tr("(no recipient)")
46 : mail.envelope().to().toString())) 46 : mail.envelope().to().toString()))
47 .arg(mail.envelope().cc().toString().isNull() ? QString(0) 47 .arg(mail.envelope().cc().toString().isNull() ? QString(0)
48 : tr("<b>Cc:</b> %1<br>").arg(deHtml(mail.envelope().cc().toString()))) 48 : tr("<b>Cc:</b> %1<br>").arg(deHtml(mail.envelope().cc().toString())))
49 .arg(mail.envelope().bcc().toString().isNull() ? QString(0) 49 .arg(mail.envelope().bcc().toString().isNull() ? QString(0)
50 : tr("<b>Bcc:</b> %1<br>").arg(deHtml(mail.envelope().bcc().toString()))) 50 : tr("<b>Bcc:</b> %1<br>").arg(deHtml(mail.envelope().bcc().toString())))
51 .arg(mail.envelope().mailDate().isNull() ? tr("(no date)") 51 .arg(mail.envelope().mailDate().isNull() ? tr("(no date)")
52 : mail.envelope().mailDate()) 52 : mail.envelope().mailDate())
53 .arg("%1"); 53 .arg("%1");
54 54
55 connect(reply, SIGNAL(activated()), SLOT(slotReply())); 55 connect(reply, SIGNAL(activated()), SLOT(slotReply()));
56 connect(forward, SIGNAL(activated()), SLOT(slotForward())); 56 connect(forward, SIGNAL(activated()), SLOT(slotForward()));
57 57
58 attachments->setEnabled(_gotBody); 58 attachments->setEnabled(_gotBody);
59 browser->setText(QString(_mailHtml).arg(tr("Getting mail body from server. Please wait..."))); 59 browser->setText(QString(_mailHtml).arg(tr("Getting mail body from server. Please wait...")));
60 60
61 _handler->iUid("FETCH", QString("%1 (BODY[1])").arg(mail.uid())); 61 _handler->iUid("FETCH", QString("%1 (BODY[1])").arg(mail.uid()));
62 connect(_handler, SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPUid(IMAPResponse &))); 62 connect(_handler, SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPUid(IMAPResponse&)));
63} 63}
64 64
65ViewMail::~ViewMail() 65ViewMail::~ViewMail()
66{ 66{
67 hide(); 67 hide();
68} 68}
69 69
70void ViewMail::hide() 70void ViewMail::hide()
71{ 71{
72 QWidget::hide(); 72 QWidget::hide();
73 73
74 if (_inLoop) { 74 if (_inLoop) {
75 _inLoop = false; 75 _inLoop = false;
76 qApp->exit_loop(); 76 qApp->exit_loop();
77 } 77 }
78} 78}
79 79
80void ViewMail::exec() 80void ViewMail::exec()
81{ 81{
82 show(); 82 show();
83 83
84 if (!_inLoop) { 84 if (!_inLoop) {
85 _inLoop = true; 85 _inLoop = true;
86 qApp->enter_loop(); 86 qApp->enter_loop();
87 } 87 }
88} 88}
89 89
90QString ViewMail::deHtml(const QString &string) 90QString ViewMail::deHtml(const QString &string)
91{ 91{
92 QString string_ = string; 92 QString string_ = string;
93 string_.replace(QRegExp("&"), "&amp;"); 93 string_.replace(QRegExp("&"), "&amp;");
94 string_.replace(QRegExp("<"), "&lt;"); 94 string_.replace(QRegExp("<"), "&lt;");
95 string_.replace(QRegExp(">"), "&gt;"); 95 string_.replace(QRegExp(">"), "&gt;");
96 string_.replace(QRegExp("\\n"), "<br>"); 96 string_.replace(QRegExp("\\n"), "<br>");
97 return string_; 97 return string_;
98} 98}
99 99
100void ViewMail::slotReply() 100void ViewMail::slotReply()
101{ 101{
102 if (!_gotBody) { 102 if (!_gotBody) {
103 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok")); 103 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok"));
104 return; 104 return;
105 } 105 }
106 106
107 QString rtext; 107 QString rtext;
108 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose 108 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
109 .arg(_mail.envelope().from()[0].toString()) 109 .arg(_mail.envelope().from()[0].toString())
110 .arg(_mail.envelope().mailDate()); 110 .arg(_mail.envelope().mailDate());
111 111
112 QString text = _mail.bodyPart(1).data(); 112 QString text = _mail.bodyPart(1).data();
113 QStringList lines = QStringList::split(QRegExp("\\n"), text); 113 QStringList lines = QStringList::split(QRegExp("\\n"), text);
114 QStringList::Iterator it; 114 QStringList::Iterator it;
115 for (it = lines.begin(); it != lines.end(); it++) { 115 for (it = lines.begin(); it != lines.end(); it++) {
116 rtext += "> " + *it + "\n"; 116 rtext += "> " + *it + "\n";
117 } 117 }
118 rtext += "\n"; 118 rtext += "\n";
119 119
120 QString prefix; 120 QString prefix;
121 if (_mail.envelope().subject().find(QRegExp("^Re: *$")) != -1) prefix = ""; 121 if (_mail.envelope().subject().find(QRegExp("^Re: *$")) != -1) prefix = "";
122 else prefix = "Re: "; // no i18n on purpose 122 else prefix = "Re: "; // no i18n on purpose
123 123
124 SendMail sendMail; 124 SendMail sendMail;
125 sendMail.setTo(_mail.envelope().from()[0].toString()); 125 sendMail.setTo(_mail.envelope().from()[0].toString());
126 sendMail.setSubject(prefix + _mail.envelope().subject()); 126 sendMail.setSubject(prefix + _mail.envelope().subject());
127 sendMail.setInReplyTo(_mail.envelope().messageId()); 127 sendMail.setInReplyTo(_mail.envelope().messageId());
128 sendMail.setMessage(rtext); 128 sendMail.setMessage(rtext);
129 129
130 Composer composer(this, 0, true); 130 Composer composer(this, 0, true);
131 composer.setSendMail(sendMail); 131 composer.setSendMail(sendMail);
132 composer.showMaximized(); 132 composer.showMaximized();
133 composer.exec(); 133 composer.exec();
134} 134}
135 135
136void ViewMail::slotForward() 136void ViewMail::slotForward()
137{ 137{
138 if (!_gotBody) { 138 if (!_gotBody) {
139 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok")); 139 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok"));
140 return; 140 return;
141 } 141 }
142 142
143 QString ftext; 143 QString ftext;
144 ftext += QString("\n----- Forwarded message from %1 -----\n\n") 144 ftext += QString("\n----- Forwarded message from %1 -----\n\n")
145 .arg(_mail.envelope().from()[0].toString()); 145 .arg(_mail.envelope().from()[0].toString());
146 if (!_mail.envelope().mailDate().isNull()) 146 if (!_mail.envelope().mailDate().isNull())
147 ftext += QString("Date: %1\n") 147 ftext += QString("Date: %1\n")
148 .arg(_mail.envelope().mailDate()); 148 .arg(_mail.envelope().mailDate());
149 if (!_mail.envelope().from()[0].toString().isNull()) 149 if (!_mail.envelope().from()[0].toString().isNull())
150 ftext += QString("From: %1\n") 150 ftext += QString("From: %1\n")
151 .arg(_mail.envelope().from()[0].toString()); 151 .arg(_mail.envelope().from()[0].toString());
152 if (!_mail.envelope().to().toString().isNull()) 152 if (!_mail.envelope().to().toString().isNull())
153 ftext += QString("To: %1\n") 153 ftext += QString("To: %1\n")
154 .arg(_mail.envelope().to().toString()); 154 .arg(_mail.envelope().to().toString());
155 if (!_mail.envelope().cc().toString().isNull()) 155 if (!_mail.envelope().cc().toString().isNull())
156 ftext += QString("Cc: %1\n") 156 ftext += QString("Cc: %1\n")
157 .arg(_mail.envelope().cc().toString()); 157 .arg(_mail.envelope().cc().toString());
158 if (!_mail.envelope().bcc().toString().isNull()) 158 if (!_mail.envelope().bcc().toString().isNull())
159 ftext += QString("Bcc: %1\n") 159 ftext += QString("Bcc: %1\n")
160 .arg(_mail.envelope().bcc().toString()); 160 .arg(_mail.envelope().bcc().toString());
161 if (!_mail.envelope().subject().isNull()) 161 if (!_mail.envelope().subject().isNull())
162 ftext += QString("Subject: %1\n") 162 ftext += QString("Subject: %1\n")
163 .arg(_mail.envelope().subject()); 163 .arg(_mail.envelope().subject());
164 164
165 ftext += QString("\n%1\n") 165 ftext += QString("\n%1\n")
166 .arg(_mail.bodyPart(1).data()); 166 .arg(_mail.bodyPart(1).data());
167 167
168 ftext += QString("----- End forwarded message -----\n"); 168 ftext += QString("----- End forwarded message -----\n");
169 169
170 SendMail sendMail; 170 SendMail sendMail;
171 sendMail.setSubject("Fwd: " + _mail.envelope().subject()); 171 sendMail.setSubject("Fwd: " + _mail.envelope().subject());
172 sendMail.setMessage(ftext); 172 sendMail.setMessage(ftext);
173 173
174 Composer composer(this, 0, true); 174 Composer composer(this, 0, true);
175 composer.setSendMail(sendMail); 175 composer.setSendMail(sendMail);
176 composer.showMaximized(); 176 composer.showMaximized();
177 composer.exec(); 177 composer.exec();
178} 178}
179 179
180void ViewMail::slotIMAPUid(IMAPResponse &response) 180void ViewMail::slotIMAPUid(IMAPResponse &response)
181{ 181{
182 disconnect(_handler, SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPUid(IMAPResponse &))); 182 disconnect(_handler, SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPUid(IMAPResponse&)));
183 183
184 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 184 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
185 QValueList<IMAPResponseBodyPart> bodyParts; 185 QValueList<IMAPResponseBodyPart> bodyParts;
186 bodyParts.append(response.FETCH()[0].bodyPart(0)); 186 bodyParts.append(response.FETCH()[0].bodyPart(0));
187 _mail.setBodyParts(bodyParts); 187 _mail.setBodyParts(bodyParts);
188 188
189 browser->setText(QString(_mailHtml).arg(deHtml(response.FETCH()[0].bodyPart(0).data()))); 189 browser->setText(QString(_mailHtml).arg(deHtml(response.FETCH()[0].bodyPart(0).data())));
190 190
191 // fillList(response.FETCH()[0].bodyStructure()); 191 // fillList(response.FETCH()[0].bodyStructure());
192 192
193 _gotBody = true; 193 _gotBody = true;
194 } else { 194 } else {
195 QMessageBox::warning(this, tr("Error"), tr("<p>I was unable to retrieve the mail from the server. You can try again later or give up.</p>"), tr("Ok")); 195 QMessageBox::warning(this, tr("Error"), tr("<p>I was unable to retrieve the mail from the server. You can try again later or give up.</p>"), tr("Ok"));
196 } 196 }
197} 197}
198 198
diff --git a/noncore/unsupported/mailit/addatt.cpp b/noncore/unsupported/mailit/addatt.cpp
index 19ac58f..420f84c 100644
--- a/noncore/unsupported/mailit/addatt.cpp
+++ b/noncore/unsupported/mailit/addatt.cpp
@@ -29,136 +29,136 @@ FileItem::FileItem(QListView *parent, DocLnk* dl)
29{ 29{
30 /*file = fileInfo; 30 /*file = fileInfo;
31 type = fileType;*/ 31 type = fileType;*/
32 32
33 doclnk=dl; 33 doclnk=dl;
34 34
35 setText(0, doclnk->name()); 35 setText(0, doclnk->name());
36 36
37 /*if (fileType == "Picture") { 37 /*if (fileType == "Picture") {
38 setPixmap(0, Resource::loadPixmap("pixmap")); 38 setPixmap(0, Resource::loadPixmap("pixmap"));
39 } else if (fileType == "Document") { 39 } else if (fileType == "Document") {
40 setPixmap(0, Resource::loadPixmap("txt")); 40 setPixmap(0, Resource::loadPixmap("txt"));
41 } else if (fileType == "Sound") { 41 } else if (fileType == "Sound") {
42 setPixmap(0, Resource::loadPixmap("play")); 42 setPixmap(0, Resource::loadPixmap("play"));
43 } else if (fileType == "Movie") { 43 } else if (fileType == "Movie") {
44 setPixmap(0, Resource::loadPixmap("MPEGPlayer")); 44 setPixmap(0, Resource::loadPixmap("MPEGPlayer"));
45 } else if (fileType == "File") { 45 } else if (fileType == "File") {
46 setPixmap(0, Resource::loadPixmap("exec")); 46 setPixmap(0, Resource::loadPixmap("exec"));
47 }*/ 47 }*/
48} 48}
49 49
50FileItem::~FileItem() 50FileItem::~FileItem()
51{ 51{
52 if (doclnk!=NULL) delete doclnk; 52 if (doclnk!=NULL) delete doclnk;
53 doclnk=NULL; 53 doclnk=NULL;
54} 54}
55 55
56AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) 56AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f)
57 : QDialog(parent, name, f) 57 : QDialog(parent, name, f)
58{ 58{
59 setCaption(tr("Adding attachments") ); 59 setCaption(tr("Adding attachments") );
60 60
61 QGridLayout *top = new QGridLayout(this, 1,1 ); 61 QGridLayout *top = new QGridLayout(this, 1,1 );
62 62
63 QHBox *buttons=new QHBox(this); 63 QHBox *buttons=new QHBox(this);
64 /*fileCategoryButton = new QPushButton(this);*/ 64 /*fileCategoryButton = new QPushButton(this);*/
65 attachButton = new QPushButton(tr("attach..."), buttons); 65 attachButton = new QPushButton(tr("attach..."), buttons);
66 removeButton = new QPushButton(tr("Remove"), buttons); 66 removeButton = new QPushButton(tr("Remove"), buttons);
67 67
68 /*fileCategories = new QPopupMenu(fileCategoryButton); 68 /*fileCategories = new QPopupMenu(fileCategoryButton);
69 fileCategoryButton->setPopup(fileCategories); 69 fileCategoryButton->setPopup(fileCategories);
70 fileCategories->insertItem("Document"); 70 fileCategories->insertItem("Document");
71 fileCategories->insertItem("Picture"); 71 fileCategories->insertItem("Picture");
72 fileCategories->insertItem("Sound"); 72 fileCategories->insertItem("Sound");
73 fileCategories->insertItem("Movie"); 73 fileCategories->insertItem("Movie");
74 fileCategories->insertItem("File"); 74 fileCategories->insertItem("File");
75 75
76 fileCategoryButton->setText("Document"); 76 fileCategoryButton->setText("Document");
77 top->addWidget(fileCategoryButton, 0, 0);*/ 77 top->addWidget(fileCategoryButton, 0, 0);*/
78 78
79 79
80 top->addWidget(buttons,1,0); 80 top->addWidget(buttons,1,0);
81 //buttons->addWidget(attachButton,0,0); 81 //buttons->addWidget(attachButton,0,0);
82 //buttons->addWidget(removeButton,0,1); 82 //buttons->addWidget(removeButton,0,1);
83 83
84 //connect(fileCategories, SIGNAL(activated(int)), this, 84 //connect(fileCategories, SIGNAL(activated(int)), this,
85 //SLOT(fileCategorySelected(int)) );*/ 85 //SLOT(fileCategorySelected(int)) );*/
86 connect(attachButton, SIGNAL(clicked()), this, 86 connect(attachButton, SIGNAL(clicked()), this,
87 SLOT(addattachment()) ); 87 SLOT(addattachment()) );
88 connect(removeButton, SIGNAL(clicked()), this, 88 connect(removeButton, SIGNAL(clicked()), this,
89 SLOT(removeattachment()) ); 89 SLOT(removeattachment()) );
90 90
91 /*listView = new QListView(this, "AttView"); 91 /*listView = new QListView(this, "AttView");
92 listView->addColumn("Documents");* 92 listView->addColumn("Documents");*
93 connect(listView, SIGNAL(doubleClicked(QListViewItem *)), this, 93 connect(listView, SIGNAL(doubleClicked(QListViewItem*)), this,
94 SLOT(addattachment()) );*/ 94 SLOT(addattachment()) );*/
95 95
96 96
97 attView = new QListView(this, "Selected"); 97 attView = new QListView(this, "Selected");
98 attView->addColumn(tr("Attached")); 98 attView->addColumn(tr("Attached"));
99 attView->addColumn(tr("File type")); 99 attView->addColumn(tr("File type"));
100 connect(attView, SIGNAL(doubleClicked(QListViewItem *)), this, 100 connect(attView, SIGNAL(doubleClicked(QListViewItem*)), this,
101 SLOT(removeattachment()) ); 101 SLOT(removeattachment()) );
102 102
103 //top->addWidget(ofs, 0,0); 103 //top->addWidget(ofs, 0,0);
104 top->addWidget(attView, 0,0); 104 top->addWidget(attView, 0,0);
105 105
106 clear(); 106 clear();
107 107
108 108
109} 109}
110 110
111void AddAtt::clear() 111void AddAtt::clear()
112{ 112{
113 attView->clear(); 113 attView->clear();
114 //getFiles(); 114 //getFiles();
115 modified = FALSE; 115 modified = FALSE;
116} 116}
117 117
118/*void AddAtt::fileCategorySelected(int id) 118/*void AddAtt::fileCategorySelected(int id)
119{ 119{
120 fileCategoryButton->setText(fileCategories->text(id)); 120 fileCategoryButton->setText(fileCategories->text(id));
121 getFiles(); 121 getFiles();
122}*/ 122}*/
123 123
124void AddAtt::addattachment() 124void AddAtt::addattachment()
125 {// ### FIXME wrong use -zecke 125 {// ### FIXME wrong use -zecke
126 OFileDialog ofs("Attachments",this,0,0,"/root/Documents"); 126 OFileDialog ofs("Attachments",this,0,0,"/root/Documents");
127 127
128 ofs.showMaximized(); 128 ofs.showMaximized();
129 129
130 if (ofs.exec()==QDialog::Accepted) 130 if (ofs.exec()==QDialog::Accepted)
131 { 131 {
132 DocLnk* dl=new DocLnk(ofs.selectedDocument()); 132 DocLnk* dl=new DocLnk(ofs.selectedDocument());
133 FileItem* fi=new FileItem(attView,dl); 133 FileItem* fi=new FileItem(attView,dl);
134 fi->setPixmap(0,dl->pixmap()); 134 fi->setPixmap(0,dl->pixmap());
135 fi->setText(1,dl->type()); 135 fi->setText(1,dl->type());
136 attView->insertItem(fi); 136 attView->insertItem(fi);
137 modified = TRUE; 137 modified = TRUE;
138 } 138 }
139} 139}
140 140
141void AddAtt::removeattachment() 141void AddAtt::removeattachment()
142{ 142{
143 if (attView->selectedItem() != NULL) 143 if (attView->selectedItem() != NULL)
144 { 144 {
145 attView->takeItem(attView->selectedItem()); 145 attView->takeItem(attView->selectedItem());
146 } 146 }
147 modified = TRUE; 147 modified = TRUE;
148} 148}
149 149
150void AddAtt::reject() 150void AddAtt::reject()
151{ 151{
152 if (modified) { 152 if (modified) {
153 attView->clear(); 153 attView->clear();
154 modified = FALSE; 154 modified = FALSE;
155 } 155 }
156} 156}
157 157
158void AddAtt::accept() 158void AddAtt::accept()
159{ 159{
160 modified = FALSE; 160 modified = FALSE;
161 hide(); 161 hide();
162} 162}
163 163
164void AddAtt::getFiles() 164void AddAtt::getFiles()
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp
index 8359acf..86c7987 100644
--- a/noncore/unsupported/mailit/emailclient.cpp
+++ b/noncore/unsupported/mailit/emailclient.cpp
@@ -1,287 +1,287 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop 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#include <qapplication.h> 20#include <qapplication.h>
21#include <qmessagebox.h> 21#include <qmessagebox.h>
22#include <qvbox.h> 22#include <qvbox.h>
23#include <qfile.h> 23#include <qfile.h>
24#include <qcheckbox.h> 24#include <qcheckbox.h>
25#include <qmenubar.h> 25#include <qmenubar.h>
26#include <qaction.h> 26#include <qaction.h>
27#include <qwhatsthis.h> 27#include <qwhatsthis.h>
28#include <qpe/resource.h> 28#include <qpe/resource.h>
29#include "emailclient.h" 29#include "emailclient.h"
30#include "writemail.h" 30#include "writemail.h"
31 31
32QCollection::Item AccountList::newItem(QCollection::Item d) 32QCollection::Item AccountList::newItem(QCollection::Item d)
33{ 33{
34 return dupl( (MailAccount *) d); 34 return dupl( (MailAccount *) d);
35} 35}
36 36
37MailAccount* AccountList::dupl(MailAccount *in) 37MailAccount* AccountList::dupl(MailAccount *in)
38{ 38{
39 ac = new MailAccount(*in); 39 ac = new MailAccount(*in);
40 return ac; 40 return ac;
41} 41}
42 42
43EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) 43EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
44 : QMainWindow( parent, name, fl ) 44 : QMainWindow( parent, name, fl )
45{ 45{
46 emailHandler = new EmailHandler(); 46 emailHandler = new EmailHandler();
47 addressList = new AddressList(); 47 addressList = new AddressList();
48 48
49 sending = FALSE; 49 sending = FALSE;
50 receiving = FALSE; 50 receiving = FALSE;
51 previewingMail = FALSE; 51 previewingMail = FALSE;
52 mailIdCount = 1; 52 mailIdCount = 1;
53 accountIdCount = 1; 53 accountIdCount = 1;
54 allAccounts = FALSE; 54 allAccounts = FALSE;
55 55
56 init(); 56 init();
57 57
58 58
59 59
60 connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); 60 connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) );
61 61
62 connect(emailHandler, SIGNAL(smtpError(int,const QString &)), this, 62 connect(emailHandler, SIGNAL(smtpError(int,const QString&)), this,
63 SLOT(smtpError(int,const QString &)) ); 63 SLOT(smtpError(int,const QString&)) );
64 connect(emailHandler, SIGNAL(popError(int,const QString &)), this, 64 connect(emailHandler, SIGNAL(popError(int,const QString&)), this,
65 SLOT(popError(int,const QString &)) ); 65 SLOT(popError(int,const QString&)) );
66 66
67 connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); 67 connect(inboxView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(inboxItemSelected()) );
68 connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); 68 connect(outboxView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(outboxItemSelected()) );
69 69
70 connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); 70 connect(inboxView, SIGNAL(pressed(QListViewItem*)), this, SLOT(inboxItemPressed()) );
71 connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) ); 71 connect(inboxView, SIGNAL(clicked(QListViewItem*)), this, SLOT(inboxItemReleased()) );
72 72
73 connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, 73 connect(emailHandler, SIGNAL(mailArrived(const Email&,bool)), this,
74 SLOT(mailArrived(const Email &, bool)) ); 74 SLOT(mailArrived(const Email&,bool)) );
75 connect(emailHandler, SIGNAL(mailTransfered(int)), this, 75 connect(emailHandler, SIGNAL(mailTransfered(int)), this,
76 SLOT(allMailArrived(int)) ); 76 SLOT(allMailArrived(int)) );
77 77
78 mailconf = new Config("mailit"); 78 mailconf = new Config("mailit");
79 //In case Synchronize is not defined in settings.txt 79 //In case Synchronize is not defined in settings.txt
80 80
81 readSettings(); 81 readSettings();
82 82
83 updateAccounts(); 83 updateAccounts();
84 84
85 lineShift = "\n"; 85 lineShift = "\n";
86 readMail(); 86 readMail();
87 lineShift = "\r\n"; 87 lineShift = "\r\n";
88 88
89 mailboxView->setCurrentTab(0); //ensure that inbox has focus 89 mailboxView->setCurrentTab(0); //ensure that inbox has focus
90 90
91 /*channel = new QCopChannel( "QPE/Application/mailit", this ); 91 /*channel = new QCopChannel( "QPE/Application/mailit", this );
92 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 92 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
93 this, SLOT(receive(const QCString&, const QByteArray&)) );*/ 93 this, SLOT(receive(const QCString&,const QByteArray&)) );*/
94 94
95} 95}
96 96
97 97
98EmailClient::~EmailClient() 98EmailClient::~EmailClient()
99{ 99{
100 //needs to be moved from destructor to closewindow event 100 //needs to be moved from destructor to closewindow event
101 saveMail(getPath(FALSE) + "inbox.txt", inboxView); 101 saveMail(getPath(FALSE) + "inbox.txt", inboxView);
102 //does not currently work. Defining outbox in the same 102 //does not currently work. Defining outbox in the same
103 //format as inbox is not a good solution as they have 103 //format as inbox is not a good solution as they have
104 //different properties 104 //different properties
105 saveMail(getPath(FALSE) + "outbox.txt", outboxView); 105 saveMail(getPath(FALSE) + "outbox.txt", outboxView);
106 saveSettings(); 106 saveSettings();
107 107
108 mailconf->write(); 108 mailconf->write();
109 delete mailconf; 109 delete mailconf;
110 110
111} 111}
112 112
113void EmailClient::init() 113void EmailClient::init()
114{ 114{
115 initStatusBar(this); 115 initStatusBar(this);
116 116
117 setToolBarsMovable(FALSE); 117 setToolBarsMovable(FALSE);
118 118
119 bar = new QToolBar(this); 119 bar = new QToolBar(this);
120 QWhatsThis::add(bar,tr("Main operation toolbar")); 120 QWhatsThis::add(bar,tr("Main operation toolbar"));
121 bar->setHorizontalStretchable( TRUE ); 121 bar->setHorizontalStretchable( TRUE );
122 122
123 mb = new QMenuBar( bar ); 123 mb = new QMenuBar( bar );
124 124
125 QPopupMenu *mail = new QPopupMenu(mb); 125 QPopupMenu *mail = new QPopupMenu(mb);
126 mb->insertItem( tr( "&Mail" ), mail); 126 mb->insertItem( tr( "&Mail" ), mail);
127 127
128 QPopupMenu *configure = new QPopupMenu(mb); 128 QPopupMenu *configure = new QPopupMenu(mb);
129 mb->insertItem( tr( "Accounts" ), configure); 129 mb->insertItem( tr( "Accounts" ), configure);
130 130
131 selectAccountMenu = new QPopupMenu(mb); 131 selectAccountMenu = new QPopupMenu(mb);
132 editAccountMenu = new QPopupMenu(mb); 132 editAccountMenu = new QPopupMenu(mb);
133 deleteAccountMenu = new QPopupMenu(mb); 133 deleteAccountMenu = new QPopupMenu(mb);
134 134
135 mail->insertItem(tr("Get Mail in"), selectAccountMenu); 135 mail->insertItem(tr("Get Mail in"), selectAccountMenu);
136 configure->insertItem(tr("Edit account"), editAccountMenu); 136 configure->insertItem(tr("Edit account"), editAccountMenu);
137 configure->insertItem(tr("Delete account"), deleteAccountMenu); 137 configure->insertItem(tr("Delete account"), deleteAccountMenu);
138 138
139 bar = new QToolBar(this); 139 bar = new QToolBar(this);
140 140
141 getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar); 141 getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar);
142 QWhatsThis::add(getMailButton,tr("Click to download mail via all available accounts.\n Press and hold to select the desired account.")); 142 QWhatsThis::add(getMailButton,tr("Click to download mail via all available accounts.\n Press and hold to select the desired account."));
143 143
144 getMailButton->setPopup(selectAccountMenu); 144 getMailButton->setPopup(selectAccountMenu);
145 145
146 sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); 146 sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0);
147 connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); 147 connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) );
148 sendMailButton->addTo(bar); 148 sendMailButton->addTo(bar);
149 sendMailButton->addTo(mail); 149 sendMailButton->addTo(mail);
150 sendMailButton->setWhatsThis("Send mail queued in the outbox"); 150 sendMailButton->setWhatsThis("Send mail queued in the outbox");
151 151
152 composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); 152 composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0);
153 connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); 153 connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) );
154 composeButton->addTo(bar); 154 composeButton->addTo(bar);
155 composeButton->addTo(mail); 155 composeButton->addTo(mail);
156 composeButton->setWhatsThis("Compose a new mail"); 156 composeButton->setWhatsThis("Compose a new mail");
157 157
158 cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); 158 cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0);
159 connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); 159 connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) );
160 cancelButton->addTo(mail); 160 cancelButton->addTo(mail);
161 cancelButton->addTo(bar); 161 cancelButton->addTo(bar);
162 cancelButton->setEnabled(FALSE); 162 cancelButton->setEnabled(FALSE);
163 cancelButton->setWhatsThis("Stop the currently active mail transfer"); 163 cancelButton->setWhatsThis("Stop the currently active mail transfer");
164 164
165 165
166 deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); 166 deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 );
167 connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); 167 connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) );
168 deleteButton->addTo(bar); 168 deleteButton->addTo(bar);
169 deleteButton->setWhatsThis("Remove the currently selected eMail(s)"); 169 deleteButton->setWhatsThis("Remove the currently selected eMail(s)");
170 170
171 mailboxView = new OTabWidget( this, "mailboxView" ); 171 mailboxView = new OTabWidget( this, "mailboxView" );
172 172
173 QWidget* widget = new QWidget( mailboxView, "widget" ); 173 QWidget* widget = new QWidget( mailboxView, "widget" );
174 grid_2 = new QGridLayout( widget ); 174 grid_2 = new QGridLayout( widget );
175// grid_2->setSpacing(6); 175// grid_2->setSpacing(6);
176// grid_2->setMargin( 11 ); 176// grid_2->setMargin( 11 );
177 177
178 inboxView = new QListView( widget, "inboxView" ); 178 inboxView = new QListView( widget, "inboxView" );
179 inboxView->addColumn( tr( "From" ) ); 179 inboxView->addColumn( tr( "From" ) );
180 inboxView->addColumn( tr( "Subject" ) ); 180 inboxView->addColumn( tr( "Subject" ) );
181 inboxView->addColumn( tr( "Date" ) ); 181 inboxView->addColumn( tr( "Date" ) );
182 inboxView->setMinimumSize( QSize( 0, 0 ) ); 182 inboxView->setMinimumSize( QSize( 0, 0 ) );
183 inboxView->setAllColumnsShowFocus(TRUE); 183 inboxView->setAllColumnsShowFocus(TRUE);
184 QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n" 184 QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n"
185 "It keeps the fetched mail which can be \n" 185 "It keeps the fetched mail which can be \n"
186 "viewed by double clicking the entry.\n" 186 "viewed by double clicking the entry.\n"
187 "blue attachment icon shows whether this \n" 187 "blue attachment icon shows whether this \n"
188 "mailhas attachments.\n")); 188 "mailhas attachments.\n"));
189 189
190 grid_2->addWidget( inboxView, 2, 0 ); 190 grid_2->addWidget( inboxView, 2, 0 );
191 mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); 191 mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) );
192 192
193 QWidget* widget_2 = new QWidget( mailboxView, "widget_2" ); 193 QWidget* widget_2 = new QWidget( mailboxView, "widget_2" );
194 grid_3 = new QGridLayout( widget_2 ); 194 grid_3 = new QGridLayout( widget_2 );
195// grid_3->setSpacing(6); 195// grid_3->setSpacing(6);
196// grid_3->setMargin( 11 ); 196// grid_3->setMargin( 11 );
197 197
198 outboxView = new QListView( widget_2, "outboxView" ); 198 outboxView = new QListView( widget_2, "outboxView" );
199 outboxView->addColumn( tr( "To" ) ); 199 outboxView->addColumn( tr( "To" ) );
200 outboxView->addColumn( tr( "Subject" ) ); 200 outboxView->addColumn( tr( "Subject" ) );
201 outboxView->setAllColumnsShowFocus(TRUE); 201 outboxView->setAllColumnsShowFocus(TRUE);
202 202
203 QWhatsThis::add(outboxView,QWidget::tr("This is the outbox view.\n" 203 QWhatsThis::add(outboxView,QWidget::tr("This is the outbox view.\n"
204 "It keeps the queued mails to send which can be \n" 204 "It keeps the queued mails to send which can be \n"
205 "reviewed by double clicking the entry.")); 205 "reviewed by double clicking the entry."));
206 grid_3->addWidget( outboxView, 0, 0 ); 206 grid_3->addWidget( outboxView, 0, 0 );
207 mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); 207 mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) );
208 208
209 setCentralWidget(mailboxView); 209 setCentralWidget(mailboxView);
210 210
211} 211}
212 212
213void EmailClient::initStatusBar(QWidget* parent) 213void EmailClient::initStatusBar(QWidget* parent)
214{ 214{
215 statusBar = new QStatusBar(parent); 215 statusBar = new QStatusBar(parent);
216 statusBar->setSizeGripEnabled(FALSE); 216 statusBar->setSizeGripEnabled(FALSE);
217 217
218 status1Label = new QLabel( tr("Idle"), statusBar); 218 status1Label = new QLabel( tr("Idle"), statusBar);
219 status2Label = new QLabel("", statusBar); 219 status2Label = new QLabel("", statusBar);
220 connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), 220 connect(emailHandler, SIGNAL(updatePopStatus(const QString&)),
221 status2Label, SLOT(setText(const QString &)) ); 221 status2Label, SLOT(setText(const QString&)) );
222 connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), 222 connect(emailHandler, SIGNAL(updateSmtpStatus(const QString&)),
223 status2Label, SLOT(setText(const QString &)) ); 223 status2Label, SLOT(setText(const QString&)) );
224 224
225 progressBar = new QProgressBar(statusBar); 225 progressBar = new QProgressBar(statusBar);
226 226
227 connect(emailHandler, SIGNAL(mailboxSize(int)), 227 connect(emailHandler, SIGNAL(mailboxSize(int)),
228 this, SLOT(setTotalSize(int)) ); 228 this, SLOT(setTotalSize(int)) );
229 connect(emailHandler, SIGNAL(currentMailSize(int)), 229 connect(emailHandler, SIGNAL(currentMailSize(int)),
230 this, SLOT(setMailSize(int)) ); 230 this, SLOT(setMailSize(int)) );
231 connect(emailHandler, SIGNAL(downloadedSize(int)), 231 connect(emailHandler, SIGNAL(downloadedSize(int)),
232 this, SLOT(setDownloadedSize(int)) ); 232 this, SLOT(setDownloadedSize(int)) );
233 233
234 statusBar->addWidget(status1Label); 234 statusBar->addWidget(status1Label);
235 statusBar->addWidget(progressBar); 235 statusBar->addWidget(progressBar);
236 statusBar->addWidget(status2Label); 236 statusBar->addWidget(status2Label);
237 237
238} 238}
239 239
240void EmailClient::compose() 240void EmailClient::compose()
241{ 241{
242 emit composeRequested(); 242 emit composeRequested();
243} 243}
244 244
245void EmailClient::cancel() 245void EmailClient::cancel()
246{ 246{
247 emailHandler->cancel(); 247 emailHandler->cancel();
248} 248}
249 249
250AddressList* EmailClient::getAdrListRef() 250AddressList* EmailClient::getAdrListRef()
251{ 251{
252 return addressList; 252 return addressList;
253} 253}
254 254
255//this needs to be rewritten to syncronize with outboxView 255//this needs to be rewritten to syncronize with outboxView
256void EmailClient::enqueMail(const Email &mail) 256void EmailClient::enqueMail(const Email &mail)
257{ 257{
258 if (accountList.count() == 0) { 258 if (accountList.count() == 0) {
259 QMessageBox::warning(qApp->activeWindow(), 259 QMessageBox::warning(qApp->activeWindow(),
260 tr("No account selected"), tr("You must create an account"), "OK\n"); 260 tr("No account selected"), tr("You must create an account"), "OK\n");
261 return; 261 return;
262 } 262 }
263 263
264 if (accountList.count() > 0) { 264 if (accountList.count() > 0) {
265 currentAccount = accountList.first(); 265 currentAccount = accountList.first();
266 qWarning("using account " + currentAccount->name); 266 qWarning("using account " + currentAccount->name);
267 } 267 }
268 268
269 Email addMail = mail; 269 Email addMail = mail;
270 addMail.from = currentAccount->name; 270 addMail.from = currentAccount->name;
271 addMail.fromMail = currentAccount->emailAddress; 271 addMail.fromMail = currentAccount->emailAddress;
272 addMail.rawMail.prepend("From: \"" + addMail.from + "\" <" + addMail.fromMail + ">\n"); 272 addMail.rawMail.prepend("From: \"" + addMail.from + "\" <" + addMail.fromMail + ">\n");
273 item = new EmailListItem(outboxView, addMail, false); 273 item = new EmailListItem(outboxView, addMail, false);
274 274
275 mailboxView->setCurrentTab(1); 275 mailboxView->setCurrentTab(1);
276 276
277} 277}
278 278
279void EmailClient::sendQuedMail() 279void EmailClient::sendQuedMail()
280{ 280{
281 int count = 0; 281 int count = 0;
282 282
283 if (accountList.count() == 0) { 283 if (accountList.count() == 0) {
284 QMessageBox::warning(qApp->activeWindow(), tr("No account selected"), tr("You must create an account"), "OK\n"); 284 QMessageBox::warning(qApp->activeWindow(), tr("No account selected"), tr("You must create an account"), "OK\n");
285 return; 285 return;
286 } 286 }
287 //traverse listview, find messages to send 287 //traverse listview, find messages to send
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp
index 06e978d..02b3e9a 100644
--- a/noncore/unsupported/mailit/emailhandler.cpp
+++ b/noncore/unsupported/mailit/emailhandler.cpp
@@ -1,122 +1,122 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop 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#include <qfileinfo.h> 20#include <qfileinfo.h>
21#include <stdlib.h> 21#include <stdlib.h>
22#include <qapplication.h> 22#include <qapplication.h>
23#include <qmessagebox.h> 23#include <qmessagebox.h>
24#include <qcstring.h> 24#include <qcstring.h>
25#include "emailhandler.h" 25#include "emailhandler.h"
26#include <qpe/applnk.h> 26#include <qpe/applnk.h>
27#include <qpe/filemanager.h> 27#include <qpe/filemanager.h>
28 28
29QCollection::Item EnclosureList::newItem(QCollection::Item d) 29QCollection::Item EnclosureList::newItem(QCollection::Item d)
30{ 30{
31 return dupl( (Enclosure *) d); 31 return dupl( (Enclosure *) d);
32} 32}
33 33
34Enclosure* EnclosureList::dupl(Enclosure *in) 34Enclosure* EnclosureList::dupl(Enclosure *in)
35{ 35{
36 ac = new Enclosure(*in); 36 ac = new Enclosure(*in);
37 return ac; 37 return ac;
38} 38}
39 39
40EmailHandler::EmailHandler() 40EmailHandler::EmailHandler()
41{ 41{
42 qDebug("EMailHandler::EmailHandler"); 42 qDebug("EMailHandler::EmailHandler");
43 43
44 smtpClient = new SmtpClient(); 44 smtpClient = new SmtpClient();
45 popClient = new PopClient(); 45 popClient = new PopClient();
46 46
47 connect(smtpClient, SIGNAL(errorOccurred(int, const QString &)), this, 47 connect(smtpClient, SIGNAL(errorOccurred(int,const QString&)), this,
48 SIGNAL(smtpError(int, const QString &)) ); 48 SIGNAL(smtpError(int,const QString&)) );
49 connect(smtpClient, SIGNAL(mailSent()), this, SIGNAL(mailSent()) ); 49 connect(smtpClient, SIGNAL(mailSent()), this, SIGNAL(mailSent()) );
50 connect(smtpClient, SIGNAL(updateStatus(const QString &)), this, 50 connect(smtpClient, SIGNAL(updateStatus(const QString&)), this,
51 SIGNAL(updateSmtpStatus(const QString &)) ); 51 SIGNAL(updateSmtpStatus(const QString&)) );
52 52
53 connect(popClient, SIGNAL(errorOccurred(int, const QString &)), this, 53 connect(popClient, SIGNAL(errorOccurred(int,const QString&)), this,
54 SIGNAL(popError(int, const QString &)) ); 54 SIGNAL(popError(int,const QString&)) );
55 connect(popClient, SIGNAL(newMessage(const QString &, int, uint, bool)), 55 connect(popClient, SIGNAL(newMessage(const QString&,int,uint,bool)),
56 this, SLOT(messageArrived(const QString &, int, uint, bool)) ); 56 this, SLOT(messageArrived(const QString&,int,uint,bool)) );
57 connect(popClient, SIGNAL(updateStatus(const QString &)), this, 57 connect(popClient, SIGNAL(updateStatus(const QString&)), this,
58 SIGNAL(updatePopStatus(const QString &)) ); 58 SIGNAL(updatePopStatus(const QString&)) );
59 connect(popClient, SIGNAL(mailTransfered(int)), this, 59 connect(popClient, SIGNAL(mailTransfered(int)), this,
60 SIGNAL(mailTransfered(int)) ); 60 SIGNAL(mailTransfered(int)) );
61 61
62 62
63 //relaying size information 63 //relaying size information
64 connect(popClient, SIGNAL(currentMailSize(int)), 64 connect(popClient, SIGNAL(currentMailSize(int)),
65 this, SIGNAL(currentMailSize(int)) ); 65 this, SIGNAL(currentMailSize(int)) );
66 connect(popClient, SIGNAL(downloadedSize(int)), 66 connect(popClient, SIGNAL(downloadedSize(int)),
67 this, SIGNAL(downloadedSize(int)) ); 67 this, SIGNAL(downloadedSize(int)) );
68} 68}
69 69
70void EmailHandler::sendMail(QList<Email> *mailList) 70void EmailHandler::sendMail(QList<Email> *mailList)
71{ 71{
72 Email *currentMail; 72 Email *currentMail;
73 QString temp; 73 QString temp;
74 QString userName = QString::null; 74 QString userName = QString::null;
75 // not supported by ALL SMTP servers in the MAIL From field 75 // not supported by ALL SMTP servers in the MAIL From field
76 // userName = "\""+mailAccount.name+"\""; 76 // userName = "\""+mailAccount.name+"\"";
77 userName += "<" + mailAccount.emailAddress + ">"; 77 userName += "<" + mailAccount.emailAddress + ">";
78 78
79 for (currentMail = mailList->first(); currentMail != 0; 79 for (currentMail = mailList->first(); currentMail != 0;
80 currentMail = mailList->next()) { 80 currentMail = mailList->next()) {
81 81
82 if (encodeMime(currentMail) == 0) { 82 if (encodeMime(currentMail) == 0) {
83 smtpClient->addMail(userName, currentMail->subject, 83 smtpClient->addMail(userName, currentMail->subject,
84 currentMail->recipients, currentMail->rawMail); 84 currentMail->recipients, currentMail->rawMail);
85 } else { //error 85 } else { //error
86 temp = tr("Could not locate all files in \nmail with subject: ") + 86 temp = tr("Could not locate all files in \nmail with subject: ") +
87 currentMail->subject; 87 currentMail->subject;
88 temp += tr("\nMail has NOT been sent"); 88 temp += tr("\nMail has NOT been sent");
89 QMessageBox::warning(qApp->activeWindow(), tr("Attachment error"), temp, tr("OK\n")); 89 QMessageBox::warning(qApp->activeWindow(), tr("Attachment error"), temp, tr("OK\n"));
90 90
91 } 91 }
92 } 92 }
93 smtpClient->newConnection(mailAccount.smtpServer, 25); 93 smtpClient->newConnection(mailAccount.smtpServer, 25);
94} 94}
95 95
96void EmailHandler::setAccount(MailAccount account) 96void EmailHandler::setAccount(MailAccount account)
97{ 97{
98 mailAccount = account; 98 mailAccount = account;
99} 99}
100 100
101void EmailHandler::getMail() 101void EmailHandler::getMail()
102{ 102{
103 popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); 103 popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd);
104 if (mailAccount.synchronize) { 104 if (mailAccount.synchronize) {
105 popClient->setSynchronize(mailAccount.lastServerMailCount); 105 popClient->setSynchronize(mailAccount.lastServerMailCount);
106 } else { 106 } else {
107 popClient->removeSynchronize(); 107 popClient->removeSynchronize();
108 } 108 }
109 109
110 headers = FALSE; 110 headers = FALSE;
111 //popClient->headersOnly(headers, 0); 111 //popClient->headersOnly(headers, 0);
112 popClient->newConnection(mailAccount.popServer, 110); 112 popClient->newConnection(mailAccount.popServer, 110);
113} 113}
114 114
115void EmailHandler::getMailHeaders() 115void EmailHandler::getMailHeaders()
116{ 116{
117 popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); 117 popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd);
118 mailAccount.synchronize ? popClient->setSynchronize(mailAccount.lastServerMailCount): popClient->removeSynchronize(); 118 mailAccount.synchronize ? popClient->setSynchronize(mailAccount.lastServerMailCount): popClient->removeSynchronize();
119 119
120 headers = TRUE; 120 headers = TRUE;
121 popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all 121 popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all
122 qDebug("Initiating connection"); 122 qDebug("Initiating connection");
diff --git a/noncore/unsupported/mailit/mailitwindow.cpp b/noncore/unsupported/mailit/mailitwindow.cpp
index 6e298c7..fec4d78 100644
--- a/noncore/unsupported/mailit/mailitwindow.cpp
+++ b/noncore/unsupported/mailit/mailitwindow.cpp
@@ -1,129 +1,129 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop 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#include <qwhatsthis.h> 20#include <qwhatsthis.h>
21#include <qmessagebox.h> 21#include <qmessagebox.h>
22#include "mailitwindow.h" 22#include "mailitwindow.h"
23 23
24MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags /*fl*/) 24MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags /*fl*/)
25 : QMainWindow(parent, name, WStyle_ContextHelp) 25 : QMainWindow(parent, name, WStyle_ContextHelp)
26{ 26{
27 currentCaption = tr("Mailit"); 27 currentCaption = tr("Mailit");
28 setCaption(tr(currentCaption)); 28 setCaption(tr(currentCaption));
29 views = new QWidgetStack(this); 29 views = new QWidgetStack(this);
30 setCentralWidget(views); 30 setCentralWidget(views);
31 QWhatsThis::add(views,tr("Central view area")); 31 QWhatsThis::add(views,tr("Central view area"));
32 emailClient = new EmailClient(views, "client"); 32 emailClient = new EmailClient(views, "client");
33 writeMail = new WriteMail(views, "writing"); 33 writeMail = new WriteMail(views, "writing");
34 readMail = new ReadMail(views, "reading"); 34 readMail = new ReadMail(views, "reading");
35 35
36 views->raiseWidget(emailClient); 36 views->raiseWidget(emailClient);
37 37
38 connect(emailClient, SIGNAL(composeRequested()), 38 connect(emailClient, SIGNAL(composeRequested()),
39 this, SLOT(compose()) ); 39 this, SLOT(compose()) );
40 connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this, 40 connect(emailClient, SIGNAL(viewEmail(QListView*,Email*)), this,
41 SLOT(viewMail(QListView *, Email *)) ); 41 SLOT(viewMail(QListView*,Email*)) );
42 connect(emailClient, SIGNAL(mailUpdated(Email *)), this, 42 connect(emailClient, SIGNAL(mailUpdated(Email*)), this,
43 SLOT(updateMailView(Email *)) ); 43 SLOT(updateMailView(Email*)) );
44 44
45 connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) ); 45 connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) );
46 connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this, 46 connect(writeMail, SIGNAL(sendMailRequested(const Email&)), this,
47 SLOT(showEmailClient()) ); 47 SLOT(showEmailClient()) );
48 connect(writeMail, SIGNAL(sendMailRequested(const Email &)), emailClient, 48 connect(writeMail, SIGNAL(sendMailRequested(const Email&)), emailClient,
49 SLOT(enqueMail(const Email &)) ); 49 SLOT(enqueMail(const Email&)) );
50 50
51 connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) ); 51 connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) );
52 connect(readMail, SIGNAL(replyRequested(Email &, bool&)), this, 52 connect(readMail, SIGNAL(replyRequested(Email&,bool&)), this,
53 SLOT(composeReply(Email &, bool&)) ); 53 SLOT(composeReply(Email&,bool&)) );
54 connect(readMail, SIGNAL(forwardRequested(Email &)), this, 54 connect(readMail, SIGNAL(forwardRequested(Email&)), this,
55 SLOT(composeForward(Email &)) ); 55 SLOT(composeForward(Email&)) );
56 56
57 connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient, 57 connect(readMail, SIGNAL(removeItem(EmailListItem*,bool&)), emailClient,
58 SLOT(deleteMail(EmailListItem *, bool &)) ); 58 SLOT(deleteMail(EmailListItem*,bool&)) );
59 connect(readMail, SIGNAL(viewingMail(Email *)), emailClient, 59 connect(readMail, SIGNAL(viewingMail(Email*)), emailClient,
60 SLOT(moveMailFront(Email *)) ); 60 SLOT(moveMailFront(Email*)) );
61 61
62 connect(emailClient, SIGNAL(newCaption(const QString &)), 62 connect(emailClient, SIGNAL(newCaption(const QString&)),
63 this, SLOT(updateCaption(const QString &)) ); 63 this, SLOT(updateCaption(const QString&)) );
64 64
65 connect(readMail, SIGNAL(download(Email *)), emailClient, SLOT(download(Email*)) ); 65 connect(readMail, SIGNAL(download(Email*)), emailClient, SLOT(download(Email*)) );
66 66
67 viewingMail = FALSE; 67 viewingMail = FALSE;
68} 68}
69 69
70MailItWindow::~MailItWindow() 70MailItWindow::~MailItWindow()
71{ 71{
72} 72}
73 73
74void MailItWindow::closeEvent(QCloseEvent *e) 74void MailItWindow::closeEvent(QCloseEvent *e)
75{ 75{
76 if (views->visibleWidget() == emailClient) { 76 if (views->visibleWidget() == emailClient) {
77 e->accept(); 77 e->accept();
78 } else { 78 } else {
79 showEmailClient(); 79 showEmailClient();
80 } 80 }
81} 81}
82 82
83void MailItWindow::compose() 83void MailItWindow::compose()
84{ 84{
85 viewingMail = FALSE; 85 viewingMail = FALSE;
86 emailClient->hide(); 86 emailClient->hide();
87 readMail->hide(); 87 readMail->hide();
88 views->raiseWidget(writeMail); 88 views->raiseWidget(writeMail);
89 writeMail->setAddressList(emailClient->getAdrListRef()); 89 writeMail->setAddressList(emailClient->getAdrListRef());
90 writeMail->newMail(); 90 writeMail->newMail();
91 setCaption( tr( "Write mail" ) ); 91 setCaption( tr( "Write mail" ) );
92} 92}
93 93
94void MailItWindow::composeReply(Email &mail, bool& replyAll) 94void MailItWindow::composeReply(Email &mail, bool& replyAll)
95{ 95{
96 compose(); 96 compose();
97 writeMail->reply(mail,replyAll) ; 97 writeMail->reply(mail,replyAll) ;
98} 98}
99 99
100void MailItWindow::composeForward(Email &mail) 100void MailItWindow::composeForward(Email &mail)
101{ 101{
102 compose(); 102 compose();
103 writeMail->forward(mail) ; 103 writeMail->forward(mail) ;
104} 104}
105 105
106 106
107void MailItWindow::showEmailClient() 107void MailItWindow::showEmailClient()
108{ 108{
109 viewingMail = FALSE; 109 viewingMail = FALSE;
110 writeMail->hide(); 110 writeMail->hide();
111 readMail->hide(); 111 readMail->hide();
112 views->raiseWidget(emailClient); 112 views->raiseWidget(emailClient);
113 setCaption( tr(currentCaption) ); 113 setCaption( tr(currentCaption) );
114} 114}
115 115
116void MailItWindow::viewMail(QListView *view, Email *mail) 116void MailItWindow::viewMail(QListView *view, Email *mail)
117{ 117{
118 viewingMail = TRUE; 118 viewingMail = TRUE;
119 emailClient->hide(); 119 emailClient->hide();
120 120
121 int result=0; 121 int result=0;
122 122
123 if ((mail->received)&&(!mail->downloaded)) 123 if ((mail->received)&&(!mail->downloaded))
124 { 124 {
125 QMessageBox mb( tr("Mail not downloaded"), 125 QMessageBox mb( tr("Mail not downloaded"),
126 tr("The mail you have clicked \n" 126 tr("The mail you have clicked \n"
127 "has not been downloaded yet.\n " 127 "has not been downloaded yet.\n "
128 "Would you like to do it now ?"), 128 "Would you like to do it now ?"),
129 QMessageBox::Information, 129 QMessageBox::Information,
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index a09bc30..7f1c0b8 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -115,150 +115,150 @@ void MainWindow::makeMenu()
115 updateAction = new QAction( tr( "Update" ), 115 updateAction = new QAction( tr( "Update" ),
116 Resource::loadIconSet( "oipkg/update" ), 116 Resource::loadIconSet( "oipkg/update" ),
117 QString::null, 0, this, 0 ); 117 QString::null, 0, this, 0 );
118 connect( updateAction, SIGNAL( activated() ), 118 connect( updateAction, SIGNAL( activated() ),
119 this , SLOT( updateList() ) ); 119 this , SLOT( updateList() ) );
120 updateAction->addTo( toolBar ); 120 updateAction->addTo( toolBar );
121 updateAction->addTo( srvMenu ); 121 updateAction->addTo( srvMenu );
122 122
123 QAction *cfgact; 123 QAction *cfgact;
124 124
125 cfgact = new QAction( tr( "Setups" ), 125 cfgact = new QAction( tr( "Setups" ),
126 QString::null, 0, this, 0 ); 126 QString::null, 0, this, 0 );
127 connect( cfgact, SIGNAL( activated() ), 127 connect( cfgact, SIGNAL( activated() ),
128 SLOT( showSettingsSetup() ) ); 128 SLOT( showSettingsSetup() ) );
129 cfgact->addTo( cfgMenu ); 129 cfgact->addTo( cfgMenu );
130 130
131 cfgact = new QAction( tr( "Servers" ), 131 cfgact = new QAction( tr( "Servers" ),
132 QString::null, 0, this, 0 ); 132 QString::null, 0, this, 0 );
133 connect( cfgact, SIGNAL( activated() ), 133 connect( cfgact, SIGNAL( activated() ),
134 SLOT( showSettingsSrv() ) ); 134 SLOT( showSettingsSrv() ) );
135 cfgact->addTo( cfgMenu ); 135 cfgact->addTo( cfgMenu );
136 cfgact = new QAction( tr( "Destinations" ), 136 cfgact = new QAction( tr( "Destinations" ),
137 QString::null, 0, this, 0 ); 137 QString::null, 0, this, 0 );
138 connect( cfgact, SIGNAL( activated() ), 138 connect( cfgact, SIGNAL( activated() ),
139 SLOT( showSettingsDst() ) ); 139 SLOT( showSettingsDst() ) );
140 cfgact->addTo( cfgMenu ); 140 cfgact->addTo( cfgMenu );
141 141
142 QAction *a; 142 QAction *a;
143 143
144 // SECTIONS 144 // SECTIONS
145 sectionBar = new QToolBar( this ); 145 sectionBar = new QToolBar( this );
146 addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); 146 addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE );
147 sectionBar->setHorizontalStretchable( true ); 147 sectionBar->setHorizontalStretchable( true );
148 QLabel *label = new QLabel( sectionBar, "section" ); 148 QLabel *label = new QLabel( sectionBar, "section" );
149// label->setBackgroundMode( NoBackground ); 149// label->setBackgroundMode( NoBackground );
150 label->font().setPointSize( 8 ); 150 label->font().setPointSize( 8 );
151 label->setText( tr( "Section:" ) ); 151 label->setText( tr( "Section:" ) );
152 sectionBar->setStretchableWidget( label ); 152 sectionBar->setStretchableWidget( label );
153 section = new QComboBox( false, sectionBar ); 153 section = new QComboBox( false, sectionBar );
154 section->font().setPointSize( 8 ); 154 section->font().setPointSize( 8 );
155 label = new QLabel( " / ", sectionBar ); 155 label = new QLabel( " / ", sectionBar );
156 label->font().setPointSize( 8 ); 156 label->font().setPointSize( 8 );
157// label->setBackgroundMode( PaletteForeground ); 157// label->setBackgroundMode( PaletteForeground );
158 subsection = new QComboBox( false, sectionBar ); 158 subsection = new QComboBox( false, sectionBar );
159 subsection->font().setPointSize( 8 ); 159 subsection->font().setPointSize( 8 );
160 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 160 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
161 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); 161 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) );
162 a->addTo( sectionBar ); 162 a->addTo( sectionBar );
163 setSections(); 163 setSections();
164 setSubSections(); 164 setSubSections();
165 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); 165 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 );
166 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); 166 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) );
167 sectionAction->setToggleAction( true ); 167 sectionAction->setToggleAction( true );
168 sectionAction->addTo( viewMenu ); 168 sectionAction->addTo( viewMenu );
169 // sectionBar->setStretchableWidget( section ); 169 // sectionBar->setStretchableWidget( section );
170 170
171 //FIND 171 //FIND
172 findBar = new QToolBar(this); 172 findBar = new QToolBar(this);
173 addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); 173 addToolBar( findBar, "Filter", QMainWindow::Top, TRUE );
174 label = new QLabel( tr("Filter: "), findBar ); 174 label = new QLabel( tr("Filter: "), findBar );
175// label->setBackgroundMode( PaletteForeground ); 175// label->setBackgroundMode( PaletteForeground );
176 findBar->setHorizontalStretchable( TRUE ); 176 findBar->setHorizontalStretchable( TRUE );
177 findEdit = new QLineEdit( findBar, "findEdit" ); 177 findEdit = new QLineEdit( findBar, "findEdit" );
178 findBar->setStretchableWidget( findEdit ); 178 findBar->setStretchableWidget( findEdit );
179 connect( findEdit, SIGNAL( textChanged( const QString & ) ), 179 connect( findEdit, SIGNAL( textChanged(const QString&) ),
180 this, SLOT( displayList() ) ); 180 this, SLOT( displayList() ) );
181 a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); 181 a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
182 connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); 182 connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) );
183 a->addTo( findBar ); 183 a->addTo( findBar );
184 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 184 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
185 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 185 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
186 a->addTo( findBar ); 186 a->addTo( findBar );
187 findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); 187 findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 );
188 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); 188 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) );
189 findAction->setToggleAction( true ); 189 findAction->setToggleAction( true );
190 findAction->addTo( viewMenu ); 190 findAction->addTo( viewMenu );
191 191
192 //SEARCH 192 //SEARCH
193 searchBar = new QToolBar(this); 193 searchBar = new QToolBar(this);
194 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 194 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
195 label = new QLabel( tr("Search: "), searchBar ); 195 label = new QLabel( tr("Search: "), searchBar );
196// label->setBackgroundMode( PaletteForeground ); 196// label->setBackgroundMode( PaletteForeground );
197 searchBar->setHorizontalStretchable( TRUE ); 197 searchBar->setHorizontalStretchable( TRUE );
198 searchEdit = new QLineEdit( searchBar, "seachEdit" ); 198 searchEdit = new QLineEdit( searchBar, "seachEdit" );
199 searchBar->setStretchableWidget( searchEdit ); 199 searchBar->setStretchableWidget( searchEdit );
200// connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 200// connect( searchEdit, SIGNAL( textChanged(const QString&) ),
201// this, SLOT( displayList() ) ); 201// this, SLOT( displayList() ) );
202 a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); 202 a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
203 connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); 203 connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) );
204 a->addTo( searchBar ); 204 a->addTo( searchBar );
205 searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); 205 searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
206 connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); 206 connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) );
207 searchCommit->addTo( searchBar ); 207 searchCommit->addTo( searchBar );
208 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 208 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
209 connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); 209 connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) );
210 a->addTo( searchBar ); 210 a->addTo( searchBar );
211 searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); 211 searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 );
212 connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); 212 connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) );
213 searchAction->setToggleAction( true ); 213 searchAction->setToggleAction( true );
214 searchAction->addTo( viewMenu ); 214 searchAction->addTo( viewMenu );
215 215
216 //DEST 216 //DEST
217 destBar = new QToolBar(this); 217 destBar = new QToolBar(this);
218 addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); 218 addToolBar( destBar, "Destination", QMainWindow::Top, TRUE );
219 label = new QLabel( tr("Destination: "), destBar ); 219 label = new QLabel( tr("Destination: "), destBar );
220// label->setBackgroundMode( PaletteForeground ); 220// label->setBackgroundMode( PaletteForeground );
221 destBar->setHorizontalStretchable( TRUE ); 221 destBar->setHorizontalStretchable( TRUE );
222 destination = new QComboBox( false, destBar ); 222 destination = new QComboBox( false, destBar );
223 destination->insertStringList( settings->getDestinationNames() ); 223 destination->insertStringList( settings->getDestinationNames() );
224 setComboName(destination,settings->getDestinationName()); 224 setComboName(destination,settings->getDestinationName());
225 connect( destination, SIGNAL(activated(int)), 225 connect( destination, SIGNAL(activated(int)),
226 settings, SLOT(activeDestinationChange(int)) ); 226 settings, SLOT(activeDestinationChange(int)) );
227// space->setBackgroundMode( PaletteForeground ); 227// space->setBackgroundMode( PaletteForeground );
228 CheckBoxLink = new QCheckBox( tr("Link"), destBar); 228 CheckBoxLink = new QCheckBox( tr("Link"), destBar);
229// CheckBoxLink->setBackgroundMode( PaletteForeground ); 229// CheckBoxLink->setBackgroundMode( PaletteForeground );
230 CheckBoxLink->setChecked( settings->createLinks() ); 230 CheckBoxLink->setChecked( settings->createLinks() );
231 connect( CheckBoxLink, SIGNAL(toggled(bool)), 231 connect( CheckBoxLink, SIGNAL(toggled(bool)),
232 settings, SLOT(linkEnabled(bool)) ); 232 settings, SLOT(linkEnabled(bool)) );
233 destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); 233 destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 );
234 connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); 234 connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) );
235 a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 235 a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
236 connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); 236 connect( a, SIGNAL( activated() ), SLOT( destClose() ) );
237 a->addTo( destBar ); 237 a->addTo( destBar );
238 destBar->setStretchableWidget( CheckBoxLink ); 238 destBar->setStretchableWidget( CheckBoxLink );
239 destAction->setToggleAction( true ); 239 destAction->setToggleAction( true );
240 destAction->addTo( viewMenu ); 240 destAction->addTo( viewMenu );
241 241
242// helpMenu 242// helpMenu
243 helpMenu->insertSeparator(); 243 helpMenu->insertSeparator();
244 a = new QAction( tr( "Package Actions" ), QString::null, 0, this, 0 ); 244 a = new QAction( tr( "Package Actions" ), QString::null, 0, this, 0 );
245 a->addTo( helpMenu ); 245 a->addTo( helpMenu );
246 helpMenu->insertSeparator(); 246 helpMenu->insertSeparator();
247 a = new QAction( tr( "Install" ), 247 a = new QAction( tr( "Install" ),
248 Resource::loadPixmap( "oipkg/install" ), QString::null, 0, this, 0 ); 248 Resource::loadPixmap( "oipkg/install" ), QString::null, 0, this, 0 );
249 a->addTo( helpMenu ); 249 a->addTo( helpMenu );
250 a = new QAction( tr( "Remove" ), 250 a = new QAction( tr( "Remove" ),
251 Resource::loadPixmap( "oipkg/uninstall" ), QString::null, 0, this, 0 ); 251 Resource::loadPixmap( "oipkg/uninstall" ), QString::null, 0, this, 0 );
252 a->addTo( helpMenu ); 252 a->addTo( helpMenu );
253 helpMenu->insertSeparator(); 253 helpMenu->insertSeparator();
254 a = new QAction( tr( "Package Status" ), QString::null, 0, this, 0 ); 254 a = new QAction( tr( "Package Status" ), QString::null, 0, this, 0 );
255 a->addTo( helpMenu ); 255 a->addTo( helpMenu );
256 helpMenu->insertSeparator(); 256 helpMenu->insertSeparator();
257 a = new QAction( tr( "New version, installed" ), 257 a = new QAction( tr( "New version, installed" ),
258 Resource::loadPixmap( "oipkg/installed" ), QString::null, 0, this, 0 ); 258 Resource::loadPixmap( "oipkg/installed" ), QString::null, 0, this, 0 );
259 a->addTo( helpMenu ); 259 a->addTo( helpMenu );
260 a = new QAction( tr( "New version, not installed" ), 260 a = new QAction( tr( "New version, not installed" ),
261 Resource::loadPixmap( "oipkg/uninstalled" ), QString::null, 0, this, 0 ); 261 Resource::loadPixmap( "oipkg/uninstalled" ), QString::null, 0, this, 0 );
262 a->addTo( helpMenu ); 262 a->addTo( helpMenu );
263 a = new QAction( tr( "Old version, installed" ), 263 a = new QAction( tr( "Old version, installed" ),
264 Resource::loadPixmap( "oipkg/installedOld" ), QString::null, 0, this, 0 ); 264 Resource::loadPixmap( "oipkg/installedOld" ), QString::null, 0, this, 0 );
@@ -407,109 +407,109 @@ void MainWindow::showSettingsDst()
407} 407}
408 408
409void MainWindow::sectionShow(bool b) 409void MainWindow::sectionShow(bool b)
410{ 410{
411 if (b) sectionBar->show(); 411 if (b) sectionBar->show();
412 else sectionBar->hide(); 412 else sectionBar->hide();
413 sectionAction->setOn( b ); 413 sectionAction->setOn( b );
414} 414}
415 415
416void MainWindow::sectionClose() 416void MainWindow::sectionClose()
417{ 417{
418 sectionAction->setOn( false ); 418 sectionAction->setOn( false );
419} 419}
420 420
421void MainWindow::findShow(bool b) 421void MainWindow::findShow(bool b)
422{ 422{
423 if (b) findBar->show(); 423 if (b) findBar->show();
424 else findBar->hide(); 424 else findBar->hide();
425 findAction->setOn( b ); 425 findAction->setOn( b );
426} 426}
427 427
428void MainWindow::findClose() 428void MainWindow::findClose()
429{ 429{
430 findAction->setOn( false ); 430 findAction->setOn( false );
431} 431}
432 432
433void MainWindow::searchShow(bool b) 433void MainWindow::searchShow(bool b)
434{ 434{
435 if (b) searchBar->show(); 435 if (b) searchBar->show();
436 else searchBar->hide(); 436 else searchBar->hide();
437 searchAction->setOn( b ); 437 searchAction->setOn( b );
438} 438}
439 439
440void MainWindow::searchClose() 440void MainWindow::searchClose()
441{ 441{
442 searchAction->setOn( false ); 442 searchAction->setOn( false );
443} 443}
444 444
445 445
446void MainWindow::destShow(bool b) 446void MainWindow::destShow(bool b)
447{ 447{
448 if (b) destBar->show(); 448 if (b) destBar->show();
449 else destBar->hide(); 449 else destBar->hide();
450 destAction->setOn( b ); 450 destAction->setOn( b );
451} 451}
452 452
453void MainWindow::destClose() 453void MainWindow::destClose()
454{ 454{
455 destAction->setOn( false ); 455 destAction->setOn( false );
456} 456}
457 457
458void MainWindow::setDocument(const QString &fileName) 458void MainWindow::setDocument(const QString &fileName)
459{ 459{
460 if ( !QFile::exists( fileName ) ) return; 460 if ( !QFile::exists( fileName ) ) return;
461 ipkg->installFile( fileName ); 461 ipkg->installFile( fileName );
462 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 462 QCopEnvelope e("QPE/System", "linkChanged(QString)");
463 QString lf = QString::null; 463 QString lf = QString::null;
464 e << lf; 464 e << lf;
465} 465}
466 466
467 467
468void MainWindow::makeChannel() 468void MainWindow::makeChannel()
469 { 469 {
470 channel = new QCopChannel( "QPE/Application/oipkg", this ); 470 channel = new QCopChannel( "QPE/Application/oipkg", this );
471 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 471 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
472 this, SLOT(receive(const QCString&, const QByteArray&)) ); 472 this, SLOT(receive(const QCString&,const QByteArray&)) );
473} 473}
474 474
475 475
476 476
477void MainWindow::receive(const QCString &msg, const QByteArray &arg) 477void MainWindow::receive(const QCString &msg, const QByteArray &arg)
478{ 478{
479 pvDebug(3, "QCop "+msg+" "+QCString(arg)); 479 pvDebug(3, "QCop "+msg+" "+QCString(arg));
480 if ( msg == "installFile(QString)" ) 480 if ( msg == "installFile(QString)" )
481 { 481 {
482 ipkg->installFile( QString(arg) ); 482 ipkg->installFile( QString(arg) );
483 }else if( msg == "removeFile(QString)" ) 483 }else if( msg == "removeFile(QString)" )
484 { 484 {
485 ipkg->removeFile( QString(arg) ); 485 ipkg->removeFile( QString(arg) );
486 }else if( msg == "createLinks(QString)" ) 486 }else if( msg == "createLinks(QString)" )
487 { 487 {
488 ipkg->createLinks( QString(arg) ); 488 ipkg->createLinks( QString(arg) );
489 }else if( msg == "removeLinks(QString)" ) 489 }else if( msg == "removeLinks(QString)" )
490 { 490 {
491 ipkg->removeLinks( QString(arg) ); 491 ipkg->removeLinks( QString(arg) );
492 }else{ 492 }else{
493 pvDebug(2,"Huh what do ya want") 493 pvDebug(2,"Huh what do ya want")
494 } 494 }
495} 495}
496 496
497 497
498void MainWindow::createLinks() 498void MainWindow::createLinks()
499{ 499{
500 pvDebug(2,"creating links..."); 500 pvDebug(2,"creating links...");
501 ipkg->createLinks( settings->destinationurl->text() ); 501 ipkg->createLinks( settings->destinationurl->text() );
502} 502}
503 503
504void MainWindow::removeLinks() 504void MainWindow::removeLinks()
505{ 505{
506 pvDebug(2,"removing links..."); 506 pvDebug(2,"removing links...");
507 ipkg->removeLinks( settings->destinationurl->text() ); 507 ipkg->removeLinks( settings->destinationurl->text() );
508} 508}
509 509
510void MainWindow::remotePackageQuery() 510void MainWindow::remotePackageQuery()
511{ 511{
512 packageListSearch.query( searchEdit->text() ); 512 packageListSearch.query( searchEdit->text() );
513 packageListSearch.update(); 513 packageListSearch.update();
514 displayList(); 514 displayList();
515} 515}
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp
index 1610a37..1b4812d 100644
--- a/noncore/unsupported/oipkg/packagelistitem.cpp
+++ b/noncore/unsupported/oipkg/packagelistitem.cpp
@@ -150,91 +150,91 @@ QPixmap PackageListItem::statePixmap() const
150 else 150 else
151 return *pm_uninstall; 151 return *pm_uninstall;
152 } 152 }
153} 153}
154 154
155QString PackageListItem::key( int column, bool ascending ) const 155QString PackageListItem::key( int column, bool ascending ) const
156{ 156{
157 if ( column == 2 ) { 157 if ( column == 2 ) {
158 QString t = text(2); 158 QString t = text(2);
159 double bytes=t.toDouble(); 159 double bytes=t.toDouble();
160 if ( t.contains('M') ) bytes*=1024*1024; 160 if ( t.contains('M') ) bytes*=1024*1024;
161 else if ( t.contains('K') || t.contains('k') ) bytes*=1024; 161 else if ( t.contains('K') || t.contains('k') ) bytes*=1024;
162 if ( !ascending ) bytes=999999999-bytes; 162 if ( !ascending ) bytes=999999999-bytes;
163 return QString().sprintf("%09d",(int)bytes); 163 return QString().sprintf("%09d",(int)bytes);
164 } else { 164 } else {
165 return QListViewItem::key(column,ascending); 165 return QListViewItem::key(column,ascending);
166 } 166 }
167} 167}
168 168
169void PackageListItem::setOn( bool b ) 169void PackageListItem::setOn( bool b )
170{ 170{
171 QCheckListItem::setOn( b ); 171 QCheckListItem::setOn( b );
172 package->toggleProcess(); 172 package->toggleProcess();
173 package->setLink( settings->createLinks() ); 173 package->setLink( settings->createLinks() );
174 displayDetails(); 174 displayDetails();
175} 175}
176 176
177void PackageListItem::displayDetails() 177void PackageListItem::displayDetails()
178{ 178{
179 QString sod; 179 QString sod;
180 sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits()); 180 sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits());
181 //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest()); 181 //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest());
182 sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); 182 sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest());
183 sod = sod.isEmpty()?QString(""):QString(" ("+sod+")"); 183 sod = sod.isEmpty()?QString(""):QString(" ("+sod+")");
184 setText(0, package->name()+sod ); 184 setText(0, package->name()+sod );
185 nameItem->setText( 0, QObject::tr("Name: ")+package->name()); 185 nameItem->setText( 0, QObject::tr("Name: ")+package->name());
186 linkItem->setText( 0, QObject::tr("Link: ")+(package->link()?QObject::tr("Yes"):QObject::tr("No"))); 186 linkItem->setText( 0, QObject::tr("Link: ")+(package->link()?QObject::tr("Yes"):QObject::tr("No")));
187 destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); 187 destItem->setText( 0, QObject::tr("Destination: ")+package->dest() );
188 statusItem->setText( 0, QObject::tr("Status: ")+package->status() ); 188 statusItem->setText( 0, QObject::tr("Status: ")+package->status() );
189 repaint(); 189 repaint();
190} 190}
191 191
192QPopupMenu* PackageListItem::getPopupMenu() 192QPopupMenu* PackageListItem::getPopupMenu()
193{ 193{
194 popupMenu->clear(); 194 popupMenu->clear();
195 destsMenu->clear(); 195 destsMenu->clear();
196 196
197 QAction *popupAction; 197 QAction *popupAction;
198 qDebug("PackageListItem::showPopup "); 198 qDebug("PackageListItem::showPopup ");
199 199
200 if (!package->installed()){ 200 if (!package->installed()){
201 popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); 201 popupMenu->insertItem( QObject::tr("Install to"), destsMenu );
202 QStringList dests = settings->getDestinationNames(); 202 QStringList dests = settings->getDestinationNames();
203 QString ad = settings->getDestinationName(); 203 QString ad = settings->getDestinationName();
204 for (uint i = 0; i < dests.count(); i++ ) 204 for (uint i = 0; i < dests.count(); i++ )
205 { 205 {
206 popupAction = new QAction( dests[i], QString::null, 0, popupMenu, 0 ); 206 popupAction = new QAction( dests[i], QString::null, 0, popupMenu, 0 );
207 popupAction->addTo( destsMenu ); 207 popupAction->addTo( destsMenu );
208 if ( dests[i] == ad && getPackage()->toInstall() ) 208 if ( dests[i] == ad && getPackage()->toInstall() )
209 { 209 {
210 popupAction->setToggleAction( true ); 210 popupAction->setToggleAction( true );
211 popupAction->setOn(true); 211 popupAction->setOn(true);
212 } 212 }
213 } 213 }
214 connect( destsMenu, SIGNAL( activated( int ) ), 214 connect( destsMenu, SIGNAL( activated(int) ),
215 this, SLOT( menuAction( int ) ) ); 215 this, SLOT( menuAction(int) ) );
216 popupMenu->popup( QCursor::pos() ); 216 popupMenu->popup( QCursor::pos() );
217 }else{ 217 }else{
218 popupMenu->insertItem( QObject::tr("Remove")); 218 popupMenu->insertItem( QObject::tr("Remove"));
219 connect( popupMenu, SIGNAL( activated( int ) ), 219 connect( popupMenu, SIGNAL( activated(int) ),
220 this, SLOT( menuAction( int ) ) ); 220 this, SLOT( menuAction(int) ) );
221 popupMenu->popup( QCursor::pos() ); 221 popupMenu->popup( QCursor::pos() );
222 } 222 }
223 return popupMenu; 223 return popupMenu;
224} 224}
225 225
226void PackageListItem::menuAction( int i ) 226void PackageListItem::menuAction( int i )
227{ 227{
228 if (!package->installed()){ 228 if (!package->installed()){
229 package->setDest( destsMenu->text(i) ); 229 package->setDest( destsMenu->text(i) );
230 package->setLink( settings->createLinks() ); 230 package->setLink( settings->createLinks() );
231 } 231 }
232 package->setOn(); 232 package->setOn();
233 displayDetails(); 233 displayDetails();
234} 234}
235 235
236//void PackageListItem::toggleProcess() 236//void PackageListItem::toggleProcess()
237//{ 237//{
238// package->toggleProcess() ; 238// package->toggleProcess() ;
239// displayDetails(); 239// displayDetails();
240//} 240//}
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp
index 3c7435d..98ebf88 100644
--- a/noncore/unsupported/oipkg/packagelistview.cpp
+++ b/noncore/unsupported/oipkg/packagelistview.cpp
@@ -1,97 +1,97 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org> 9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
10#include "packagelistview.h" 10#include "packagelistview.h"
11 11
12#include <qpopupmenu.h> 12#include <qpopupmenu.h>
13#include <qaction.h> 13#include <qaction.h>
14 14
15#include "listviewitemoipkg.h" 15#include "listviewitemoipkg.h"
16#include "packagelistitem.h" 16#include "packagelistitem.h"
17#include "pksettings.h" 17#include "pksettings.h"
18 18
19PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) 19PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s)
20 : QListView(p,n) 20 : QListView(p,n)
21{ 21{
22 settings = s; 22 settings = s;
23 popupTimer = new QTimer( this ); 23 popupTimer = new QTimer( this );
24 setSelectionMode(QListView::NoSelection); 24 setSelectionMode(QListView::NoSelection);
25 addColumn( tr("Package") ); 25 addColumn( tr("Package") );
26 setRootIsDecorated( true ); 26 setRootIsDecorated( true );
27 27
28 connect( popupTimer, SIGNAL(timeout()), 28 connect( popupTimer, SIGNAL(timeout()),
29 this, SLOT(showPopup()) ); 29 this, SLOT(showPopup()) );
30 connect( this, SIGNAL( pressed( QListViewItem* ) ), 30 connect( this, SIGNAL( pressed(QListViewItem*) ),
31 this, SLOT( setCurrent( QListViewItem* ) ) ); 31 this, SLOT( setCurrent(QListViewItem*) ) );
32 connect( this, SIGNAL( clicked( QListViewItem* ) ), 32 connect( this, SIGNAL( clicked(QListViewItem*) ),
33 this, SLOT( stopTimer( QListViewItem* ) ) ); 33 this, SLOT( stopTimer(QListViewItem*) ) );
34 34
35} 35}
36 36
37//PackageListView::~PackageListView() 37//PackageListView::~PackageListView()
38//{ 38//{
39//} 39//}
40 40
41void PackageListView::setCurrent( QListViewItem* p ) 41void PackageListView::setCurrent( QListViewItem* p )
42{ 42{
43 qDebug("PackageListView::setCurrent "); 43 qDebug("PackageListView::setCurrent ");
44 activeItem = (ListViewItemOipkg*)p; 44 activeItem = (ListViewItemOipkg*)p;
45 45
46 if ( activeItem != 0 ) popupTimer->start( 750, true ); 46 if ( activeItem != 0 ) popupTimer->start( 750, true );
47 47
48// if ( activeItem->getType() != ListViewItemOipkg::Package ){ 48// if ( activeItem->getType() != ListViewItemOipkg::Package ){
49// qDebug("PackageListView::setCurrent !p "); 49// qDebug("PackageListView::setCurrent !p ");
50// activePackage = 0; 50// activePackage = 0;
51 // activePackageListItem = 0; 51 // activePackageListItem = 0;
52// qDebug("PackageListView::setCurrent returning "); 52// qDebug("PackageListView::setCurrent returning ");
53// return; 53// return;
54// }; 54// };
55// activePackageListItem = (PackageListItem*)p; 55// activePackageListItem = (PackageListItem*)p;
56// activePackage = activePackageListItem->getPackage(); 56// activePackage = activePackageListItem->getPackage();
57// if (activePackage == 0 ) 57// if (activePackage == 0 )
58// { 58// {
59// qDebug("PackageListView::setCurrent if (!activePackage)"); 59// qDebug("PackageListView::setCurrent if (!activePackage)");
60// return; 60// return;
61// } 61// }
62 62
63 63
64 qDebug("PackageListView::setCurrent popupTimer->start"); 64 qDebug("PackageListView::setCurrent popupTimer->start");
65} 65}
66 66
67 67
68void PackageListView::showPopup() 68void PackageListView::showPopup()
69{ 69{
70 qDebug("PackageListView::showPopup"); 70 qDebug("PackageListView::showPopup");
71 QPopupMenu *popup = activeItem->getPopupMenu(); 71 QPopupMenu *popup = activeItem->getPopupMenu();
72 if (popup == 0) return; 72 if (popup == 0) return;
73 popup->popup( QCursor::pos() ); 73 popup->popup( QCursor::pos() );
74 qDebug("PackageListView::showPopup"); 74 qDebug("PackageListView::showPopup");
75} 75}
76 76
77void PackageListView::stopTimer( QListViewItem* ) 77void PackageListView::stopTimer( QListViewItem* )
78{ 78{
79 popupTimer->stop(); 79 popupTimer->stop();
80} 80}
81 81
82 82
83void PackageListView::display() 83void PackageListView::display()
84{ 84{
85 QDictIterator<PackageList> list( PackageLists ); 85 QDictIterator<PackageList> list( PackageLists );
86 PackageList *packlist; 86 PackageList *packlist;
87 OipkgPackage *pack; 87 OipkgPackage *pack;
88 PackageListItem *item; 88 PackageListItem *item;
89 ListViewItemOipkg *rootItem; 89 ListViewItemOipkg *rootItem;
90 QListViewItem* it; 90 QListViewItem* it;
91 QListViewItem* itdel; 91 QListViewItem* itdel;
92 while ( list.current() ) { 92 while ( list.current() ) {
93 packlist = list.current(); 93 packlist = list.current();
94 rootItem = rootItems.find( list.currentKey() ); 94 rootItem = rootItems.find( list.currentKey() );
95 //rootItem->clear(); 95 //rootItem->clear();
96 it=rootItem->firstChild(); 96 it=rootItem->firstChild();
97 while ( it ) 97 while ( it )
diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp
index 063b018..aac011e 100644
--- a/noncore/unsupported/oipkg/pksettings.cpp
+++ b/noncore/unsupported/oipkg/pksettings.cpp
@@ -1,113 +1,113 @@
1#include "pksettings.h" 1#include "pksettings.h"
2 2
3#include <qpe/process.h> 3#include <qpe/process.h>
4#include <qpe/resource.h> 4#include <qpe/resource.h>
5#include <qpe/stringutil.h> 5#include <qpe/stringutil.h>
6#include <qpe/qpeapplication.h> 6#include <qpe/qpeapplication.h>
7#include <qpe/qcopenvelope_qws.h> 7#include <qpe/qcopenvelope_qws.h>
8#include <qpe/applnk.h> 8#include <qpe/applnk.h>
9#include <qpe/config.h> 9#include <qpe/config.h>
10 10
11#include <qprogressbar.h> 11#include <qprogressbar.h>
12#include <qcombobox.h> 12#include <qcombobox.h>
13#include <qdict.h> 13#include <qdict.h>
14#include <qfile.h> 14#include <qfile.h>
15#include <qlineedit.h> 15#include <qlineedit.h>
16#include <qpushbutton.h> 16#include <qpushbutton.h>
17#include <qlistview.h> 17#include <qlistview.h>
18#include <qlistbox.h> 18#include <qlistbox.h>
19#include <qcheckbox.h> 19#include <qcheckbox.h>
20#include <qmessagebox.h> 20#include <qmessagebox.h>
21#include <qpainter.h> 21#include <qpainter.h>
22#include <qpixmap.h> 22#include <qpixmap.h>
23#include <qregexp.h> 23#include <qregexp.h>
24#include <qstring.h> 24#include <qstring.h>
25#include <qobject.h> 25#include <qobject.h>
26#include <qtextstream.h> 26#include <qtextstream.h>
27#include <qtextview.h> 27#include <qtextview.h>
28#include <qtoolbutton.h> 28#include <qtoolbutton.h>
29#include <qtabwidget.h> 29#include <qtabwidget.h>
30 30
31#include <stdlib.h> 31#include <stdlib.h>
32#include <unistd.h> 32#include <unistd.h>
33#include "debug.h" 33#include "debug.h"
34//#include "utils.h" 34//#include "utils.h"
35 35
36PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl ) 36PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl )
37 : PackageManagerSettingsBase( parent, name, fl ) 37 : PackageManagerSettingsBase( parent, name, fl )
38{ 38{
39 connect( newserver, SIGNAL(clicked()), this, SLOT(newServer()) ); 39 connect( newserver, SIGNAL(clicked()), this, SLOT(newServer()) );
40 connect( removeserver, SIGNAL(clicked()), this, SLOT(removeServer()) ); 40 connect( removeserver, SIGNAL(clicked()), this, SLOT(removeServer()) );
41 connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); 41 connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) );
42 connect( newdestination, SIGNAL(clicked()), this, SLOT(newDestination()) ); 42 connect( newdestination, SIGNAL(clicked()), this, SLOT(newDestination()) );
43 connect( removedestination, SIGNAL(clicked()), this, SLOT(removeDestination()) ); 43 connect( removedestination, SIGNAL(clicked()), this, SLOT(removeDestination()) );
44 connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); 44 connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) );
45 // connect( CheckBoxLink, SIGNAL(toggled(bool)), 45 // connect( CheckBoxLink, SIGNAL(toggled(bool)),
46 // activeLinkDestination, SLOT(setEnabled(bool)) ); 46 // activeLinkDestination, SLOT(setEnabled(bool)) );
47 47
48// connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) ); 48// connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) );
49// connect( settingName, SIGNAL(textChanged(const QString &)), this, SLOT(installationSettingSetName(const QString &)) ); 49// connect( settingName, SIGNAL(textChanged(const QString&)), this, SLOT(installationSettingSetName(const QString&)) );
50// connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) ); 50// connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) );
51// connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) ); 51// connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) );
52 // connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) ); 52 // connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) );
53 servername->setEnabled(FALSE); 53 servername->setEnabled(FALSE);
54 serverurl->setEnabled(FALSE); 54 serverurl->setEnabled(FALSE);
55 serverurlDic.setAutoDelete(TRUE); 55 serverurlDic.setAutoDelete(TRUE);
56 destinationname->setEnabled(FALSE); 56 destinationname->setEnabled(FALSE);
57 destinationurl->setEnabled(FALSE); 57 destinationurl->setEnabled(FALSE);
58 destinationurlDic.setAutoDelete(TRUE); 58 destinationurlDic.setAutoDelete(TRUE);
59 readSettings(); 59 readSettings();
60 activeLinkDestination->hide(); 60 activeLinkDestination->hide();
61 serverChanged = false; 61 serverChanged = false;
62 62
63 // get rid of setups 63 // get rid of setups
64// Settings->hide(); 64// Settings->hide();
65// settingName->hide(); 65// settingName->hide();
66// newsetting->hide(); 66// newsetting->hide();
67// renamesetting->hide(); 67// renamesetting->hide();
68// removesetting->hide(); 68// removesetting->hide();
69} 69}
70 70
71PackageManagerSettings::~PackageManagerSettings() 71PackageManagerSettings::~PackageManagerSettings()
72{ 72{
73} 73}
74 74
75 75
76void PackageManagerSettings::newServer() 76void PackageManagerSettings::newServer()
77{ 77{
78 int i = servers->count(); 78 int i = servers->count();
79 if ( servername->isEnabled() || serverurl->text().isEmpty() ) { 79 if ( servername->isEnabled() || serverurl->text().isEmpty() ) {
80 serverurlDic.insert(i,new QString("http://")); 80 serverurlDic.insert(i,new QString("http://"));
81 servers->insertItem(tr("New")); 81 servers->insertItem(tr("New"));
82 activeServers->insertItem(tr("New")); 82 activeServers->insertItem(tr("New"));
83 } else { 83 } else {
84 // allows one-level undo 84 // allows one-level undo
85 serverurlDic.insert(i,new QString(serverurl->text())); 85 serverurlDic.insert(i,new QString(serverurl->text()));
86 servers->insertItem(servername->text()); 86 servers->insertItem(servername->text());
87 activeServers->insertItem(servername->text()); 87 activeServers->insertItem(servername->text());
88 } 88 }
89 changed = true; 89 changed = true;
90 servers->setSelected(i,TRUE); 90 servers->setSelected(i,TRUE);
91 editServer(i); 91 editServer(i);
92 changed = true; 92 changed = true;
93} 93}
94 94
95void PackageManagerSettings::newDestination() 95void PackageManagerSettings::newDestination()
96{ 96{
97 int i = destinations->count(); 97 int i = destinations->count();
98 if ( destinationname->isEnabled() || destinationurl->text().isEmpty() ) { 98 if ( destinationname->isEnabled() || destinationurl->text().isEmpty() ) {
99 destinationurlDic.insert(i,new QString("/")); 99 destinationurlDic.insert(i,new QString("/"));
100 destinations->insertItem(tr("New")); 100 destinations->insertItem(tr("New"));
101 activeDestination->insertItem(tr("New")); 101 activeDestination->insertItem(tr("New"));
102 activeLinkDestination->insertItem(tr("New")); 102 activeLinkDestination->insertItem(tr("New"));
103 } else { 103 } else {
104 // allows one-level undo 104 // allows one-level undo
105 destinationurlDic.insert(i,new QString(destinationurl->text())); 105 destinationurlDic.insert(i,new QString(destinationurl->text()));
106 destinations->insertItem(destinationname->text()); 106 destinations->insertItem(destinationname->text());
107 activeDestination->insertItem(destinationname->text()); 107 activeDestination->insertItem(destinationname->text());
108 activeLinkDestination->insertItem(destinationname->text()); 108 activeLinkDestination->insertItem(destinationname->text());
109 } 109 }
110 destinations->setSelected(i,TRUE); 110 destinations->setSelected(i,TRUE);
111 editDestination(i); 111 editDestination(i);
112 changed = true; 112 changed = true;
113} 113}
diff --git a/noncore/unsupported/qpdf/qbusybar.cpp b/noncore/unsupported/qpdf/qbusybar.cpp
index ce7ab8e..e942f06 100644
--- a/noncore/unsupported/qpdf/qbusybar.cpp
+++ b/noncore/unsupported/qpdf/qbusybar.cpp
@@ -1,84 +1,84 @@
1#include <qapplication.h> 1#include <qapplication.h>
2#include <qtimer.h> 2#include <qtimer.h>
3#include <qpainter.h> 3#include <qpainter.h>
4 4
5#include "qbusybar.h" 5#include "qbusybar.h"
6 6
7 7
8 8
9QBusyBar::QBusyBar ( QWidget *parent, const char *name, int flags ) : QWidget ( parent, name, flags | WRepaintNoErase ) 9QBusyBar::QBusyBar ( QWidget *parent, const char *name, int flags ) : QWidget ( parent, name, flags | WRepaintNoErase )
10{ 10{
11 m_busy = 0; 11 m_busy = 0;
12 12
13 m_div = 0; 13 m_div = 0;
14 m_pos = 0; 14 m_pos = 0;
15 m_fade = 0; 15 m_fade = 0;
16 m_fadecols = 0; 16 m_fadecols = 0;
17 m_speed = 500; 17 m_speed = 500;
18 18
19 m_timer = new QTimer ( this ); 19 m_timer = new QTimer ( this );
20 connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( slotTimeout ( ))); 20 connect ( m_timer, SIGNAL( timeout()), this, SLOT( slotTimeout()));
21 21
22 setParameters ( 12, 8, 200 ); 22 setParameters ( 12, 8, 200 );
23} 23}
24 24
25 void QBusyBar::setParameters ( int d, int s, int v ) 25 void QBusyBar::setParameters ( int d, int s, int v )
26 { 26 {
27 bool running = m_timer-> isActive ( ); 27 bool running = m_timer-> isActive ( );
28 28
29 if ( running ) 29 if ( running )
30 m_timer-> stop ( ); 30 m_timer-> stop ( );
31 31
32 m_div = d; 32 m_div = d;
33 m_speed = v; 33 m_speed = v;
34 34
35 delete [] m_fadecols; 35 delete [] m_fadecols;
36 m_fade = s; 36 m_fade = s;
37 m_fadecols = new QColor [m_fade]; 37 m_fadecols = new QColor [m_fade];
38 38
39 int rt, gt, bt; 39 int rt, gt, bt;
40 int rf, gf, bf; 40 int rf, gf, bf;
41 41
42 colorGroup ( ). color ( QColorGroup::Highlight ). rgb ( &rf, &gf, &bf ); 42 colorGroup ( ). color ( QColorGroup::Highlight ). rgb ( &rf, &gf, &bf );
43 colorGroup ( ). color ( QColorGroup::Background ). rgb ( &rt, &gt, &bt ); 43 colorGroup ( ). color ( QColorGroup::Background ). rgb ( &rt, &gt, &bt );
44 44
45 for ( int i = 0; i < s; i++ ) 45 for ( int i = 0; i < s; i++ )
46 m_fadecols [i]. setRgb ( rf + ( rt - rf ) * i / s, gf + ( gt - gf ) * i / s, bf + ( bt - bf ) * i / s ); 46 m_fadecols [i]. setRgb ( rf + ( rt - rf ) * i / s, gf + ( gt - gf ) * i / s, bf + ( bt - bf ) * i / s );
47 47
48 if ( running ) { 48 if ( running ) {
49 m_pos = 0; 49 m_pos = 0;
50 m_timer-> start ( m_speed ); 50 m_timer-> start ( m_speed );
51 } 51 }
52} 52}
53 53
54QBusyBar::~QBusyBar ( ) 54QBusyBar::~QBusyBar ( )
55{ 55{
56 delete [] m_fadecols; 56 delete [] m_fadecols;
57} 57}
58 58
59bool QBusyBar::isBusy ( ) const 59bool QBusyBar::isBusy ( ) const
60{ 60{
61 return m_busy; 61 return m_busy;
62} 62}
63 63
64void QBusyBar::beginBusy ( ) 64void QBusyBar::beginBusy ( )
65{ 65{
66 setBusy ( true ); 66 setBusy ( true );
67} 67}
68 68
69void QBusyBar::endBusy ( ) 69void QBusyBar::endBusy ( )
70{ 70{
71 setBusy ( false ); 71 setBusy ( false );
72} 72}
73 73
74void QBusyBar::setBusy ( bool b ) 74void QBusyBar::setBusy ( bool b )
75{ 75{
76 int busy = m_busy + ( b ? 1 : -1 ); 76 int busy = m_busy + ( b ? 1 : -1 );
77 77
78 if ( busy < 0 ) 78 if ( busy < 0 )
79 busy = 0; 79 busy = 0;
80 80
81 if (( m_busy == 0 ) && ( busy > 0 )) { // Changed stateto on 81 if (( m_busy == 0 ) && ( busy > 0 )) { // Changed stateto on
82 m_pos = 0; 82 m_pos = 0;
83 m_timer-> start ( m_speed ); 83 m_timer-> start ( m_speed );
84 update ( ); 84 update ( );
diff --git a/noncore/unsupported/qpdf/qpdf.cpp b/noncore/unsupported/qpdf/qpdf.cpp
index 5cdcccf..75e86d0 100644
--- a/noncore/unsupported/qpdf/qpdf.cpp
+++ b/noncore/unsupported/qpdf/qpdf.cpp
@@ -24,187 +24,187 @@
24#include <qtoolbutton.h> 24#include <qtoolbutton.h>
25#include <qmenubar.h> 25#include <qmenubar.h>
26#include <qpopupmenu.h> 26#include <qpopupmenu.h>
27#include <qwidgetstack.h> 27#include <qwidgetstack.h>
28#include <qtimer.h> 28#include <qtimer.h>
29#include <qfileinfo.h> 29#include <qfileinfo.h>
30#include <qstring.h> 30#include <qstring.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qspinbox.h> 32#include <qspinbox.h>
33#include <qlayout.h> 33#include <qlayout.h>
34#include <qdialog.h> 34#include <qdialog.h>
35#include <qlabel.h> 35#include <qlabel.h>
36#include <qmessagebox.h> 36#include <qmessagebox.h>
37 37
38#include "qpdf.h" 38#include "qpdf.h"
39 39
40#ifdef QPDF_QPE_ONLY 40#ifdef QPDF_QPE_ONLY
41#include <qpe/fileselector.h> 41#include <qpe/fileselector.h>
42#else 42#else
43#include <opie/ofileselector.h> 43#include <opie/ofileselector.h>
44#endif 44#endif
45 45
46 46
47int main ( int argc, char **argv ) 47int main ( int argc, char **argv )
48{ 48{
49 QPEApplication app ( argc, argv ); 49 QPEApplication app ( argc, argv );
50 50
51 // read config file 51 // read config file
52 globalParams = new GlobalParams ( "" ); 52 globalParams = new GlobalParams ( "" );
53 globalParams-> setErrQuiet ( true ); 53 globalParams-> setErrQuiet ( true );
54 54
55 QPdfDlg *dlg = new QPdfDlg ( ); 55 QPdfDlg *dlg = new QPdfDlg ( );
56 app. showMainDocumentWidget ( dlg ); 56 app. showMainDocumentWidget ( dlg );
57 57
58 if (( app. argc ( ) == 3 ) && ( app. argv ( ) [1] == QCString ( "-f" ))) 58 if (( app. argc ( ) == 3 ) && ( app. argv ( ) [1] == QCString ( "-f" )))
59 dlg-> openFile ( app. argv ( ) [2] ); 59 dlg-> openFile ( app. argv ( ) [2] );
60 60
61 return app. exec ( ); 61 return app. exec ( );
62} 62}
63 63
64 64
65QPdfDlg::QPdfDlg ( ) : QMainWindow ( ) 65QPdfDlg::QPdfDlg ( ) : QMainWindow ( )
66{ 66{
67 setCaption ( tr( "QPdf" )); 67 setCaption ( tr( "QPdf" ));
68 setIcon ( Resource::loadPixmap ( "qpdf_icon" )); 68 setIcon ( Resource::loadPixmap ( "qpdf_icon" ));
69 69
70 m_busy = false; 70 m_busy = false;
71 71
72 m_doc = 0; 72 m_doc = 0;
73 m_pages = 0; 73 m_pages = 0;
74 m_zoom = 72; 74 m_zoom = 72;
75 m_currentpage = 0; 75 m_currentpage = 0;
76 76
77 m_fullscreen = false; 77 m_fullscreen = false;
78 m_renderok = false; 78 m_renderok = false;
79 79
80 80
81 setToolBarsMovable ( false ); 81 setToolBarsMovable ( false );
82 82
83 m_stack = new QWidgetStack ( this ); 83 m_stack = new QWidgetStack ( this );
84 m_stack-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding )); 84 m_stack-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding ));
85 setCentralWidget ( m_stack ); 85 setCentralWidget ( m_stack );
86 86
87 m_outdev = new QPEOutputDev ( m_stack ); 87 m_outdev = new QPEOutputDev ( m_stack );
88 connect ( m_outdev, SIGNAL( selectionChanged ( const QRect & )), this, SLOT( copyToClipboard ( const QRect & ))); 88 connect ( m_outdev, SIGNAL( selectionChanged(const QRect&)), this, SLOT( copyToClipboard(const QRect&)));
89 89
90#ifdef QPDF_QPE_ONLY 90#ifdef QPDF_QPE_ONLY
91 m_filesel = new FileSelector ( "application/pdf", m_stack, "fs", false, true ); 91 m_filesel = new FileSelector ( "application/pdf", m_stack, "fs", false, true );
92#else 92#else
93 m_filesel = new OFileSelector ( "application/pdf", m_stack, "fs", false, true ); 93 m_filesel = new OFileSelector ( "application/pdf", m_stack, "fs", false, true );
94#endif 94#endif
95 95
96 connect ( m_filesel, SIGNAL( closeMe ( )), this, SLOT( closeFileSelector ( ))); 96 connect ( m_filesel, SIGNAL( closeMe()), this, SLOT( closeFileSelector()));
97 connect ( m_filesel, SIGNAL( fileSelected ( const DocLnk & )), this, SLOT( openFile ( const DocLnk & ))); 97 connect ( m_filesel, SIGNAL( fileSelected(const DocLnk&)), this, SLOT( openFile(const DocLnk&)));
98 98
99 m_tb_menu = new QToolBar ( this ); 99 m_tb_menu = new QToolBar ( this );
100 m_tb_menu-> setHorizontalStretchable ( true ); 100 m_tb_menu-> setHorizontalStretchable ( true );
101 101
102 QMenuBar *mb = new QMenuBar ( m_tb_menu ); 102 QMenuBar *mb = new QMenuBar ( m_tb_menu );
103 103
104 m_pm_zoom = new QPopupMenu ( mb ); 104 m_pm_zoom = new QPopupMenu ( mb );
105 m_pm_zoom-> setCheckable ( true ); 105 m_pm_zoom-> setCheckable ( true );
106 106
107 mb-> insertItem ( tr( "Zoom" ), m_pm_zoom ); 107 mb-> insertItem ( tr( "Zoom" ), m_pm_zoom );
108 108
109 m_pm_zoom-> insertItem ( tr( "Fit to width" ), 1 ); 109 m_pm_zoom-> insertItem ( tr( "Fit to width" ), 1 );
110 m_pm_zoom-> insertItem ( tr( "Fit to page" ), 2 ); 110 m_pm_zoom-> insertItem ( tr( "Fit to page" ), 2 );
111 m_pm_zoom-> insertSeparator ( ); 111 m_pm_zoom-> insertSeparator ( );
112 m_pm_zoom-> insertItem ( tr( "50%" ), 50 ); 112 m_pm_zoom-> insertItem ( tr( "50%" ), 50 );
113 m_pm_zoom-> insertItem ( tr( "75%" ), 75 ); 113 m_pm_zoom-> insertItem ( tr( "75%" ), 75 );
114 m_pm_zoom-> insertItem ( tr( "100%" ), 100 ); 114 m_pm_zoom-> insertItem ( tr( "100%" ), 100 );
115 m_pm_zoom-> insertItem ( tr( "125%" ), 125 ); 115 m_pm_zoom-> insertItem ( tr( "125%" ), 125 );
116 m_pm_zoom-> insertItem ( tr( "150%" ), 150 ); 116 m_pm_zoom-> insertItem ( tr( "150%" ), 150 );
117 m_pm_zoom-> insertItem ( tr( "200%" ), 200 ); 117 m_pm_zoom-> insertItem ( tr( "200%" ), 200 );
118 118
119 connect ( m_pm_zoom, SIGNAL( activated ( int )), this, SLOT( setZoom ( int ))); 119 connect ( m_pm_zoom, SIGNAL( activated(int)), this, SLOT( setZoom(int)));
120 120
121 m_tb_tool = new QToolBar ( this ); 121 m_tb_tool = new QToolBar ( this );
122 122
123 new QToolButton ( Resource::loadIconSet ( "fileopen" ), tr( "Open..." ), QString::null, this, SLOT( openFile ( )), m_tb_tool, "open" ); 123 new QToolButton ( Resource::loadIconSet ( "fileopen" ), tr( "Open..." ), QString::null, this, SLOT( openFile()), m_tb_tool, "open" );
124 m_tb_tool-> addSeparator ( ); 124 m_tb_tool-> addSeparator ( );
125 m_to_find = new QToolButton ( Resource::loadIconSet ( "find" ), tr( "Find..." ), QString::null, this, SLOT( toggleFindBar ( )), m_tb_tool, "find" ); 125 m_to_find = new QToolButton ( Resource::loadIconSet ( "find" ), tr( "Find..." ), QString::null, this, SLOT( toggleFindBar()), m_tb_tool, "find" );
126 m_to_find-> setToggleButton ( true ); 126 m_to_find-> setToggleButton ( true );
127 m_tb_tool-> addSeparator ( ); 127 m_tb_tool-> addSeparator ( );
128 m_to_full = new QToolButton ( Resource::loadIconSet ( "fullscreen" ), tr( "Fullscreen" ), QString::null, this, SLOT( toggleFullscreen ( )), m_tb_tool, "fullscreen" ); 128 m_to_full = new QToolButton ( Resource::loadIconSet ( "fullscreen" ), tr( "Fullscreen" ), QString::null, this, SLOT( toggleFullscreen()), m_tb_tool, "fullscreen" );
129 m_to_full-> setToggleButton ( true ); 129 m_to_full-> setToggleButton ( true );
130 m_tb_tool-> addSeparator ( ); 130 m_tb_tool-> addSeparator ( );
131 new QToolButton ( Resource::loadIconSet ( "fastback" ), tr( "First page" ), QString::null, this, SLOT( firstPage ( )), m_tb_tool, "first" ); 131 new QToolButton ( Resource::loadIconSet ( "fastback" ), tr( "First page" ), QString::null, this, SLOT( firstPage()), m_tb_tool, "first" );
132 new QToolButton ( Resource::loadIconSet ( "back" ), tr( "Previous page" ), QString::null, this, SLOT( prevPage ( )), m_tb_tool, "prev" ); 132 new QToolButton ( Resource::loadIconSet ( "back" ), tr( "Previous page" ), QString::null, this, SLOT( prevPage()), m_tb_tool, "prev" );
133 new QToolButton ( Resource::loadIconSet ( "down" ), tr( "Goto page..." ), QString::null, this, SLOT( gotoPageDialog ( )), m_tb_tool, "goto" ); 133 new QToolButton ( Resource::loadIconSet ( "down" ), tr( "Goto page..." ), QString::null, this, SLOT( gotoPageDialog()), m_tb_tool, "goto" );
134 new QToolButton ( Resource::loadIconSet ( "forward" ), tr( "Next page" ), QString::null, this, SLOT( nextPage ( )), m_tb_tool, "next" ); 134 new QToolButton ( Resource::loadIconSet ( "forward" ), tr( "Next page" ), QString::null, this, SLOT( nextPage()), m_tb_tool, "next" );
135 new QToolButton ( Resource::loadIconSet ( "fastforward" ), tr( "Last page" ), QString::null, this, SLOT( lastPage ( )), m_tb_tool, "last" ); 135 new QToolButton ( Resource::loadIconSet ( "fastforward" ), tr( "Last page" ), QString::null, this, SLOT( lastPage()), m_tb_tool, "last" );
136 136
137 m_tb_find = new QToolBar ( this ); 137 m_tb_find = new QToolBar ( this );
138 addToolBar ( m_tb_find, "Search", QMainWindow::Top, true ); 138 addToolBar ( m_tb_find, "Search", QMainWindow::Top, true );
139 m_tb_find-> setHorizontalStretchable ( true ); 139 m_tb_find-> setHorizontalStretchable ( true );
140 m_tb_find-> hide ( ); 140 m_tb_find-> hide ( );
141 141
142 m_findedit = new QLineEdit ( m_tb_find, "findedit" ); 142 m_findedit = new QLineEdit ( m_tb_find, "findedit" );
143 m_tb_find-> setStretchableWidget ( m_findedit ); 143 m_tb_find-> setStretchableWidget ( m_findedit );
144 connect ( m_findedit, SIGNAL( textChanged ( const QString & )), this, SLOT( findText ( const QString & ))); 144 connect ( m_findedit, SIGNAL( textChanged(const QString&)), this, SLOT( findText(const QString&)));
145 145
146 new QToolButton ( Resource::loadIconSet ( "next" ), tr( "Next" ), QString::null, this, SLOT( findText ( )), m_tb_find, "findnext" ); 146 new QToolButton ( Resource::loadIconSet ( "next" ), tr( "Next" ), QString::null, this, SLOT( findText()), m_tb_find, "findnext" );
147 147
148 openFile ( ); 148 openFile ( );
149} 149}
150 150
151QPdfDlg::~QPdfDlg ( ) 151QPdfDlg::~QPdfDlg ( )
152{ 152{
153 delete m_doc; 153 delete m_doc;
154} 154}
155 155
156// vv Fullscreen handling (for broken QT-lib) [David Hedbor, www.eongames.com] 156// vv Fullscreen handling (for broken QT-lib) [David Hedbor, www.eongames.com]
157 157
158void QPdfDlg::resizeEvent ( QResizeEvent * ) 158void QPdfDlg::resizeEvent ( QResizeEvent * )
159{ 159{
160 if ( m_fullscreen && ( size ( ) != qApp-> desktop ( )-> size ( ))) 160 if ( m_fullscreen && ( size ( ) != qApp-> desktop ( )-> size ( )))
161 setFullscreen ( true ); 161 setFullscreen ( true );
162} 162}
163 163
164void QPdfDlg::focusInEvent ( QFocusEvent * ) 164void QPdfDlg::focusInEvent ( QFocusEvent * )
165{ 165{
166 if ( m_fullscreen ) 166 if ( m_fullscreen )
167 setFullscreen ( true ); 167 setFullscreen ( true );
168} 168}
169 169
170void QPdfDlg::toggleFullscreen ( ) 170void QPdfDlg::toggleFullscreen ( )
171{ 171{
172 if ( m_to_full-> isOn ( ) == m_fullscreen ) 172 if ( m_to_full-> isOn ( ) == m_fullscreen )
173 m_to_full-> setOn ( !m_fullscreen ); 173 m_to_full-> setOn ( !m_fullscreen );
174 174
175 m_fullscreen = !m_fullscreen; 175 m_fullscreen = !m_fullscreen;
176 setFullscreen ( m_fullscreen ); 176 setFullscreen ( m_fullscreen );
177} 177}
178 178
179void QPdfDlg::setFullscreen ( bool b ) 179void QPdfDlg::setFullscreen ( bool b )
180{ 180{
181 static QSize normalsize; 181 static QSize normalsize;
182 182
183 if ( b ) { 183 if ( b ) {
184 if ( !normalsize. isValid ( )) 184 if ( !normalsize. isValid ( ))
185 normalsize = size ( ); 185 normalsize = size ( );
186 186
187 setFixedSize ( qApp-> desktop ( )-> size ( )); 187 setFixedSize ( qApp-> desktop ( )-> size ( ));
188 showNormal ( ); 188 showNormal ( );
189 reparent ( 0, WStyle_Customize | WStyle_NoBorder, QPoint ( 0, 0 )); 189 reparent ( 0, WStyle_Customize | WStyle_NoBorder, QPoint ( 0, 0 ));
190 showFullScreen ( ); 190 showFullScreen ( );
191 } 191 }
192 else { 192 else {
193 showNormal ( ); 193 showNormal ( );
194 reparent ( 0, 0, QPoint ( 0, 0 )); 194 reparent ( 0, 0, QPoint ( 0, 0 ));
195 resize ( normalsize ); 195 resize ( normalsize );
196 showMaximized ( ); 196 showMaximized ( );
197 normalsize = QSize ( ); 197 normalsize = QSize ( );
198 } 198 }
199} 199}
200 200
201// ^^ Fullscreen handling (for broken QT-lib) 201// ^^ Fullscreen handling (for broken QT-lib)
202 202
203void QPdfDlg::setBusy ( bool b ) 203void QPdfDlg::setBusy ( bool b )
204{ 204{
205 if ( b != m_busy ) { 205 if ( b != m_busy ) {
206 m_busy = b; 206 m_busy = b;
207 207
208 m_outdev-> setBusy ( m_busy ); 208 m_outdev-> setBusy ( m_busy );
209 setEnabled ( !m_busy ); 209 setEnabled ( !m_busy );
210 } 210 }
@@ -434,107 +434,107 @@ void QPdfDlg::gotoPage ( int n )
434 434
435 renderPage ( ); 435 renderPage ( );
436 } 436 }
437} 437}
438 438
439void QPdfDlg::renderPage ( ) 439void QPdfDlg::renderPage ( )
440{ 440{
441 if ( m_renderok && m_doc && m_doc-> isOk ( )) { 441 if ( m_renderok && m_doc && m_doc-> isOk ( )) {
442 m_renderok = false; 442 m_renderok = false;
443 443
444 setBusy ( true ); 444 setBusy ( true );
445 m_doc-> displayPage ( m_outdev, m_currentpage, m_zoom, 0, true ); 445 m_doc-> displayPage ( m_outdev, m_currentpage, m_zoom, 0, true );
446 setBusy ( false ); 446 setBusy ( false );
447 447
448 m_outdev-> setPageCount ( m_currentpage, m_pages ); 448 m_outdev-> setPageCount ( m_currentpage, m_pages );
449 449
450 m_renderok = true; 450 m_renderok = true;
451 } 451 }
452} 452}
453 453
454void QPdfDlg::closeFileSelector ( ) 454void QPdfDlg::closeFileSelector ( )
455{ 455{
456 m_tb_menu-> show ( ); 456 m_tb_menu-> show ( );
457 m_tb_tool-> show ( ); 457 m_tb_tool-> show ( );
458 m_stack-> raiseWidget ( m_outdev ); 458 m_stack-> raiseWidget ( m_outdev );
459} 459}
460 460
461void QPdfDlg::openFile ( ) 461void QPdfDlg::openFile ( )
462{ 462{
463 m_tb_menu-> hide ( ); 463 m_tb_menu-> hide ( );
464 m_tb_tool-> hide ( ); 464 m_tb_tool-> hide ( );
465 m_tb_find-> hide ( ); 465 m_tb_find-> hide ( );
466 m_stack-> raiseWidget ( m_filesel ); 466 m_stack-> raiseWidget ( m_filesel );
467} 467}
468 468
469void QPdfDlg::openFile ( const QString &f ) 469void QPdfDlg::openFile ( const QString &f )
470{ 470{
471 DocLnk nf; 471 DocLnk nf;
472 nf. setType ( "application/pdf" ); 472 nf. setType ( "application/pdf" );
473 nf. setFile ( f ); 473 nf. setFile ( f );
474 QFileInfo fi ( f ); 474 QFileInfo fi ( f );
475 nf. setName ( fi. baseName ( )); 475 nf. setName ( fi. baseName ( ));
476 openFile ( nf ); 476 openFile ( nf );
477} 477}
478 478
479void QPdfDlg::openFile ( const DocLnk &f ) 479void QPdfDlg::openFile ( const DocLnk &f )
480{ 480{
481 QString fn = f. file ( ); 481 QString fn = f. file ( );
482 QFileInfo fi ( fn ); 482 QFileInfo fi ( fn );
483 483
484 if ( fi. exists ( )) { 484 if ( fi. exists ( )) {
485 delete m_doc; 485 delete m_doc;
486 486
487 m_doc = new PDFDoc ( new GString ( fn. local8Bit ( )), 0, 0 ); 487 m_doc = new PDFDoc ( new GString ( fn. local8Bit ( )), 0, 0 );
488 488
489 if ( m_doc-> isOk ( )) { 489 if ( m_doc-> isOk ( )) {
490 m_currentdoc = f. name ( ); 490 m_currentdoc = f. name ( );
491 int sep = m_currentdoc. findRev ( '/' ); 491 int sep = m_currentdoc. findRev ( '/' );
492 if ( sep > 0 ) 492 if ( sep > 0 )
493 m_currentdoc = m_currentdoc. mid ( sep + 1 ); 493 m_currentdoc = m_currentdoc. mid ( sep + 1 );
494 494
495 m_pages = m_doc-> getNumPages ( ); 495 m_pages = m_doc-> getNumPages ( );
496 m_currentpage = 0; 496 m_currentpage = 0;
497 497
498 QTimer::singleShot ( 0, this, SLOT( delayedInit ( ))); 498 QTimer::singleShot ( 0, this, SLOT( delayedInit()));
499 } 499 }
500 else { 500 else {
501 delete m_doc; 501 delete m_doc;
502 m_doc = 0; 502 m_doc = 0;
503 503
504 m_currentdoc = QString::null; 504 m_currentdoc = QString::null;
505 } 505 }
506 506
507 updateCaption ( ); 507 updateCaption ( );
508 } 508 }
509 else 509 else
510 QMessageBox::warning ( this, tr( "Error" ), tr( "File does not exist!" )); 510 QMessageBox::warning ( this, tr( "Error" ), tr( "File does not exist!" ));
511} 511}
512 512
513void QPdfDlg::setDocument ( const QString &f ) 513void QPdfDlg::setDocument ( const QString &f )
514{ 514{
515 if ( f. find ( ".desktop", 0, true ) == -1 ) 515 if ( f. find ( ".desktop", 0, true ) == -1 )
516 openFile ( f ); 516 openFile ( f );
517 else 517 else
518 openFile ( DocLnk ( f )); 518 openFile ( DocLnk ( f ));
519 519
520 closeFileSelector ( ); 520 closeFileSelector ( );
521} 521}
522 522
523void QPdfDlg::delayedInit ( ) 523void QPdfDlg::delayedInit ( )
524 { 524 {
525 closeFileSelector ( ); 525 closeFileSelector ( );
526 526
527 m_currentpage = 0; 527 m_currentpage = 0;
528 m_zoom = 0; 528 m_zoom = 0;
529 m_renderok = false; 529 m_renderok = false;
530 530
531 setZoom ( 100 ); 531 setZoom ( 100 );
532 gotoPage ( 1 ); 532 gotoPage ( 1 );
533 533
534 m_renderok = true; 534 m_renderok = true;
535 535
536 renderPage ( ); 536 renderPage ( );
537 537
538 m_outdev-> setFocus ( ); 538 m_outdev-> setFocus ( );
539} 539}
540 540
diff --git a/x11/libqpe-x11/qpe/qpeapplication.cpp b/x11/libqpe-x11/qpe/qpeapplication.cpp
index 0fce355..3cb8faf 100644
--- a/x11/libqpe-x11/qpe/qpeapplication.cpp
+++ b/x11/libqpe-x11/qpe/qpeapplication.cpp
@@ -230,139 +230,139 @@ QPEApplication::~QPEApplication() {
230 230
231 delete d; 231 delete d;
232} 232}
233QPEApplication::QPEApplication(int &arg, char** argv, Type t) 233QPEApplication::QPEApplication(int &arg, char** argv, Type t)
234 : QApplication( arg, argv, t ) { 234 : QApplication( arg, argv, t ) {
235 d = new Private; 235 d = new Private;
236 d->loadTextCodecs(); 236 d->loadTextCodecs();
237 d->loadImageCodecs(); 237 d->loadImageCodecs();
238 238
239 // Init X-Atom 239 // Init X-Atom
240 Atom *atoms[5]; 240 Atom *atoms[5];
241 Atom atoms_re[5]; 241 Atom atoms_re[5];
242 char* names[5]; 242 char* names[5];
243 int n = 0; 243 int n = 0;
244 atoms[n] = &d->wm_delete_window; 244 atoms[n] = &d->wm_delete_window;
245 names[n++] = "WM_DELETE_WINDOW"; 245 names[n++] = "WM_DELETE_WINDOW";
246 246
247 atoms[n] = &d->wm_take_focus; 247 atoms[n] = &d->wm_take_focus;
248 names[n++] = "WM_TAKE_FOCUS"; 248 names[n++] = "WM_TAKE_FOCUS";
249 249
250 atoms[n] = &d->wm_context_help; 250 atoms[n] = &d->wm_context_help;
251 names[n++] = "_NET_WM_CONTEXT_HELP"; 251 names[n++] = "_NET_WM_CONTEXT_HELP";
252 252
253 atoms[n] = &d->wm_context_accept; 253 atoms[n] = &d->wm_context_accept;
254 names[n++] = "_NET_WM_CONTEXT_ACCEPT"; 254 names[n++] = "_NET_WM_CONTEXT_ACCEPT";
255 255
256 atoms[n] = &d->wm_protocols; 256 atoms[n] = &d->wm_protocols;
257 names[n++] = "WM_PROTOCOLS"; 257 names[n++] = "WM_PROTOCOLS";
258 258
259 XInternAtoms( qt_xdisplay(), names, n, FALSE, atoms_re); 259 XInternAtoms( qt_xdisplay(), names, n, FALSE, atoms_re);
260 // now copy the values over to the properties 260 // now copy the values over to the properties
261 for (int i = 0; i < n; i++ ) 261 for (int i = 0; i < n; i++ )
262 *atoms[i] = atoms_re[i]; 262 *atoms[i] = atoms_re[i];
263 // done with X11 Stuff 263 // done with X11 Stuff
264 264
265 int dw = desktop()->width(); 265 int dw = desktop()->width();
266 if ( dw < 200 ) { 266 if ( dw < 200 ) {
267 setFont( QFont( "helvetica", 8 ) ); 267 setFont( QFont( "helvetica", 8 ) );
268 AppLnk::setSmallIconSize( 10 ); 268 AppLnk::setSmallIconSize( 10 );
269 AppLnk::setBigIconSize( 28 ); 269 AppLnk::setBigIconSize( 28 );
270 }else if ( dw > 600 ) { 270 }else if ( dw > 600 ) {
271 setFont( QFont( "helvetica", 12 ) ); 271 setFont( QFont( "helvetica", 12 ) );
272 AppLnk::setSmallIconSize( 24 ); 272 AppLnk::setSmallIconSize( 24 );
273 AppLnk::setBigIconSize( 48 ); 273 AppLnk::setBigIconSize( 48 );
274 }else if ( dw > 200 ) { 274 }else if ( dw > 200 ) {
275 setFont( QFont( "helvetica", 10 ) ); 275 setFont( QFont( "helvetica", 10 ) );
276 AppLnk::setSmallIconSize( 16 ); 276 AppLnk::setSmallIconSize( 16 );
277 AppLnk::setBigIconSize( 32 ); 277 AppLnk::setBigIconSize( 32 );
278 } 278 }
279 QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); 279 QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory );
280 280
281 connect( this, SIGNAL( lastWindowClosed() ), this, SLOT(hideOrQuit() ) ); 281 connect( this, SIGNAL( lastWindowClosed() ), this, SLOT(hideOrQuit() ) );
282 282
283 QString qcopfn( "/tmp/qcop-msg-" ); 283 QString qcopfn( "/tmp/qcop-msg-" );
284 qcopfn += QString( argv[0] ); // append command name to the QCOP name 284 qcopfn += QString( argv[0] ); // append command name to the QCOP name
285 QFile file( qcopfn ); 285 QFile file( qcopfn );
286 if (file.open(IO_ReadOnly ) ) { 286 if (file.open(IO_ReadOnly ) ) {
287 flock( file.handle(), LOCK_EX ); 287 flock( file.handle(), LOCK_EX );
288 } 288 }
289 289
290 /* Hmmm damn we need to make the parent 0l otherwise it get's deleted 290 /* Hmmm damn we need to make the parent 0l otherwise it get's deleted
291 * past the QApplication 291 * past the QApplication
292 */ 292 */
293 m_sys = new QCopChannel( "QPE/System", 0l); 293 m_sys = new QCopChannel( "QPE/System", 0l);
294 connect(m_sys, SIGNAL( received( const QCString&, const QByteArray& ) ), 294 connect(m_sys, SIGNAL( received(const QCString&,const QByteArray&) ),
295 this, SLOT(systemMessage( const QCString&, const QByteArray& ) ) ); 295 this, SLOT(systemMessage(const QCString&,const QByteArray&) ) );
296 296
297 // private channel QPE/Application/appname 297 // private channel QPE/Application/appname
298 QCString channel = QCString( argv[0] ); 298 QCString channel = QCString( argv[0] );
299 channel.replace( QRegExp( ".*/"), "" ); 299 channel.replace( QRegExp( ".*/"), "" );
300 d->appName = channel; 300 d->appName = channel;
301 channel = "QPE/Application/"+ channel; 301 channel = "QPE/Application/"+ channel;
302 m_pid = new QCopChannel( channel, 0l ); 302 m_pid = new QCopChannel( channel, 0l );
303 connect(m_pid, SIGNAL( received( const QCString&, const QByteArray& ) ), 303 connect(m_pid, SIGNAL( received(const QCString&,const QByteArray&) ),
304 this, SLOT( pidMessage( const QCString&, const QByteArray& ) ) ); 304 this, SLOT( pidMessage(const QCString&,const QByteArray&) ) );
305 305
306 // read the Pre QCOP Stuff from the file 306 // read the Pre QCOP Stuff from the file
307 if ( file.isOpen() ) { 307 if ( file.isOpen() ) {
308 d->keep_running = FALSE; 308 d->keep_running = FALSE;
309 QDataStream ds( &file ); 309 QDataStream ds( &file );
310 QCString chanel, message; 310 QCString chanel, message;
311 QByteArray data; 311 QByteArray data;
312 while (!ds.atEnd() ) { 312 while (!ds.atEnd() ) {
313 ds >> chanel >> message >> data; 313 ds >> chanel >> message >> data;
314 d->enqueueQCop( chanel, message, data ); 314 d->enqueueQCop( chanel, message, data );
315 } 315 }
316 flock( file.handle(), LOCK_UN ); 316 flock( file.handle(), LOCK_UN );
317 file.close(); 317 file.close();
318 file.remove(); 318 file.remove();
319 } 319 }
320 320
321 // read in some stuff from the command line 321 // read in some stuff from the command line
322 // we do not have setArgs so we need to take 322 // we do not have setArgs so we need to take
323 // care of that 323 // care of that
324 for ( int a = 0; a < arg; a++ ) { 324 for ( int a = 0; a < arg; a++ ) {
325 if ( qstrcmp( argv[a], "-preload" ) == 0 ) { 325 if ( qstrcmp( argv[a], "-preload" ) == 0 ) {
326 d->preloaded = TRUE; 326 d->preloaded = TRUE;
327 }else if ( qstrcmp( argv[a ] , "-preload-show" ) == 0 ) { 327 }else if ( qstrcmp( argv[a ] , "-preload-show" ) == 0 ) {
328 d->preloaded = TRUE; 328 d->preloaded = TRUE;
329 d->forceshow = TRUE; 329 d->forceshow = TRUE;
330 } 330 }
331 } 331 }
332 initTranslations(); 332 initTranslations();
333 applyStyle(); 333 applyStyle();
334 334
335 if ( type() == GuiServer ) 335 if ( type() == GuiServer )
336 ; 336 ;
337 337
338 installEventFilter( this ); 338 installEventFilter( this );
339 QPEMenuToolFocusManager::initialize(); 339 QPEMenuToolFocusManager::initialize();
340} 340}
341void QPEApplication::initTranslations() { 341void QPEApplication::initTranslations() {
342 // Translations add it 342 // Translations add it
343 QStringList langs = Global::languageList(); 343 QStringList langs = Global::languageList();
344 for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { 344 for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) {
345 QString lang = *it; 345 QString lang = *it;
346 346
347 QTranslator * trans; 347 QTranslator * trans;
348 QString tfn; 348 QString tfn;
349 349
350 trans = new QTranslator( this ); 350 trans = new QTranslator( this );
351 tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm"; 351 tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm";
352 if ( trans->load( tfn ) ) 352 if ( trans->load( tfn ) )
353 installTranslator( trans ); 353 installTranslator( trans );
354 else 354 else
355 delete trans; 355 delete trans;
356 356
357 trans = new QTranslator( this ); 357 trans = new QTranslator( this );
358 tfn = qpeDir() + "/i18n/" + lang + "/" + d->appName + ".qm"; 358 tfn = qpeDir() + "/i18n/" + lang + "/" + d->appName + ".qm";
359 if ( trans->load( tfn ) ) 359 if ( trans->load( tfn ) )
360 installTranslator( trans ); 360 installTranslator( trans );
361 else 361 else
362 delete trans; 362 delete trans;
363 } 363 }
364} 364}
365QString QPEApplication::qpeDir() { 365QString QPEApplication::qpeDir() {
366 const char * base = getenv( "OPIEDIR" ); 366 const char * base = getenv( "OPIEDIR" );
367 if ( base ) 367 if ( base )
368 return QString( base ) + "/"; 368 return QString( base ) + "/";
diff --git a/x11/libqpe-x11/qt/qcopchannel_qws.cpp b/x11/libqpe-x11/qt/qcopchannel_qws.cpp
index 706756e..a82ba4d 100644
--- a/x11/libqpe-x11/qt/qcopchannel_qws.cpp
+++ b/x11/libqpe-x11/qt/qcopchannel_qws.cpp
@@ -1,80 +1,80 @@
1 1
2#include "../../ipc/client/ocopclient.h" 2#include "../../ipc/client/ocopclient.h"
3 3
4#include <qcopchannel_qws.h> 4#include <qcopchannel_qws.h>
5 5
6QList<QCopChannel>* QCopChannel::m_list = 0; 6QList<QCopChannel>* QCopChannel::m_list = 0;
7QMap<QCString, int> QCopChannel::m_refCount; 7QMap<QCString, int> QCopChannel::m_refCount;
8 8
9QCopChannel::QCopChannel( const QCString& channel, QObject* parent, 9QCopChannel::QCopChannel( const QCString& channel, QObject* parent,
10 const char* name ) 10 const char* name )
11 : QObject( parent, name ),m_chan(channel) { 11 : QObject( parent, name ),m_chan(channel) {
12 if (!m_list ) { 12 if (!m_list ) {
13 m_list = new QList<QCopChannel>; 13 m_list = new QList<QCopChannel>;
14 /* only connect once */ 14 /* only connect once */
15 connect(OCOPClient::self(), SIGNAL(called(const QCString&, const QCString&, const QByteArray& ) ), 15 connect(OCOPClient::self(), SIGNAL(called(const QCString&,const QCString&,const QByteArray&) ),
16 this, SLOT(rev(const QCString&, const QCString&, const QByteArray&) ) ); 16 this, SLOT(rev(const QCString&,const QCString&,const QByteArray&) ) );
17 } 17 }
18 /* first registration or ref count is 0 for m_chan*/ 18 /* first registration or ref count is 0 for m_chan*/
19 if (!m_refCount.contains( m_chan ) || !m_refCount[m_chan] ) { 19 if (!m_refCount.contains( m_chan ) || !m_refCount[m_chan] ) {
20 qWarning("adding channel %s", m_chan.data() ); 20 qWarning("adding channel %s", m_chan.data() );
21 m_refCount[m_chan] = 1; 21 m_refCount[m_chan] = 1;
22 OCOPClient::self()->addChannel( m_chan ); 22 OCOPClient::self()->addChannel( m_chan );
23 }else{ 23 }else{
24 qWarning("reffing up for %s %d", m_chan.data(), m_refCount[m_chan] ); 24 qWarning("reffing up for %s %d", m_chan.data(), m_refCount[m_chan] );
25 m_refCount[m_chan]++; 25 m_refCount[m_chan]++;
26 } 26 }
27 27
28 m_list->append(this); 28 m_list->append(this);
29} 29}
30void QCopChannel::receive( const QCString& msg, const QByteArray& ar ) { 30void QCopChannel::receive( const QCString& msg, const QByteArray& ar ) {
31 emit received( msg, ar ); 31 emit received( msg, ar );
32} 32}
33QCopChannel::~QCopChannel() { 33QCopChannel::~QCopChannel() {
34 if (m_refCount[m_chan] == 1 ) { 34 if (m_refCount[m_chan] == 1 ) {
35 OCOPClient::self()->delChannel( m_chan ); 35 OCOPClient::self()->delChannel( m_chan );
36 m_refCount[m_chan] = 0; 36 m_refCount[m_chan] = 0;
37 }else 37 }else
38 m_refCount[m_chan]--; 38 m_refCount[m_chan]--;
39 39
40 40
41 m_list->remove(this); 41 m_list->remove(this);
42 if (m_list->count() == 0 ) { 42 if (m_list->count() == 0 ) {
43 delete m_list; 43 delete m_list;
44 m_list = 0; 44 m_list = 0;
45 } 45 }
46 46
47} 47}
48QCString QCopChannel::channel()const { 48QCString QCopChannel::channel()const {
49 return m_chan; 49 return m_chan;
50} 50}
51bool QCopChannel::isRegistered( const QCString& chan) { 51bool QCopChannel::isRegistered( const QCString& chan) {
52 if (m_refCount.contains(chan) ) { 52 if (m_refCount.contains(chan) ) {
53 qDebug("Client:locally contains"); 53 qDebug("Client:locally contains");
54 return true; 54 return true;
55 } 55 }
56 return OCOPClient::self()->isRegistered( chan ); 56 return OCOPClient::self()->isRegistered( chan );
57} 57}
58bool QCopChannel::send( const QCString& chan, const QCString& msg ) { 58bool QCopChannel::send( const QCString& chan, const QCString& msg ) {
59 QByteArray ar; 59 QByteArray ar;
60 return send(chan, msg, ar ); 60 return send(chan, msg, ar );
61} 61}
62bool QCopChannel::send( const QCString& chan, const QCString& msg, 62bool QCopChannel::send( const QCString& chan, const QCString& msg,
63 const QByteArray& ar ) { 63 const QByteArray& ar ) {
64 OCOPClient::self()->send( chan, msg, ar ); 64 OCOPClient::self()->send( chan, msg, ar );
65 return true; 65 return true;
66} 66}
67bool QCopChannel::sendLocally( const QCString& chann, const QCString& msg, 67bool QCopChannel::sendLocally( const QCString& chann, const QCString& msg,
68 const QByteArray& ar ) { 68 const QByteArray& ar ) {
69 qWarning("Client:sendLocally %s %s", chann.data(), msg.data() ); 69 qWarning("Client:sendLocally %s %s", chann.data(), msg.data() );
70 if (!m_list ) 70 if (!m_list )
71 return true; 71 return true;
72 QCopChannel* chan; 72 QCopChannel* chan;
73 73
74 for ( chan = m_list->first(); chan; chan = m_list->next() ) { 74 for ( chan = m_list->first(); chan; chan = m_list->next() ) {
75 if ( chan->channel() == chann ) 75 if ( chan->channel() == chann )
76 chan->receive( msg, ar ); 76 chan->receive( msg, ar );
77 } 77 }
78 78
79 return true; 79 return true;
80} 80}