summaryrefslogtreecommitdiff
authoralwin <alwin>2004-03-02 12:14:15 (UTC)
committer alwin <alwin>2004-03-02 12:14:15 (UTC)
commit0d59c780513da78033f4d9040475dee9db0256d4 (patch) (unidiff)
tree503d320b4aa3daae9982082e7b34e3e2c48bdfb7
parenta0981652d61776d70f25980f035748b21339e946 (diff)
downloadopie-0d59c780513da78033f4d9040475dee9db0256d4.zip
opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.gz
opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.bz2
run the optimize_connect script
the whole cvs is tagged with "before_optimize_connect" if there are problems you can check the diff (but it had compiled and run here)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/cardmon/cardmon.cpp8
-rw-r--r--core/applets/clipboardapplet/clipboard.cpp8
-rw-r--r--core/applets/clockapplet/clock.cpp6
-rw-r--r--core/applets/irdaapplet/irda.cpp4
-rw-r--r--core/applets/multikeyapplet/multikey.cpp4
-rw-r--r--core/applets/rotateapplet/rotate.cpp4
-rw-r--r--core/applets/screenshotapplet/screenshot.cpp6
-rw-r--r--core/applets/vmemo/vmemo.cpp4
-rw-r--r--core/applets/volumeapplet/volume.cpp36
-rw-r--r--core/apps/embeddedkonsole/commandeditdialog.cpp2
-rw-r--r--core/apps/embeddedkonsole/session.cpp8
-rw-r--r--core/apps/helpbrowser/helpbrowser.cpp20
-rw-r--r--core/apps/textedit/textedit.cpp10
-rw-r--r--core/launcher/appicons.cpp14
-rw-r--r--core/launcher/applauncher.cpp8
-rw-r--r--core/launcher/firstuse.cpp8
-rw-r--r--core/launcher/inputmethods.cpp4
-rw-r--r--core/launcher/launcher.cpp12
-rw-r--r--core/launcher/launcherview.cpp12
-rw-r--r--core/launcher/packageslave.cpp4
-rw-r--r--core/launcher/qcopbridge.cpp12
-rw-r--r--core/launcher/runningappbar.cpp4
-rw-r--r--core/launcher/server.cpp18
-rw-r--r--core/launcher/serverapp.cpp10
-rw-r--r--core/launcher/shutdownimpl.cpp6
-rw-r--r--core/launcher/taskbar.cpp4
-rw-r--r--core/launcher/transferserver.cpp12
-rw-r--r--core/multimedia/opieplayer/loopcontrol.cpp4
-rw-r--r--core/multimedia/opieplayer/loopcontrol_threaded.cpp4
-rw-r--r--core/multimedia/opieplayer/mediaplayer.cpp4
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp48
-rw-r--r--core/obex/obexhandler.cpp4
-rw-r--r--core/obex/obexsend.cpp16
-rw-r--r--core/obex/receiver.cpp4
-rw-r--r--core/opie-login/loginwindowimpl.cpp10
-rw-r--r--core/opie-login/main.cpp2
-rw-r--r--core/pim/addressbook/abtable.cpp2
-rw-r--r--core/pim/addressbook/abview.cpp8
-rw-r--r--core/pim/addressbook/addressbook.cpp20
-rw-r--r--core/pim/addressbook/contacteditor.cpp60
-rw-r--r--core/pim/datebook/datebook.cpp36
-rw-r--r--core/pim/datebook/datebookday.cpp16
-rw-r--r--core/pim/datebook/datebookdayallday.cpp2
-rw-r--r--core/pim/datebook/datebookdayheaderimpl.cpp4
-rw-r--r--core/pim/datebook/datebooksettings.cpp2
-rw-r--r--core/pim/datebook/datebookweek.cpp4
-rw-r--r--core/pim/datebook/datebookweekheaderimpl.cpp2
-rw-r--r--core/pim/datebook/datebookweeklst.cpp28
-rw-r--r--core/pim/datebook/dateentryimpl.cpp20
-rw-r--r--core/pim/datebook/repeatentry.cpp4
-rw-r--r--core/pim/datebook2/mainwindow.cpp12
-rw-r--r--core/pim/osearch/mainwindow.cpp2
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginwidget.cpp4
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.cpp4
-rw-r--r--core/pim/today/plugins/mail/mailpluginwidget.cpp4
-rw-r--r--core/pim/today/today.cpp4
-rw-r--r--core/pim/today/todayconfig.cpp2
-rw-r--r--core/pim/todo/mainwindow.cpp2
-rw-r--r--core/pim/todo/otaskeditor.cpp2
-rw-r--r--core/pim/todo/tableview.cpp16
-rw-r--r--core/pim/todo/taskeditoralarms.cpp4
-rw-r--r--core/pim/todo/taskeditorstatus.cpp12
-rw-r--r--core/qws/qcopbridge.cpp10
-rw-r--r--core/qws/transferserver.cpp32
-rw-r--r--core/settings/button/buttonsettings.cpp2
-rw-r--r--core/settings/button/remapdlg.cpp2
-rw-r--r--core/settings/citytime/citytime.cpp4
-rw-r--r--core/settings/citytime/citytimebase.cpp2
-rw-r--r--core/settings/citytime/zonemap.cpp16
-rw-r--r--core/settings/launcher/menusettings.cpp4
-rw-r--r--core/settings/launcher/tabdialog.cpp18
-rw-r--r--core/settings/launcher/tabssettings.cpp6
-rw-r--r--core/settings/launcher/taskbarsettings.cpp2
-rw-r--r--core/settings/light-and-power/light.cpp14
-rw-r--r--core/settings/light-and-power/sensor.cpp8
-rw-r--r--core/tools/quicklauncher/main.cpp4
-rw-r--r--development/keyview/keyview.cpp4
-rw-r--r--examples/main-tab/simple.cpp2
-rw-r--r--examples/simple-pim/simple.cpp16
-rw-r--r--inputmethods/handwriting/qimpenhelp.cpp12
-rw-r--r--inputmethods/handwriting/qimpeninput.cpp24
-rw-r--r--inputmethods/handwriting/qimpensetup.cpp12
-rw-r--r--inputmethods/multikey/keyboard.cpp4
-rw-r--r--libopie/big-screen/example/osplitter_mail.cpp4
-rw-r--r--libopie/colordialog.cpp8
-rw-r--r--libopie/colorpopupmenu.cpp2
-rw-r--r--libopie/ocolorbutton.cpp2
-rw-r--r--libopie/odevice.cpp16
-rw-r--r--libopie/ofileselector.cpp14
-rw-r--r--libopie/ofontselector.cpp8
-rw-r--r--libopie/orecurrancewidget.cpp4
-rw-r--r--libopie/otabwidget.cpp4
-rw-r--r--libopie/otimepicker.cpp12
-rw-r--r--libopie/pim/ocontactaccess.cpp13
-rw-r--r--libopie/pim/opimmainwindow.cpp8
-rw-r--r--libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp4
-rw-r--r--libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp2
-rw-r--r--libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp20
-rw-r--r--libopie2/opiecore/device/odevice.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_yopy.cpp4
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp4
-rw-r--r--libopie2/opiecore/oprocess.cpp12
-rw-r--r--libopie2/opiepim/core/ocontactaccess.cpp8
-rw-r--r--libopie2/opiepim/ui/opimmainwindow.cpp8
-rw-r--r--libopie2/opiepim/ui/opimrecurrencewidget.cpp4
-rw-r--r--libopie2/opieui/fileselector/ofiledialog.cpp4
-rw-r--r--libopie2/opieui/fileselector/ofileselector.cpp14
-rw-r--r--libopie2/opieui/ofontselector.cpp8
-rw-r--r--libopie2/opieui/otabwidget.cpp4
-rw-r--r--libopie2/opieui/otimepicker.cpp12
-rw-r--r--libopie2/opieui/oversatileview.cpp40
113 files changed, 536 insertions, 531 deletions
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp
index 7625545..e8072c6 100644
--- a/core/applets/cardmon/cardmon.cpp
+++ b/core/applets/cardmon/cardmon.cpp
@@ -7,103 +7,103 @@
7* email : max.reiss@gmx.de 7* email : max.reiss@gmx.de
8* based on two apps by Devin Butterfield 8* based on two apps by Devin Butterfield
9*/ 9*/
10/*************************************************************************** 10/***************************************************************************
11 * * 11 * *
12 * This program is free software; you can redistribute it and/or modify * 12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by * 13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or * 14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. * 15 * (at your option) any later version. *
16 * * 16 * *
17 ***************************************************************************/ 17 ***************************************************************************/
18 18
19#include "cardmon.h" 19#include "cardmon.h"
20 20
21/* OPIE */ 21/* OPIE */
22#include <opie2/odevice.h> 22#include <opie2/odevice.h>
23#include <opie2/otaskbarapplet.h> 23#include <opie2/otaskbarapplet.h>
24#include <qpe/applnk.h> 24#include <qpe/applnk.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26 26
27/* QT */ 27/* QT */
28#include <qcopchannel_qws.h> 28#include <qcopchannel_qws.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qfile.h> 30#include <qfile.h>
31#include <qtextstream.h> 31#include <qtextstream.h>
32#include <qsound.h> 32#include <qsound.h>
33#include <qtimer.h> 33#include <qtimer.h>
34 34
35/* STD */ 35/* STD */
36#include <stdio.h> 36#include <stdio.h>
37#include <unistd.h> 37#include <unistd.h>
38#include <stdlib.h> 38#include <stdlib.h>
39#include <string.h> 39#include <string.h>
40#include <fcntl.h> 40#include <fcntl.h>
41 41
42#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 42#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
43#include <sys/vfs.h> 43#include <sys/vfs.h>
44#include <mntent.h> 44#include <mntent.h>
45#endif 45#endif
46 46
47using namespace Opie; 47using namespace Opie;
48 48
49CardMonitor::CardMonitor( QWidget * parent ) : QWidget( parent ), 49CardMonitor::CardMonitor( QWidget * parent ) : QWidget( parent ),
50 pm( Resource::loadPixmap( "cardmon/pcmcia" ) ) 50 pm( Resource::loadPixmap( "cardmon/pcmcia" ) )
51{ 51{
52 52
53 QCopChannel * pcmciaChannel = new QCopChannel( "QPE/Card", this ); 53 QCopChannel * pcmciaChannel = new QCopChannel( "QPE/Card", this );
54 connect( pcmciaChannel, 54 connect( pcmciaChannel,
55 SIGNAL( received( const QCString &, const QByteArray & ) ), this, 55 SIGNAL( received(const QCString&,const QByteArray&) ), this,
56 SLOT( cardMessage( const QCString &, const QByteArray & ) ) ); 56 SLOT( cardMessage(const QCString&,const QByteArray&) ) );
57 57
58 QCopChannel *sdChannel = new QCopChannel( "QPE/Card", this ); 58 QCopChannel *sdChannel = new QCopChannel( "QPE/Card", this );
59 connect( sdChannel, 59 connect( sdChannel,
60 SIGNAL( received( const QCString &, const QByteArray & ) ), this, 60 SIGNAL( received(const QCString&,const QByteArray&) ), this,
61 SLOT( cardMessage( const QCString &, const QByteArray & ) ) ); 61 SLOT( cardMessage(const QCString&,const QByteArray&) ) );
62 62
63 cardInPcmcia0 = FALSE; 63 cardInPcmcia0 = FALSE;
64 cardInPcmcia1 = FALSE; 64 cardInPcmcia1 = FALSE;
65 cardInSd = FALSE; 65 cardInSd = FALSE;
66 66
67 setFocusPolicy( NoFocus ); 67 setFocusPolicy( NoFocus );
68 68
69 setFixedWidth ( AppLnk::smallIconSize() ); 69 setFixedWidth ( AppLnk::smallIconSize() );
70 setFixedHeight ( AppLnk::smallIconSize() ); 70 setFixedHeight ( AppLnk::smallIconSize() );
71 71
72 getStatusPcmcia( TRUE ); 72 getStatusPcmcia( TRUE );
73 getStatusSd( TRUE ); 73 getStatusSd( TRUE );
74 repaint( FALSE ); 74 repaint( FALSE );
75 popupMenu = 0; 75 popupMenu = 0;
76} 76}
77 77
78CardMonitor::~CardMonitor() 78CardMonitor::~CardMonitor()
79{ 79{
80 if ( popupMenu ) 80 if ( popupMenu )
81 { 81 {
82 delete popupMenu; 82 delete popupMenu;
83 } 83 }
84} 84}
85 85
86void CardMonitor::popUp( QString message, QString icon ) 86void CardMonitor::popUp( QString message, QString icon )
87{ 87{
88 if ( !popupMenu ) 88 if ( !popupMenu )
89 { 89 {
90 popupMenu = new QPopupMenu( this ); 90 popupMenu = new QPopupMenu( this );
91 } 91 }
92 92
93 popupMenu->clear(); 93 popupMenu->clear();
94 if ( icon.isEmpty() ) 94 if ( icon.isEmpty() )
95 { 95 {
96 popupMenu->insertItem( message, 0 ); 96 popupMenu->insertItem( message, 0 );
97 } 97 }
98 else 98 else
99 { 99 {
100 popupMenu->insertItem( QIconSet( Resource::loadPixmap( icon ) ), 100 popupMenu->insertItem( QIconSet( Resource::loadPixmap( icon ) ),
101 message, 0 ); 101 message, 0 );
102 } 102 }
103 103
104 QPoint p = mapToGlobal( QPoint( 0, 0 ) ); 104 QPoint p = mapToGlobal( QPoint( 0, 0 ) );
105 QSize s = popupMenu->sizeHint(); 105 QSize s = popupMenu->sizeHint();
106 popupMenu->popup( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), 106 popupMenu->popup( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ),
107 p.y() - s.height() ), 0 ); 107 p.y() - s.height() ), 0 );
108 108
109 QTimer::singleShot( 2000, this, SLOT( popupTimeout() ) ); 109 QTimer::singleShot( 2000, this, SLOT( popupTimeout() ) );
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp
index 34d151e..4fc8076 100644
--- a/core/applets/clipboardapplet/clipboard.cpp
+++ b/core/applets/clipboardapplet/clipboard.cpp
@@ -1,150 +1,150 @@
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 "clipboard.h" 21#include "clipboard.h"
22 22
23#include <opie2/otaskbarapplet.h> 23#include <opie2/otaskbarapplet.h>
24#include <qpe/resource.h> 24#include <qpe/resource.h>
25#include <qpe/applnk.h> 25#include <qpe/applnk.h>
26 26
27#include <qpainter.h> 27#include <qpainter.h>
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qwindowsystem_qws.h> 29#include <qwindowsystem_qws.h>
30#include <qapplication.h> 30#include <qapplication.h>
31#include <qclipboard.h> 31#include <qclipboard.h>
32#include <qtimer.h> 32#include <qtimer.h>
33 33
34//=========================================================================== 34//===========================================================================
35 35
36 36
37ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) 37ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name )
38{ 38{
39 setFixedWidth ( AppLnk::smallIconSize() ); 39 setFixedWidth ( AppLnk::smallIconSize() );
40 setFixedHeight ( AppLnk::smallIconSize() ); 40 setFixedHeight ( AppLnk::smallIconSize() );
41 41
42 QImage img = Resource::loadImage( "paste"); 42 QImage img = Resource::loadImage( "paste");
43 img = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 43 img = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
44 44
45 m_clipboardPixmap.convertFromImage( img ); 45 m_clipboardPixmap.convertFromImage( img );
46 46
47 m_timer = new QTimer ( this ); 47 m_timer = new QTimer ( this );
48 48
49 connect ( QApplication::clipboard ( ), SIGNAL( dataChanged ( )), this, SLOT( newData ( ))); 49 connect ( QApplication::clipboard ( ), SIGNAL( dataChanged()), this, SLOT( newData()));
50 connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( newData ( ))); 50 connect ( m_timer, SIGNAL( timeout()), this, SLOT( newData()));
51 connect ( qApp, SIGNAL( aboutToQuit ( )), this, SLOT( shutdown ( ))); 51 connect ( qApp, SIGNAL( aboutToQuit()), this, SLOT( shutdown()));
52 52
53 m_menu = 0; 53 m_menu = 0;
54 m_dirty = true; 54 m_dirty = true;
55 m_lasttext = QString::null; 55 m_lasttext = QString::null;
56 56
57 m_timer-> start ( 0, true ); 57 m_timer-> start ( 0, true );
58} 58}
59 59
60ClipboardApplet::~ClipboardApplet ( ) 60ClipboardApplet::~ClipboardApplet ( )
61{ 61{
62} 62}
63 63
64int ClipboardApplet::position() 64int ClipboardApplet::position()
65{ 65{
66 return 6; 66 return 6;
67} 67}
68 68
69void ClipboardApplet::shutdown ( ) 69void ClipboardApplet::shutdown ( )
70{ 70{
71 // the timer has to be stopped, or Qt/E will hang on quit() 71 // the timer has to be stopped, or Qt/E will hang on quit()
72 // see launcher/desktop.cpp 72 // see launcher/desktop.cpp
73 73
74 m_timer-> stop ( ); 74 m_timer-> stop ( );
75} 75}
76 76
77void ClipboardApplet::mousePressEvent ( QMouseEvent *) 77void ClipboardApplet::mousePressEvent ( QMouseEvent *)
78{ 78{
79 if ( m_dirty ) { 79 if ( m_dirty ) {
80 delete m_menu; 80 delete m_menu;
81 81
82 m_menu = new QPopupMenu ( this ); 82 m_menu = new QPopupMenu ( this );
83 m_menu-> setCheckable ( true ); 83 m_menu-> setCheckable ( true );
84 84
85 if ( m_history. count ( )) { 85 if ( m_history. count ( )) {
86 for ( unsigned int i = 0; i < m_history. count ( ); i++ ) { 86 for ( unsigned int i = 0; i < m_history. count ( ); i++ ) {
87 QString str = m_history [i]; 87 QString str = m_history [i];
88 88
89 if ( str. length ( ) > 20 ) 89 if ( str. length ( ) > 20 )
90 str = str. left ( 20 ) + "..."; 90 str = str. left ( 20 ) + "...";
91 91
92 m_menu-> insertItem ( QString ( "%1: %2" ). arg ( i + 1 ). arg ( str ), i ); 92 m_menu-> insertItem ( QString ( "%1: %2" ). arg ( i + 1 ). arg ( str ), i );
93 m_menu-> setItemChecked ( i, false ); 93 m_menu-> setItemChecked ( i, false );
94 } 94 }
95 m_menu-> setItemChecked ( m_history. count ( ) - 1, true ); 95 m_menu-> setItemChecked ( m_history. count ( ) - 1, true );
96 m_menu-> insertSeparator ( ); 96 m_menu-> insertSeparator ( );
97 } 97 }
98 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "cut" )), tr( "Cut" ), 100 ); 98 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "cut" )), tr( "Cut" ), 100 );
99 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "copy" )), tr( "Copy" ), 101 ); 99 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "copy" )), tr( "Copy" ), 101 );
100 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "paste" )), tr( "Paste" ), 102 ); 100 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "paste" )), tr( "Paste" ), 102 );
101 101
102 connect ( m_menu, SIGNAL( activated ( int )), this, SLOT( action ( int ))); 102 connect ( m_menu, SIGNAL( activated(int)), this, SLOT( action(int)));
103 103
104 m_dirty = false; 104 m_dirty = false;
105 } 105 }
106 QPoint p = mapToGlobal ( QPoint ( 0, 0 )); 106 QPoint p = mapToGlobal ( QPoint ( 0, 0 ));
107 QSize s = m_menu-> sizeHint ( ); 107 QSize s = m_menu-> sizeHint ( );
108 108
109 m_menu-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( ))); 109 m_menu-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( )));
110} 110}
111 111
112void ClipboardApplet::action(int id) 112void ClipboardApplet::action(int id)
113{ 113{
114 ushort unicode = 0; 114 ushort unicode = 0;
115 int scan = 0; 115 int scan = 0;
116 116
117 switch ( id ) { 117 switch ( id ) {
118 case 100: 118 case 100:
119 unicode = 'X' - '@'; 119 unicode = 'X' - '@';
120 scan = Key_X; // Cut 120 scan = Key_X; // Cut
121 break; 121 break;
122 case 101: 122 case 101:
123 unicode = 'C' - '@'; 123 unicode = 'C' - '@';
124 scan = Key_C; // Copy 124 scan = Key_C; // Copy
125 break; 125 break;
126 case 102: 126 case 102:
127 unicode = 'V' - '@'; 127 unicode = 'V' - '@';
128 scan = Key_V; // Paste 128 scan = Key_V; // Paste
129 break; 129 break;
130 130
131 default: 131 default:
132 if (( id >= 0 ) && ( uint( id ) < m_history. count ( ))) { 132 if (( id >= 0 ) && ( uint( id ) < m_history. count ( ))) {
133 QApplication::clipboard ( )-> setText ( m_history [id] ); 133 QApplication::clipboard ( )-> setText ( m_history [id] );
134 134
135 for ( uint i = 0; i < m_history. count ( ); i++ ) 135 for ( uint i = 0; i < m_history. count ( ); i++ )
136 m_menu-> setItemChecked ( i, i == uint( id )); 136 m_menu-> setItemChecked ( i, i == uint( id ));
137 137
138 unicode = 'V' - '@'; 138 unicode = 'V' - '@';
139 scan = Key_V; 139 scan = Key_V;
140 } 140 }
141 break; 141 break;
142 } 142 }
143 143
144 if ( scan ) { 144 if ( scan ) {
145 qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false ); 145 qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false );
146 qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false ); 146 qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false );
147 } 147 }
148} 148}
149 149
150void ClipboardApplet::paintEvent ( QPaintEvent* ) 150void ClipboardApplet::paintEvent ( QPaintEvent* )
diff --git a/core/applets/clockapplet/clock.cpp b/core/applets/clockapplet/clock.cpp
index 9fead03..120a019 100644
--- a/core/applets/clockapplet/clock.cpp
+++ b/core/applets/clockapplet/clock.cpp
@@ -1,83 +1,83 @@
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 "clock.h" 21#include "clock.h"
22 22
23#include <opie2/otaskbarapplet.h> 23#include <opie2/otaskbarapplet.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/qcopenvelope_qws.h> 25#include <qpe/qcopenvelope_qws.h>
26#include <qpe/config.h> 26#include <qpe/config.h>
27 27
28LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent ) 28LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent )
29{ 29{
30 // If you want a sunken border around the clock do this: 30 // If you want a sunken border around the clock do this:
31 // setFrameStyle( QFrame::Panel | QFrame::Sunken ); 31 // setFrameStyle( QFrame::Panel | QFrame::Sunken );
32 //setFont( QFont( "Helvetica", , QFont::Normal ) ); 32 //setFont( QFont( "Helvetica", , QFont::Normal ) );
33 connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime( ) ) ); 33 connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime() ) );
34 connect( qApp, SIGNAL( clockChanged( bool ) ), 34 connect( qApp, SIGNAL( clockChanged(bool) ),
35 this, SLOT( slotClockChanged( bool ) ) ); 35 this, SLOT( slotClockChanged(bool) ) );
36 readConfig(); 36 readConfig();
37 timerId = 0; 37 timerId = 0;
38 timerEvent( 0 ); 38 timerEvent( 0 );
39 show(); 39 show();
40} 40}
41 41
42int LauncherClock::position() 42int LauncherClock::position()
43{ 43{
44 return 10; 44 return 10;
45} 45}
46 46
47void LauncherClock::readConfig() { 47void LauncherClock::readConfig() {
48 Config config( "qpe" ); 48 Config config( "qpe" );
49 config.setGroup( "Time" ); 49 config.setGroup( "Time" );
50 ampmFormat = config.readBoolEntry( "AMPM", TRUE ); 50 ampmFormat = config.readBoolEntry( "AMPM", TRUE );
51 config.setGroup( "Date" ); 51 config.setGroup( "Date" );
52 format = config.readNumEntry("ClockApplet",0); 52 format = config.readNumEntry("ClockApplet",0);
53} 53}
54 54
55void LauncherClock::mouseReleaseEvent( QMouseEvent * ) 55void LauncherClock::mouseReleaseEvent( QMouseEvent * )
56{ 56{
57 QCString setTimeApp; 57 QCString setTimeApp;
58 setTimeApp="systemtime"; 58 setTimeApp="systemtime";
59 QCopEnvelope e("QPE/Application/"+setTimeApp, "raise()"); 59 QCopEnvelope e("QPE/Application/"+setTimeApp, "raise()");
60} 60}
61 61
62 62
63void LauncherClock::timerEvent( QTimerEvent *e ) 63void LauncherClock::timerEvent( QTimerEvent *e )
64{ 64{
65 if ( !e || e->timerId() == timerId ) { 65 if ( !e || e->timerId() == timerId ) {
66 killTimer( timerId ); 66 killTimer( timerId );
67 changeTime(); 67 changeTime();
68 QTime t = QTime::currentTime(); 68 QTime t = QTime::currentTime();
69 int ms = (60 - t.second())*1000 - t.msec(); 69 int ms = (60 - t.second())*1000 - t.msec();
70 timerId = startTimer( ms ); 70 timerId = startTimer( ms );
71 } else { 71 } else {
72 QLabel::timerEvent( e ); 72 QLabel::timerEvent( e );
73 } 73 }
74} 74}
75 75
76void LauncherClock::updateTime( void ) 76void LauncherClock::updateTime( void )
77{ 77{
78 changeTime(); 78 changeTime();
79} 79}
80 80
81void LauncherClock::changeTime( void ) 81void LauncherClock::changeTime( void )
82{ 82{
83 QTime tm = QDateTime::currentDateTime().time(); 83 QTime tm = QDateTime::currentDateTime().time();
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp
index afc0592..dde8050 100644
--- a/core/applets/irdaapplet/irda.cpp
+++ b/core/applets/irdaapplet/irda.cpp
@@ -15,134 +15,134 @@
15**********************************************************************/ 15**********************************************************************/
16 16
17#include "irda.h" 17#include "irda.h"
18 18
19/* OPIE */ 19/* OPIE */
20#include <opie2/otaskbarapplet.h> 20#include <opie2/otaskbarapplet.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23 23
24/* QT */ 24/* QT */
25#include <qpainter.h> 25#include <qpainter.h>
26#include <qfile.h> 26#include <qfile.h>
27#include <qtimer.h> 27#include <qtimer.h>
28#include <qtextstream.h> 28#include <qtextstream.h>
29 29
30/* STD */ 30/* STD */
31#include <unistd.h> 31#include <unistd.h>
32#include <net/if.h> 32#include <net/if.h>
33#include <netinet/in.h> 33#include <netinet/in.h>
34#include <sys/types.h> 34#include <sys/types.h>
35#include <sys/socket.h> 35#include <sys/socket.h>
36#include <sys/ioctl.h> 36#include <sys/ioctl.h>
37 37
38//=========================================================================== 38//===========================================================================
39 39
40IrdaApplet::IrdaApplet ( QWidget *parent, const char *name ) 40IrdaApplet::IrdaApplet ( QWidget *parent, const char *name )
41 : QWidget ( parent, name ) 41 : QWidget ( parent, name )
42{ 42{
43 setFixedHeight ( 18 ); 43 setFixedHeight ( 18 );
44 setFixedWidth ( 14 ); 44 setFixedWidth ( 14 );
45 45
46 m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP ); 46 m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP );
47 47
48 m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" ); 48 m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" );
49 m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" ); 49 m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" );
50 m_irdaDiscoveryOnPixmap = Resource::loadPixmap( "irdaapplet/magglass" ); 50 m_irdaDiscoveryOnPixmap = Resource::loadPixmap( "irdaapplet/magglass" );
51 m_receiveActivePixmap = Resource::loadPixmap( "irdaapplet/receive" ); 51 m_receiveActivePixmap = Resource::loadPixmap( "irdaapplet/receive" );
52 52
53 m_irda_active = false; 53 m_irda_active = false;
54 m_irda_discovery_active = false; 54 m_irda_discovery_active = false;
55 m_receive_active = false; 55 m_receive_active = false;
56 m_receive_state_changed = false; 56 m_receive_state_changed = false;
57 m_popup = 0; 57 m_popup = 0;
58 m_wasOn = false; 58 m_wasOn = false;
59 m_wasDiscover = false; 59 m_wasDiscover = false;
60 60
61 QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this ); 61 QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this );
62 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), 62 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
63 this, SLOT(slotMessage(const QCString&, const QByteArray& ) ) ); 63 this, SLOT(slotMessage(const QCString&,const QByteArray&) ) );
64} 64}
65 65
66int IrdaApplet::position() 66int IrdaApplet::position()
67{ 67{
68 return 6; 68 return 6;
69} 69}
70 70
71void IrdaApplet::show() 71void IrdaApplet::show()
72{ 72{
73 QWidget::show ( ); 73 QWidget::show ( );
74 startTimer ( 2000 ); 74 startTimer ( 2000 );
75} 75}
76 76
77IrdaApplet::~IrdaApplet() 77IrdaApplet::~IrdaApplet()
78{ 78{
79 if ( m_sockfd >= 0 ) 79 if ( m_sockfd >= 0 )
80 ::close ( m_sockfd ); 80 ::close ( m_sockfd );
81} 81}
82 82
83void IrdaApplet::popup ( QString message, QString icon ) 83void IrdaApplet::popup ( QString message, QString icon )
84{ 84{
85 if ( !m_popup ) 85 if ( !m_popup )
86 m_popup = new QPopupMenu ( this ); 86 m_popup = new QPopupMenu ( this );
87 87
88 m_popup-> clear ( ); 88 m_popup-> clear ( );
89 89
90 if ( icon. isEmpty ( )) 90 if ( icon. isEmpty ( ))
91 m_popup-> insertItem ( message, 0 ); 91 m_popup-> insertItem ( message, 0 );
92 else 92 else
93 m_popup-> insertItem ( QIconSet ( Resource::loadPixmap ( icon )), message, 0 ); 93 m_popup-> insertItem ( QIconSet ( Resource::loadPixmap ( icon )), message, 0 );
94 94
95 QPoint p = mapToGlobal ( QPoint ( 0, 0 )); 95 QPoint p = mapToGlobal ( QPoint ( 0, 0 ));
96 QSize s = m_popup-> sizeHint ( ); 96 QSize s = m_popup-> sizeHint ( );
97 m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), 97 m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ),
98 p. y ( ) - s. height ( ))); 98 p. y ( ) - s. height ( )));
99 99
100 QTimer::singleShot ( 2000, this, SLOT( popupTimeout ( ))); 100 QTimer::singleShot ( 2000, this, SLOT( popupTimeout()));
101} 101}
102 102
103void IrdaApplet::popupTimeout ( ) 103void IrdaApplet::popupTimeout ( )
104{ 104{
105 m_popup-> hide ( ); 105 m_popup-> hide ( );
106} 106}
107 107
108bool IrdaApplet::checkIrdaStatus ( ) 108bool IrdaApplet::checkIrdaStatus ( )
109{ 109{
110 struct ifreq ifr; 110 struct ifreq ifr;
111 strcpy ( ifr. ifr_name, "irda0" ); 111 strcpy ( ifr. ifr_name, "irda0" );
112 112
113 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) 113 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 )
114 return false; 114 return false;
115 115
116 return ( ifr. ifr_flags & IFF_UP ); 116 return ( ifr. ifr_flags & IFF_UP );
117} 117}
118 118
119bool IrdaApplet::setIrdaStatus ( bool b ) 119bool IrdaApplet::setIrdaStatus ( bool b )
120{ 120{
121 struct ifreq ifr; 121 struct ifreq ifr;
122 strcpy ( ifr. ifr_name, "irda0" ); 122 strcpy ( ifr. ifr_name, "irda0" );
123 123
124 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) 124 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 )
125 return false; 125 return false;
126 126
127 if ( b ) { 127 if ( b ) {
128 ifr. ifr_flags |= IFF_UP; 128 ifr. ifr_flags |= IFF_UP;
129 } 129 }
130 else { 130 else {
131 setIrdaDiscoveryStatus ( 0 ); 131 setIrdaDiscoveryStatus ( 0 );
132 setIrdaReceiveStatus ( 0 ); 132 setIrdaReceiveStatus ( 0 );
133 ifr. ifr_flags &= ~IFF_UP; 133 ifr. ifr_flags &= ~IFF_UP;
134 } 134 }
135 135
136 if ( ::ioctl ( m_sockfd, SIOCSIFFLAGS, &ifr ) < 0 ) 136 if ( ::ioctl ( m_sockfd, SIOCSIFFLAGS, &ifr ) < 0 )
137 return false; 137 return false;
138 138
139 return true; 139 return true;
140} 140}
141 141
142bool IrdaApplet::checkIrdaDiscoveryStatus ( ) 142bool IrdaApplet::checkIrdaDiscoveryStatus ( )
143{ 143{
144 QFile discovery ( "/proc/sys/net/irda/discovery" ); 144 QFile discovery ( "/proc/sys/net/irda/discovery" );
145 145
146 QString streamIn = "0"; 146 QString streamIn = "0";
147 147
148 if ( discovery. open ( IO_ReadOnly )) { 148 if ( discovery. open ( IO_ReadOnly )) {
diff --git a/core/applets/multikeyapplet/multikey.cpp b/core/applets/multikeyapplet/multikey.cpp
index b17498d..fc5f093 100644
--- a/core/applets/multikeyapplet/multikey.cpp
+++ b/core/applets/multikeyapplet/multikey.cpp
@@ -1,76 +1,76 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2004 Anton Kachalov mouse@altlinux.ru 2** Copyright (C) 2004 Anton Kachalov mouse@altlinux.ru
3** All rights reserved. 3** All rights reserved.
4** 4**
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13**********************************************************************/ 13**********************************************************************/
14 14
15#include "multikey.h" 15#include "multikey.h"
16 16
17/* OPIE */ 17/* OPIE */
18#include <opie2/otaskbarapplet.h> 18#include <opie2/otaskbarapplet.h>
19#include <qpe/qcopenvelope_qws.h> 19#include <qpe/qcopenvelope_qws.h>
20 20
21/* QT */ 21/* QT */
22#include <qdir.h> 22#include <qdir.h>
23 23
24Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN") 24Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN")
25{ 25{
26 QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this); 26 QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this);
27 connect( swChannel, SIGNAL(received(const QCString &, const QByteArray &)), 27 connect( swChannel, SIGNAL(received(const QCString&,const QByteArray&)),
28 this, SLOT(message(const QCString &, const QByteArray &))); 28 this, SLOT(message(const QCString&,const QByteArray&)));
29 29
30 setFont( QFont( "Helvetica", 10, QFont::Normal ) ); 30 setFont( QFont( "Helvetica", 10, QFont::Normal ) );
31 QPEApplication::setStylusOperation(this, QPEApplication::RightOnHold); 31 QPEApplication::setStylusOperation(this, QPEApplication::RightOnHold);
32 lang = 0; 32 lang = 0;
33 QCopEnvelope e("MultiKey/Keyboard", "getmultikey()"); 33 QCopEnvelope e("MultiKey/Keyboard", "getmultikey()");
34 setText("EN"); 34 setText("EN");
35 popupMenu.insertItem("EN", 0); 35 popupMenu.insertItem("EN", 0);
36 show(); 36 show();
37} 37}
38 38
39void Multikey::mousePressEvent(QMouseEvent *ev) 39void Multikey::mousePressEvent(QMouseEvent *ev)
40{ 40{
41 if (!sw_maps.count()) 41 if (!sw_maps.count())
42 return; 42 return;
43 43
44 if (ev->button() == RightButton) { 44 if (ev->button() == RightButton) {
45 45
46 QPoint p = mapToGlobal(QPoint(0, 0)); 46 QPoint p = mapToGlobal(QPoint(0, 0));
47 QSize s = popupMenu.sizeHint(); 47 QSize s = popupMenu.sizeHint();
48 int opt = popupMenu.exec(QPoint(p.x() + (width() / 2) - (s.width() / 2), 48 int opt = popupMenu.exec(QPoint(p.x() + (width() / 2) - (s.width() / 2),
49 p.y() - s.height()), 0); 49 p.y() - s.height()), 0);
50 50
51 if (opt == -1) 51 if (opt == -1)
52 return; 52 return;
53 lang = opt; 53 lang = opt;
54 54
55 QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); 55 QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)");
56 e << sw_maps[lang]; 56 e << sw_maps[lang];
57 setText(labels[lang]); 57 setText(labels[lang]);
58 } 58 }
59 QWidget::mousePressEvent(ev); 59 QWidget::mousePressEvent(ev);
60} 60}
61 61
62void Multikey::mouseReleaseEvent(QMouseEvent *ev) 62void Multikey::mouseReleaseEvent(QMouseEvent *ev)
63{ 63{
64 if (!sw_maps.count()) 64 if (!sw_maps.count())
65 return; 65 return;
66 66
67 lang = lang < sw_maps.count()-1 ? lang+1 : 0; 67 lang = lang < sw_maps.count()-1 ? lang+1 : 0;
68 QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); 68 QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)");
69 //qDebug("Lang=%d, count=%d, lab=%s", lang, sw_maps.count(), labels[lang].ascii()); 69 //qDebug("Lang=%d, count=%d, lab=%s", lang, sw_maps.count(), labels[lang].ascii());
70 e << sw_maps[lang]; 70 e << sw_maps[lang];
71 setText(labels[lang]); 71 setText(labels[lang]);
72} 72}
73 73
74void Multikey::message(const QCString &message, const QByteArray &data) 74void Multikey::message(const QCString &message, const QByteArray &data)
75{ 75{
76 if ( message == "setsw(QString,QString)" ) { 76 if ( message == "setsw(QString,QString)" ) {
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp
index dcbf809..0488c36 100644
--- a/core/applets/rotateapplet/rotate.cpp
+++ b/core/applets/rotateapplet/rotate.cpp
@@ -3,98 +3,98 @@
3 Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org> 3 Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org>
4 Copyright (C) 2003 Greg Gilbert <ggilbert@treke.net> 4 Copyright (C) 2003 Greg Gilbert <ggilbert@treke.net>
5               =. Copyright (C) 2004 Michael Lauer <mickey@Vanille.de> 5               =. Copyright (C) 2004 Michael Lauer <mickey@Vanille.de>
6             .=l. 6             .=l.
7           .>+-= 7           .>+-=
8 _;:,     .>    :=|. This library is free software; you can 8 _;:,     .>    :=|. This library is free software; you can
9.> <,   >  .   <= redistribute it and/or modify it under 9.> <,   >  .   <= redistribute it and/or modify it under
10:=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
14    .%+i>       _;_. 14    .%+i>       _;_.
15    .i_,=:_.      -<s. This library is distributed in the hope that 15    .i_,=:_.      -<s. This library is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=| MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=| MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .     .: details. 21++=   -.     .     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
25    --        :-= this library; see the file COPYING.LIB. 25    --        :-= this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29*/ 29*/
30 30
31#include "rotate.h" 31#include "rotate.h"
32 32
33/* OPIE */ 33/* OPIE */
34#include <opie/odevice.h> 34#include <opie/odevice.h>
35#include <qpe/config.h> 35#include <qpe/config.h>
36#include <qpe/power.h> 36#include <qpe/power.h>
37#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
38#include <qpe/resource.h> 38#include <qpe/resource.h>
39using namespace Opie; 39using namespace Opie;
40 40
41/* QT */ 41/* QT */
42 42
43#include <time.h> 43#include <time.h>
44 44
45RotateApplet::RotateApplet() 45RotateApplet::RotateApplet()
46 :QObject( 0, "RotateApplet" ), m_flipped( false ) 46 :QObject( 0, "RotateApplet" ), m_flipped( false )
47{ 47{
48 48
49#if !defined(QT_NO_COP) 49#if !defined(QT_NO_COP)
50 QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this ); 50 QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this );
51 connect ( rotateChannel, SIGNAL( received( const QCString &, const QByteArray &) ), 51 connect ( rotateChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
52 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); 52 this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) );
53#endif 53#endif
54 54
55} 55}
56 56
57RotateApplet::~RotateApplet ( ) 57RotateApplet::~RotateApplet ( )
58{} 58{}
59 59
60/** 60/**
61 * Qcop receive method. 61 * Qcop receive method.
62 */ 62 */
63void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data ) 63void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data )
64{ 64{
65 qDebug( "RotateApplet::channelReceived( '%s' )", (const char*) msg ); 65 qDebug( "RotateApplet::channelReceived( '%s' )", (const char*) msg );
66 66
67 if ( ODevice::inst()->hasHingeSensor() ) 67 if ( ODevice::inst()->hasHingeSensor() )
68 { 68 {
69 struct timespec interval; 69 struct timespec interval;
70 struct timespec remain; 70 struct timespec remain;
71 interval.tv_sec = 0; 71 interval.tv_sec = 0;
72 interval.tv_nsec = 600000; 72 interval.tv_nsec = 600000;
73 ::nanosleep( &interval, &remain ); 73 ::nanosleep( &interval, &remain );
74 OHingeStatus status = ODevice::inst()->readHingeSensor(); 74 OHingeStatus status = ODevice::inst()->readHingeSensor();
75 qDebug( "RotateApplet::readHingeSensor = %d", (int) status ); 75 qDebug( "RotateApplet::readHingeSensor = %d", (int) status );
76 76
77 Config cfg( "apm" ); 77 Config cfg( "apm" );
78 cfg.setGroup( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ? "AC" : "Battery" ); 78 cfg.setGroup( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ? "AC" : "Battery" );
79 int action = cfg.readNumEntry( "CloseHingeAction", 0 ); 79 int action = cfg.readNumEntry( "CloseHingeAction", 0 );
80 80
81 if ( status == CASE_CLOSED ) 81 if ( status == CASE_CLOSED )
82 { 82 {
83 switch ( action ) 83 switch ( action )
84 { 84 {
85 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 0 ); break; 85 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 0 ); break;
86 case 2: /* SUSPEND */ ODevice::inst()->suspend(); break; 86 case 2: /* SUSPEND */ ODevice::inst()->suspend(); break;
87 default: /* IGNORE */ break; 87 default: /* IGNORE */ break;
88 } 88 }
89 } 89 }
90 else /* status != CASE_CLOSED */ 90 else /* status != CASE_CLOSED */
91 { 91 {
92 switch ( action ) 92 switch ( action )
93 { 93 {
94 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 127 ); break; 94 case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 127 ); break;
95 case 2: /* SUSPEND */ /* How to wake up the device from kernel? */; break; 95 case 2: /* SUSPEND */ /* How to wake up the device from kernel? */; break;
96 default: /* IGNORE */ break; 96 default: /* IGNORE */ break;
97 } 97 }
98 } 98 }
99 qDebug( "RotateApplet::switchAction %d performed.", cfg.readNumEntry( "CloseHingeAction", 0 ) ); 99 qDebug( "RotateApplet::switchAction %d performed.", cfg.readNumEntry( "CloseHingeAction", 0 ) );
100 } 100 }
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp
index 5d6bce4..20e1c9b 100644
--- a/core/applets/screenshotapplet/screenshot.cpp
+++ b/core/applets/screenshotapplet/screenshot.cpp
@@ -254,99 +254,99 @@ static char * snapshot_xpm[] = {
254static const char *SCAP_hostname = "www.handhelds.org"; 254static const char *SCAP_hostname = "www.handhelds.org";
255static const int SCAP_port = 80; 255static const int SCAP_port = 80;
256 256
257 257
258ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name ) 258ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name )
259 : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) 259 : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup )
260{ 260{
261 setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); 261 setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
262 QVBoxLayout *vbox = new QVBoxLayout ( this, 5, 3 ); 262 QVBoxLayout *vbox = new QVBoxLayout ( this, 5, 3 );
263 QHBoxLayout *hbox; 263 QHBoxLayout *hbox;
264 264
265 hbox = new QHBoxLayout ( vbox ); 265 hbox = new QHBoxLayout ( vbox );
266 266
267 QLabel *l = new QLabel ( tr( "Delay" ), this ); 267 QLabel *l = new QLabel ( tr( "Delay" ), this );
268 hbox-> addWidget ( l ); 268 hbox-> addWidget ( l );
269 269
270 delaySpin = new QSpinBox( 0, 60, 1, this, "Spinner" ); 270 delaySpin = new QSpinBox( 0, 60, 1, this, "Spinner" );
271 delaySpin-> setButtonSymbols ( QSpinBox::PlusMinus ); 271 delaySpin-> setButtonSymbols ( QSpinBox::PlusMinus );
272 delaySpin-> setSuffix ( tr( "sec" )); 272 delaySpin-> setSuffix ( tr( "sec" ));
273 delaySpin-> setFocusPolicy( QWidget::NoFocus ); 273 delaySpin-> setFocusPolicy( QWidget::NoFocus );
274 delaySpin-> setValue ( 1 ); 274 delaySpin-> setValue ( 1 );
275 hbox-> addWidget ( delaySpin ); 275 hbox-> addWidget ( delaySpin );
276 276
277 saveNamedCheck = new QCheckBox ( tr( "Save named" ), this); 277 saveNamedCheck = new QCheckBox ( tr( "Save named" ), this);
278 saveNamedCheck-> setFocusPolicy ( QWidget::NoFocus ); 278 saveNamedCheck-> setFocusPolicy ( QWidget::NoFocus );
279 vbox->addWidget( saveNamedCheck); 279 vbox->addWidget( saveNamedCheck);
280 280
281 vbox-> addSpacing ( 3 ); 281 vbox-> addSpacing ( 3 );
282 282
283 l = new QLabel ( tr( "Save screenshot as..." ), this ); 283 l = new QLabel ( tr( "Save screenshot as..." ), this );
284 vbox-> addWidget ( l, AlignCenter ); 284 vbox-> addWidget ( l, AlignCenter );
285 285
286 hbox = new QHBoxLayout ( vbox ); 286 hbox = new QHBoxLayout ( vbox );
287 287
288 grabItButton = new QPushButton( tr( "File" ), this, "GrabButton" ); 288 grabItButton = new QPushButton( tr( "File" ), this, "GrabButton" );
289 grabItButton ->setFocusPolicy( QWidget::TabFocus ); 289 grabItButton ->setFocusPolicy( QWidget::TabFocus );
290 hbox-> addWidget ( grabItButton ); 290 hbox-> addWidget ( grabItButton );
291 291
292 scapButton = new QPushButton( tr( "Scap" ), this, "ScapButton" ); 292 scapButton = new QPushButton( tr( "Scap" ), this, "ScapButton" );
293 scapButton ->setFocusPolicy( QWidget::TabFocus ); 293 scapButton ->setFocusPolicy( QWidget::TabFocus );
294 hbox-> addWidget ( scapButton ); 294 hbox-> addWidget ( scapButton );
295 295
296 setFixedSize ( sizeHint ( )); 296 setFixedSize ( sizeHint ( ));
297 setFocusPolicy ( QWidget::NoFocus ); 297 setFocusPolicy ( QWidget::NoFocus );
298 298
299 299
300 grabTimer = new QTimer ( this, "grab timer"); 300 grabTimer = new QTimer ( this, "grab timer");
301 301
302 connect ( grabTimer, SIGNAL( timeout ( )), this, SLOT( performGrab ( ))); 302 connect ( grabTimer, SIGNAL( timeout()), this, SLOT( performGrab()));
303 connect ( grabItButton, SIGNAL( clicked ( )), SLOT( slotGrab ( ))); 303 connect ( grabItButton, SIGNAL( clicked()), SLOT( slotGrab()));
304 connect ( scapButton, SIGNAL( clicked ( )), SLOT( slotScap ( ))); 304 connect ( scapButton, SIGNAL( clicked()), SLOT( slotScap()));
305} 305}
306 306
307void ScreenshotControl::slotGrab() 307void ScreenshotControl::slotGrab()
308{ 308{
309 buttonPushed = 1; 309 buttonPushed = 1;
310 hide(); 310 hide();
311 311
312 setFileName = FALSE; 312 setFileName = FALSE;
313 if ( saveNamedCheck->isChecked()) { 313 if ( saveNamedCheck->isChecked()) {
314 setFileName = TRUE; 314 setFileName = TRUE;
315 InputDialog *fileDlg; 315 InputDialog *fileDlg;
316 316
317 fileDlg = new InputDialog( 0 , tr("Name of screenshot "), TRUE, 0); 317 fileDlg = new InputDialog( 0 , tr("Name of screenshot "), TRUE, 0);
318 fileDlg->exec(); 318 fileDlg->exec();
319 fileDlg->raise(); 319 fileDlg->raise();
320 QString fileName, list; 320 QString fileName, list;
321 if ( fileDlg->result() == 1 ) { 321 if ( fileDlg->result() == 1 ) {
322 fileName = fileDlg->LineEdit1->text(); 322 fileName = fileDlg->LineEdit1->text();
323 323
324 if (fileName.find("/", 0, TRUE) == -1) 324 if (fileName.find("/", 0, TRUE) == -1)
325 FileNamePath = QDir::homeDirPath() + "/Documents/image/png/" + fileName; 325 FileNamePath = QDir::homeDirPath() + "/Documents/image/png/" + fileName;
326 else 326 else
327 FileNamePath = fileName; 327 FileNamePath = fileName;
328 328
329 } 329 }
330 delete fileDlg; 330 delete fileDlg;
331 } 331 }
332 332
333 if ( delaySpin->value() ) 333 if ( delaySpin->value() )
334 grabTimer->start( delaySpin->value() * 1000, true ); 334 grabTimer->start( delaySpin->value() * 1000, true );
335 else 335 else
336 show(); 336 show();
337} 337}
338 338
339void ScreenshotControl::slotScap() 339void ScreenshotControl::slotScap()
340{ 340{
341 buttonPushed = 2; 341 buttonPushed = 2;
342 hide(); 342 hide();
343 343
344 if ( delaySpin->value() ) 344 if ( delaySpin->value() )
345 grabTimer->start( delaySpin->value() * 1000, true ); 345 grabTimer->start( delaySpin->value() * 1000, true );
346 else 346 else
347 show(); 347 show();
348} 348}
349 349
350 350
351void ScreenshotControl::savePixmap() 351void ScreenshotControl::savePixmap()
352{ 352{
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index 563d110..27f6015 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -168,98 +168,98 @@ static char * vmemo_xpm[] = {
168 " . c #65656A", 168 " . c #65656A",
169 ".. c #999AA2", 169 ".. c #999AA2",
170 "+. c #52535A", 170 "+. c #52535A",
171 "@. c #151B21", 171 "@. c #151B21",
172 "#. c #515257", 172 "#. c #515257",
173 "$. c #B5B5BE", 173 "$. c #B5B5BE",
174 "%. c #616167", 174 "%. c #616167",
175 "&. c #1A1D22", 175 "&. c #1A1D22",
176 "*. c #000713", 176 "*. c #000713",
177 "=. c #1F1F21", 177 "=. c #1F1F21",
178 " ", 178 " ",
179 " . + @ # ", 179 " . + @ # ",
180 " $ % & * = - ", 180 " $ % & * = - ",
181 " ; > , ' ) ! ~ ", 181 " ; > , ' ) ! ~ ",
182 " { ] ^ / ( _ : ", 182 " { ] ^ / ( _ : ",
183 " < [ } | 1 2 3 ", 183 " < [ } | 1 2 3 ",
184 " 4 5 6 7 8 9 0 a b c ", 184 " 4 5 6 7 8 9 0 a b c ",
185 " d e f g h i j 3 k l m n ", 185 " d e f g h i j 3 k l m n ",
186 " o p q r s t u v w n ", 186 " o p q r s t u v w n ",
187 " o x y z A B C D E n ", 187 " o x y z A B C D E n ",
188 " F G H I J K L M N O ", 188 " F G H I J K L M N O ",
189 " P Q R S T U V W X ", 189 " P Q R S T U V W X ",
190 " Y Z ` b ...+. ", 190 " Y Z ` b ...+. ",
191 " @.#.$.%.&. ", 191 " @.#.$.%.&. ",
192 " *.B =. ", 192 " *.B =. ",
193 " n n n n n n n n n "}; 193 " n n n n n n n n n "};
194 194
195 195
196VMemo::VMemo( QWidget *parent, const char *_name ) 196VMemo::VMemo( QWidget *parent, const char *_name )
197 : QWidget( parent, _name ) { 197 : QWidget( parent, _name ) {
198 setFixedHeight( 18 ); 198 setFixedHeight( 18 );
199 setFixedWidth( 14 ); 199 setFixedWidth( 14 );
200 200
201 t_timer = new QTimer( this ); 201 t_timer = new QTimer( this );
202 connect( t_timer, SIGNAL( timeout() ), SLOT( timerBreak() ) ); 202 connect( t_timer, SIGNAL( timeout() ), SLOT( timerBreak() ) );
203 203
204 Config vmCfg("Vmemo"); 204 Config vmCfg("Vmemo");
205 vmCfg.setGroup("Defaults"); 205 vmCfg.setGroup("Defaults");
206 int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); 206 int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1));
207 useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); 207 useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0);
208 208
209 qDebug("toggleKey %d", toggleKey); 209 qDebug("toggleKey %d", toggleKey);
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 systemZaurus=TRUE; 211 systemZaurus=TRUE;
212 else 212 else
213 systemZaurus=FALSE; 213 systemZaurus=FALSE;
214 214
215 myChannel = new QCopChannel( "QPE/VMemo", this ); 215 myChannel = new QCopChannel( "QPE/VMemo", this );
216 connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), 216 connect( myChannel, SIGNAL(received(const QCString&,const QByteArray&)),
217 this, SLOT(receive(const QCString&, const QByteArray&)) ); 217 this, SLOT(receive(const QCString&,const QByteArray&)) );
218 218
219 if( toggleKey != -1 ) { 219 if( toggleKey != -1 ) {
220 // keyRegister(key, channel, message) 220 // keyRegister(key, channel, message)
221 QCopEnvelope e("QPE/Launcher", "keyRegister(int,QCString,QCString)"); 221 QCopEnvelope e("QPE/Launcher", "keyRegister(int,QCString,QCString)");
222 // e << 4096; // Key_Escape 222 // e << 4096; // Key_Escape
223 // e << Key_F5; //4148 223 // e << Key_F5; //4148
224 e << toggleKey; 224 e << toggleKey;
225 e << QString("QPE/VMemo"); 225 e << QString("QPE/VMemo");
226 e << QString("toggleRecord()"); 226 e << QString("toggleRecord()");
227 } 227 }
228 if(toggleKey == 1) 228 if(toggleKey == 1)
229 usingIcon=TRUE; 229 usingIcon=TRUE;
230 else 230 else
231 usingIcon=FALSE; 231 usingIcon=FALSE;
232 if( vmCfg.readNumEntry("hideIcon",0) == 1) 232 if( vmCfg.readNumEntry("hideIcon",0) == 1)
233 hide(); 233 hide();
234 recording = FALSE; 234 recording = FALSE;
235 // } 235 // }
236} 236}
237 237
238VMemo::~VMemo() { 238VMemo::~VMemo() {
239} 239}
240 240
241int VMemo::position() 241int VMemo::position()
242{ 242{
243 return 6; 243 return 6;
244} 244}
245 245
246void VMemo::receive( const QCString &msg, const QByteArray &data ) { 246void VMemo::receive( const QCString &msg, const QByteArray &data ) {
247 qDebug("receive"); 247 qDebug("receive");
248 QDataStream stream( data, IO_ReadOnly ); 248 QDataStream stream( data, IO_ReadOnly );
249 249
250 if (msg == "toggleRecord()") { 250 if (msg == "toggleRecord()") {
251 if (recording) { 251 if (recording) {
252 fromToggle = TRUE; 252 fromToggle = TRUE;
253 stopRecording(); 253 stopRecording();
254 } else { 254 } else {
255 fromToggle = TRUE; 255 fromToggle = TRUE;
256 startRecording(); 256 startRecording();
257 } 257 }
258 } 258 }
259} 259}
260 260
261void VMemo::paintEvent( QPaintEvent* ) { 261void VMemo::paintEvent( QPaintEvent* ) {
262 QPainter p(this); 262 QPainter p(this);
263 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); 263 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm );
264} 264}
265 265
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp
index 8fd88f6..942cebb 100644
--- a/core/applets/volumeapplet/volume.cpp
+++ b/core/applets/volumeapplet/volume.cpp
@@ -363,117 +363,117 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
363 alarmLabel-> setPixmap ( QPixmap ( alarm_xpm )); 363 alarmLabel-> setPixmap ( QPixmap ( alarm_xpm ));
364 364
365 grid-> addWidget ( alarmLabel, 0, 3, AlignCenter ); 365 grid-> addWidget ( alarmLabel, 0, 3, AlignCenter );
366 grid-> addWidget ( alarmSlider, 1, 3, AlignCenter ); 366 grid-> addWidget ( alarmSlider, 1, 3, AlignCenter );
367 367
368 alarmLed = new OLedBox ( yellow, this ); 368 alarmLed = new OLedBox ( yellow, this );
369 alarmLed-> setFocusPolicy ( QWidget::NoFocus ); 369 alarmLed-> setFocusPolicy ( QWidget::NoFocus );
370 alarmLed-> setFixedSize ( 16, 16 ); 370 alarmLed-> setFixedSize ( 16, 16 );
371 371
372 grid-> addWidget ( alarmLed, 2, 3, AlignCenter ); 372 grid-> addWidget ( alarmLed, 2, 3, AlignCenter );
373 373
374 if ( !has_wav_alarm ) { 374 if ( !has_wav_alarm ) {
375 alarmSlider-> hide ( ); 375 alarmSlider-> hide ( );
376 alarmLabel-> hide ( ); 376 alarmLabel-> hide ( );
377 alarmLed-> hide ( ); 377 alarmLed-> hide ( );
378 } 378 }
379 379
380 grid-> addWidget ( new QLabel ( tr( "Enable Sounds for:" ), this ), 0, 6, AlignVCenter | AlignLeft ); 380 grid-> addWidget ( new QLabel ( tr( "Enable Sounds for:" ), this ), 0, 6, AlignVCenter | AlignLeft );
381 381
382 vbox = new QVBoxLayout ( ); 382 vbox = new QVBoxLayout ( );
383 vbox-> setSpacing ( 4 ); 383 vbox-> setSpacing ( 4 );
384 grid-> addMultiCellLayout ( vbox, 1, 2, 6, 6 ); 384 grid-> addMultiCellLayout ( vbox, 1, 2, 6, 6 );
385 385
386 tapBox = new QCheckBox ( tr( "Screen Taps" ), this ); 386 tapBox = new QCheckBox ( tr( "Screen Taps" ), this );
387 tapBox-> setFocusPolicy ( QWidget::NoFocus ); 387 tapBox-> setFocusPolicy ( QWidget::NoFocus );
388 388
389 vbox-> addWidget ( tapBox, AlignVCenter | AlignLeft ); 389 vbox-> addWidget ( tapBox, AlignVCenter | AlignLeft );
390 390
391 keyBox = new QCheckBox ( tr( "Key Clicks" ), this ); 391 keyBox = new QCheckBox ( tr( "Key Clicks" ), this );
392 keyBox-> setFocusPolicy ( QWidget::NoFocus ); 392 keyBox-> setFocusPolicy ( QWidget::NoFocus );
393 393
394 vbox-> addWidget ( keyBox, AlignVCenter | AlignLeft ); 394 vbox-> addWidget ( keyBox, AlignVCenter | AlignLeft );
395 395
396 alarmBox = new QCheckBox ( tr( "Alarm Sound" ), this ); 396 alarmBox = new QCheckBox ( tr( "Alarm Sound" ), this );
397 alarmBox-> setFocusPolicy ( QWidget::NoFocus ); 397 alarmBox-> setFocusPolicy ( QWidget::NoFocus );
398 398
399 vbox-> addWidget ( alarmBox, AlignVCenter | AlignLeft ); 399 vbox-> addWidget ( alarmBox, AlignVCenter | AlignLeft );
400 400
401 if ( has_wav_alarm ) { 401 if ( has_wav_alarm ) {
402 alarmBox-> hide ( ); 402 alarmBox-> hide ( );
403 } 403 }
404 404
405 vbox-> addStretch ( 100 ); 405 vbox-> addStretch ( 100 );
406 406
407 setFixedSize ( sizeHint ( )); 407 setFixedSize ( sizeHint ( ));
408 setFocusPolicy ( QWidget::NoFocus ); 408 setFocusPolicy ( QWidget::NoFocus );
409 409
410 rateTimer = new QTimer( this ); 410 rateTimer = new QTimer( this );
411 connect ( rateTimer, SIGNAL( timeout ( )), this, SLOT( rateTimerDone ( ))); 411 connect ( rateTimer, SIGNAL( timeout()), this, SLOT( rateTimerDone()));
412 412
413 connect ( upButton, SIGNAL( pressed ( )), this, SLOT( buttonChanged ( ))); 413 connect ( upButton, SIGNAL( pressed()), this, SLOT( buttonChanged()));
414 connect ( upButton, SIGNAL( released ( )), this, SLOT( buttonChanged ( ))); 414 connect ( upButton, SIGNAL( released()), this, SLOT( buttonChanged()));
415 connect ( downButton, SIGNAL( pressed ( )), this, SLOT( buttonChanged ( ))); 415 connect ( downButton, SIGNAL( pressed()), this, SLOT( buttonChanged()));
416 connect ( downButton, SIGNAL( released ( )), this, SLOT( buttonChanged ( ))); 416 connect ( downButton, SIGNAL( released()), this, SLOT( buttonChanged()));
417 417
418 connect ( micSlider, SIGNAL( valueChanged ( int )), this, SLOT( micMoved( int ))); 418 connect ( micSlider, SIGNAL( valueChanged(int)), this, SLOT( micMoved(int)));
419 connect ( volSlider, SIGNAL( valueChanged ( int )), this, SLOT( volMoved( int ))); 419 connect ( volSlider, SIGNAL( valueChanged(int)), this, SLOT( volMoved(int)));
420 connect ( alarmSlider, SIGNAL( valueChanged ( int )), this, SLOT( alarmMoved( int ))); 420 connect ( alarmSlider, SIGNAL( valueChanged(int)), this, SLOT( alarmMoved(int)));
421 connect ( bassSlider, SIGNAL( valueChanged ( int )), this, SLOT( bassMoved( int ))); 421 connect ( bassSlider, SIGNAL( valueChanged(int)), this, SLOT( bassMoved(int)));
422 connect ( trebleSlider, SIGNAL( valueChanged ( int )), this, SLOT( trebleMoved( int ))); 422 connect ( trebleSlider, SIGNAL( valueChanged(int)), this, SLOT( trebleMoved(int)));
423 423
424 424
425 connect ( volLed, SIGNAL( toggled ( bool )), this, SLOT( volMuteToggled ( bool ))); 425 connect ( volLed, SIGNAL( toggled(bool)), this, SLOT( volMuteToggled(bool)));
426 connect ( micLed, SIGNAL( toggled ( bool )), this, SLOT( micMuteToggled ( bool ))); 426 connect ( micLed, SIGNAL( toggled(bool)), this, SLOT( micMuteToggled(bool)));
427 connect ( alarmLed, SIGNAL( toggled ( bool )), this, SLOT( alarmSoundToggled ( bool ))); 427 connect ( alarmLed, SIGNAL( toggled(bool)), this, SLOT( alarmSoundToggled(bool)));
428 428
429 connect ( alarmBox, SIGNAL( toggled ( bool )), this, SLOT( alarmSoundToggled ( bool ))); 429 connect ( alarmBox, SIGNAL( toggled(bool)), this, SLOT( alarmSoundToggled(bool)));
430 connect ( keyBox, SIGNAL( toggled ( bool )), this, SLOT( keyClickToggled ( bool ))); 430 connect ( keyBox, SIGNAL( toggled(bool)), this, SLOT( keyClickToggled(bool)));
431 connect ( tapBox, SIGNAL( toggled ( bool )), this, SLOT( screenTapToggled ( bool ))); 431 connect ( tapBox, SIGNAL( toggled(bool)), this, SLOT( screenTapToggled(bool)));
432 432
433 // initialize variables 433 // initialize variables
434 434
435 readConfig ( true ); 435 readConfig ( true );
436 436
437 // initialize the config file, in case some entries are missing 437 // initialize the config file, in case some entries are missing
438 438
439 writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_None ); 439 writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_None );
440 writeConfigEntry ( "BassPercent", m_vol_percent, UPD_None ); 440 writeConfigEntry ( "BassPercent", m_vol_percent, UPD_None );
441 writeConfigEntry ( "TreblePercent", m_vol_percent, UPD_None ); 441 writeConfigEntry ( "TreblePercent", m_vol_percent, UPD_None );
442 writeConfigEntry ( "Mute", m_vol_muted, UPD_None ); 442 writeConfigEntry ( "Mute", m_vol_muted, UPD_None );
443 writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None ); 443 writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None );
444 writeConfigEntry ( "TouchSound", m_snd_touch, UPD_None ); 444 writeConfigEntry ( "TouchSound", m_snd_touch, UPD_None );
445 writeConfigEntry ( "KeySound", m_snd_key, UPD_None ); 445 writeConfigEntry ( "KeySound", m_snd_key, UPD_None );
446 writeConfigEntry ( "AlarmSound", m_snd_alarm, UPD_Vol ); 446 writeConfigEntry ( "AlarmSound", m_snd_alarm, UPD_Vol );
447 447
448 writeConfigEntry ( "Mic", m_mic_percent, UPD_None ); 448 writeConfigEntry ( "Mic", m_mic_percent, UPD_None );
449 writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic ); 449 writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic );
450} 450}
451 451
452bool VolumeControl::volMuted ( ) const 452bool VolumeControl::volMuted ( ) const
453{ 453{
454 return m_vol_muted; 454 return m_vol_muted;
455} 455}
456 456
457int VolumeControl::volPercent ( ) const 457int VolumeControl::volPercent ( ) const
458{ 458{
459 return m_vol_percent; 459 return m_vol_percent;
460} 460}
461 461
462void VolumeControl::keyPressEvent ( QKeyEvent *e ) 462void VolumeControl::keyPressEvent ( QKeyEvent *e )
463{ 463{
464 switch ( e-> key ( )) { 464 switch ( e-> key ( )) {
465 case Key_Up: 465 case Key_Up:
466 volSlider-> subtractStep ( ); 466 volSlider-> subtractStep ( );
467 break; 467 break;
468 case Key_Down: 468 case Key_Down:
469 volSlider-> addStep ( ); 469 volSlider-> addStep ( );
470 break; 470 break;
471 case Key_Space: 471 case Key_Space:
472 volLed-> toggle ( ); 472 volLed-> toggle ( );
473 break; 473 break;
474 case Key_Escape: 474 case Key_Escape:
475 hide ( ); 475 hide ( );
476 break; 476 break;
477 } 477 }
478} 478}
479 479
@@ -679,98 +679,98 @@ void VolumeControl::trebleMoved ( int percent )
679 writeConfigEntry ( "TreblePercent", m_treble_percent, UPD_Treble ); 679 writeConfigEntry ( "TreblePercent", m_treble_percent, UPD_Treble );
680} 680}
681 681
682 682
683 683
684void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) 684void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd )
685{ 685{
686 Config cfg ( "qpe" ); 686 Config cfg ( "qpe" );
687 cfg. setGroup ( "Volume" ); 687 cfg. setGroup ( "Volume" );
688 cfg. writeEntry ( entry, val ); 688 cfg. writeEntry ( entry, val );
689// cfg. write ( ); 689// cfg. write ( );
690 690
691#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) 691#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
692 switch ( upd ) { 692 switch ( upd ) {
693 case UPD_Vol: { 693 case UPD_Vol: {
694 QCopEnvelope ( "QPE/System", "volumeChange(bool)" ) << m_vol_muted; 694 QCopEnvelope ( "QPE/System", "volumeChange(bool)" ) << m_vol_muted;
695 break; 695 break;
696 } 696 }
697 case UPD_Mic: { 697 case UPD_Mic: {
698 QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted; 698 QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted;
699 break; 699 break;
700 } 700 }
701 case UPD_Bass: { 701 case UPD_Bass: {
702 QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true; 702 QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true;
703 break; 703 break;
704 } 704 }
705 case UPD_Treble: { 705 case UPD_Treble: {
706 QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true; 706 QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true;
707 break; 707 break;
708 } 708 }
709 709
710 case UPD_None: 710 case UPD_None:
711 break; 711 break;
712 } 712 }
713#endif 713#endif
714} 714}
715 715
716//=========================================================================== 716//===========================================================================
717 717
718VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) 718VolumeApplet::VolumeApplet( QWidget *parent, const char *name )
719 : QWidget( parent, name ) 719 : QWidget( parent, name )
720{ 720{
721 setFixedWidth ( AppLnk::smallIconSize() ); 721 setFixedWidth ( AppLnk::smallIconSize() );
722 setFixedHeight ( AppLnk::smallIconSize()+4 ); 722 setFixedHeight ( AppLnk::smallIconSize()+4 );
723 723
724 m_pixmap = new QPixmap ( Resource::loadPixmap ( "volume" )); 724 m_pixmap = new QPixmap ( Resource::loadPixmap ( "volume" ));
725 m_dialog = new VolumeControl ( this, true, this, "volumecontrol" ); 725 m_dialog = new VolumeControl ( this, true, this, "volumecontrol" );
726 726
727 connect ( qApp, SIGNAL( volumeChanged ( bool )), m_dialog, SLOT( volumeChanged( bool ))); 727 connect ( qApp, SIGNAL( volumeChanged(bool)), m_dialog, SLOT( volumeChanged(bool)));
728 connect ( qApp, SIGNAL( micChanged ( bool )), m_dialog, SLOT ( micChanged( bool ))); 728 connect ( qApp, SIGNAL( micChanged(bool)), m_dialog, SLOT ( micChanged(bool)));
729} 729}
730 730
731VolumeApplet::~VolumeApplet() 731VolumeApplet::~VolumeApplet()
732{ 732{
733 delete m_pixmap; 733 delete m_pixmap;
734} 734}
735 735
736int VolumeApplet::position() 736int VolumeApplet::position()
737{ 737{
738 return 6; 738 return 6;
739} 739}
740 740
741void VolumeApplet::mousePressEvent ( QMouseEvent * ) 741void VolumeApplet::mousePressEvent ( QMouseEvent * )
742{ 742{
743 if ( m_dialog-> isVisible ( )) 743 if ( m_dialog-> isVisible ( ))
744 m_dialog-> hide ( ); 744 m_dialog-> hide ( );
745 else 745 else
746 m_dialog-> show ( true ); 746 m_dialog-> show ( true );
747} 747}
748 748
749void VolumeApplet::redraw ( bool all ) 749void VolumeApplet::redraw ( bool all )
750{ 750{
751 if ( all ) 751 if ( all )
752 repaint ( true ); 752 repaint ( true );
753 else 753 else
754 repaint ( 2, height ( ) - 3, width ( ) - 4, 2, false ); 754 repaint ( 2, height ( ) - 3, width ( ) - 4, 2, false );
755} 755}
756 756
757 757
758void VolumeApplet::paintEvent ( QPaintEvent * ) 758void VolumeApplet::paintEvent ( QPaintEvent * )
759{ 759{
760 QPainter p ( this ); 760 QPainter p ( this );
761 761
762 p. drawPixmap ( (width()- m_pixmap->width())/2, QMAX( (height()-4-m_pixmap->height() )/2, 1), *m_pixmap ); 762 p. drawPixmap ( (width()- m_pixmap->width())/2, QMAX( (height()-4-m_pixmap->height() )/2, 1), *m_pixmap );
763 p. setPen ( darkGray ); 763 p. setPen ( darkGray );
764 p. drawRect ( 1, height() - 4, width() - 2, 4 ); 764 p. drawRect ( 1, height() - 4, width() - 2, 4 );
765 765
766 int pixelsWide = m_dialog-> volPercent ( ) * ( width() - 4 ) / 100; 766 int pixelsWide = m_dialog-> volPercent ( ) * ( width() - 4 ) / 100;
767 p. fillRect ( 2, height() - 3, pixelsWide, 2, red ); 767 p. fillRect ( 2, height() - 3, pixelsWide, 2, red );
768 p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); 768 p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray );
769 769
770 if ( m_dialog-> volMuted ( )) { 770 if ( m_dialog-> volMuted ( )) {
771 p. setPen ( red ); 771 p. setPen ( red );
772 p. drawLine ( 1, 2, width() - 2, height() - 5 ); 772 p. drawLine ( 1, 2, width() - 2, height() - 5 );
773 p. drawLine ( 1, 3, width() - 2, height() - 4 ); 773 p. drawLine ( 1, 3, width() - 2, height() - 4 );
774 p. drawLine ( width() - 2, 2, 1, height() - 5 ); 774 p. drawLine ( width() - 2, 2, 1, height() - 5 );
775 p. drawLine ( width() - 2, 3, 1, height() - 4 ); 775 p. drawLine ( width() - 2, 3, 1, height() - 4 );
776 } 776 }
diff --git a/core/apps/embeddedkonsole/commandeditdialog.cpp b/core/apps/embeddedkonsole/commandeditdialog.cpp
index c0066d8..6587b26 100644
--- a/core/apps/embeddedkonsole/commandeditdialog.cpp
+++ b/core/apps/embeddedkonsole/commandeditdialog.cpp
@@ -6,97 +6,97 @@
6#include <qpe/resource.h> 6#include <qpe/resource.h>
7#include <qtoolbutton.h> 7#include <qtoolbutton.h>
8#include <qlineedit.h> 8#include <qlineedit.h>
9#include <qheader.h> 9#include <qheader.h>
10#include <qlabel.h> 10#include <qlabel.h>
11#include "smallcommandeditdialogbase.h" 11#include "smallcommandeditdialogbase.h"
12 12
13CommandEditDialog::CommandEditDialog(QWidget *parent, const char* name, WFlags fl ) 13CommandEditDialog::CommandEditDialog(QWidget *parent, const char* name, WFlags fl )
14 : CommandEditDialogBase(parent, name, TRUE, fl) 14 : CommandEditDialogBase(parent, name, TRUE, fl)
15 15
16{ 16{
17 m_SuggestedCommandList->addColumn( tr("Command Selection") ); 17 m_SuggestedCommandList->addColumn( tr("Command Selection") );
18 m_SuggestedCommandList->header()->hide(); 18 m_SuggestedCommandList->header()->hide();
19 m_SuggestedCommandList->setSorting(-1,FALSE); 19 m_SuggestedCommandList->setSorting(-1,FALSE);
20 m_SuggestedCommandList->clearSelection(); 20 m_SuggestedCommandList->clearSelection();
21 m_SuggestedCommandList->setSorting(0,TRUE); 21 m_SuggestedCommandList->setSorting(0,TRUE);
22 QListViewItem *item; 22 QListViewItem *item;
23 item = new QListViewItem( m_SuggestedCommandList,"export "); 23 item = new QListViewItem( m_SuggestedCommandList,"export ");
24 item = new QListViewItem( m_SuggestedCommandList,"ifconfig "); 24 item = new QListViewItem( m_SuggestedCommandList,"ifconfig ");
25 item = new QListViewItem( m_SuggestedCommandList,"ipkg "); 25 item = new QListViewItem( m_SuggestedCommandList,"ipkg ");
26 item = new QListViewItem( m_SuggestedCommandList,"gzip "); 26 item = new QListViewItem( m_SuggestedCommandList,"gzip ");
27 item = new QListViewItem( m_SuggestedCommandList,"gunzip "); 27 item = new QListViewItem( m_SuggestedCommandList,"gunzip ");
28 item = new QListViewItem( m_SuggestedCommandList,"chgrp "); 28 item = new QListViewItem( m_SuggestedCommandList,"chgrp ");
29 item = new QListViewItem( m_SuggestedCommandList,"chown "); 29 item = new QListViewItem( m_SuggestedCommandList,"chown ");
30 item = new QListViewItem( m_SuggestedCommandList,"date "); 30 item = new QListViewItem( m_SuggestedCommandList,"date ");
31 item = new QListViewItem( m_SuggestedCommandList,"dd "); 31 item = new QListViewItem( m_SuggestedCommandList,"dd ");
32 item = new QListViewItem( m_SuggestedCommandList,"dmesg "); 32 item = new QListViewItem( m_SuggestedCommandList,"dmesg ");
33 item = new QListViewItem( m_SuggestedCommandList,"fuser "); 33 item = new QListViewItem( m_SuggestedCommandList,"fuser ");
34 item = new QListViewItem( m_SuggestedCommandList,"hostname "); 34 item = new QListViewItem( m_SuggestedCommandList,"hostname ");
35 item = new QListViewItem( m_SuggestedCommandList,"kill "); 35 item = new QListViewItem( m_SuggestedCommandList,"kill ");
36 item = new QListViewItem( m_SuggestedCommandList,"killall "); 36 item = new QListViewItem( m_SuggestedCommandList,"killall ");
37 item = new QListViewItem( m_SuggestedCommandList,"ln "); 37 item = new QListViewItem( m_SuggestedCommandList,"ln ");
38 item = new QListViewItem( m_SuggestedCommandList,"ln -s "); 38 item = new QListViewItem( m_SuggestedCommandList,"ln -s ");
39 item = new QListViewItem( m_SuggestedCommandList,"lsmod"); 39 item = new QListViewItem( m_SuggestedCommandList,"lsmod");
40 item = new QListViewItem( m_SuggestedCommandList,"depmod -a"); 40 item = new QListViewItem( m_SuggestedCommandList,"depmod -a");
41 item = new QListViewItem( m_SuggestedCommandList,"modprobe "); 41 item = new QListViewItem( m_SuggestedCommandList,"modprobe ");
42 item = new QListViewItem( m_SuggestedCommandList,"mount "); 42 item = new QListViewItem( m_SuggestedCommandList,"mount ");
43 item = new QListViewItem( m_SuggestedCommandList,"more "); 43 item = new QListViewItem( m_SuggestedCommandList,"more ");
44 item = new QListViewItem( m_SuggestedCommandList,"sort "); 44 item = new QListViewItem( m_SuggestedCommandList,"sort ");
45 item = new QListViewItem( m_SuggestedCommandList,"touch "); 45 item = new QListViewItem( m_SuggestedCommandList,"touch ");
46 item = new QListViewItem( m_SuggestedCommandList,"umount "); 46 item = new QListViewItem( m_SuggestedCommandList,"umount ");
47 item = new QListViewItem( m_SuggestedCommandList,"mknod "); 47 item = new QListViewItem( m_SuggestedCommandList,"mknod ");
48 item = new QListViewItem( m_SuggestedCommandList,"netstat "); 48 item = new QListViewItem( m_SuggestedCommandList,"netstat ");
49 item = new QListViewItem( m_SuggestedCommandList,"route "); 49 item = new QListViewItem( m_SuggestedCommandList,"route ");
50 item = new QListViewItem( m_SuggestedCommandList,"cardctl eject "); 50 item = new QListViewItem( m_SuggestedCommandList,"cardctl eject ");
51 m_SuggestedCommandList->setSelected(m_SuggestedCommandList->firstChild(),TRUE); 51 m_SuggestedCommandList->setSelected(m_SuggestedCommandList->firstChild(),TRUE);
52 m_SuggestedCommandList->sort(); 52 m_SuggestedCommandList->sort();
53 53
54 connect( m_SuggestedCommandList, SIGNAL( clicked( QListViewItem * ) ), m_PlayListSelection, SLOT( addToSelection( QListViewItem *) ) ); 54 connect( m_SuggestedCommandList, SIGNAL( clicked(QListViewItem*) ), m_PlayListSelection, SLOT( addToSelection(QListViewItem*) ) );
55 55
56 56
57 57
58 ToolButton1->setTextLabel("new"); 58 ToolButton1->setTextLabel("new");
59 ToolButton1->setPixmap(Resource::loadPixmap("new")); 59 ToolButton1->setPixmap(Resource::loadPixmap("new"));
60 ToolButton1->setAutoRaise(TRUE); 60 ToolButton1->setAutoRaise(TRUE);
61 ToolButton1->setFocusPolicy(QWidget::NoFocus); 61 ToolButton1->setFocusPolicy(QWidget::NoFocus);
62 connect(ToolButton1,SIGNAL(clicked()),this,SLOT(showAddDialog())); 62 connect(ToolButton1,SIGNAL(clicked()),this,SLOT(showAddDialog()));
63 63
64 ToolButton2->setTextLabel("edit"); 64 ToolButton2->setTextLabel("edit");
65 ToolButton2->setPixmap(Resource::loadPixmap("edit")); 65 ToolButton2->setPixmap(Resource::loadPixmap("edit"));
66 ToolButton2->setAutoRaise(TRUE); 66 ToolButton2->setAutoRaise(TRUE);
67 ToolButton2->setFocusPolicy(QWidget::NoFocus); 67 ToolButton2->setFocusPolicy(QWidget::NoFocus);
68 connect(ToolButton2,SIGNAL(clicked()),this,SLOT(showEditDialog())); 68 connect(ToolButton2,SIGNAL(clicked()),this,SLOT(showEditDialog()));
69 69
70 ToolButton3->setTextLabel("delete"); 70 ToolButton3->setTextLabel("delete");
71 ToolButton3->setPixmap(Resource::loadPixmap("editdelete")); 71 ToolButton3->setPixmap(Resource::loadPixmap("editdelete"));
72 ToolButton3->setAutoRaise(TRUE); 72 ToolButton3->setAutoRaise(TRUE);
73 ToolButton3->setFocusPolicy(QWidget::NoFocus); 73 ToolButton3->setFocusPolicy(QWidget::NoFocus);
74 connect(ToolButton3,SIGNAL(clicked()),m_PlayListSelection,SLOT(removeSelected())); 74 connect(ToolButton3,SIGNAL(clicked()),m_PlayListSelection,SLOT(removeSelected()));
75 75
76 ToolButton4->setTextLabel("up"); 76 ToolButton4->setTextLabel("up");
77 ToolButton4->setPixmap(Resource::loadPixmap("up")); 77 ToolButton4->setPixmap(Resource::loadPixmap("up"));
78 ToolButton4->setAutoRaise(TRUE); 78 ToolButton4->setAutoRaise(TRUE);
79 ToolButton4->setFocusPolicy(QWidget::NoFocus); 79 ToolButton4->setFocusPolicy(QWidget::NoFocus);
80 connect(ToolButton4,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedUp())); 80 connect(ToolButton4,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedUp()));
81 81
82 ToolButton5->setTextLabel("down"); 82 ToolButton5->setTextLabel("down");
83 ToolButton5->setPixmap(Resource::loadPixmap("down")); 83 ToolButton5->setPixmap(Resource::loadPixmap("down"));
84 ToolButton5->setAutoRaise(TRUE); 84 ToolButton5->setAutoRaise(TRUE);
85 ToolButton5->setFocusPolicy(QWidget::NoFocus); 85 ToolButton5->setFocusPolicy(QWidget::NoFocus);
86 86
87connect(ToolButton5,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedDown())); 87connect(ToolButton5,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedDown()));
88 88
89 89
90 90
91 91
92 QListViewItem *current = m_SuggestedCommandList->selectedItem(); 92 QListViewItem *current = m_SuggestedCommandList->selectedItem();
93 if ( current ) 93 if ( current )
94 item->moveItem( current ); 94 item->moveItem( current );
95 m_SuggestedCommandList->setSelected( item, TRUE ); 95 m_SuggestedCommandList->setSelected( item, TRUE );
96 m_SuggestedCommandList->ensureItemVisible( m_SuggestedCommandList->selectedItem() ); 96 m_SuggestedCommandList->ensureItemVisible( m_SuggestedCommandList->selectedItem() );
97 Config cfg( "Konsole" ); 97 Config cfg( "Konsole" );
98 cfg.setGroup("Commands"); 98 cfg.setGroup("Commands");
99 if (cfg.readEntry("Commands Set","FALSE") == "TRUE") { 99 if (cfg.readEntry("Commands Set","FALSE") == "TRUE") {
100 for (int i = 0; i < 100; i++) { 100 for (int i = 0; i < 100; i++) {
101 QString tmp; 101 QString tmp;
102 tmp = cfg.readEntry( QString::number(i),""); 102 tmp = cfg.readEntry( QString::number(i),"");
diff --git a/core/apps/embeddedkonsole/session.cpp b/core/apps/embeddedkonsole/session.cpp
index 043b8db..a94712a 100644
--- a/core/apps/embeddedkonsole/session.cpp
+++ b/core/apps/embeddedkonsole/session.cpp
@@ -6,119 +6,119 @@
6 /* */ 6 /* */
7/* -------------------------------------------------------------------------- */ 7/* -------------------------------------------------------------------------- */
8#include "session.h" 8#include "session.h"
9// #include <kdebug.h> 9// #include <kdebug.h>
10 10
11#include <stdlib.h> 11#include <stdlib.h>
12 12
13#define HERE fprintf(stderr,"%s(%d): here\n",__FILE__,__LINE__) 13#define HERE fprintf(stderr,"%s(%d): here\n",__FILE__,__LINE__)
14 14
15/*! \class TESession 15/*! \class TESession
16 16
17 Sessions are combinations of TEPTy and Emulations. 17 Sessions are combinations of TEPTy and Emulations.
18 18
19 The stuff in here does not belong to the terminal emulation framework, 19 The stuff in here does not belong to the terminal emulation framework,
20 but to main.C. It serves it's duty by providing a single reference 20 but to main.C. It serves it's duty by providing a single reference
21 to TEPTy/Emulation pairs. In fact, it is only there to demonstrate one 21 to TEPTy/Emulation pairs. In fact, it is only there to demonstrate one
22 of the abilities of the framework - multible sessions. 22 of the abilities of the framework - multible sessions.
23*/ 23*/
24 24
25TESession::TESession(QMainWindow* main, TEWidget* _te, const char* _pgm, QStrList & _args, const char *_term) : schema_no(0), font_no(3), pgm(_pgm), args(_args) 25TESession::TESession(QMainWindow* main, TEWidget* _te, const char* _pgm, QStrList & _args, const char *_term) : schema_no(0), font_no(3), pgm(_pgm), args(_args)
26{ 26{
27 te = _te; 27 te = _te;
28 term = _term; 28 term = _term;
29 29
30 // sh = new TEPty(); 30 // sh = new TEPty();
31 sh = new MyPty(); 31 sh = new MyPty();
32 em = new TEmuVt102(te); 32 em = new TEmuVt102(te);
33 33
34 sh->setSize(te->Lines(),te->Columns()); // not absolutely nessesary 34 sh->setSize(te->Lines(),te->Columns()); // not absolutely nessesary
35 QObject::connect( sh,SIGNAL(block_in(const char*,int)), 35 QObject::connect( sh,SIGNAL(block_in(const char*,int)),
36 em,SLOT(onRcvBlock(const char*,int)) ); 36 em,SLOT(onRcvBlock(const char*,int)) );
37 QObject::connect( em,SIGNAL(ImageSizeChanged(int,int)), 37 QObject::connect( em,SIGNAL(ImageSizeChanged(int,int)),
38 sh,SLOT(setSize(int,int))); 38 sh,SLOT(setSize(int,int)));
39 39
40 // 'main' should do those connects itself, somehow. 40 // 'main' should do those connects itself, somehow.
41 // These aren't KTMW's slots, but konsole's.(David) 41 // These aren't KTMW's slots, but konsole's.(David)
42 42
43/* 43/*
44 QObject::connect( em,SIGNAL(ImageSizeChanged(int,int)), 44 QObject::connect( em,SIGNAL(ImageSizeChanged(int,int)),
45 main,SLOT(notifySize(int,int))); 45 main,SLOT(notifySize(int,int)));
46*/ 46*/
47 QObject::connect( em,SIGNAL(sndBlock(const char*,int)), 47 QObject::connect( em,SIGNAL(sndBlock(const char*,int)),
48 sh,SLOT(send_bytes(const char*,int)) ); 48 sh,SLOT(send_bytes(const char*,int)) );
49 QObject::connect( em,SIGNAL(changeColumns(int)), 49 QObject::connect( em,SIGNAL(changeColumns(int)),
50 main,SLOT(changeColumns(int)) ); 50 main,SLOT(changeColumns(int)) );
51 51
52 52
53 53
54 QObject::connect( em,SIGNAL(changeTitle(int, const QString&)), 54 QObject::connect( em,SIGNAL(changeTitle(int,const QString&)),
55 this,SLOT(changeTitle(int, const QString&)) ); 55 this,SLOT(changeTitle(int,const QString&)) );
56 56
57 QObject::connect( sh,SIGNAL(done(int)), this,SLOT(done(int)) ); 57 QObject::connect( sh,SIGNAL(done(int)), this,SLOT(done(int)) );
58} 58}
59 59
60 60
61 61
62void TESession::run() 62void TESession::run()
63{ 63{
64 //kdDebug() << "Running the session!" << pgm << "\n"; 64 //kdDebug() << "Running the session!" << pgm << "\n";
65 sh->run(pgm,args,term.data(),FALSE); 65 sh->run(pgm,args,term.data(),FALSE);
66} 66}
67 67
68void TESession::kill(int ) // signal) 68void TESession::kill(int ) // signal)
69{ 69{
70// sh->kill(signal); 70// sh->kill(signal);
71} 71}
72 72
73TESession::~TESession() 73TESession::~TESession()
74{ 74{
75 QObject::disconnect( sh, SIGNAL( done( int ) ), 75 QObject::disconnect( sh, SIGNAL( done(int) ),
76 this, SLOT( done( int ) ) ); 76 this, SLOT( done(int) ) );
77 delete em; 77 delete em;
78 delete sh; 78 delete sh;
79} 79}
80 80
81void TESession::setConnect(bool c) 81void TESession::setConnect(bool c)
82{ 82{
83 em->setConnect(c); 83 em->setConnect(c);
84} 84}
85 85
86void TESession::done(int status) 86void TESession::done(int status)
87{ 87{
88 emit done(te,status); 88 emit done(te,status);
89} 89}
90 90
91void TESession::terminate() 91void TESession::terminate()
92{ 92{
93 delete this; 93 delete this;
94} 94}
95 95
96TEmulation* TESession::getEmulation() 96TEmulation* TESession::getEmulation()
97{ 97{
98 return em; 98 return em;
99} 99}
100 100
101// following interfaces might be misplaced /// 101// following interfaces might be misplaced ///
102 102
103int TESession::schemaNo() 103int TESession::schemaNo()
104{ 104{
105 return schema_no; 105 return schema_no;
106} 106}
107 107
108int TESession::keymap() 108int TESession::keymap()
109{ 109{
110 return keymap_no; 110 return keymap_no;
111} 111}
112 112
113int TESession::fontNo() 113int TESession::fontNo()
114{ 114{
115 return font_no; 115 return font_no;
116} 116}
117 117
118const char* TESession::emuName() 118const char* TESession::emuName()
119{ 119{
120 return term.data(); 120 return term.data();
121} 121}
122 122
123void TESession::setSchemaNo(int sn) 123void TESession::setSchemaNo(int sn)
124{ 124{
diff --git a/core/apps/helpbrowser/helpbrowser.cpp b/core/apps/helpbrowser/helpbrowser.cpp
index 8fb0161..336d9fb 100644
--- a/core/apps/helpbrowser/helpbrowser.cpp
+++ b/core/apps/helpbrowser/helpbrowser.cpp
@@ -25,139 +25,139 @@
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27 27
28#include <qmenubar.h> 28#include <qmenubar.h>
29#include <qtoolbar.h> 29#include <qtoolbar.h>
30#include <qpe/qcopenvelope_qws.h> 30#include <qpe/qcopenvelope_qws.h>
31#include <qfileinfo.h> 31#include <qfileinfo.h>
32#include <qaction.h> 32#include <qaction.h>
33 33
34#include <cctype> 34#include <cctype>
35 35
36#include "magictextbrowser.h" 36#include "magictextbrowser.h"
37 37
38HelpBrowser::HelpBrowser( QWidget* parent, const char *name, WFlags f ) 38HelpBrowser::HelpBrowser( QWidget* parent, const char *name, WFlags f )
39 : QMainWindow( parent, name, f ), 39 : QMainWindow( parent, name, f ),
40 selectedURL() 40 selectedURL()
41{ 41{
42 init( "index.html" ); 42 init( "index.html" );
43} 43}
44 44
45 45
46 46
47void HelpBrowser::init( const QString& _home ) 47void HelpBrowser::init( const QString& _home )
48{ 48{
49 setIcon( Resource::loadPixmap( "HelpBrowser" ) ); 49 setIcon( Resource::loadPixmap( "HelpBrowser" ) );
50 setBackgroundMode( PaletteButton ); 50 setBackgroundMode( PaletteButton );
51 51
52 browser = new MagicTextBrowser( this ); 52 browser = new MagicTextBrowser( this );
53 browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 53 browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );
54 connect( browser, SIGNAL( textChanged() ), 54 connect( browser, SIGNAL( textChanged() ),
55 this, SLOT( textChanged() ) ); 55 this, SLOT( textChanged() ) );
56 56
57 setCentralWidget( browser ); 57 setCentralWidget( browser );
58 setToolBarsMovable( FALSE ); 58 setToolBarsMovable( FALSE );
59 59
60 if ( !_home.isEmpty() ) 60 if ( !_home.isEmpty() )
61 browser->setSource( _home ); 61 browser->setSource( _home );
62 62
63 QToolBar* toolbar = new QToolBar( this ); 63 QToolBar* toolbar = new QToolBar( this );
64 toolbar->setHorizontalStretchable( TRUE ); 64 toolbar->setHorizontalStretchable( TRUE );
65 QMenuBar *menu = new QMenuBar( toolbar ); 65 QMenuBar *menu = new QMenuBar( toolbar );
66 66
67 toolbar = new QToolBar( this ); 67 toolbar = new QToolBar( this );
68 // addToolBar( toolbar, "Toolbar"); 68 // addToolBar( toolbar, "Toolbar");
69 69
70 QPopupMenu* go = new QPopupMenu( this ); 70 QPopupMenu* go = new QPopupMenu( this );
71 backAction = new QAction( tr( "Backward" ), Resource::loadIconSet( "back" ), QString::null, 0, this, 0 ); 71 backAction = new QAction( tr( "Backward" ), Resource::loadIconSet( "back" ), QString::null, 0, this, 0 );
72 connect( backAction, SIGNAL( activated() ), browser, SLOT( backward() ) ); 72 connect( backAction, SIGNAL( activated() ), browser, SLOT( backward() ) );
73 connect( browser, SIGNAL( backwardAvailable( bool ) ), 73 connect( browser, SIGNAL( backwardAvailable(bool) ),
74 backAction, SLOT( setEnabled( bool ) ) ); 74 backAction, SLOT( setEnabled(bool) ) );
75 backAction->addTo( go ); 75 backAction->addTo( go );
76 backAction->addTo( toolbar ); 76 backAction->addTo( toolbar );
77 backAction->setEnabled( FALSE ); 77 backAction->setEnabled( FALSE );
78 78
79 forwardAction = new QAction( tr( "Forward" ), Resource::loadIconSet( "forward" ), QString::null, 0, this, 0 ); 79 forwardAction = new QAction( tr( "Forward" ), Resource::loadIconSet( "forward" ), QString::null, 0, this, 0 );
80 connect( forwardAction, SIGNAL( activated() ), browser, SLOT( forward() ) ); 80 connect( forwardAction, SIGNAL( activated() ), browser, SLOT( forward() ) );
81 connect( browser, SIGNAL( forwardAvailable( bool ) ), 81 connect( browser, SIGNAL( forwardAvailable(bool) ),
82 forwardAction, SLOT( setEnabled( bool ) ) ); 82 forwardAction, SLOT( setEnabled(bool) ) );
83 forwardAction->addTo( go ); 83 forwardAction->addTo( go );
84 forwardAction->addTo( toolbar ); 84 forwardAction->addTo( toolbar );
85 forwardAction->setEnabled( FALSE ); 85 forwardAction->setEnabled( FALSE );
86 86
87 QAction *a = new QAction( tr( "Home" ), Resource::loadIconSet( "home" ), QString::null, 0, this, 0 ); 87 QAction *a = new QAction( tr( "Home" ), Resource::loadIconSet( "home" ), QString::null, 0, this, 0 );
88 connect( a, SIGNAL( activated() ), browser, SLOT( home() ) ); 88 connect( a, SIGNAL( activated() ), browser, SLOT( home() ) );
89 a->addTo( go ); 89 a->addTo( go );
90 a->addTo( toolbar ); 90 a->addTo( toolbar );
91 91
92 bookm = new QPopupMenu( this ); 92 bookm = new QPopupMenu( this );
93 bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); 93 bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) );
94 bookm->insertItem( tr( "Remove from Bookmarks" ), this, SLOT( removeBookmark() ) ); 94 bookm->insertItem( tr( "Remove from Bookmarks" ), this, SLOT( removeBookmark() ) );
95 bookm->insertSeparator(); 95 bookm->insertSeparator();
96 connect( bookm, SIGNAL( activated( int ) ), 96 connect( bookm, SIGNAL( activated(int) ),
97 this, SLOT( bookmChosen( int ) ) ); 97 this, SLOT( bookmChosen(int) ) );
98 98
99 readBookmarks(); 99 readBookmarks();
100 100
101 menu->insertItem( tr("Go"), go ); 101 menu->insertItem( tr("Go"), go );
102 menu->insertItem( tr( "Bookmarks" ), bookm ); 102 menu->insertItem( tr( "Bookmarks" ), bookm );
103 103
104 resize( 240, 300 ); 104 resize( 240, 300 );
105 browser->setFocus(); 105 browser->setFocus();
106 browser->setFrameStyle( QFrame::NoFrame ); 106 browser->setFrameStyle( QFrame::NoFrame );
107 107
108#if !defined(QT_NO_COP) 108#if !defined(QT_NO_COP)
109 QCopChannel *addressChannel = new QCopChannel("QPE/HelpBrowser" , this ); 109 QCopChannel *addressChannel = new QCopChannel("QPE/HelpBrowser" , this );
110 connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), 110 connect (addressChannel, SIGNAL( received(const QCString&,const QByteArray&)),
111 this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); 111 this, SLOT ( appMessage(const QCString&,const QByteArray&) ) );
112#endif 112#endif
113 113
114 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), 114 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)),
115 this, SLOT(appMessage(const QCString&, const QByteArray&)) ); 115 this, SLOT(appMessage(const QCString&,const QByteArray&)) );
116} 116}
117 117
118void HelpBrowser::appMessage(const QCString& msg, const QByteArray& data) 118void HelpBrowser::appMessage(const QCString& msg, const QByteArray& data)
119{ 119{
120 qDebug("reached appMessage"); 120 qDebug("reached appMessage");
121 if ( msg == "showFile(QString)" ) { 121 if ( msg == "showFile(QString)" ) {
122 QDataStream ds(data,IO_ReadOnly); 122 QDataStream ds(data,IO_ReadOnly);
123 QString fn; 123 QString fn;
124 ds >> fn; 124 ds >> fn;
125 setDocument( fn ); 125 setDocument( fn );
126 126
127 QPEApplication::setKeepRunning(); 127 QPEApplication::setKeepRunning();
128 128
129 showMaximized(); 129 showMaximized();
130 setActiveWindow(); 130 setActiveWindow();
131 raise(); 131 raise();
132 } 132 }
133} 133}
134 134
135void HelpBrowser::setDocument( const QString &doc ) 135void HelpBrowser::setDocument( const QString &doc )
136{ 136{
137 if ( !doc.isEmpty() ) 137 if ( !doc.isEmpty() )
138 browser->setSource( doc ); 138 browser->setSource( doc );
139 raise(); 139 raise();
140} 140}
141 141
142 142
143void HelpBrowser::textChanged() 143void HelpBrowser::textChanged()
144{ 144{
145 if ( browser->documentTitle().isNull() ) 145 if ( browser->documentTitle().isNull() )
146 setCaption( tr("Help Browser") ); 146 setCaption( tr("Help Browser") );
147 else 147 else
148 setCaption( browser->documentTitle() ) ; 148 setCaption( browser->documentTitle() ) ;
149 149
150 selectedURL = caption(); 150 selectedURL = caption();
151} 151}
152 152
153HelpBrowser::~HelpBrowser() 153HelpBrowser::~HelpBrowser()
154{ 154{
155 QStringList bookmarks; 155 QStringList bookmarks;
156 QMap<int, Bookmark>::Iterator it2 = mBookmarks.begin(); 156 QMap<int, Bookmark>::Iterator it2 = mBookmarks.begin();
157 for ( ; it2 != mBookmarks.end(); ++it2 ) 157 for ( ; it2 != mBookmarks.end(); ++it2 )
158 bookmarks.append( (*it2).name + "=" + (*it2).file ); 158 bookmarks.append( (*it2).name + "=" + (*it2).file );
159 159
160 QFile f2( Global::applicationFileName("helpbrowser", "bookmarks") ); 160 QFile f2( Global::applicationFileName("helpbrowser", "bookmarks") );
161 if ( f2.open( IO_WriteOnly ) ) { 161 if ( f2.open( IO_WriteOnly ) ) {
162 QDataStream s2( &f2 ); 162 QDataStream s2( &f2 );
163 s2 << bookmarks; 163 s2 << bookmarks;
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 55725cc..b54da34 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -118,98 +118,98 @@ void QpeEditor::find ( const QString &txt, bool caseSensitive,
118 } else { 118 } else {
119 getCursorPosition( &line, &col ); 119 getCursorPosition( &line, &col );
120 } 120 }
121 //ignore backwards for now.... 121 //ignore backwards for now....
122 if ( !backwards ) { 122 if ( !backwards ) {
123 for ( ; ; ) { 123 for ( ; ; ) {
124 if ( line >= numLines() ) { 124 if ( line >= numLines() ) {
125 wrap = true; 125 wrap = true;
126 //emit notFound(); 126 //emit notFound();
127 break; 127 break;
128 } 128 }
129 int findCol = getString( line )->find( txt, col, caseSensitive ); 129 int findCol = getString( line )->find( txt, col, caseSensitive );
130 if ( findCol >= 0 ) { 130 if ( findCol >= 0 ) {
131 setCursorPosition( line, findCol, false ); 131 setCursorPosition( line, findCol, false );
132 col = findCol + txt.length(); 132 col = findCol + txt.length();
133 setCursorPosition( line, col, true ); 133 setCursorPosition( line, col, true );
134 134
135 //found = true; 135 //found = true;
136 break; 136 break;
137 } 137 }
138 line++; 138 line++;
139 col = 0; 139 col = 0;
140 } 140 }
141 } 141 }
142} 142}
143 143
144 144
145#else 145#else
146 146
147#error "Must make a QpeEditor that inherits QTextEdit" 147#error "Must make a QpeEditor that inherits QTextEdit"
148 148
149#endif 149#endif
150 150
151 151
152static const int nfontsizes = 6; 152static const int nfontsizes = 6;
153static const int fontsize[nfontsizes] = {8,10,12,14,18,24}; 153static const int fontsize[nfontsizes] = {8,10,12,14,18,24};
154 154
155TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) 155TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
156 : QMainWindow( parent, name, f ), bFromDocView( false ) 156 : QMainWindow( parent, name, f ), bFromDocView( false )
157{ 157{
158 doc = 0; 158 doc = 0;
159 edited=false; 159 edited=false;
160 fromSetDocument=false; 160 fromSetDocument=false;
161 161
162 setToolBarsMovable( false ); 162 setToolBarsMovable( false );
163 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 163 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
164 164
165 channel = new QCopChannel( "QPE/Application/textedit", this ); 165 channel = new QCopChannel( "QPE/Application/textedit", this );
166 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 166 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
167 this, SLOT(receive(const QCString&, const QByteArray&)) ); 167 this, SLOT(receive(const QCString&,const QByteArray&)) );
168 168
169 setIcon( Resource::loadPixmap( "TextEditor" ) ); 169 setIcon( Resource::loadPixmap( "TextEditor" ) );
170 170
171 QToolBar *bar = new QToolBar( this ); 171 QToolBar *bar = new QToolBar( this );
172 bar->setHorizontalStretchable( true ); 172 bar->setHorizontalStretchable( true );
173 menu = bar; 173 menu = bar;
174 174
175 QMenuBar *mb = new QMenuBar( bar ); 175 QMenuBar *mb = new QMenuBar( bar );
176 QPopupMenu *file = new QPopupMenu( this ); 176 QPopupMenu *file = new QPopupMenu( this );
177 QPopupMenu *edit = new QPopupMenu( this ); 177 QPopupMenu *edit = new QPopupMenu( this );
178 QPopupMenu *advancedMenu = new QPopupMenu(this); 178 QPopupMenu *advancedMenu = new QPopupMenu(this);
179 179
180 font = new QPopupMenu( this ); 180 font = new QPopupMenu( this );
181 181
182 bar = new QToolBar( this ); 182 bar = new QToolBar( this );
183 editBar = bar; 183 editBar = bar;
184 184
185 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), 185 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ),
186 QString::null, 0, this, 0 ); 186 QString::null, 0, this, 0 );
187 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 187 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
188// a->addTo( bar ); 188// a->addTo( bar );
189 a->addTo( file ); 189 a->addTo( file );
190 190
191 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), 191 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ),
192 QString::null, 0, this, 0 ); 192 QString::null, 0, this, 0 );
193 connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); 193 connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
194 a->addTo( bar ); 194 a->addTo( bar );
195 a->addTo( file ); 195 a->addTo( file );
196 196
197 a = new QAction( tr( "Save" ), Resource::loadPixmap("save") , 197 a = new QAction( tr( "Save" ), Resource::loadPixmap("save") ,
198 QString::null, 0, this, 0 ); 198 QString::null, 0, this, 0 );
199 connect( a, SIGNAL( activated() ), this, SLOT( save() ) ); 199 connect( a, SIGNAL( activated() ), this, SLOT( save() ) );
200 file->insertSeparator(); 200 file->insertSeparator();
201 a->addTo( bar ); 201 a->addTo( bar );
202 a->addTo( file ); 202 a->addTo( file );
203 203
204 a = new QAction( tr( "Save As" ), Resource::loadPixmap("save") , 204 a = new QAction( tr( "Save As" ), Resource::loadPixmap("save") ,
205 QString::null, 0, this, 0 ); 205 QString::null, 0, this, 0 );
206 connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) ); 206 connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) );
207 a->addTo( file ); 207 a->addTo( file );
208 208
209 a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), 209 a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ),
210 QString::null, 0, this, 0 ); 210 QString::null, 0, this, 0 );
211 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); 211 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
212 a->addTo( editBar ); 212 a->addTo( editBar );
213 a->addTo( edit ); 213 a->addTo( edit );
214 214
215 a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), 215 a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ),
@@ -280,97 +280,97 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
280 this, SLOT( doPrompt(bool) ) ); 280 this, SLOT( doPrompt(bool) ) );
281 nAdvanced->setToggleAction(true); 281 nAdvanced->setToggleAction(true);
282 nAdvanced->addTo( advancedMenu ); 282 nAdvanced->addTo( advancedMenu );
283 283
284 desktopAction = new QAction( tr("Always open linked file"), 284 desktopAction = new QAction( tr("Always open linked file"),
285 QString::null, 0, this, 0 ); 285 QString::null, 0, this, 0 );
286 connect( desktopAction, SIGNAL( toggled(bool) ), 286 connect( desktopAction, SIGNAL( toggled(bool) ),
287 this, SLOT( doDesktop(bool) ) ); 287 this, SLOT( doDesktop(bool) ) );
288 desktopAction->setToggleAction(true); 288 desktopAction->setToggleAction(true);
289 desktopAction->addTo( advancedMenu); 289 desktopAction->addTo( advancedMenu);
290 290
291 filePermAction = new QAction( tr("File Permissions"), 291 filePermAction = new QAction( tr("File Permissions"),
292 QString::null, 0, this, 0 ); 292 QString::null, 0, this, 0 );
293 connect( filePermAction, SIGNAL( toggled(bool) ), 293 connect( filePermAction, SIGNAL( toggled(bool) ),
294 this, SLOT( doFilePerms(bool) ) ); 294 this, SLOT( doFilePerms(bool) ) );
295 filePermAction->setToggleAction(true); 295 filePermAction->setToggleAction(true);
296 filePermAction->addTo( advancedMenu); 296 filePermAction->addTo( advancedMenu);
297 297
298 searchBarAction = new QAction( tr("Search Bar Open"), 298 searchBarAction = new QAction( tr("Search Bar Open"),
299 QString::null, 0, this, 0 ); 299 QString::null, 0, this, 0 );
300 connect( searchBarAction, SIGNAL( toggled(bool) ), 300 connect( searchBarAction, SIGNAL( toggled(bool) ),
301 this, SLOT( setSearchBar(bool) ) ); 301 this, SLOT( setSearchBar(bool) ) );
302 searchBarAction->setToggleAction(true); 302 searchBarAction->setToggleAction(true);
303 searchBarAction->addTo( advancedMenu); 303 searchBarAction->addTo( advancedMenu);
304 304
305 nAutoSave = new QAction( tr("Auto Save 5 min."), 305 nAutoSave = new QAction( tr("Auto Save 5 min."),
306 QString::null, 0, this, 0 ); 306 QString::null, 0, this, 0 );
307 connect( nAutoSave, SIGNAL( toggled(bool) ), 307 connect( nAutoSave, SIGNAL( toggled(bool) ),
308 this, SLOT( doTimer(bool) ) ); 308 this, SLOT( doTimer(bool) ) );
309 nAutoSave->setToggleAction(true); 309 nAutoSave->setToggleAction(true);
310 nAutoSave->addTo( advancedMenu); 310 nAutoSave->addTo( advancedMenu);
311 311
312 312
313 //font->insertSeparator(); 313 //font->insertSeparator();
314 314
315 //font->insertItem(tr("About"), this, SLOT( doAbout()) ); 315 //font->insertItem(tr("About"), this, SLOT( doAbout()) );
316 316
317 mb->insertItem( tr( "File" ), file ); 317 mb->insertItem( tr( "File" ), file );
318 mb->insertItem( tr( "Edit" ), edit ); 318 mb->insertItem( tr( "Edit" ), edit );
319 mb->insertItem( tr( "View" ), font ); 319 mb->insertItem( tr( "View" ), font );
320 320
321 searchBar = new QToolBar(this); 321 searchBar = new QToolBar(this);
322 addToolBar( searchBar, "Search", QMainWindow::Top, true ); 322 addToolBar( searchBar, "Search", QMainWindow::Top, true );
323 323
324 searchBar->setHorizontalStretchable( true ); 324 searchBar->setHorizontalStretchable( true );
325 325
326 searchEdit = new QLineEdit( searchBar, "searchEdit" ); 326 searchEdit = new QLineEdit( searchBar, "searchEdit" );
327 searchBar->setStretchableWidget( searchEdit ); 327 searchBar->setStretchableWidget( searchEdit );
328 connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 328 connect( searchEdit, SIGNAL( textChanged(const QString&) ),
329 this, SLOT( search() ) ); 329 this, SLOT( search() ) );
330 330
331 a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), 331 a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ),
332 QString::null, 0, this, 0 ); 332 QString::null, 0, this, 0 );
333 connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); 333 connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) );
334 a->addTo( searchBar ); 334 a->addTo( searchBar );
335 a->addTo( edit ); 335 a->addTo( edit );
336 336
337 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), 337 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ),
338 QString::null, 0, this, 0 ); 338 QString::null, 0, this, 0 );
339 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 339 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
340 a->addTo( searchBar ); 340 a->addTo( searchBar );
341 341
342 edit->insertSeparator(); 342 edit->insertSeparator();
343 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), 343 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ),
344 QString::null, 0, this, 0 ); 344 QString::null, 0, this, 0 );
345 connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) ); 345 connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) );
346 a->addTo( edit ); 346 a->addTo( edit );
347 347
348 searchBar->hide(); 348 searchBar->hide();
349 349
350 editor = new QpeEditor( this ); 350 editor = new QpeEditor( this );
351 setCentralWidget( editor ); 351 setCentralWidget( editor );
352 editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 352 editor->setFrameStyle( QFrame::Panel | QFrame::Sunken );
353 connect( editor, SIGNAL( textChanged() ), 353 connect( editor, SIGNAL( textChanged() ),
354 this, SLOT( editorChanged() ) ); 354 this, SLOT( editorChanged() ) );
355 355
356 QPEApplication::setStylusOperation( editor, QPEApplication::RightOnHold); 356 QPEApplication::setStylusOperation( editor, QPEApplication::RightOnHold);
357 357
358 Config cfg("TextEdit"); 358 Config cfg("TextEdit");
359 cfg. setGroup ( "Font" ); 359 cfg. setGroup ( "Font" );
360 360
361 QFont defaultFont = editor-> font ( ); 361 QFont defaultFont = editor-> font ( );
362 362
363 QString family = cfg. readEntry ( "Family", defaultFont. family ( )); 363 QString family = cfg. readEntry ( "Family", defaultFont. family ( ));
364 int size = cfg. readNumEntry ( "Size", defaultFont. pointSize ( )); 364 int size = cfg. readNumEntry ( "Size", defaultFont. pointSize ( ));
365 int weight = cfg. readNumEntry ( "Weight", defaultFont. weight ( )); 365 int weight = cfg. readNumEntry ( "Weight", defaultFont. weight ( ));
366 bool italic = cfg. readBoolEntry ( "Italic", defaultFont. italic ( )); 366 bool italic = cfg. readBoolEntry ( "Italic", defaultFont. italic ( ));
367 367
368 defaultFont = QFont ( family, size, weight, italic ); 368 defaultFont = QFont ( family, size, weight, italic );
369 editor-> setFont ( defaultFont ); 369 editor-> setFont ( defaultFont );
370// updateCaption(); 370// updateCaption();
371 371
372 cfg.setGroup ( "View" ); 372 cfg.setGroup ( "View" );
373 373
374 promptExit = cfg.readBoolEntry ( "PromptExit", false ); 374 promptExit = cfg.readBoolEntry ( "PromptExit", false );
375 openDesktop = cfg.readBoolEntry ( "OpenDesktop", true ); 375 openDesktop = cfg.readBoolEntry ( "OpenDesktop", true );
376 filePerms = cfg.readBoolEntry ( "FilePermissions", false ); 376 filePerms = cfg.readBoolEntry ( "FilePermissions", false );
@@ -538,98 +538,98 @@ void TextEdit::setSearchBar(bool b) {
538 cfg.setGroup("View"); 538 cfg.setGroup("View");
539 cfg.writeEntry ( "SearchBar", b ); 539 cfg.writeEntry ( "SearchBar", b );
540 searchBarAction->setOn(b); 540 searchBarAction->setOn(b);
541 if(b) 541 if(b)
542 searchBar->show(); 542 searchBar->show();
543 else 543 else
544 searchBar->hide(); 544 searchBar->hide();
545 editor->setFocus(); 545 editor->setFocus();
546} 546}
547 547
548void TextEdit::fileNew() { 548void TextEdit::fileNew() {
549// if( !bFromDocView ) { 549// if( !bFromDocView ) {
550// saveAs(); 550// saveAs();
551// } 551// }
552 newFile(DocLnk()); 552 newFile(DocLnk());
553} 553}
554 554
555void TextEdit::fileOpen() { 555void TextEdit::fileOpen() {
556 Config cfg("TextEdit"); 556 Config cfg("TextEdit");
557 cfg. setGroup ( "View" ); 557 cfg. setGroup ( "View" );
558 QMap<QString, QStringList> map; 558 QMap<QString, QStringList> map;
559 map.insert(tr("All"), QStringList() ); 559 map.insert(tr("All"), QStringList() );
560 QStringList text; 560 QStringList text;
561 text << "text/*"; 561 text << "text/*";
562 map.insert(tr("Text"), text ); 562 map.insert(tr("Text"), text );
563 text << "*"; 563 text << "*";
564 map.insert(tr("All"), text ); 564 map.insert(tr("All"), text );
565 QString str = OFileDialog::getOpenFileName( 2, 565 QString str = OFileDialog::getOpenFileName( 2,
566 QString::null , 566 QString::null ,
567 QString::null, map); 567 QString::null, map);
568 if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) 568 if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() )
569 { 569 {
570 openFile( str ); 570 openFile( str );
571 } 571 }
572 else 572 else
573 updateCaption(); 573 updateCaption();
574} 574}
575 575
576void TextEdit::doSearchBar() { 576void TextEdit::doSearchBar() {
577 if(!useSearchBar) 577 if(!useSearchBar)
578 searchBar->hide(); 578 searchBar->hide();
579 else 579 else
580 searchBar->show(); 580 searchBar->show();
581} 581}
582 582
583#if 0 583#if 0
584void TextEdit::slotFind() { 584void TextEdit::slotFind() {
585 FindDialog frmFind( tr("Text Editor"), this ); 585 FindDialog frmFind( tr("Text Editor"), this );
586 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), 586 connect( &frmFind, SIGNAL(signalFindClicked(const QString&,bool,bool,int)),
587 editor, SLOT(slotDoFind( const QString&,bool,bool))); 587 editor, SLOT(slotDoFind(const QString&,bool,bool)));
588 588
589 //case sensitive, backwards, [category] 589 //case sensitive, backwards, [category]
590 590
591 connect( editor, SIGNAL(notFound()), 591 connect( editor, SIGNAL(notFound()),
592 &frmFind, SLOT(slotNotFound()) ); 592 &frmFind, SLOT(slotNotFound()) );
593 connect( editor, SIGNAL(searchWrapped()), 593 connect( editor, SIGNAL(searchWrapped()),
594 &frmFind, SLOT(slotWrapAround()) ); 594 &frmFind, SLOT(slotWrapAround()) );
595 595
596 frmFind.exec(); 596 frmFind.exec();
597 597
598 598
599} 599}
600#endif 600#endif
601 601
602void TextEdit::fileRevert() { 602void TextEdit::fileRevert() {
603 clear(); 603 clear();
604 fileOpen(); 604 fileOpen();
605} 605}
606 606
607void TextEdit::editCut() { 607void TextEdit::editCut() {
608#ifndef QT_NO_CLIPBOARD 608#ifndef QT_NO_CLIPBOARD
609 editor->cut(); 609 editor->cut();
610#endif 610#endif
611} 611}
612 612
613void TextEdit::editCopy() { 613void TextEdit::editCopy() {
614#ifndef QT_NO_CLIPBOARD 614#ifndef QT_NO_CLIPBOARD
615 editor->copy(); 615 editor->copy();
616#endif 616#endif
617} 617}
618 618
619void TextEdit::editPaste() { 619void TextEdit::editPaste() {
620#ifndef QT_NO_CLIPBOARD 620#ifndef QT_NO_CLIPBOARD
621 editor->paste(); 621 editor->paste();
622#endif 622#endif
623} 623}
624 624
625void TextEdit::editFind() { 625void TextEdit::editFind() {
626 searchBar->show(); 626 searchBar->show();
627 searchEdit->setFocus(); 627 searchEdit->setFocus();
628} 628}
629 629
630void TextEdit::findNext() { 630void TextEdit::findNext() {
631 editor->find( searchEdit->text(), false, false ); 631 editor->find( searchEdit->text(), false, false );
632 632
633} 633}
634 634
635void TextEdit::findClose() { 635void TextEdit::findClose() {
diff --git a/core/launcher/appicons.cpp b/core/launcher/appicons.cpp
index c51ee5a..4d48b24 100644
--- a/core/launcher/appicons.cpp
+++ b/core/launcher/appicons.cpp
@@ -1,119 +1,121 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of 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 21
22#include "appicons.h" 22#include "appicons.h"
23 23
24#include <qpe/qcopenvelope_qws.h> 24#ifdef QWS
25#include <qtopia/qcopenvelope_qws.h>
26#endif
25 27
26#include <qtooltip.h> 28#include <qtooltip.h>
27#include <qpixmap.h> 29#include <qpixmap.h>
28 30
29 31
30AppIcons::AppIcons( QWidget *parent ) : 32AppIcons::AppIcons( QWidget *parent ) :
31 QHBox(parent) 33 QHBox(parent)
32{ 34{
33 buttons.setAutoDelete(TRUE); 35 buttons.setAutoDelete(TRUE);
34 36
35#ifndef QT_NO_COP 37#ifndef QT_NO_COP
36 QCopChannel* channel = new QCopChannel("Qt/Tray", this); 38 QCopChannel* channel = new QCopChannel("Qt/Tray", this);
37 connect(channel, SIGNAL(received(const QCString&, const QByteArray&)), 39 connect(channel, SIGNAL(received(const QCString&,const QByteArray&)),
38 this, SLOT(receive(const QCString&, const QByteArray&))); 40 this, SLOT(receive(const QCString&,const QByteArray&)));
39#endif 41#endif
40} 42}
41 43
42void AppIcons::setIcon(int id, const QPixmap& pm) 44void AppIcons::setIcon(int id, const QPixmap& pm)
43{ 45{
44 button(id)->setPixmap(pm); 46 button(id)->setPixmap(pm);
45} 47}
46 48
47class FlatButton : public QLabel { 49class FlatButton : public QLabel {
48 Q_OBJECT 50 Q_OBJECT
49public: 51public:
50 FlatButton(QWidget* parent) : QLabel(parent) { } 52 FlatButton(QWidget* parent) : QLabel(parent) { }
51 53
52 void mouseDoubleClickEvent(QMouseEvent* e) 54 void mouseDoubleClickEvent(QMouseEvent* e)
53 { 55 {
54 emit clicked(e->pos(),e->button(),TRUE); 56 emit clicked(e->pos(),e->button(),TRUE);
55 } 57 }
56 void mouseReleaseEvent(QMouseEvent* e) 58 void mouseReleaseEvent(QMouseEvent* e)
57 { 59 {
58 if ( rect().contains(e->pos()) ) 60 if ( rect().contains(e->pos()) )
59 emit clicked(e->pos(),e->button(),FALSE); 61 emit clicked(e->pos(),e->button(),FALSE);
60 } 62 }
61 63
62signals: 64signals:
63 void clicked(const QPoint&, int, bool); 65 void clicked(const QPoint&, int, bool);
64}; 66};
65 67
66QLabel* AppIcons::button(int id) 68QLabel* AppIcons::button(int id)
67{ 69{
68 QLabel* f = buttons.find(id); 70 QLabel* f = buttons.find(id);
69 if ( !f ) { 71 if ( !f ) {
70 buttons.insert(id,f=new FlatButton(this)); 72 buttons.insert(id,f=new FlatButton(this));
71 connect(f,SIGNAL(clicked(const QPoint&, int, bool)),this,SLOT(clicked(const QPoint&, int, bool))); 73 connect(f,SIGNAL(clicked(const QPoint&,int,bool)),this,SLOT(clicked(const QPoint&,int,bool)));
72 f->show(); 74 f->show();
73 } 75 }
74 return f; 76 return f;
75} 77}
76 78
77int AppIcons::findId(QLabel* b) 79int AppIcons::findId(QLabel* b)
78{ 80{
79 QIntDictIterator<QLabel> it(buttons); 81 QIntDictIterator<QLabel> it(buttons);
80 for ( ; ; ++it ) 82 for ( ; ; ++it )
81 if ( it.current() == b ) return it.currentKey(); 83 if ( it.current() == b ) return it.currentKey();
82} 84}
83 85
84void AppIcons::clicked(const QPoint& relpos, int button, bool dbl) 86void AppIcons::clicked(const QPoint& relpos, int button, bool dbl)
85{ 87{
86#ifndef QT_NO_COP 88#ifndef QT_NO_COP
87 QLabel* s = (QLabel*)sender(); 89 QLabel* s = (QLabel*)sender();
88 if ( button == RightButton ) { 90 if ( button == RightButton ) {
89 QCopEnvelope("Qt/Tray","popup(int,QPoint)") 91 QCopEnvelope("Qt/Tray","popup(int,QPoint)")
90 << findId(s) << s->mapToGlobal(QPoint(0,0)); 92 << findId(s) << s->mapToGlobal(QPoint(0,0));
91 } else { 93 } else {
92 QCopEnvelope("Qt/Tray", 94 QCopEnvelope("Qt/Tray",
93 dbl ? "doubleClicked(int,QPoint)" : "clicked(int,QPoint)") 95 dbl ? "doubleClicked(int,QPoint)" : "clicked(int,QPoint)")
94 << findId(s) << relpos; 96 << findId(s) << relpos;
95 } 97 }
96#endif 98#endif
97} 99}
98 100
99void AppIcons::setToolTip(int id, const QString& tip) 101void AppIcons::setToolTip(int id, const QString& tip)
100{ 102{
101 QToolTip::add(button(id),tip); 103 QToolTip::add(button(id),tip);
102} 104}
103 105
104void AppIcons::remove(int id) 106void AppIcons::remove(int id)
105{ 107{
106 buttons.remove(id); 108 buttons.remove(id);
107} 109}
108 110
109void AppIcons::receive( const QCString &msg, const QByteArray &data ) 111void AppIcons::receive( const QCString &msg, const QByteArray &data )
110{ 112{
111 QDataStream stream( data, IO_ReadOnly ); 113 QDataStream stream( data, IO_ReadOnly );
112 if ( msg == "remove(int)" ) { 114 if ( msg == "remove(int)" ) {
113 int id; 115 int id;
114 stream >> id; 116 stream >> id;
115 remove(id); 117 remove(id);
116 } else if ( msg == "setIcon(int,QPixmap)" ) { 118 } else if ( msg == "setIcon(int,QPixmap)" ) {
117 int id; 119 int id;
118 QPixmap pm; 120 QPixmap pm;
119 stream >> id >> pm; 121 stream >> id >> pm;
diff --git a/core/launcher/applauncher.cpp b/core/launcher/applauncher.cpp
index 7d3c032..08a3cb4 100644
--- a/core/launcher/applauncher.cpp
+++ b/core/launcher/applauncher.cpp
@@ -41,102 +41,102 @@
41#include <process.h> 41#include <process.h>
42#include <windows.h> 42#include <windows.h>
43#include <winbase.h> 43#include <winbase.h>
44#endif 44#endif
45 45
46#include <signal.h> 46#include <signal.h>
47#include <sys/types.h> 47#include <sys/types.h>
48#include <stdlib.h> 48#include <stdlib.h>
49 49
50#include <qtimer.h> 50#include <qtimer.h>
51#include <qwindowsystem_qws.h> 51#include <qwindowsystem_qws.h>
52#include <qmessagebox.h> 52#include <qmessagebox.h>
53#include <qfileinfo.h> 53#include <qfileinfo.h>
54 54
55#include <qtopia/qcopenvelope_qws.h> 55#include <qtopia/qcopenvelope_qws.h>
56#include <qtopia/qpeapplication.h> 56#include <qtopia/qpeapplication.h>
57 57
58#include "applauncher.h" 58#include "applauncher.h"
59#include "documentlist.h" 59#include "documentlist.h"
60 60
61const int AppLauncher::RAISE_TIMEOUT_MS = 5000; 61const int AppLauncher::RAISE_TIMEOUT_MS = 5000;
62 62
63//--------------------------------------------------------------------------- 63//---------------------------------------------------------------------------
64 64
65static AppLauncher* appLauncherPtr; 65static AppLauncher* appLauncherPtr;
66 66
67const int appStopEventID = 1290; 67const int appStopEventID = 1290;
68 68
69class AppStoppedEvent : public QCustomEvent 69class AppStoppedEvent : public QCustomEvent
70{ 70{
71public: 71public:
72 AppStoppedEvent(int pid, int status) 72 AppStoppedEvent(int pid, int status)
73 : QCustomEvent( appStopEventID ), mPid(pid), mStatus(status) { } 73 : QCustomEvent( appStopEventID ), mPid(pid), mStatus(status) { }
74 74
75 int pid() { return mPid; } 75 int pid() { return mPid; }
76 int status() { return mStatus; } 76 int status() { return mStatus; }
77 77
78private: 78private:
79 int mPid, mStatus; 79 int mPid, mStatus;
80}; 80};
81 81
82AppLauncher::AppLauncher(QObject *parent, const char *name) 82AppLauncher::AppLauncher(QObject *parent, const char *name)
83 : QObject(parent, name), qlPid(0), qlReady(FALSE), 83 : QObject(parent, name), qlPid(0), qlReady(FALSE),
84 appKillerBox(0) 84 appKillerBox(0)
85{ 85{
86 connect(qwsServer, SIGNAL(newChannel(const QString&)), this, SLOT(newQcopChannel(const QString&))); 86 connect(qwsServer, SIGNAL(newChannel(const QString&)), this, SLOT(newQcopChannel(const QString&)));
87 connect(qwsServer, SIGNAL(removedChannel(const QString&)), this, SLOT(removedQcopChannel(const QString&))); 87 connect(qwsServer, SIGNAL(removedChannel(const QString&)), this, SLOT(removedQcopChannel(const QString&)));
88 QCopChannel* channel = new QCopChannel( "QPE/System", this ); 88 QCopChannel* channel = new QCopChannel( "QPE/System", this );
89 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 89 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
90 this, SLOT(received(const QCString&, const QByteArray&)) ); 90 this, SLOT(received(const QCString&,const QByteArray&)) );
91 91
92 channel = new QCopChannel( "QPE/Server", this ); 92 channel = new QCopChannel( "QPE/Server", this );
93 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 93 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
94 this, SLOT(received(const QCString&, const QByteArray&)) ); 94 this, SLOT(received(const QCString&,const QByteArray&)) );
95 95
96#ifndef Q_OS_WIN32 96#ifndef Q_OS_WIN32
97 signal(SIGCHLD, signalHandler); 97 signal(SIGCHLD, signalHandler);
98#else 98#else
99 runningAppsProc.setAutoDelete( TRUE ); 99 runningAppsProc.setAutoDelete( TRUE );
100#endif 100#endif
101 QString tmp = qApp->argv()[0]; 101 QString tmp = qApp->argv()[0];
102 int pos = tmp.findRev('/'); 102 int pos = tmp.findRev('/');
103 if ( pos > -1 ) 103 if ( pos > -1 )
104 tmp = tmp.mid(++pos); 104 tmp = tmp.mid(++pos);
105 runningApps[::getpid()] = tmp; 105 runningApps[::getpid()] = tmp;
106 106
107 appLauncherPtr = this; 107 appLauncherPtr = this;
108 108
109 QTimer::singleShot( 1000, this, SLOT(createQuickLauncher()) ); 109 QTimer::singleShot( 1000, this, SLOT(createQuickLauncher()) );
110} 110}
111 111
112AppLauncher::~AppLauncher() 112AppLauncher::~AppLauncher()
113{ 113{
114 appLauncherPtr = 0; 114 appLauncherPtr = 0;
115#ifndef Q_OS_WIN32 115#ifndef Q_OS_WIN32
116 signal(SIGCHLD, SIG_DFL); 116 signal(SIGCHLD, SIG_DFL);
117#endif 117#endif
118 if ( qlPid ) { 118 if ( qlPid ) {
119 int status; 119 int status;
120 ::kill( qlPid, SIGTERM ); 120 ::kill( qlPid, SIGTERM );
121 waitpid( qlPid, &status, 0 ); 121 waitpid( qlPid, &status, 0 );
122 } 122 }
123} 123}
124 124
125/* We use the QCopChannel of the app as an indicator of when it has been launched 125/* We use the QCopChannel of the app as an indicator of when it has been launched
126 so that we can disable the busy indicators */ 126 so that we can disable the busy indicators */
127void AppLauncher::newQcopChannel(const QString& channelName) 127void AppLauncher::newQcopChannel(const QString& channelName)
128{ 128{
129// qDebug("channel %s added", channelName.data() ); 129// qDebug("channel %s added", channelName.data() );
130 QString prefix("QPE/Application/"); 130 QString prefix("QPE/Application/");
131 if (channelName.startsWith(prefix)) { 131 if (channelName.startsWith(prefix)) {
132 { 132 {
133 QCopEnvelope e("QPE/System", "newChannel(QString)"); 133 QCopEnvelope e("QPE/System", "newChannel(QString)");
134 e << channelName; 134 e << channelName;
135 } 135 }
136 QString appName = channelName.mid(prefix.length()); 136 QString appName = channelName.mid(prefix.length());
137 if ( appName != "quicklauncher" ) { 137 if ( appName != "quicklauncher" ) {
138 emit connected( appName ); 138 emit connected( appName );
139 QCopEnvelope e("QPE/System", "notBusy(QString)"); 139 QCopEnvelope e("QPE/System", "notBusy(QString)");
140 e << appName; 140 e << appName;
141 } 141 }
142 } else if (channelName.startsWith("QPE/QuickLauncher-")) { 142 } else if (channelName.startsWith("QPE/QuickLauncher-")) {
diff --git a/core/launcher/firstuse.cpp b/core/launcher/firstuse.cpp
index 50ae6c2..4316648 100644
--- a/core/launcher/firstuse.cpp
+++ b/core/launcher/firstuse.cpp
@@ -53,157 +53,157 @@
53 53
54 54
55#include <stdlib.h> 55#include <stdlib.h>
56#include <sys/types.h> 56#include <sys/types.h>
57#if defined(Q_OS_LINUX) || defined(_OS_LINUX_) 57#if defined(Q_OS_LINUX) || defined(_OS_LINUX_)
58#include <unistd.h> 58#include <unistd.h>
59#endif 59#endif
60 60
61 61
62struct { 62struct {
63 bool enabled; 63 bool enabled;
64 const char *app; 64 const char *app;
65 const char *start; 65 const char *start;
66 const char *stop; 66 const char *stop;
67 const char *desc; 67 const char *desc;
68} 68}
69settingsTable [] = 69settingsTable [] =
70{ 70{
71 { FALSE, "language", "raise()", "accept()", // No tr 71 { FALSE, "language", "raise()", "accept()", // No tr
72 QT_TR_NOOP("Language") }, 72 QT_TR_NOOP("Language") },
73 { FALSE, "doctab", "raise()", "accept()", // No tr 73 { FALSE, "doctab", "raise()", "accept()", // No tr
74 QT_TR_NOOP("DocTab") }, 74 QT_TR_NOOP("DocTab") },
75#ifndef Q_OS_WIN32 75#ifndef Q_OS_WIN32
76 { FALSE, "systemtime", "raise()", "accept()", // No tr 76 { FALSE, "systemtime", "raise()", "accept()", // No tr
77 QT_TR_NOOP("Time and Date") }, 77 QT_TR_NOOP("Time and Date") },
78#endif 78#endif
79 { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr 79 { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr
80 QT_TR_NOOP("Personal Information") }, 80 QT_TR_NOOP("Personal Information") },
81 { FALSE, 0, 0, 0, 0 } 81 { FALSE, 0, 0, 0, 0 }
82}; 82};
83 83
84 84
85FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) : 85FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) :
86 QDialog( parent, name, TRUE, wf), 86 QDialog( parent, name, TRUE, wf),
87 transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1), 87 transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1),
88 waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE) 88 waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE)
89{ 89{
90 ServerApplication::allowRestart = FALSE; 90 ServerApplication::allowRestart = FALSE;
91 // we force our height beyound the maximum (which we set anyway) 91 // we force our height beyound the maximum (which we set anyway)
92 QRect desk = qApp->desktop()->geometry(); 92 QRect desk = qApp->desktop()->geometry();
93 setGeometry( 0, 0, desk.width(), desk.height() ); 93 setGeometry( 0, 0, desk.width(), desk.height() );
94 94
95 connect(qwsServer, SIGNAL(newChannel(const QString&)), 95 connect(qwsServer, SIGNAL(newChannel(const QString&)),
96 this, SLOT(newQcopChannel(const QString&))); 96 this, SLOT(newQcopChannel(const QString&)));
97 97
98 // Create a DocumentList so appLauncher has appLnkSet to search 98 // Create a DocumentList so appLauncher has appLnkSet to search
99 docList = new DocumentList( 0, FALSE ); 99 docList = new DocumentList( 0, FALSE );
100 appLauncher = new AppLauncher( this ); 100 appLauncher = new AppLauncher( this );
101 connect( appLauncher, SIGNAL(terminated(int, const QString&)), 101 connect( appLauncher, SIGNAL(terminated(int,const QString&)),
102 this, SLOT(terminated(int, const QString&)) ); 102 this, SLOT(terminated(int,const QString&)) );
103 103
104 // more hackery 104 // more hackery
105 // I will be run as either the main server or as part of the main server 105 // I will be run as either the main server or as part of the main server
106 QWSServer::setScreenSaverIntervals(0); 106 QWSServer::setScreenSaverIntervals(0);
107 loadPixmaps(); 107 loadPixmaps();
108 108
109 //check if there is a language program 109 //check if there is a language program
110#ifndef Q_OS_WIN32 110#ifndef Q_OS_WIN32
111 QString exeSuffix; 111 QString exeSuffix;
112#else 112#else
113 QString exeSuffix(".exe"); 113 QString exeSuffix(".exe");
114#endif 114#endif
115 115
116 for ( int i = 0; settingsTable[i].app; i++ ) { 116 for ( int i = 0; settingsTable[i].app; i++ ) {
117 QString file = QPEApplication::qpeDir() + "bin/"; 117 QString file = QPEApplication::qpeDir() + "bin/";
118 file += settingsTable[i].app; 118 file += settingsTable[i].app;
119 file += exeSuffix; 119 file += exeSuffix;
120 if ( QFile::exists(file) ) 120 if ( QFile::exists(file) )
121 settingsTable[i].enabled = TRUE; 121 settingsTable[i].enabled = TRUE;
122 } 122 }
123 123
124 setFocusPolicy(NoFocus); 124 setFocusPolicy(NoFocus);
125 125
126 taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader); 126 taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader);
127 127
128 inputMethods = new InputMethods(taskBar); 128 inputMethods = new InputMethods(taskBar);
129 connect(inputMethods, SIGNAL(inputToggled(bool)), 129 connect(inputMethods, SIGNAL(inputToggled(bool)),
130 this, SLOT(calcMaxWindowRect())); 130 this, SLOT(calcMaxWindowRect()));
131 131
132 back = new QPushButton(tr("<< Back"), taskBar); 132 back = new QPushButton(tr("<< Back"), taskBar);
133 back->setFocusPolicy(NoFocus); 133 back->setFocusPolicy(NoFocus);
134 connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) ); 134 connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) );
135 135
136 next = new QPushButton(tr("Next >>"), taskBar); 136 next = new QPushButton(tr("Next >>"), taskBar);
137 next->setFocusPolicy(NoFocus); 137 next->setFocusPolicy(NoFocus);
138 connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) ); 138 connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) );
139 139
140 // need to set the geom to lower corner 140 // need to set the geom to lower corner
141 QSize sz = inputMethods->sizeHint(); 141 QSize sz = inputMethods->sizeHint();
142 int buttonWidth = (width() - sz.width()) / 2; 142 int buttonWidth = (width() - sz.width()) / 2;
143 int x = 0; 143 int x = 0;
144 144
145 controlHeight = back->sizeHint().height(); 145 controlHeight = back->sizeHint().height();
146 146
147 inputMethods->setGeometry(0,0, sz.width(), controlHeight ); 147 inputMethods->setGeometry(0,0, sz.width(), controlHeight );
148 x += sz.width(); 148 x += sz.width();
149 149
150 back->setGeometry(x, 0, buttonWidth, controlHeight); 150 back->setGeometry(x, 0, buttonWidth, controlHeight);
151 x += buttonWidth; 151 x += buttonWidth;
152 next->setGeometry(x, 0, buttonWidth, controlHeight); 152 next->setGeometry(x, 0, buttonWidth, controlHeight);
153 153
154 taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight); 154 taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight);
155 taskBar->hide(); 155 taskBar->hide();
156 156
157#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 157#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
158 qDebug("Setting up QCop to QPE/System"); 158 qDebug("Setting up QCop to QPE/System");
159 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); 159 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
160 connect(sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), 160 connect(sysChannel, SIGNAL(received(const QCString&,const QByteArray&)),
161 this, SLOT(message(const QCString &, const QByteArray &)) ); 161 this, SLOT(message(const QCString&,const QByteArray&)) );
162#endif 162#endif
163 calcMaxWindowRect(); 163 calcMaxWindowRect();
164 164
165 m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false; 165 m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false;
166 166
167 if ( m_calHandler) { 167 if ( m_calHandler) {
168 if ( !QFile::exists("/etc/pointercal") ) { 168 if ( !QFile::exists("/etc/pointercal") ) {
169 needCalibrate = TRUE; 169 needCalibrate = TRUE;
170 grabMouse(); 170 grabMouse();
171 } 171 }
172 } 172 }
173 173
174 Config config("locale"); 174 Config config("locale");
175 config.setGroup( "Language"); 175 config.setGroup( "Language");
176 lang = config.readEntry( "Language", "en"); 176 lang = config.readEntry( "Language", "en");
177 177
178 defaultFont = font(); 178 defaultFont = font();
179 179
180 //###language/font hack; should look it up somewhere 180 //###language/font hack; should look it up somewhere
181#ifdef Q_WS_QWS 181#ifdef Q_WS_QWS
182 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { 182 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) {
183 QFont fn = FontManager::unicodeFont( FontManager::Proportional ); 183 QFont fn = FontManager::unicodeFont( FontManager::Proportional );
184 qApp->setFont( fn, TRUE ); 184 qApp->setFont( fn, TRUE );
185 } 185 }
186#endif 186#endif
187} 187}
188 188
189FirstUse::~FirstUse() 189FirstUse::~FirstUse()
190{ 190{
191 delete appLauncher; 191 delete appLauncher;
192 delete docList; 192 delete docList;
193 delete taskBar; 193 delete taskBar;
194 ServerApplication::allowRestart = TRUE; 194 ServerApplication::allowRestart = TRUE;
195} 195}
196 196
197void FirstUse::calcMaxWindowRect() 197void FirstUse::calcMaxWindowRect()
198{ 198{
199#ifdef Q_WS_QWS 199#ifdef Q_WS_QWS
200 QRect wr; 200 QRect wr;
201 int displayWidth = qApp->desktop()->width(); 201 int displayWidth = qApp->desktop()->width();
202 QRect ir = inputMethods->inputRect(); 202 QRect ir = inputMethods->inputRect();
203 if ( ir.isValid() ) { 203 if ( ir.isValid() ) {
204 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 204 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
205 } else { 205 } else {
206 wr.setCoords( 0, 0, displayWidth-1, 206 wr.setCoords( 0, 0, displayWidth-1,
207 qApp->desktop()->height() - controlHeight-1); 207 qApp->desktop()->height() - controlHeight-1);
208 } 208 }
209 209
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp
index 683f1e2..19e799a 100644
--- a/core/launcher/inputmethods.cpp
+++ b/core/launcher/inputmethods.cpp
@@ -100,98 +100,98 @@ InputMethods::InputMethods( QWidget *parent ) :
100 100
101 setBackgroundMode( PaletteBackground ); 101 setBackgroundMode( PaletteBackground );
102 QHBoxLayout *hbox = new QHBoxLayout( this ); 102 QHBoxLayout *hbox = new QHBoxLayout( this );
103 103
104 kbdButton = new IMToolButton( this); 104 kbdButton = new IMToolButton( this);
105 kbdButton->setFocusPolicy(NoFocus); 105 kbdButton->setFocusPolicy(NoFocus);
106 kbdButton->setToggleButton( TRUE ); 106 kbdButton->setToggleButton( TRUE );
107 if (parent->sizeHint().height() > 0) 107 if (parent->sizeHint().height() > 0)
108 kbdButton->setFixedHeight( parent->sizeHint().height() ); 108 kbdButton->setFixedHeight( parent->sizeHint().height() );
109 kbdButton->setFixedWidth( 32 ); 109 kbdButton->setFixedWidth( 32 );
110 kbdButton->setAutoRaise( TRUE ); 110 kbdButton->setAutoRaise( TRUE );
111 kbdButton->setUsesBigPixmap( TRUE ); 111 kbdButton->setUsesBigPixmap( TRUE );
112 hbox->addWidget( kbdButton ); 112 hbox->addWidget( kbdButton );
113 connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) ); 113 connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) );
114 114
115 kbdChoice = new IMToolButton( this ); 115 kbdChoice = new IMToolButton( this );
116 kbdChoice->setFocusPolicy(NoFocus); 116 kbdChoice->setFocusPolicy(NoFocus);
117 kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); 117 kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) );
118 if (parent->sizeHint().height() > 0) 118 if (parent->sizeHint().height() > 0)
119 kbdChoice->setFixedHeight( parent->sizeHint().height() ); 119 kbdChoice->setFixedHeight( parent->sizeHint().height() );
120 kbdChoice->setFixedWidth( 13 ); 120 kbdChoice->setFixedWidth( 13 );
121 kbdChoice->setAutoRaise( TRUE ); 121 kbdChoice->setAutoRaise( TRUE );
122 hbox->addWidget( kbdChoice ); 122 hbox->addWidget( kbdChoice );
123 connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) ); 123 connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) );
124 124
125 connect( (QPEApplication*)qApp, SIGNAL(clientMoused()), 125 connect( (QPEApplication*)qApp, SIGNAL(clientMoused()),
126 this, SLOT(resetStates()) ); 126 this, SLOT(resetStates()) );
127 127
128 128
129 imButton = new QWidgetStack( this ); // later a widget stack 129 imButton = new QWidgetStack( this ); // later a widget stack
130 imButton->setFocusPolicy(NoFocus); 130 imButton->setFocusPolicy(NoFocus);
131 if (parent->sizeHint().height() > 0) 131 if (parent->sizeHint().height() > 0)
132 imButton->setFixedHeight( parent->sizeHint().height() ); 132 imButton->setFixedHeight( parent->sizeHint().height() );
133 hbox->addWidget(imButton); 133 hbox->addWidget(imButton);
134 134
135 imChoice = new QToolButton( this ); 135 imChoice = new QToolButton( this );
136 imChoice->setFocusPolicy(NoFocus); 136 imChoice->setFocusPolicy(NoFocus);
137 imChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); 137 imChoice->setPixmap( QPixmap( (const char **)tri_xpm ) );
138 if (parent->sizeHint().height() > 0) 138 if (parent->sizeHint().height() > 0)
139 imChoice->setFixedHeight( parent->sizeHint().height() ); 139 imChoice->setFixedHeight( parent->sizeHint().height() );
140 imChoice->setFixedWidth( 13 ); 140 imChoice->setFixedWidth( 13 );
141 imChoice->setAutoRaise( TRUE ); 141 imChoice->setAutoRaise( TRUE );
142 hbox->addWidget( imChoice ); 142 hbox->addWidget( imChoice );
143 connect( imChoice, SIGNAL(clicked()), this, SLOT(chooseIm()) ); 143 connect( imChoice, SIGNAL(clicked()), this, SLOT(chooseIm()) );
144 144
145 loadInputMethods(); 145 loadInputMethods();
146 146
147 QCopChannel *channel = new QCopChannel( "QPE/IME", this ); 147 QCopChannel *channel = new QCopChannel( "QPE/IME", this );
148 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 148 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
149 this, SLOT(qcopReceive(const QCString&, const QByteArray&)) ); 149 this, SLOT(qcopReceive(const QCString&,const QByteArray&)) );
150} 150}
151 151
152InputMethods::~InputMethods() 152InputMethods::~InputMethods()
153{ 153{
154 Config cfg("qpe"); 154 Config cfg("qpe");
155 cfg.setGroup("InputMethod"); 155 cfg.setGroup("InputMethod");
156 if (imethod) 156 if (imethod)
157 cfg.writeEntry("im", imethod->name() ); 157 cfg.writeEntry("im", imethod->name() );
158 if (mkeyboard) 158 if (mkeyboard)
159 cfg.writeEntry("current", mkeyboard->name() ); 159 cfg.writeEntry("current", mkeyboard->name() );
160 160
161 unloadInputMethods(); 161 unloadInputMethods();
162} 162}
163 163
164void InputMethods::hideInputMethod() 164void InputMethods::hideInputMethod()
165{ 165{
166 kbdButton->setOn( FALSE ); 166 kbdButton->setOn( FALSE );
167} 167}
168 168
169void InputMethods::showInputMethod() 169void InputMethods::showInputMethod()
170{ 170{
171 kbdButton->setOn( TRUE ); 171 kbdButton->setOn( TRUE );
172} 172}
173 173
174void InputMethods::showInputMethod(const QString& name) 174void InputMethods::showInputMethod(const QString& name)
175{ 175{
176 int i = 0; 176 int i = 0;
177 QValueList<InputMethod>::Iterator it; 177 QValueList<InputMethod>::Iterator it;
178 InputMethod *im = 0; 178 InputMethod *im = 0;
179 for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { 179 for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) {
180 QString lname = (*it).libName.mid((*it).libName.findRev('/') + 1); 180 QString lname = (*it).libName.mid((*it).libName.findRev('/') + 1);
181 if ( (*it).name() == name || lname == name ) { 181 if ( (*it).name() == name || lname == name ) {
182 im = &(*it); 182 im = &(*it);
183 break; 183 break;
184 } 184 }
185 } 185 }
186 if ( im ) 186 if ( im )
187 chooseKeyboard(im); 187 chooseKeyboard(im);
188} 188}
189 189
190void InputMethods::resetStates() 190void InputMethods::resetStates()
191{ 191{
192 if ( mkeyboard && !mkeyboard->newIM ) 192 if ( mkeyboard && !mkeyboard->newIM )
193 mkeyboard->interface->resetState(); 193 mkeyboard->interface->resetState();
194} 194}
195 195
196QRect InputMethods::inputRect() const 196QRect InputMethods::inputRect() const
197{ 197{
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 54efb0b..5d0c778 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -53,100 +53,100 @@
53#include "startmenu.h" 53#include "startmenu.h"
54#include "taskbar.h" 54#include "taskbar.h"
55 55
56#include "serverinterface.h" 56#include "serverinterface.h"
57#include "launcherview.h" 57#include "launcherview.h"
58#include "launcher.h" 58#include "launcher.h"
59#include "server.h" 59#include "server.h"
60 60
61#define QTOPIA_INTERNAL_FSLP 61#define QTOPIA_INTERNAL_FSLP
62#include <qtopia/lnkproperties.h> 62#include <qtopia/lnkproperties.h>
63#include <stdlib.h> 63#include <stdlib.h>
64#include <assert.h> 64#include <assert.h>
65 65
66#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 66#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
67#include <unistd.h> 67#include <unistd.h>
68#include <stdio.h> 68#include <stdio.h>
69#include <sys/vfs.h> 69#include <sys/vfs.h>
70#include <mntent.h> 70#include <mntent.h>
71#endif 71#endif
72 72
73#ifdef Q_WS_QWS 73#ifdef Q_WS_QWS
74#include <qkeyboard_qws.h> 74#include <qkeyboard_qws.h>
75#include <qpe/lnkproperties.h> 75#include <qpe/lnkproperties.h>
76#endif 76#endif
77 77
78 78
79static bool isVisibleWindow( int ); 79static bool isVisibleWindow( int );
80//=========================================================================== 80//===========================================================================
81 81
82LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : 82LauncherTabWidget::LauncherTabWidget( Launcher* parent ) :
83 QVBox( parent ), docview( 0 ) 83 QVBox( parent ), docview( 0 )
84{ 84{
85 docLoadingWidgetEnabled = false; 85 docLoadingWidgetEnabled = false;
86 docLoadingWidget = 0; 86 docLoadingWidget = 0;
87 docLoadingWidgetProgress = 0; 87 docLoadingWidgetProgress = 0;
88 launcher = parent; 88 launcher = parent;
89 categoryBar = new LauncherTabBar( this ); 89 categoryBar = new LauncherTabBar( this );
90 QPalette pal = categoryBar->palette(); 90 QPalette pal = categoryBar->palette();
91 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); 91 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) );
92 pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); 92 pal.setColor( QColorGroup::Background, pal.active().background().light(110) );
93 categoryBar->setPalette( pal ); 93 categoryBar->setPalette( pal );
94 stack = new QWidgetStack(this); 94 stack = new QWidgetStack(this);
95 connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) ); 95 connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) );
96 categoryBar->show(); 96 categoryBar->show();
97 stack->show(); 97 stack->show();
98 98
99#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 99#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
100 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); 100 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this );
101 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 101 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
102 this, SLOT(launcherMessage(const QCString&, const QByteArray&)) ); 102 this, SLOT(launcherMessage(const QCString&,const QByteArray&)) );
103 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), 103 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)),
104 this, SLOT(appMessage(const QCString&, const QByteArray&))); 104 this, SLOT(appMessage(const QCString&,const QByteArray&)));
105#endif 105#endif
106 106
107 createDocLoadingWidget(); 107 createDocLoadingWidget();
108} 108}
109 109
110void LauncherTabWidget::createDocLoadingWidget() 110void LauncherTabWidget::createDocLoadingWidget()
111{ 111{
112 // Construct the 'doc loading widget' shown when finding documents 112 // Construct the 'doc loading widget' shown when finding documents
113 113
114 // ### LauncherView class needs changing to be more generic so 114 // ### LauncherView class needs changing to be more generic so
115 // this widget can change its background similar to the iconviews 115 // this widget can change its background similar to the iconviews
116 // so the background for this matches 116 // so the background for this matches
117 docLoadingWidget = new LauncherView( stack ); 117 docLoadingWidget = new LauncherView( stack );
118 docLoadingWidget->hideIcons(); 118 docLoadingWidget->hideIcons();
119 QVBox *docLoadingVBox = new QVBox( docLoadingWidget ); 119 QVBox *docLoadingVBox = new QVBox( docLoadingWidget );
120 120
121 docLoadingVBox->setSpacing( 20 ); 121 docLoadingVBox->setSpacing( 20 );
122 docLoadingVBox->setMargin( 10 ); 122 docLoadingVBox->setMargin( 10 );
123 123
124 QWidget *space1 = new QWidget( docLoadingVBox ); 124 QWidget *space1 = new QWidget( docLoadingVBox );
125 docLoadingVBox->setStretchFactor( space1, 1 ); 125 docLoadingVBox->setStretchFactor( space1, 1 );
126 126
127 QLabel *waitPixmap = new QLabel( docLoadingVBox ); 127 QLabel *waitPixmap = new QLabel( docLoadingVBox );
128 waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); 128 waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) );
129 waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); 129 waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) );
130 waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); 130 waitPixmap->setAlignment( int( QLabel::AlignCenter ) );
131 131
132 Config cfg( "Launcher" ); 132 Config cfg( "Launcher" );
133 cfg.setGroup( "DocTab" ); 133 cfg.setGroup( "DocTab" );
134 bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); 134 bool docTabEnabled = cfg.readBoolEntry( "Enable", true );
135 135
136 QLabel *textLabel = new QLabel( docLoadingVBox ); 136 QLabel *textLabel = new QLabel( docLoadingVBox );
137 textLabel->setAlignment( int( QLabel::AlignCenter ) ); 137 textLabel->setAlignment( int( QLabel::AlignCenter ) );
138 docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); 138 docLoadingWidgetProgress = new QProgressBar( docLoadingVBox );
139 docLoadingWidgetProgress->setProgress( 0 ); 139 docLoadingWidgetProgress->setProgress( 0 );
140 docLoadingWidgetProgress->setCenterIndicator( TRUE ); 140 docLoadingWidgetProgress->setCenterIndicator( TRUE );
141 docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker 141 docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker
142 setProgressStyle(); 142 setProgressStyle();
143 143
144 if ( docTabEnabled ) 144 if ( docTabEnabled )
145 { 145 {
146 textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); 146 textLabel->setText( tr( "<b>Finding Documents...</b>" ) );
147 } 147 }
148 else 148 else
149 { 149 {
150 textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>" 150 textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>"
151 "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) ); 151 "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) );
152 docLoadingWidgetProgress->hide(); 152 docLoadingWidgetProgress->hide();
@@ -432,98 +432,98 @@ void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &
432} 432}
433 433
434 434
435 435
436//--------------------------------------------------------------------------- 436//---------------------------------------------------------------------------
437 437
438Launcher::Launcher() 438Launcher::Launcher()
439 : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) 439 : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader )
440{ 440{
441 tabs = 0; 441 tabs = 0;
442 tb = 0; 442 tb = 0;
443 Config cfg( "Launcher" ); 443 Config cfg( "Launcher" );
444 cfg.setGroup( "DocTab" ); 444 cfg.setGroup( "DocTab" );
445 docTabEnabled = cfg.readBoolEntry( "Enable", true ); 445 docTabEnabled = cfg.readBoolEntry( "Enable", true );
446} 446}
447 447
448void Launcher::createGUI() 448void Launcher::createGUI()
449{ 449{
450 setCaption( tr("Launcher") ); 450 setCaption( tr("Launcher") );
451 451
452 // we have a pretty good idea how big we'll be 452 // we have a pretty good idea how big we'll be
453 setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); 453 setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() );
454 454
455 tb = new TaskBar; 455 tb = new TaskBar;
456 tabs = new LauncherTabWidget( this ); 456 tabs = new LauncherTabWidget( this );
457 setCentralWidget( tabs ); 457 setCentralWidget( tabs );
458 458
459 ServerInterface::dockWidget( tb, ServerInterface::Bottom ); 459 ServerInterface::dockWidget( tb, ServerInterface::Bottom );
460 tb->show(); 460 tb->show();
461 461
462 qApp->installEventFilter( this ); 462 qApp->installEventFilter( this );
463 463
464 464
465 connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) ); 465 connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) );
466 connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); 466 connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) );
467 connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); 467 connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) );
468 468
469 connect( tb, SIGNAL(tabSelected(const QString&)), 469 connect( tb, SIGNAL(tabSelected(const QString&)),
470 this, SLOT(showTab(const QString&)) ); 470 this, SLOT(showTab(const QString&)) );
471 connect( tabs, SIGNAL(selected(const QString&)), 471 connect( tabs, SIGNAL(selected(const QString&)),
472 this, SLOT(viewSelected(const QString&)) ); 472 this, SLOT(viewSelected(const QString&)) );
473 connect( tabs, SIGNAL(clicked(const AppLnk*)), 473 connect( tabs, SIGNAL(clicked(const AppLnk*)),
474 this, SLOT(select(const AppLnk*))); 474 this, SLOT(select(const AppLnk*)));
475 connect( tabs, SIGNAL(rightPressed(AppLnk*)), 475 connect( tabs, SIGNAL(rightPressed(AppLnk*)),
476 this, SLOT(properties(AppLnk*))); 476 this, SLOT(properties(AppLnk*)));
477 477
478#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 478#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
479 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); 479 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
480 connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), 480 connect( sysChannel, SIGNAL(received(const QCString&,const QByteArray&)),
481 this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); 481 this, SLOT(systemMessage(const QCString&,const QByteArray&)) );
482#endif 482#endif
483 483
484 // all documents 484 // all documents
485 QImage img( Resource::loadImage( "DocsIcon" ) ); 485 QImage img( Resource::loadImage( "DocsIcon" ) );
486 QPixmap pm; 486 QPixmap pm;
487 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 487 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
488 // It could add this itself if it handles docs 488 // It could add this itself if it handles docs
489 489
490 tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); 490 tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE );
491 491
492 QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); 492 QTimer::singleShot( 0, tabs, SLOT( initLayout() ) );
493 qApp->setMainWidget( this ); 493 qApp->setMainWidget( this );
494 QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); 494 QTimer::singleShot( 500, this, SLOT( makeVisible() ) );
495} 495}
496 496
497Launcher::~Launcher() 497Launcher::~Launcher()
498{ 498{
499 if ( tb ) 499 if ( tb )
500 destroyGUI(); 500 destroyGUI();
501} 501}
502 502
503 bool Launcher::requiresDocuments() const 503 bool Launcher::requiresDocuments() const
504 { 504 {
505 Config cfg( "Launcher" ); 505 Config cfg( "Launcher" );
506 cfg.setGroup( "DocTab" ); 506 cfg.setGroup( "DocTab" );
507 return cfg.readBoolEntry( "Enable", true ); 507 return cfg.readBoolEntry( "Enable", true );
508} 508}
509 509
510void Launcher::makeVisible() 510void Launcher::makeVisible()
511{ 511{
512 showMaximized(); 512 showMaximized();
513} 513}
514 514
515void Launcher::destroyGUI() 515void Launcher::destroyGUI()
516{ 516{
517 delete tb; 517 delete tb;
518 tb = 0; 518 tb = 0;
519 delete tabs; 519 delete tabs;
520 tabs =0; 520 tabs =0;
521} 521}
522 522
523bool Launcher::eventFilter( QObject*, QEvent *ev ) 523bool Launcher::eventFilter( QObject*, QEvent *ev )
524{ 524{
525#ifdef QT_QWS_CUSTOM 525#ifdef QT_QWS_CUSTOM
526 if ( ev->type() == QEvent::KeyPress ) { 526 if ( ev->type() == QEvent::KeyPress ) {
527 QKeyEvent *ke = (QKeyEvent *)ev; 527 QKeyEvent *ke = (QKeyEvent *)ev;
528 if ( ke->key() == Qt::Key_F11 ) { // menu key 528 if ( ke->key() == Qt::Key_F11 ) { // menu key
529 QWidget *active = qApp->activeWindow(); 529 QWidget *active = qApp->activeWindow();
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 513b1bd..6c7d487 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -570,104 +570,104 @@ bool LauncherIconView::removeLink(const QString& linkfile)
570 bool did = FALSE; 570 bool did = FALSE;
571 DocLnk dl(linkfile); 571 DocLnk dl(linkfile);
572 while (item) { 572 while (item) {
573 l = item->appLnk(); 573 l = item->appLnk();
574 LauncherItem *nextItem = (LauncherItem *)item->nextItem(); 574 LauncherItem *nextItem = (LauncherItem *)item->nextItem();
575 if ( l->linkFileKnown() && l->linkFile() == linkfile 575 if ( l->linkFileKnown() && l->linkFile() == linkfile
576 || l->fileKnown() && ( 576 || l->fileKnown() && (
577 l->file() == linkfile 577 l->file() == linkfile
578 || dl.isValid() && dl.file() == l->file() ) ) { 578 || dl.isValid() && dl.file() == l->file() ) ) {
579 delete item; 579 delete item;
580 did = TRUE; 580 did = TRUE;
581 } 581 }
582 item = nextItem; 582 item = nextItem;
583 } 583 }
584 QListIterator<AppLnk> it(hidden); 584 QListIterator<AppLnk> it(hidden);
585 while ((l=it.current())) { 585 while ((l=it.current())) {
586 ++it; 586 ++it;
587 if ( l->linkFileKnown() && l->linkFile() == linkfile 587 if ( l->linkFileKnown() && l->linkFile() == linkfile
588 || l->file() == linkfile 588 || l->file() == linkfile
589 || dl.isValid() && dl.file() == l->file() ) { 589 || dl.isValid() && dl.file() == l->file() ) {
590 hidden.removeRef(l); 590 hidden.removeRef(l);
591 did = TRUE; 591 did = TRUE;
592 } 592 }
593 } 593 }
594 return did; 594 return did;
595} 595}
596 596
597//=========================================================================== 597//===========================================================================
598 598
599LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl ) 599LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl )
600 : QVBox( parent, name, fl ) 600 : QVBox( parent, name, fl )
601{ 601{
602 catmb = 0; 602 catmb = 0;
603 icons = new LauncherIconView( this ); 603 icons = new LauncherIconView( this );
604 setFocusProxy(icons); 604 setFocusProxy(icons);
605 QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold ); 605 QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold );
606 606
607 icons->setItemsMovable( FALSE ); 607 icons->setItemsMovable( FALSE );
608 icons->setAutoArrange( TRUE ); 608 icons->setAutoArrange( TRUE );
609 icons->setSorting( TRUE ); 609 icons->setSorting( TRUE );
610 icons->setFrameStyle( QFrame::NoFrame ); 610 icons->setFrameStyle( QFrame::NoFrame );
611 icons->setMargin( 0 ); 611 icons->setMargin( 0 );
612 icons->setSelectionMode( QIconView::NoSelection ); 612 icons->setSelectionMode( QIconView::NoSelection );
613 icons->setBackgroundMode( PaletteBase ); 613 icons->setBackgroundMode( PaletteBase );
614 icons->setResizeMode( QIconView::Fixed ); 614 icons->setResizeMode( QIconView::Fixed );
615 vmode = (ViewMode)-1; 615 vmode = (ViewMode)-1;
616 setViewMode( Icon ); 616 setViewMode( Icon );
617 617
618 connect( icons, SIGNAL(mouseButtonClicked(int, QIconViewItem *, const QPoint&)), 618 connect( icons, SIGNAL(mouseButtonClicked(int,QIconViewItem*,const QPoint&)),
619 SLOT(itemClicked(int, QIconViewItem *)) ); 619 SLOT(itemClicked(int,QIconViewItem*)) );
620 connect( icons, SIGNAL(selectionChanged()), 620 connect( icons, SIGNAL(selectionChanged()),
621 SLOT(selectionChanged()) ); 621 SLOT(selectionChanged()) );
622 connect( icons, SIGNAL(returnPressed(QIconViewItem *)), 622 connect( icons, SIGNAL(returnPressed(QIconViewItem*)),
623 SLOT(returnPressed(QIconViewItem *)) ); 623 SLOT(returnPressed(QIconViewItem*)) );
624 connect( icons, SIGNAL(mouseButtonPressed(int, QIconViewItem *, const QPoint&)), 624 connect( icons, SIGNAL(mouseButtonPressed(int,QIconViewItem*,const QPoint&)),
625 SLOT(itemPressed(int, QIconViewItem *)) ); 625 SLOT(itemPressed(int,QIconViewItem*)) );
626 626
627 tools = 0; 627 tools = 0;
628 setBackgroundType( Ruled, QString::null ); 628 setBackgroundType( Ruled, QString::null );
629} 629}
630 630
631LauncherView::~LauncherView() 631LauncherView::~LauncherView()
632{ 632{
633 if ( bgCache && bgCache->contains( bgName ) ) 633 if ( bgCache && bgCache->contains( bgName ) )
634 (*bgCache)[bgName]->ref--; 634 (*bgCache)[bgName]->ref--;
635} 635}
636 636
637void LauncherView::hideIcons() 637void LauncherView::hideIcons()
638{ 638{
639 icons->hide(); 639 icons->hide();
640} 640}
641 641
642void LauncherView::setToolsEnabled(bool y) 642void LauncherView::setToolsEnabled(bool y)
643{ 643{
644 if ( !y != !tools ) { 644 if ( !y != !tools ) {
645 if ( y ) { 645 if ( y ) {
646 tools = new QHBox(this); 646 tools = new QHBox(this);
647 647
648 // Type filter 648 // Type filter
649 typemb = new QComboBox(tools); 649 typemb = new QComboBox(tools);
650 QSizePolicy p = typemb->sizePolicy(); 650 QSizePolicy p = typemb->sizePolicy();
651 p.setHorData(QSizePolicy::Expanding); 651 p.setHorData(QSizePolicy::Expanding);
652 typemb->setSizePolicy(p); 652 typemb->setSizePolicy(p);
653 653
654 // Category filter 654 // Category filter
655 updateTools(); 655 updateTools();
656 tools->show(); 656 tools->show();
657 657
658 // Always show vscrollbar 658 // Always show vscrollbar
659 icons->setVScrollBarMode( QScrollView::AlwaysOn ); 659 icons->setVScrollBarMode( QScrollView::AlwaysOn );
660 } else { 660 } else {
661 delete tools; 661 delete tools;
662 tools = 0; 662 tools = 0;
663 } 663 }
664 } 664 }
665} 665}
666 666
667void LauncherView::updateTools() 667void LauncherView::updateTools()
668{ 668{
669 disconnect( typemb, SIGNAL(activated(int)), 669 disconnect( typemb, SIGNAL(activated(int)),
670 this, SLOT(showType(int)) ); 670 this, SLOT(showType(int)) );
671 if ( catmb ) disconnect( catmb, SIGNAL(signalSelected(int)), 671 if ( catmb ) disconnect( catmb, SIGNAL(signalSelected(int)),
672 this, SLOT(showCategory(int)) ); 672 this, SLOT(showCategory(int)) );
673 673
diff --git a/core/launcher/packageslave.cpp b/core/launcher/packageslave.cpp
index 321b5dd..7e61b0e 100644
--- a/core/launcher/packageslave.cpp
+++ b/core/launcher/packageslave.cpp
@@ -7,98 +7,98 @@
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 "packageslave.h" 21#include "packageslave.h"
22#include <qtopia/qprocess.h> 22#include <qtopia/qprocess.h>
23 23
24#ifdef Q_WS_QWS 24#ifdef Q_WS_QWS
25#include <qtopia/qcopenvelope_qws.h> 25#include <qtopia/qcopenvelope_qws.h>
26#endif 26#endif
27 27
28#ifdef Q_WS_QWS 28#ifdef Q_WS_QWS
29#include <qcopchannel_qws.h> 29#include <qcopchannel_qws.h>
30#endif 30#endif
31 31
32#include <qtextstream.h> 32#include <qtextstream.h>
33 33
34#include <stdlib.h> 34#include <stdlib.h>
35#include <sys/stat.h> // mkdir() 35#include <sys/stat.h> // mkdir()
36 36
37#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 37#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
38#include <unistd.h> 38#include <unistd.h>
39#include <sys/vfs.h> 39#include <sys/vfs.h>
40#include <mntent.h> 40#include <mntent.h>
41#elif defined(Q_OS_WIN32) 41#elif defined(Q_OS_WIN32)
42#include <windows.h> 42#include <windows.h>
43#include <winbase.h> 43#include <winbase.h>
44#elif defined(Q_OS_MACX) 44#elif defined(Q_OS_MACX)
45#include <unistd.h> 45#include <unistd.h>
46#endif 46#endif
47 47
48 48
49PackageHandler::PackageHandler( QObject *parent, char* name ) 49PackageHandler::PackageHandler( QObject *parent, char* name )
50 : QObject( parent, name ), packageChannel( 0 ), currentProcess( 0 ), mNoSpaceLeft( FALSE ) 50 : QObject( parent, name ), packageChannel( 0 ), currentProcess( 0 ), mNoSpaceLeft( FALSE )
51{ 51{
52 // setup qcop channel 52 // setup qcop channel
53#ifndef QT_NO_COP 53#ifndef QT_NO_COP
54 packageChannel = new QCopChannel( "QPE/Package", this ); 54 packageChannel = new QCopChannel( "QPE/Package", this );
55 connect( packageChannel, SIGNAL( received(const QCString &, const QByteArray &) ), 55 connect( packageChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
56 this, SLOT( qcopMessage( const QCString &, const QByteArray &) ) ); 56 this, SLOT( qcopMessage(const QCString&,const QByteArray&) ) );
57#endif 57#endif
58} 58}
59 59
60void PackageHandler::qcopMessage( const QCString &msg, const QByteArray &data ) 60void PackageHandler::qcopMessage( const QCString &msg, const QByteArray &data )
61{ 61{
62 QDataStream stream( data, IO_ReadOnly ); 62 QDataStream stream( data, IO_ReadOnly );
63 63
64 if ( msg == "installPackage(QString)" ) { 64 if ( msg == "installPackage(QString)" ) {
65 QString file; 65 QString file;
66 stream >> file; 66 stream >> file;
67 installPackage( file ); 67 installPackage( file );
68 } else if ( msg == "removePackage(QString)" ) { 68 } else if ( msg == "removePackage(QString)" ) {
69 QString file; 69 QString file;
70 stream >> file; 70 stream >> file;
71 removePackage( file ); 71 removePackage( file );
72 } else if ( msg == "addPackageFiles(QString,QString)" ) { 72 } else if ( msg == "addPackageFiles(QString,QString)" ) {
73 QString location, listfile; 73 QString location, listfile;
74 stream >> location >> listfile; 74 stream >> location >> listfile;
75 addPackageFiles( location, listfile); 75 addPackageFiles( location, listfile);
76 } else if ( msg == "addPackages(QString)" ) { 76 } else if ( msg == "addPackages(QString)" ) {
77 QString location; 77 QString location;
78 stream >> location; 78 stream >> location;
79 addPackages( location ); 79 addPackages( location );
80 } else if ( msg == "cleanupPackageFiles(QString)" ) { 80 } else if ( msg == "cleanupPackageFiles(QString)" ) {
81 QString listfile; 81 QString listfile;
82 stream >> listfile; 82 stream >> listfile;
83 cleanupPackageFiles( listfile ); 83 cleanupPackageFiles( listfile );
84 } else if ( msg == "cleanupPackages(QString)" ) { 84 } else if ( msg == "cleanupPackages(QString)" ) {
85 QString location; 85 QString location;
86 stream >> location; 86 stream >> location;
87 cleanupPackages( location ); 87 cleanupPackages( location );
88 } else if ( msg == "prepareInstall(QString,QString)" ) { 88 } else if ( msg == "prepareInstall(QString,QString)" ) {
89 QString size, path; 89 QString size, path;
90 stream >> size; 90 stream >> size;
91 stream >> path; 91 stream >> path;
92 prepareInstall( size, path ); 92 prepareInstall( size, path );
93 } 93 }
94} 94}
95 95
96void PackageHandler::installPackage( const QString &package ) 96void PackageHandler::installPackage( const QString &package )
97{ 97{
98 if ( mNoSpaceLeft ) { 98 if ( mNoSpaceLeft ) {
99 mNoSpaceLeft = FALSE; 99 mNoSpaceLeft = FALSE;
100 // Don't emit that for now, I still couldn't test it (Wener) 100 // Don't emit that for now, I still couldn't test it (Wener)
101 //sendReply( "installFailed(QString)", package ); 101 //sendReply( "installFailed(QString)", package );
102 //return; 102 //return;
103 } 103 }
104 104
diff --git a/core/launcher/qcopbridge.cpp b/core/launcher/qcopbridge.cpp
index 24f471d..53efba4 100644
--- a/core/launcher/qcopbridge.cpp
+++ b/core/launcher/qcopbridge.cpp
@@ -20,135 +20,135 @@
20 20
21#include "qcopbridge.h" 21#include "qcopbridge.h"
22#include "transferserver.h" 22#include "transferserver.h"
23 23
24#include <opie2/oglobal.h> 24#include <opie2/oglobal.h>
25 25
26#ifdef Q_WS_QWS 26#ifdef Q_WS_QWS
27#include <qtopia/qcopenvelope_qws.h> 27#include <qtopia/qcopenvelope_qws.h>
28#endif 28#endif
29#include <qtopia/qpeapplication.h> 29#include <qtopia/qpeapplication.h>
30 30
31#include <qtopia/version.h> 31#include <qtopia/version.h>
32 32
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qtimer.h> 34#include <qtimer.h>
35#ifdef Q_WS_QWS 35#ifdef Q_WS_QWS
36#include <qcopchannel_qws.h> 36#include <qcopchannel_qws.h>
37#endif 37#endif
38 38
39#ifndef _XOPEN_SOURCE 39#ifndef _XOPEN_SOURCE
40#define _XOPEN_SOURCE 40#define _XOPEN_SOURCE
41#endif 41#endif
42#ifndef Q_OS_WIN32 42#ifndef Q_OS_WIN32
43#include <pwd.h> 43#include <pwd.h>
44#include <unistd.h> 44#include <unistd.h>
45#include <sys/types.h> 45#include <sys/types.h>
46#endif 46#endif
47 47
48#if defined(_OS_LINUX_) 48#if defined(_OS_LINUX_)
49#include <shadow.h> 49#include <shadow.h>
50#endif 50#endif
51 51
52 52
53//#define INSECURE 53//#define INSECURE
54 54
55const int block_size = 51200; 55const int block_size = 51200;
56 56
57QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent, 57QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent,
58 const char* name ) 58 const char* name )
59 : QServerSocket( port, 1, parent, name ), 59 : QServerSocket( port, 1, parent, name ),
60 desktopChannel( 0 ), 60 desktopChannel( 0 ),
61 cardChannel( 0 ) 61 cardChannel( 0 )
62{ 62{
63 if ( !ok() ) 63 if ( !ok() )
64 qWarning( "Failed to bind to port %d", port ); 64 qWarning( "Failed to bind to port %d", port );
65 else { 65 else {
66#ifndef QT_NO_COP 66#ifndef QT_NO_COP
67 desktopChannel = new QCopChannel( "QPE/Desktop", this ); 67 desktopChannel = new QCopChannel( "QPE/Desktop", this );
68 connect( desktopChannel, SIGNAL(received(const QCString &, const QByteArray &)), 68 connect( desktopChannel, SIGNAL(received(const QCString&,const QByteArray&)),
69 this, SLOT(desktopMessage( const QCString &, const QByteArray &)) ); 69 this, SLOT(desktopMessage(const QCString&,const QByteArray&)) );
70 cardChannel = new QCopChannel( "QPE/Card", this ); 70 cardChannel = new QCopChannel( "QPE/Card", this );
71 connect( cardChannel, SIGNAL(received(const QCString &, const QByteArray &)), 71 connect( cardChannel, SIGNAL(received(const QCString&,const QByteArray&)),
72 this, SLOT(desktopMessage( const QCString &, const QByteArray &)) ); 72 this, SLOT(desktopMessage(const QCString&,const QByteArray&)) );
73#endif 73#endif
74 } 74 }
75 sendSync = FALSE; 75 sendSync = FALSE;
76 openConnections.setAutoDelete( TRUE ); 76 openConnections.setAutoDelete( TRUE );
77 authorizeConnections(); 77 authorizeConnections();
78} 78}
79 79
80QCopBridge::~QCopBridge() 80QCopBridge::~QCopBridge()
81{ 81{
82#ifndef QT_NO_COP 82#ifndef QT_NO_COP
83 delete desktopChannel; 83 delete desktopChannel;
84#endif 84#endif
85} 85}
86 86
87void QCopBridge::authorizeConnections() 87void QCopBridge::authorizeConnections()
88{ 88{
89 Config cfg("Security"); 89 Config cfg("Security");
90 cfg.setGroup("SyncMode"); 90 cfg.setGroup("SyncMode");
91 m_mode = Mode(cfg.readNumEntry("Mode", Sharp )); 91 m_mode = Mode(cfg.readNumEntry("Mode", Sharp ));
92 QListIterator<QCopBridgePI> it(openConnections); 92 QListIterator<QCopBridgePI> it(openConnections);
93 while ( it.current() ) { 93 while ( it.current() ) {
94 if ( !it.current()->verifyAuthorised() ) { 94 if ( !it.current()->verifyAuthorised() ) {
95 disconnect ( it.current(), SIGNAL( connectionClosed( QCopBridgePI *) ), this, SLOT( closed( QCopBridgePI *) ) ); 95 disconnect ( it.current(), SIGNAL( connectionClosed(QCopBridgePI*) ), this, SLOT( closed(QCopBridgePI*) ) );
96 openConnections.removeRef( it.current() ); 96 openConnections.removeRef( it.current() );
97 } else 97 } else
98 ++it; 98 ++it;
99 } 99 }
100} 100}
101 101
102void QCopBridge::newConnection( int socket ) 102void QCopBridge::newConnection( int socket )
103{ 103{
104 QCopBridgePI *pi = new QCopBridgePI( socket, this ); 104 QCopBridgePI *pi = new QCopBridgePI( socket, this );
105 openConnections.append( pi ); 105 openConnections.append( pi );
106 connect ( pi, SIGNAL( connectionClosed( QCopBridgePI *) ), this, SLOT( closed( QCopBridgePI *) ) ); 106 connect ( pi, SIGNAL( connectionClosed(QCopBridgePI*) ), this, SLOT( closed(QCopBridgePI*) ) );
107 107
108 /* ### libqtopia merge FIXME */ 108 /* ### libqtopia merge FIXME */
109#if 0 109#if 0
110 QPEApplication::setTempScreenSaverMode( QPEApplication::DisableSuspend ); 110 QPEApplication::setTempScreenSaverMode( QPEApplication::DisableSuspend );
111#endif 111#endif
112#ifndef QT_NO_COP 112#ifndef QT_NO_COP
113 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; 113 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend;
114#endif 114#endif
115 115
116 if ( sendSync ) { 116 if ( sendSync ) {
117 pi ->startSync(); 117 pi ->startSync();
118 sendSync = FALSE; 118 sendSync = FALSE;
119 } 119 }
120} 120}
121 121
122void QCopBridge::closed( QCopBridgePI *pi ) 122void QCopBridge::closed( QCopBridgePI *pi )
123{ 123{
124 emit connectionClosed( pi->peerAddress() ); 124 emit connectionClosed( pi->peerAddress() );
125 openConnections.removeRef( pi ); 125 openConnections.removeRef( pi );
126 if ( openConnections.count() == 0 ) { 126 if ( openConnections.count() == 0 ) {
127 /* ### FIXME libqtopia merge */ 127 /* ### FIXME libqtopia merge */
128#if 0 128#if 0
129 QPEApplication::setTempScreenSaverMode( QPEApplication::Enable ); 129 QPEApplication::setTempScreenSaverMode( QPEApplication::Enable );
130#endif 130#endif
131#ifndef QT_NO_COP 131#ifndef QT_NO_COP
132 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 132 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
133#endif 133#endif
134 } 134 }
135} 135}
136 136
137void QCopBridge::closeOpenConnections() 137void QCopBridge::closeOpenConnections()
138{ 138{
139 QCopBridgePI *pi; 139 QCopBridgePI *pi;
140 for ( pi = openConnections.first(); pi != 0; pi = openConnections.next() ) 140 for ( pi = openConnections.first(); pi != 0; pi = openConnections.next() )
141 pi->close(); 141 pi->close();
142} 142}
143 143
144 144
145void QCopBridge::desktopMessage( const QCString &command, const QByteArray &data ) 145void QCopBridge::desktopMessage( const QCString &command, const QByteArray &data )
146{ 146{
147 if ( command == "startSync()" ) { 147 if ( command == "startSync()" ) {
148 // we need to buffer it a bit 148 // we need to buffer it a bit
149 sendSync = TRUE; 149 sendSync = TRUE;
150 startTimer( 20000 ); 150 startTimer( 20000 );
151 } 151 }
152 152
153 if ( m_mode & Qtopia1_7 ) { 153 if ( m_mode & Qtopia1_7 ) {
154 // send the command to all open connections 154 // send the command to all open connections
diff --git a/core/launcher/runningappbar.cpp b/core/launcher/runningappbar.cpp
index 11d10dc..2e9d2a9 100644
--- a/core/launcher/runningappbar.cpp
+++ b/core/launcher/runningappbar.cpp
@@ -1,86 +1,86 @@
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 QTOPIA_INTERNAL_PRELOADACCESS 21#define QTOPIA_INTERNAL_PRELOADACCESS
22 22
23 23
24#include <stdlib.h> 24#include <stdlib.h>
25 25
26#include <qpainter.h> 26#include <qpainter.h>
27 27
28#include <qtopia/qcopenvelope_qws.h> 28#include <qtopia/qcopenvelope_qws.h>
29 29
30#include "runningappbar.h" 30#include "runningappbar.h"
31#include "serverinterface.h" 31#include "serverinterface.h"
32 32
33RunningAppBar::RunningAppBar(QWidget* parent) 33RunningAppBar::RunningAppBar(QWidget* parent)
34 : QFrame(parent), selectedAppIndex(-1) 34 : QFrame(parent), selectedAppIndex(-1)
35{ 35{
36 QCopChannel* channel = new QCopChannel( "QPE/System", this ); 36 QCopChannel* channel = new QCopChannel( "QPE/System", this );
37 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 37 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
38 this, SLOT(received(const QCString&, const QByteArray&)) ); 38 this, SLOT(received(const QCString&,const QByteArray&)) );
39 39
40 spacing = AppLnk::smallIconSize()+3; 40 spacing = AppLnk::smallIconSize()+3;
41} 41}
42 42
43RunningAppBar::~RunningAppBar() 43RunningAppBar::~RunningAppBar()
44{ 44{
45} 45}
46 46
47void RunningAppBar::received(const QCString& msg, const QByteArray& data) { 47void RunningAppBar::received(const QCString& msg, const QByteArray& data) {
48 // Since fast apps appear and disappear without disconnecting from their 48 // Since fast apps appear and disappear without disconnecting from their
49 // channel we need to watch for the showing/hiding events and update according. 49 // channel we need to watch for the showing/hiding events and update according.
50 QDataStream stream( data, IO_ReadOnly ); 50 QDataStream stream( data, IO_ReadOnly );
51 if ( msg == "fastAppShowing(QString)") { 51 if ( msg == "fastAppShowing(QString)") {
52 QString appName; 52 QString appName;
53 stream >> appName; 53 stream >> appName;
54 // qDebug("fastAppShowing %s", appName.data() ); 54 // qDebug("fastAppShowing %s", appName.data() );
55 const AppLnk* f = ServerInterface::appLnks().findExec(appName); 55 const AppLnk* f = ServerInterface::appLnks().findExec(appName);
56 if ( f ) addTask(*f); 56 if ( f ) addTask(*f);
57 } else if ( msg == "fastAppHiding(QString)") { 57 } else if ( msg == "fastAppHiding(QString)") {
58 QString appName; 58 QString appName;
59 stream >> appName; 59 stream >> appName;
60 const AppLnk* f = ServerInterface::appLnks().findExec(appName); 60 const AppLnk* f = ServerInterface::appLnks().findExec(appName);
61 if ( f ) removeTask(*f); 61 if ( f ) removeTask(*f);
62 } 62 }
63} 63}
64 64
65void RunningAppBar::addTask(const AppLnk& appLnk) { 65void RunningAppBar::addTask(const AppLnk& appLnk) {
66 qDebug("Added %s to app list.", appLnk.name().latin1()); 66 qDebug("Added %s to app list.", appLnk.name().latin1());
67 AppLnk* newApp = new AppLnk(appLnk); 67 AppLnk* newApp = new AppLnk(appLnk);
68 newApp->setExec(appLnk.exec()); 68 newApp->setExec(appLnk.exec());
69 appList.prepend(newApp); 69 appList.prepend(newApp);
70 update(); 70 update();
71} 71}
72 72
73void RunningAppBar::removeTask(const AppLnk& appLnk) { 73void RunningAppBar::removeTask(const AppLnk& appLnk) {
74 unsigned int i = 0; 74 unsigned int i = 0;
75 for (; i < appList.count() ; i++) { 75 for (; i < appList.count() ; i++) {
76 AppLnk* target = appList.at(i); 76 AppLnk* target = appList.at(i);
77 if (target->exec() == appLnk.exec()) { 77 if (target->exec() == appLnk.exec()) {
78 qDebug("Removing %s from app list.", appLnk.name().latin1()); 78 qDebug("Removing %s from app list.", appLnk.name().latin1());
79 appList.remove(); 79 appList.remove();
80 delete target; 80 delete target;
81 } 81 }
82 } 82 }
83 update(); 83 update();
84} 84}
85 85
86void RunningAppBar::mousePressEvent(QMouseEvent *e) 86void RunningAppBar::mousePressEvent(QMouseEvent *e)
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp
index 068d716..ea0b792 100644
--- a/core/launcher/server.cpp
+++ b/core/launcher/server.cpp
@@ -102,120 +102,120 @@ static Global::Command builtins[] = {
102#ifdef SINGLE_APP 102#ifdef SINGLE_APP
103#define APP(a,b,c,d) { a, new##b, c, d }, 103#define APP(a,b,c,d) { a, new##b, c, d },
104#include "apps.h" 104#include "apps.h"
105#undef APP 105#undef APP
106#endif 106#endif
107 107
108 /* FIXME defines need to be defined*/ 108 /* FIXME defines need to be defined*/
109#if !defined(OPIE_NO_BUILTIN_CALIBRATE) 109#if !defined(OPIE_NO_BUILTIN_CALIBRATE)
110 { "calibrate", calibrate, 1, 0 }, // No tr 110 { "calibrate", calibrate, 1, 0 }, // No tr
111#endif 111#endif
112#if !defined(OPIE_NO_BUILTIN_SHUTDOWN) 112#if !defined(OPIE_NO_BUILTIN_SHUTDOWN)
113 { "shutdown", Global::shutdown, 1, 0 }, // No tr 113 { "shutdown", Global::shutdown, 1, 0 }, // No tr
114 // { "run", run, 1, 0 }, // No tr 114 // { "run", run, 1, 0 }, // No tr
115#endif 115#endif
116 116
117 { 0, calibrate,0, 0 }, 117 { 0, calibrate,0, 0 },
118}; 118};
119 119
120 120
121//--------------------------------------------------------------------------- 121//---------------------------------------------------------------------------
122 122
123 123
124//=========================================================================== 124//===========================================================================
125 125
126Server::Server() : 126Server::Server() :
127 QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), 127 QWidget( 0, 0, WStyle_Tool | WStyle_Customize ),
128 qcopBridge( 0 ), 128 qcopBridge( 0 ),
129 transferServer( 0 ), 129 transferServer( 0 ),
130 packageHandler( 0 ), 130 packageHandler( 0 ),
131 syncDialog( 0 ) 131 syncDialog( 0 )
132{ 132{
133 Global::setBuiltinCommands(builtins); 133 Global::setBuiltinCommands(builtins);
134 134
135 tid_xfer = 0; 135 tid_xfer = 0;
136 /* ### FIXME ### */ 136 /* ### FIXME ### */
137/* tid_today = startTimer(3600*2*1000);*/ 137/* tid_today = startTimer(3600*2*1000);*/
138 last_today_show = QDate::currentDate(); 138 last_today_show = QDate::currentDate();
139 139
140#if 0 140#if 0
141 tsmMonitor = new TempScreenSaverMode(); 141 tsmMonitor = new TempScreenSaverMode();
142 connect( tsmMonitor, SIGNAL(forceSuspend()), qApp, SIGNAL(power()) ); 142 connect( tsmMonitor, SIGNAL(forceSuspend()), qApp, SIGNAL(power()) );
143#endif 143#endif
144 144
145 serverGui = new Launcher; 145 serverGui = new Launcher;
146 serverGui->createGUI(); 146 serverGui->createGUI();
147 147
148 docList = new DocumentList( serverGui ); 148 docList = new DocumentList( serverGui );
149 appLauncher = new AppLauncher(this); 149 appLauncher = new AppLauncher(this);
150 connect(appLauncher, SIGNAL(launched(int, const QString &)), this, SLOT(applicationLaunched(int, const QString &)) ); 150 connect(appLauncher, SIGNAL(launched(int,const QString&)), this, SLOT(applicationLaunched(int,const QString&)) );
151 connect(appLauncher, SIGNAL(terminated(int, const QString &)), this, SLOT(applicationTerminated(int, const QString &)) ); 151 connect(appLauncher, SIGNAL(terminated(int,const QString&)), this, SLOT(applicationTerminated(int,const QString&)) );
152 connect(appLauncher, SIGNAL(connected(const QString &)), this, SLOT(applicationConnected(const QString &)) ); 152 connect(appLauncher, SIGNAL(connected(const QString&)), this, SLOT(applicationConnected(const QString&)) );
153 153
154 storage = new StorageInfo( this ); 154 storage = new StorageInfo( this );
155 connect( storage, SIGNAL(disksChanged()), this, SLOT(storageChanged()) ); 155 connect( storage, SIGNAL(disksChanged()), this, SLOT(storageChanged()) );
156 156
157 // start services 157 // start services
158 startTransferServer(); 158 startTransferServer();
159 (void) new IrServer( this ); 159 (void) new IrServer( this );
160 160
161 packageHandler = new PackageHandler( this ); 161 packageHandler = new PackageHandler( this );
162 connect(qApp, SIGNAL(activate(const Opie::ODeviceButton*,bool)), 162 connect(qApp, SIGNAL(activate(const Opie::ODeviceButton*,bool)),
163 this,SLOT(activate(const Opie::ODeviceButton*,bool))); 163 this,SLOT(activate(const Opie::ODeviceButton*,bool)));
164 164
165 setGeometry( -10, -10, 9, 9 ); 165 setGeometry( -10, -10, 9, 9 );
166 166
167 QCopChannel *channel = new QCopChannel("QPE/System", this); 167 QCopChannel *channel = new QCopChannel("QPE/System", this);
168 connect(channel, SIGNAL(received(const QCString &, const QByteArray &)), 168 connect(channel, SIGNAL(received(const QCString&,const QByteArray&)),
169 this, SLOT(systemMsg(const QCString &, const QByteArray &)) ); 169 this, SLOT(systemMsg(const QCString&,const QByteArray&)) );
170 170
171 QCopChannel *tbChannel = new QCopChannel( "QPE/TaskBar", this ); 171 QCopChannel *tbChannel = new QCopChannel( "QPE/TaskBar", this );
172 connect( tbChannel, SIGNAL(received(const QCString&, const QByteArray&)), 172 connect( tbChannel, SIGNAL(received(const QCString&,const QByteArray&)),
173 this, SLOT(receiveTaskBar(const QCString&, const QByteArray&)) ); 173 this, SLOT(receiveTaskBar(const QCString&,const QByteArray&)) );
174 174
175 connect( qApp, SIGNAL(prepareForRestart()), this, SLOT(terminateServers()) ); 175 connect( qApp, SIGNAL(prepareForRestart()), this, SLOT(terminateServers()) );
176 connect( qApp, SIGNAL(timeChanged()), this, SLOT(pokeTimeMonitors()) ); 176 connect( qApp, SIGNAL(timeChanged()), this, SLOT(pokeTimeMonitors()) );
177 177
178 preloadApps(); 178 preloadApps();
179} 179}
180 180
181void Server::show() 181void Server::show()
182{ 182{
183 ServerApplication::login(TRUE); 183 ServerApplication::login(TRUE);
184 QWidget::show(); 184 QWidget::show();
185} 185}
186 186
187Server::~Server() 187Server::~Server()
188{ 188{
189 serverGui->destroyGUI(); 189 serverGui->destroyGUI();
190 delete docList; 190 delete docList;
191 delete qcopBridge; 191 delete qcopBridge;
192 delete transferServer; 192 delete transferServer;
193 delete serverGui; 193 delete serverGui;
194#if 0 194#if 0
195 delete tsmMonitor; 195 delete tsmMonitor;
196#endif 196#endif
197} 197}
198 198
199static bool hasVisibleWindow(const QString& clientname, bool partial) 199static bool hasVisibleWindow(const QString& clientname, bool partial)
200{ 200{
201#ifdef QWS 201#ifdef QWS
202 const QList<QWSWindow> &list = qwsServer->clientWindows(); 202 const QList<QWSWindow> &list = qwsServer->clientWindows();
203 QWSWindow* w; 203 QWSWindow* w;
204 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { 204 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
205 if ( w->client()->identity() == clientname ) { 205 if ( w->client()->identity() == clientname ) {
206 if ( partial && !w->isFullyObscured() ) 206 if ( partial && !w->isFullyObscured() )
207 return TRUE; 207 return TRUE;
208 if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) { 208 if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) {
209# if QT_VERSION < 0x030000 209# if QT_VERSION < 0x030000
210 QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect, 210 QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect,
211 QSize(qt_screen->width(),qt_screen->height()) ); 211 QSize(qt_screen->width(),qt_screen->height()) );
212# else 212# else
213 QRect mwr = qt_maxWindowRect; 213 QRect mwr = qt_maxWindowRect;
214# endif 214# endif
215 if ( mwr.contains(w->requested().boundingRect()) ) 215 if ( mwr.contains(w->requested().boundingRect()) )
216 return TRUE; 216 return TRUE;
217 } 217 }
218 } 218 }
219 } 219 }
220#endif 220#endif
221 return FALSE; 221 return FALSE;
@@ -568,98 +568,98 @@ bool Server::mkdir(const QString &localPath)
568 568
569 QString dirSeps = "/"; 569 QString dirSeps = "/";
570 int dirIndex = localPath.find(dirSeps); 570 int dirIndex = localPath.find(dirSeps);
571 QString checkedPath; 571 QString checkedPath;
572 572
573 // didn't find any seps; weird, use the cur dir instead 573 // didn't find any seps; weird, use the cur dir instead
574 if (dirIndex == -1) { 574 if (dirIndex == -1) {
575 //qDebug("No seperators found in path %s", localPath.latin1()); 575 //qDebug("No seperators found in path %s", localPath.latin1());
576 checkedPath = QDir::currentDirPath(); 576 checkedPath = QDir::currentDirPath();
577 } 577 }
578 578
579 while (checkedPath != localPath) { 579 while (checkedPath != localPath) {
580 // no more seperators found, use the local path 580 // no more seperators found, use the local path
581 if (dirIndex == -1) 581 if (dirIndex == -1)
582 checkedPath = localPath; 582 checkedPath = localPath;
583 else { 583 else {
584 // the next directory to check 584 // the next directory to check
585 checkedPath = localPath.left(dirIndex) + "/"; 585 checkedPath = localPath.left(dirIndex) + "/";
586 // advance the iterator; the next dir seperator 586 // advance the iterator; the next dir seperator
587 dirIndex = localPath.find(dirSeps, dirIndex+1); 587 dirIndex = localPath.find(dirSeps, dirIndex+1);
588 } 588 }
589 589
590 QDir checkDir(checkedPath); 590 QDir checkDir(checkedPath);
591 if (!checkDir.exists()) { 591 if (!checkDir.exists()) {
592 //qDebug("mkdir making dir %s", checkedPath.latin1()); 592 //qDebug("mkdir making dir %s", checkedPath.latin1());
593 593
594 if (!checkDir.mkdir(checkedPath)) { 594 if (!checkDir.mkdir(checkedPath)) {
595 qDebug("Unable to make directory %s", checkedPath.latin1()); 595 qDebug("Unable to make directory %s", checkedPath.latin1());
596 return FALSE; 596 return FALSE;
597 } 597 }
598 } 598 }
599 599
600 } 600 }
601 return TRUE; 601 return TRUE;
602} 602}
603 603
604void Server::styleChange( QStyle &s ) 604void Server::styleChange( QStyle &s )
605{ 605{
606 QWidget::styleChange( s ); 606 QWidget::styleChange( s );
607} 607}
608 608
609void Server::startTransferServer() 609void Server::startTransferServer()
610{ 610{
611 if ( !qcopBridge ) { 611 if ( !qcopBridge ) {
612 // start qcop bridge server 612 // start qcop bridge server
613 qcopBridge = new QCopBridge( 4243 ); 613 qcopBridge = new QCopBridge( 4243 );
614 if ( qcopBridge->ok() ) { 614 if ( qcopBridge->ok() ) {
615 // ... OK 615 // ... OK
616 connect( qcopBridge, SIGNAL(connectionClosed(const QHostAddress &)), 616 connect( qcopBridge, SIGNAL(connectionClosed(const QHostAddress&)),
617 this, SLOT(syncConnectionClosed(const QHostAddress &)) ); 617 this, SLOT(syncConnectionClosed(const QHostAddress&)) );
618 } else { 618 } else {
619 delete qcopBridge; 619 delete qcopBridge;
620 qcopBridge = 0; 620 qcopBridge = 0;
621 } 621 }
622 } 622 }
623 if ( !transferServer ) { 623 if ( !transferServer ) {
624 // start transfer server 624 // start transfer server
625 transferServer = new TransferServer( 4242 ); 625 transferServer = new TransferServer( 4242 );
626 if ( transferServer->ok() ) { 626 if ( transferServer->ok() ) {
627 // ... OK 627 // ... OK
628 } else { 628 } else {
629 delete transferServer; 629 delete transferServer;
630 transferServer = 0; 630 transferServer = 0;
631 } 631 }
632 } 632 }
633 if ( !transferServer || !qcopBridge ) 633 if ( !transferServer || !qcopBridge )
634 tid_xfer = startTimer( 2000 ); 634 tid_xfer = startTimer( 2000 );
635} 635}
636 636
637void Server::timerEvent( QTimerEvent *e ) 637void Server::timerEvent( QTimerEvent *e )
638{ 638{
639 if ( e->timerId() == tid_xfer ) { 639 if ( e->timerId() == tid_xfer ) {
640 killTimer( tid_xfer ); 640 killTimer( tid_xfer );
641 tid_xfer = 0; 641 tid_xfer = 0;
642 startTransferServer(); 642 startTransferServer();
643 } 643 }
644 /* ### FIXME today startin */ 644 /* ### FIXME today startin */
645#if 0 645#if 0
646 else if ( e->timerId() == tid_today ) { 646 else if ( e->timerId() == tid_today ) {
647 QDate today = QDate::currentDate(); 647 QDate today = QDate::currentDate();
648 if ( today != last_today_show ) { 648 if ( today != last_today_show ) {
649 last_today_show = today; 649 last_today_show = today;
650 Config cfg("today"); 650 Config cfg("today");
651 cfg.setGroup("Start"); 651 cfg.setGroup("Start");
652#ifndef QPE_DEFAULT_TODAY_MODE 652#ifndef QPE_DEFAULT_TODAY_MODE
653#define QPE_DEFAULT_TODAY_MODE "Never" 653#define QPE_DEFAULT_TODAY_MODE "Never"
654#endif 654#endif
655 if ( cfg.readEntry("Mode",QPE_DEFAULT_TODAY_MODE) == "Daily" ) { 655 if ( cfg.readEntry("Mode",QPE_DEFAULT_TODAY_MODE) == "Daily" ) {
656 QCopEnvelope env(Service::channel("today"),"raise()"); 656 QCopEnvelope env(Service::channel("today"),"raise()");
657 } 657 }
658 } 658 }
659 } 659 }
660#endif 660#endif
661} 661}
662 662
663void Server::terminateServers() 663void Server::terminateServers()
664{ 664{
665 delete transferServer; 665 delete transferServer;
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp
index f7c2341..d38dd97 100644
--- a/core/launcher/serverapp.cpp
+++ b/core/launcher/serverapp.cpp
@@ -256,108 +256,108 @@ enum MemState { MemUnknown, MemVeryLow, MemLow, MemNormal } memstate=MemUnknown;
256QPE_MEMALERTER_IMPL 256QPE_MEMALERTER_IMPL
257#endif 257#endif
258 258
259 259
260 260
261//--------------------------------------------------------------------------- 261//---------------------------------------------------------------------------
262 262
263bool ServerApplication::doRestart = FALSE; 263bool ServerApplication::doRestart = FALSE;
264bool ServerApplication::allowRestart = TRUE; 264bool ServerApplication::allowRestart = TRUE;
265bool ServerApplication::ms_is_starting = TRUE; 265bool ServerApplication::ms_is_starting = TRUE;
266 266
267void ServerApplication::switchLCD( bool on ) { 267void ServerApplication::switchLCD( bool on ) {
268 if ( !qApp ) 268 if ( !qApp )
269 return; 269 return;
270 270
271 ServerApplication *dapp = ServerApplication::me() ; 271 ServerApplication *dapp = ServerApplication::me() ;
272 272
273 if ( !dapp-> m_screensaver ) 273 if ( !dapp-> m_screensaver )
274 return; 274 return;
275 275
276 if ( on ) { 276 if ( on ) {
277 dapp-> m_screensaver-> setDisplayState ( true ); 277 dapp-> m_screensaver-> setDisplayState ( true );
278 dapp-> m_screensaver-> setBacklight ( -3 ); 278 dapp-> m_screensaver-> setBacklight ( -3 );
279 }else 279 }else
280 dapp-> m_screensaver-> setDisplayState ( false ); 280 dapp-> m_screensaver-> setDisplayState ( false );
281 281
282 282
283} 283}
284 284
285ServerApplication::ServerApplication( int& argc, char **argv, Type t ) 285ServerApplication::ServerApplication( int& argc, char **argv, Type t )
286 : QPEApplication( argc, argv, t ) 286 : QPEApplication( argc, argv, t )
287{ 287{
288 ms_is_starting = true; 288 ms_is_starting = true;
289 289
290 // We know we'll have lots of cached pixmaps due to App/DocLnks 290 // We know we'll have lots of cached pixmaps due to App/DocLnks
291 QPixmapCache::setCacheLimit(512); 291 QPixmapCache::setCacheLimit(512);
292 292
293 m_ps = new PowerStatus; 293 m_ps = new PowerStatus;
294 m_ps_last = new PowerStatus; 294 m_ps_last = new PowerStatus;
295 pa = new DesktopPowerAlerter( 0 ); 295 pa = new DesktopPowerAlerter( 0 );
296 296
297 m_apm_timer = new QTimer( this ); 297 m_apm_timer = new QTimer( this );
298 connect(m_apm_timer, SIGNAL( timeout() ), 298 connect(m_apm_timer, SIGNAL( timeout() ),
299 this, SLOT( apmTimeout() ) ); 299 this, SLOT( apmTimeout() ) );
300 300
301 reloadPowerWarnSettings(); 301 reloadPowerWarnSettings();
302 302
303 QCopChannel *channel = new QCopChannel( "QPE/System", this ); 303 QCopChannel *channel = new QCopChannel( "QPE/System", this );
304 connect(channel, SIGNAL(received( const QCString&, const QByteArray& ) ), 304 connect(channel, SIGNAL(received(const QCString&,const QByteArray&) ),
305 this, SLOT(systemMessage(const QCString&, const QByteArray& ) ) ); 305 this, SLOT(systemMessage(const QCString&,const QByteArray&) ) );
306 306
307 channel = new QCopChannel("QPE/Launcher", this ); 307 channel = new QCopChannel("QPE/Launcher", this );
308 connect(channel, SIGNAL(received( const QCString&, const QByteArray& ) ), 308 connect(channel, SIGNAL(received(const QCString&,const QByteArray&) ),
309 this, SLOT(launcherMessage( const QCString&, const QByteArray& ) ) ); 309 this, SLOT(launcherMessage(const QCString&,const QByteArray&) ) );
310 310
311 m_screensaver = new OpieScreenSaver(); 311 m_screensaver = new OpieScreenSaver();
312 m_screensaver->setInterval( -1 ); 312 m_screensaver->setInterval( -1 );
313 QWSServer::setScreenSaver( m_screensaver ); 313 QWSServer::setScreenSaver( m_screensaver );
314 314
315 connect( qApp, SIGNAL( volumeChanged( bool ) ), 315 connect( qApp, SIGNAL( volumeChanged(bool) ),
316 this, SLOT( rereadVolumes() ) ); 316 this, SLOT( rereadVolumes() ) );
317 317
318 318
319 /* ### PluginLoader libqtopia SafeMode */ 319 /* ### PluginLoader libqtopia SafeMode */
320#if 0 320#if 0
321 if ( PluginLoader::inSafeMode() ) 321 if ( PluginLoader::inSafeMode() )
322 QTimer::singleShot(500, this, SLOT(showSafeMode()) ); 322 QTimer::singleShot(500, this, SLOT(showSafeMode()) );
323 QTimer::singleShot(20*1000, this, SLOT(clearSafeMode()) ); 323 QTimer::singleShot(20*1000, this, SLOT(clearSafeMode()) );
324#endif 324#endif
325 325
326 kf = new KeyFilter(this); 326 kf = new KeyFilter(this);
327 327
328 connect( kf, SIGNAL(launch()), this, SIGNAL(launch()) ); 328 connect( kf, SIGNAL(launch()), this, SIGNAL(launch()) );
329 connect( kf, SIGNAL(power()), this, SIGNAL(power()) ); 329 connect( kf, SIGNAL(power()), this, SIGNAL(power()) );
330 connect( kf, SIGNAL(backlight()), this, SIGNAL(backlight()) ); 330 connect( kf, SIGNAL(backlight()), this, SIGNAL(backlight()) );
331 connect( kf, SIGNAL(symbol()), this, SIGNAL(symbol())); 331 connect( kf, SIGNAL(symbol()), this, SIGNAL(symbol()));
332 connect( kf, SIGNAL(numLockStateToggle()), this,SIGNAL(numLockStateToggle())); 332 connect( kf, SIGNAL(numLockStateToggle()), this,SIGNAL(numLockStateToggle()));
333 connect( kf, SIGNAL(capsLockStateToggle()), this,SIGNAL(capsLockStateToggle())); 333 connect( kf, SIGNAL(capsLockStateToggle()), this,SIGNAL(capsLockStateToggle()));
334 connect( kf, SIGNAL(activate(const Opie::ODeviceButton*,bool)), 334 connect( kf, SIGNAL(activate(const Opie::ODeviceButton*,bool)),
335 this,SIGNAL(activate(const Opie::ODeviceButton*,bool))); 335 this,SIGNAL(activate(const Opie::ODeviceButton*,bool)));
336 336
337 337
338 connect( kf, SIGNAL(backlight()), this, SLOT(toggleLight()) ); 338 connect( kf, SIGNAL(backlight()), this, SLOT(toggleLight()) );
339 339
340 connect( this, SIGNAL(power() ), 340 connect( this, SIGNAL(power() ),
341 SLOT(togglePower() ) ); 341 SLOT(togglePower() ) );
342 342
343 rereadVolumes(); 343 rereadVolumes();
344 344
345 serverApp = this; 345 serverApp = this;
346 346
347 apmTimeout(); 347 apmTimeout();
348 grabKeyboard(); 348 grabKeyboard();
349 349
350 /* make sure the event filter is installed */ 350 /* make sure the event filter is installed */
351 const Opie::ODeviceButton* but = Opie::ODevice::inst()->buttonForKeycode( -1 ); 351 const Opie::ODeviceButton* but = Opie::ODevice::inst()->buttonForKeycode( -1 );
352} 352}
353 353
354 354
355ServerApplication::~ServerApplication() 355ServerApplication::~ServerApplication()
356{ 356{
357 ungrabKeyboard(); 357 ungrabKeyboard();
358 358
359 359
360 delete pa; 360 delete pa;
361 delete m_ps; 361 delete m_ps;
362 delete m_ps_last; 362 delete m_ps_last;
363} 363}
diff --git a/core/launcher/shutdownimpl.cpp b/core/launcher/shutdownimpl.cpp
index f43a2a3..2731568 100644
--- a/core/launcher/shutdownimpl.cpp
+++ b/core/launcher/shutdownimpl.cpp
@@ -61,100 +61,100 @@ ShutdownImpl::ShutdownImpl( QWidget* parent, const char *name, WFlags fl )
61 61
62 QGridLayout *grid = new QGridLayout ( btngrp-> layout ( ) ); 62 QGridLayout *grid = new QGridLayout ( btngrp-> layout ( ) );
63 grid-> setAlignment ( Qt::AlignTop ); 63 grid-> setAlignment ( Qt::AlignTop );
64 grid-> setSpacing ( 3 ); 64 grid-> setSpacing ( 3 );
65 grid-> setMargin ( 7 ); 65 grid-> setMargin ( 7 );
66 66
67 QPushButton *quit = new QPushButton ( tr( "Terminate Opie" ), btngrp, "quit" ); 67 QPushButton *quit = new QPushButton ( tr( "Terminate Opie" ), btngrp, "quit" );
68 changeButtonColor ( quit, QColor ( 236, 236, 179 ) ); 68 changeButtonColor ( quit, QColor ( 236, 236, 179 ) );
69 btngrp-> insert ( quit, 4 ); 69 btngrp-> insert ( quit, 4 );
70 grid-> addWidget ( quit, 1, 1 ); 70 grid-> addWidget ( quit, 1, 1 );
71 71
72 QPushButton *reboot = new QPushButton ( tr( "Reboot" ), btngrp, "reboot" ); 72 QPushButton *reboot = new QPushButton ( tr( "Reboot" ), btngrp, "reboot" );
73 changeButtonColor ( reboot, QColor( 236, 183, 181 ) ); 73 changeButtonColor ( reboot, QColor( 236, 183, 181 ) );
74 btngrp-> insert ( reboot, 2 ); 74 btngrp-> insert ( reboot, 2 );
75 grid-> addWidget( reboot, 1, 0 ); 75 grid-> addWidget( reboot, 1, 0 );
76 76
77 QPushButton *restart = new QPushButton ( tr( "Restart Opie" ), btngrp, "restart" ); 77 QPushButton *restart = new QPushButton ( tr( "Restart Opie" ), btngrp, "restart" );
78 changeButtonColor ( restart, QColor( 236, 236, 179 ) ); 78 changeButtonColor ( restart, QColor( 236, 236, 179 ) );
79 btngrp-> insert ( restart, 3 ); 79 btngrp-> insert ( restart, 3 );
80 grid-> addWidget ( restart, 0, 1 ); 80 grid-> addWidget ( restart, 0, 1 );
81 81
82 QPushButton *shutdown = new QPushButton( tr( "Shutdown" ), btngrp, "shutdown" ); 82 QPushButton *shutdown = new QPushButton( tr( "Shutdown" ), btngrp, "shutdown" );
83 changeButtonColor ( shutdown, QColor( 236, 183, 181 ) ); 83 changeButtonColor ( shutdown, QColor( 236, 183, 181 ) );
84 btngrp-> insert ( shutdown, 1 ); 84 btngrp-> insert ( shutdown, 1 );
85 grid-> addWidget ( shutdown, 0, 0 ); 85 grid-> addWidget ( shutdown, 0, 0 );
86 86
87 vbox-> addWidget ( btngrp ); 87 vbox-> addWidget ( btngrp );
88 88
89 m_info = new QLabel ( this, "info" ); 89 m_info = new QLabel ( this, "info" );
90 m_info-> setText( tr( "<p>\n" "These termination options are provided primarily for use while developing and testing the Opie system. In a normal environment, these concepts are unnecessary." ) ); 90 m_info-> setText( tr( "<p>\n" "These termination options are provided primarily for use while developing and testing the Opie system. In a normal environment, these concepts are unnecessary." ) );
91 vbox-> addWidget ( m_info ); 91 vbox-> addWidget ( m_info );
92 92
93 m_progress = new QProgressBar ( this, "progressBar" ); 93 m_progress = new QProgressBar ( this, "progressBar" );
94 m_progress-> setFrameShape ( QProgressBar::Panel ); 94 m_progress-> setFrameShape ( QProgressBar::Panel );
95 m_progress-> setFrameShadow ( QProgressBar::Sunken ); 95 m_progress-> setFrameShadow ( QProgressBar::Sunken );
96 m_progress-> setTotalSteps ( 20 ); 96 m_progress-> setTotalSteps ( 20 );
97 m_progress-> setIndicatorFollowsStyle ( false ); 97 m_progress-> setIndicatorFollowsStyle ( false );
98 vbox-> addWidget ( m_progress ); 98 vbox-> addWidget ( m_progress );
99 99
100 vbox-> addItem ( new QSpacerItem ( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); 100 vbox-> addItem ( new QSpacerItem ( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
101 101
102 QPushButton *cancel = new QPushButton ( tr( "Cancel" ), this, "cancel" ); 102 QPushButton *cancel = new QPushButton ( tr( "Cancel" ), this, "cancel" );
103 changeButtonColor ( cancel, QColor( 181, 222, 178 ) ); 103 changeButtonColor ( cancel, QColor( 181, 222, 178 ) );
104 cancel-> setDefault ( true ); 104 cancel-> setDefault ( true );
105 cancel-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding, cancel-> sizePolicy ( ). hasHeightForWidth ( ) ) ); 105 cancel-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding, cancel-> sizePolicy ( ). hasHeightForWidth ( ) ) );
106 vbox-> addWidget ( cancel ); 106 vbox-> addWidget ( cancel );
107 107
108 m_timer = new QTimer ( this ); 108 m_timer = new QTimer ( this );
109 connect ( m_timer, SIGNAL( timeout ( ) ), this, SLOT( timeout ( ) ) ); 109 connect ( m_timer, SIGNAL( timeout() ), this, SLOT( timeout() ) );
110 110
111 connect ( btngrp, SIGNAL( clicked ( int ) ), this, SLOT( buttonClicked ( int ) ) ); 111 connect ( btngrp, SIGNAL( clicked(int) ), this, SLOT( buttonClicked(int) ) );
112 connect ( cancel, SIGNAL( clicked ( ) ), this, SLOT( cancelClicked ( ) ) ); 112 connect ( cancel, SIGNAL( clicked() ), this, SLOT( cancelClicked() ) );
113 113
114 m_progress-> hide ( ); 114 m_progress-> hide ( );
115 Global::hideInputMethod ( ); 115 Global::hideInputMethod ( );
116} 116}
117 117
118void ShutdownImpl::buttonClicked ( int b ) 118void ShutdownImpl::buttonClicked ( int b )
119{ 119{
120 m_counter = 0; 120 m_counter = 0;
121 121
122 switch ( b ) { 122 switch ( b ) {
123 case 1: 123 case 1:
124 m_operation = ShutdownSystem; 124 m_operation = ShutdownSystem;
125 break; 125 break;
126 case 2: 126 case 2:
127 m_operation = RebootSystem; 127 m_operation = RebootSystem;
128 break; 128 break;
129 case 3: 129 case 3:
130 m_operation = RestartDesktop; 130 m_operation = RestartDesktop;
131 break; 131 break;
132 case 4: 132 case 4:
133 m_operation = TerminateDesktop; 133 m_operation = TerminateDesktop;
134 break; 134 break;
135 } 135 }
136 m_info-> hide ( ); 136 m_info-> hide ( );
137 m_progress-> show ( ); 137 m_progress-> show ( );
138 m_timer-> start ( 300 ); 138 m_timer-> start ( 300 );
139 timeout ( ); 139 timeout ( );
140} 140}
141 141
142void ShutdownImpl::cancelClicked ( ) 142void ShutdownImpl::cancelClicked ( )
143{ 143{
144 m_progress-> hide ( ); 144 m_progress-> hide ( );
145 m_info-> show ( ); 145 m_info-> show ( );
146 if ( m_timer-> isActive ( ) ) 146 if ( m_timer-> isActive ( ) )
147 m_timer-> stop ( ); 147 m_timer-> stop ( );
148 else 148 else
149 close ( ); 149 close ( );
150} 150}
151 151
152void ShutdownImpl::timeout ( ) 152void ShutdownImpl::timeout ( )
153{ 153{
154 if ( ( m_counter += 2 ) > m_progress-> totalSteps ( ) ) { 154 if ( ( m_counter += 2 ) > m_progress-> totalSteps ( ) ) {
155 m_progress-> hide ( ); 155 m_progress-> hide ( );
156 m_timer-> stop ( ); 156 m_timer-> stop ( );
157 emit shutdown ( m_operation ); 157 emit shutdown ( m_operation );
158 } 158 }
159 else 159 else
160 m_progress-> setProgress ( m_counter ); 160 m_progress-> setProgress ( m_counter );
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index 491a8a3..91e2f20 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -168,98 +168,98 @@ private:
168 168
169TaskBar::~TaskBar() 169TaskBar::~TaskBar()
170{ 170{
171} 171}
172 172
173 173
174TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) 174TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader)
175{ 175{
176 Config cfg( "Launcher" ); 176 Config cfg( "Launcher" );
177 cfg.setGroup( "InputMethods" ); 177 cfg.setGroup( "InputMethods" );
178 resizeRunningApp = cfg.readBoolEntry( "Resize", true ); 178 resizeRunningApp = cfg.readBoolEntry( "Resize", true );
179 179
180 sm = new StartMenu( this ); 180 sm = new StartMenu( this );
181 connect( sm, SIGNAL(tabSelected(const QString&)), this, 181 connect( sm, SIGNAL(tabSelected(const QString&)), this,
182 SIGNAL(tabSelected(const QString&)) ); 182 SIGNAL(tabSelected(const QString&)) );
183 183
184 inputMethods = new InputMethods( this ); 184 inputMethods = new InputMethods( this );
185 connect( inputMethods, SIGNAL(inputToggled(bool)), 185 connect( inputMethods, SIGNAL(inputToggled(bool)),
186 this, SLOT(calcMaxWindowRect()) ); 186 this, SLOT(calcMaxWindowRect()) );
187 187
188 stack = new QWidgetStack( this ); 188 stack = new QWidgetStack( this );
189 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); 189 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
190 label = new QLabel(stack); 190 label = new QLabel(stack);
191 191
192 runningAppBar = new RunningAppBar(stack); 192 runningAppBar = new RunningAppBar(stack);
193 stack->raiseWidget(runningAppBar); 193 stack->raiseWidget(runningAppBar);
194 194
195 waitIcon = new Wait( this ); 195 waitIcon = new Wait( this );
196 (void) new AppIcons( this ); 196 (void) new AppIcons( this );
197 197
198 sysTray = new SysTray( this ); 198 sysTray = new SysTray( this );
199 199
200 /* ### FIXME plugin loader and safe mode */ 200 /* ### FIXME plugin loader and safe mode */
201#if 0 201#if 0
202 if (PluginLoader::inSafeMode()) 202 if (PluginLoader::inSafeMode())
203 (void)new SafeMode( this ); 203 (void)new SafeMode( this );
204#endif 204#endif
205 205
206 // ## make customizable in some way? 206 // ## make customizable in some way?
207#ifdef QT_QWS_CUSTOM 207#ifdef QT_QWS_CUSTOM
208 lockState = new LockKeyState( this ); 208 lockState = new LockKeyState( this );
209#else 209#else
210 lockState = 0; 210 lockState = 0;
211#endif 211#endif
212 212
213#if defined(Q_WS_QWS) 213#if defined(Q_WS_QWS)
214#if !defined(QT_NO_COP) 214#if !defined(QT_NO_COP)
215 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); 215 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this );
216 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 216 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
217 this, SLOT(receive(const QCString&, const QByteArray&)) ); 217 this, SLOT(receive(const QCString&,const QByteArray&)) );
218#endif 218#endif
219#endif 219#endif
220 waitTimer = new QTimer( this ); 220 waitTimer = new QTimer( this );
221 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); 221 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) );
222 clearer = new QTimer( this ); 222 clearer = new QTimer( this );
223 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); 223 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar()));
224 224
225 connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) ); 225 connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) );
226 connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); 226 connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) );
227 connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); 227 connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) );
228} 228}
229 229
230void TaskBar::setStatusMessage( const QString &text ) 230void TaskBar::setStatusMessage( const QString &text )
231{ 231{
232 if ( !text.isEmpty() ) { 232 if ( !text.isEmpty() ) {
233 label->setText( text ); 233 label->setText( text );
234 stack->raiseWidget( label ); 234 stack->raiseWidget( label );
235 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) 235 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) )
236 sysTray->hide(); 236 sysTray->hide();
237 clearer->start( 3000, TRUE ); 237 clearer->start( 3000, TRUE );
238 } else { 238 } else {
239 clearStatusBar(); 239 clearStatusBar();
240 } 240 }
241} 241}
242 242
243void TaskBar::clearStatusBar() 243void TaskBar::clearStatusBar()
244{ 244{
245 label->clear(); 245 label->clear();
246 stack->raiseWidget(runningAppBar); 246 stack->raiseWidget(runningAppBar);
247 if ( sysTray ) 247 if ( sysTray )
248 sysTray->show(); 248 sysTray->show();
249 // stack->raiseWidget( mru ); 249 // stack->raiseWidget( mru );
250} 250}
251 251
252void TaskBar::startWait() 252void TaskBar::startWait()
253{ 253{
254 waitIcon->setWaiting( true ); 254 waitIcon->setWaiting( true );
255 // a catchall stop after 10 seconds... 255 // a catchall stop after 10 seconds...
256 waitTimer->start( 10 * 1000, true ); 256 waitTimer->start( 10 * 1000, true );
257} 257}
258 258
259void TaskBar::stopWait(const QString&) 259void TaskBar::stopWait(const QString&)
260{ 260{
261 waitTimer->stop(); 261 waitTimer->stop();
262 waitIcon->setWaiting( false ); 262 waitIcon->setWaiting( false );
263} 263}
264 264
265void TaskBar::stopWait() 265void TaskBar::stopWait()
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp
index b998e95..a5e20b2 100644
--- a/core/launcher/transferserver.cpp
+++ b/core/launcher/transferserver.cpp
@@ -28,116 +28,116 @@
28#include <stdlib.h> 28#include <stdlib.h>
29#include <time.h> 29#include <time.h>
30 30
31#ifndef Q_OS_MACX 31#ifndef Q_OS_MACX
32#include <shadow.h> 32#include <shadow.h>
33#include <crypt.h> 33#include <crypt.h>
34#endif /* Q_OS_MACX */ 34#endif /* Q_OS_MACX */
35 35
36#else 36#else
37#include <stdlib.h> 37#include <stdlib.h>
38#include <time.h> 38#include <time.h>
39#endif 39#endif
40 40
41 41
42#if defined(_OS_LINUX_) 42#if defined(_OS_LINUX_)
43#include <shadow.h> 43#include <shadow.h>
44#endif 44#endif
45 45
46#include <qtextstream.h> 46#include <qtextstream.h>
47#include <qmessagebox.h> 47#include <qmessagebox.h>
48//#include <qtopia/qcopchannel_qws.h> 48//#include <qtopia/qcopchannel_qws.h>
49#include <qtopia/process.h> 49#include <qtopia/process.h>
50#include <qtopia/private/contact.h> 50#include <qtopia/private/contact.h>
51#include <qtopia/version.h> 51#include <qtopia/version.h>
52#ifdef Q_WS_QWS 52#ifdef Q_WS_QWS
53#include <qtopia/qcopenvelope_qws.h> 53#include <qtopia/qcopenvelope_qws.h>
54#endif 54#endif
55 55
56 56
57#include "transferserver.h" 57#include "transferserver.h"
58#include <qtopia/qprocess.h> 58#include <qtopia/qprocess.h>
59 59
60const int block_size = 51200; 60const int block_size = 51200;
61 61
62TransferServer::TransferServer( Q_UINT16 port, QObject *parent, 62TransferServer::TransferServer( Q_UINT16 port, QObject *parent,
63 const char* name) 63 const char* name)
64 : QServerSocket( port, 1, parent, name ) 64 : QServerSocket( port, 1, parent, name )
65{ 65{
66 connections.setAutoDelete( TRUE ); 66 connections.setAutoDelete( TRUE );
67 if ( !ok() ) 67 if ( !ok() )
68 qWarning( "Failed to bind to port %d", port ); 68 qWarning( "Failed to bind to port %d", port );
69} 69}
70 70
71void TransferServer::authorizeConnections() 71void TransferServer::authorizeConnections()
72{ 72{
73 QListIterator<ServerPI> it(connections); 73 QListIterator<ServerPI> it(connections);
74 while ( it.current() ) { 74 while ( it.current() ) {
75 if ( !it.current()->verifyAuthorised() ) { 75 if ( !it.current()->verifyAuthorised() ) {
76 disconnect( it.current(), SIGNAL(connectionClosed(ServerPI *)), this, SLOT( closed(ServerPI *)) ); 76 disconnect( it.current(), SIGNAL(connectionClosed(ServerPI*)), this, SLOT( closed(ServerPI*)) );
77 connections.removeRef( it.current() ); 77 connections.removeRef( it.current() );
78 } else 78 } else
79 ++it; 79 ++it;
80 } 80 }
81} 81}
82 82
83void TransferServer::closed(ServerPI *item) 83void TransferServer::closed(ServerPI *item)
84{ 84{
85 connections.removeRef(item); 85 connections.removeRef(item);
86} 86}
87 87
88TransferServer::~TransferServer() 88TransferServer::~TransferServer()
89{ 89{
90} 90}
91 91
92void TransferServer::newConnection( int socket ) 92void TransferServer::newConnection( int socket )
93{ 93{
94 ServerPI *ptr = new ServerPI( socket, this ); 94 ServerPI *ptr = new ServerPI( socket, this );
95 connect( ptr, SIGNAL(connectionClosed(ServerPI *)), this, SLOT( closed(ServerPI *)) ); 95 connect( ptr, SIGNAL(connectionClosed(ServerPI*)), this, SLOT( closed(ServerPI*)) );
96 connections.append( ptr ); 96 connections.append( ptr );
97} 97}
98 98
99QString SyncAuthentication::serverId() 99QString SyncAuthentication::serverId()
100{ 100{
101 Config cfg("Security"); 101 Config cfg("Security");
102 cfg.setGroup("Sync"); 102 cfg.setGroup("Sync");
103 QString r = cfg.readEntry("serverid"); 103 QString r = cfg.readEntry("serverid");
104 104
105 if ( r.isEmpty() ) { 105 if ( r.isEmpty() ) {
106 r = OGlobal::generateUuid(); 106 r = OGlobal::generateUuid();
107 cfg.writeEntry("serverid", r ); 107 cfg.writeEntry("serverid", r );
108 } 108 }
109 return r; 109 return r;
110} 110}
111 111
112QString SyncAuthentication::ownerName() 112QString SyncAuthentication::ownerName()
113{ 113{
114 QString vfilename = Global::applicationFileName("addressbook", 114 QString vfilename = Global::applicationFileName("addressbook",
115 "businesscard.vcf"); 115 "businesscard.vcf");
116 if (QFile::exists(vfilename)) { 116 if (QFile::exists(vfilename)) {
117 Contact c; 117 Contact c;
118 c = Contact::readVCard( vfilename )[0]; 118 c = Contact::readVCard( vfilename )[0];
119 return c.fullName(); 119 return c.fullName();
120 } 120 }
121 121
122 return QString::null; 122 return QString::null;
123} 123}
124 124
125QString SyncAuthentication::loginName() 125QString SyncAuthentication::loginName()
126{ 126{
127 struct passwd *pw = 0L; 127 struct passwd *pw = 0L;
128#ifndef Q_OS_WIN32 128#ifndef Q_OS_WIN32
129 pw = getpwuid( geteuid() ); 129 pw = getpwuid( geteuid() );
130 return QString::fromLocal8Bit( pw->pw_name ); 130 return QString::fromLocal8Bit( pw->pw_name );
131#else 131#else
132 //### revise 132 //### revise
133 return QString(); 133 return QString();
134#endif 134#endif
135} 135}
136 136
137int SyncAuthentication::isAuthorized(QHostAddress peeraddress) 137int SyncAuthentication::isAuthorized(QHostAddress peeraddress)
138{ 138{
139 Config cfg("Security"); 139 Config cfg("Security");
140 cfg.setGroup("Sync"); 140 cfg.setGroup("Sync");
141 // QString allowedstr = cfg.readEntry("auth_peer","192.168.1.0"); 141 // QString allowedstr = cfg.readEntry("auth_peer","192.168.1.0");
142 uint auth_peer = cfg.readNumEntry("auth_peer", 0xc0a80100); 142 uint auth_peer = cfg.readNumEntry("auth_peer", 0xc0a80100);
143 143
@@ -288,109 +288,109 @@ bool SyncAuthentication::checkPassword( const QString& password )
288#else 288#else
289 //### revise 289 //### revise
290 QString cpassword(""); 290 QString cpassword("");
291#endif 291#endif
292 denials=0; 292 denials=0;
293 pwds.prepend(cpassword); 293 pwds.prepend(cpassword);
294 cfg.writeEntry("Passwords",pwds,' '); 294 cfg.writeEntry("Passwords",pwds,' ');
295 lock--; 295 lock--;
296 return TRUE; 296 return TRUE;
297 } 297 }
298 } 298 }
299 lock--; 299 lock--;
300 300
301 return FALSE; 301 return FALSE;
302} 302}
303 303
304 304
305ServerPI::ServerPI( int socket, QObject *parent, const char* name ) 305ServerPI::ServerPI( int socket, QObject *parent, const char* name )
306 : QSocket( parent, name ) , dtp( 0 ), serversocket( 0 ), waitsocket( 0 ), 306 : QSocket( parent, name ) , dtp( 0 ), serversocket( 0 ), waitsocket( 0 ),
307 storFileSize(-1) 307 storFileSize(-1)
308{ 308{
309 state = Connected; 309 state = Connected;
310 310
311 setSocket( socket ); 311 setSocket( socket );
312 312
313 peerport = peerPort(); 313 peerport = peerPort();
314 peeraddress = peerAddress(); 314 peeraddress = peerAddress();
315 315
316#ifndef INSECURE 316#ifndef INSECURE
317 if ( !SyncAuthentication::isAuthorized(peeraddress) ) { 317 if ( !SyncAuthentication::isAuthorized(peeraddress) ) {
318 state = Forbidden; 318 state = Forbidden;
319 startTimer( 0 ); 319 startTimer( 0 );
320 } else 320 } else
321#endif 321#endif
322 { 322 {
323 connect( this, SIGNAL( readyRead() ), SLOT( read() ) ); 323 connect( this, SIGNAL( readyRead() ), SLOT( read() ) );
324 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); 324 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) );
325 325
326 passiv = FALSE; 326 passiv = FALSE;
327 for( int i = 0; i < 4; i++ ) 327 for( int i = 0; i < 4; i++ )
328 wait[i] = FALSE; 328 wait[i] = FALSE;
329 329
330 send( "220 Qtopia " QPE_VERSION " FTP Server" ); // No tr 330 send( "220 Qtopia " QPE_VERSION " FTP Server" ); // No tr
331 state = Wait_USER; 331 state = Wait_USER;
332 332
333 dtp = new ServerDTP( this ); 333 dtp = new ServerDTP( this );
334 connect( dtp, SIGNAL( completed() ), SLOT( dtpCompleted() ) ); 334 connect( dtp, SIGNAL( completed() ), SLOT( dtpCompleted() ) );
335 connect( dtp, SIGNAL( failed() ), SLOT( dtpFailed() ) ); 335 connect( dtp, SIGNAL( failed() ), SLOT( dtpFailed() ) );
336 connect( dtp, SIGNAL( error( int ) ), SLOT( dtpError( int ) ) ); 336 connect( dtp, SIGNAL( error(int) ), SLOT( dtpError(int) ) );
337 337
338 338
339 directory = QDir::currentDirPath(); 339 directory = QDir::currentDirPath();
340 340
341 static int p = 1024; 341 static int p = 1024;
342 342
343 while ( !serversocket || !serversocket->ok() ) { 343 while ( !serversocket || !serversocket->ok() ) {
344 delete serversocket; 344 delete serversocket;
345 serversocket = new ServerSocket( ++p, this ); 345 serversocket = new ServerSocket( ++p, this );
346 } 346 }
347 connect( serversocket, SIGNAL( newIncomming( int ) ), 347 connect( serversocket, SIGNAL( newIncomming(int) ),
348 SLOT( newConnection( int ) ) ); 348 SLOT( newConnection(int) ) );
349 } 349 }
350} 350}
351 351
352ServerPI::~ServerPI() 352ServerPI::~ServerPI()
353{ 353{
354 close(); 354 close();
355 355
356 if ( dtp ) 356 if ( dtp )
357 dtp->close(); 357 dtp->close();
358 delete dtp; 358 delete dtp;
359 delete serversocket; 359 delete serversocket;
360} 360}
361 361
362bool ServerPI::verifyAuthorised() 362bool ServerPI::verifyAuthorised()
363{ 363{
364 if ( !SyncAuthentication::isAuthorized(peerAddress()) ) { 364 if ( !SyncAuthentication::isAuthorized(peerAddress()) ) {
365 state = Forbidden; 365 state = Forbidden;
366 return FALSE; 366 return FALSE;
367 } 367 }
368 return TRUE; 368 return TRUE;
369} 369}
370 370
371void ServerPI::connectionClosed() 371void ServerPI::connectionClosed()
372{ 372{
373 // qDebug( "Debug: Connection closed" ); 373 // qDebug( "Debug: Connection closed" );
374 emit connectionClosed(this); 374 emit connectionClosed(this);
375} 375}
376 376
377void ServerPI::send( const QString& msg ) 377void ServerPI::send( const QString& msg )
378{ 378{
379 QTextStream os( this ); 379 QTextStream os( this );
380 os << msg << endl; 380 os << msg << endl;
381 //qDebug( "Reply: %s", msg.latin1() ); 381 //qDebug( "Reply: %s", msg.latin1() );
382} 382}
383 383
384void ServerPI::read() 384void ServerPI::read()
385{ 385{
386 while ( canReadLine() ) 386 while ( canReadLine() )
387 process( readLine().stripWhiteSpace() ); 387 process( readLine().stripWhiteSpace() );
388} 388}
389 389
390bool ServerPI::checkReadFile( const QString& file ) 390bool ServerPI::checkReadFile( const QString& file )
391{ 391{
392 QString filename; 392 QString filename;
393 393
394 if ( file[0] != "/" ) 394 if ( file[0] != "/" )
395 filename = directory.path() + "/" + file; 395 filename = directory.path() + "/" + file;
396 else 396 else
@@ -1041,97 +1041,97 @@ void ServerPI::newConnection( int socket )
1041 qDebug("check retrieve file"); 1041 qDebug("check retrieve file");
1042 if ( backupRestoreGzip( waitfile ) ) 1042 if ( backupRestoreGzip( waitfile ) )
1043 dtp->retrieveGzipFile( waitfile ); 1043 dtp->retrieveGzipFile( waitfile );
1044 else 1044 else
1045 dtp->retrieveFile( waitfile, storFileSize ); 1045 dtp->retrieveFile( waitfile, storFileSize );
1046 dtp->setSocket( socket ); 1046 dtp->setSocket( socket );
1047 } 1047 }
1048 else if ( wait[SendByteArray] ) { 1048 else if ( wait[SendByteArray] ) {
1049 dtp->sendByteArray( waitarray ); 1049 dtp->sendByteArray( waitarray );
1050 dtp->setSocket( socket ); 1050 dtp->setSocket( socket );
1051 } 1051 }
1052 else if ( wait[RetrieveByteArray] ) { 1052 else if ( wait[RetrieveByteArray] ) {
1053 qDebug("retrieve byte array"); 1053 qDebug("retrieve byte array");
1054 dtp->retrieveByteArray(); 1054 dtp->retrieveByteArray();
1055 dtp->setSocket( socket ); 1055 dtp->setSocket( socket );
1056 } 1056 }
1057 else 1057 else
1058 waitsocket = socket; 1058 waitsocket = socket;
1059 1059
1060 for( int i = 0; i < 4; i++ ) 1060 for( int i = 0; i < 4; i++ )
1061 wait[i] = FALSE; 1061 wait[i] = FALSE;
1062} 1062}
1063 1063
1064QString ServerPI::absFilePath( const QString& file ) 1064QString ServerPI::absFilePath( const QString& file )
1065{ 1065{
1066 if ( file.isEmpty() ) return file; 1066 if ( file.isEmpty() ) return file;
1067 1067
1068 QString filepath( file ); 1068 QString filepath( file );
1069 if ( file[0] != "/" ) 1069 if ( file[0] != "/" )
1070 filepath = directory.path() + "/" + file; 1070 filepath = directory.path() + "/" + file;
1071 1071
1072 return filepath; 1072 return filepath;
1073} 1073}
1074 1074
1075 1075
1076void ServerPI::timerEvent( QTimerEvent * ) 1076void ServerPI::timerEvent( QTimerEvent * )
1077{ 1077{
1078 connectionClosed(); 1078 connectionClosed();
1079} 1079}
1080 1080
1081 1081
1082ServerDTP::ServerDTP( QObject *parent, const char* name) 1082ServerDTP::ServerDTP( QObject *parent, const char* name)
1083 : QSocket( parent, name ), mode( Idle ), createTargzProc( 0 ), 1083 : QSocket( parent, name ), mode( Idle ), createTargzProc( 0 ),
1084 retrieveTargzProc( 0 ) 1084 retrieveTargzProc( 0 )
1085{ 1085{
1086 1086
1087 connect( this, SIGNAL( connected() ), SLOT( connected() ) ); 1087 connect( this, SIGNAL( connected() ), SLOT( connected() ) );
1088 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); 1088 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) );
1089 connect( this, SIGNAL( bytesWritten( int ) ), SLOT( bytesWritten( int ) ) ); 1089 connect( this, SIGNAL( bytesWritten(int) ), SLOT( bytesWritten(int) ) );
1090 connect( this, SIGNAL( readyRead() ), SLOT( readyRead() ) ); 1090 connect( this, SIGNAL( readyRead() ), SLOT( readyRead() ) );
1091 1091
1092 createTargzProc = new QProcess( QString("tar"), this, "createTargzProc"); // No tr 1092 createTargzProc = new QProcess( QString("tar"), this, "createTargzProc"); // No tr
1093 createTargzProc->setCommunication( QProcess::Stdout ); 1093 createTargzProc->setCommunication( QProcess::Stdout );
1094 createTargzProc->setWorkingDirectory( QDir::rootDirPath() ); 1094 createTargzProc->setWorkingDirectory( QDir::rootDirPath() );
1095 connect( createTargzProc, SIGNAL( processExited() ), SLOT( targzDone() ) ); 1095 connect( createTargzProc, SIGNAL( processExited() ), SLOT( targzDone() ) );
1096 1096
1097 retrieveTargzProc = new QProcess( this, "retrieveTargzProc" ); 1097 retrieveTargzProc = new QProcess( this, "retrieveTargzProc" );
1098 retrieveTargzProc->setCommunication( QProcess::Stdin ); 1098 retrieveTargzProc->setCommunication( QProcess::Stdin );
1099 retrieveTargzProc->setWorkingDirectory( QDir::rootDirPath() ); 1099 retrieveTargzProc->setWorkingDirectory( QDir::rootDirPath() );
1100 connect( retrieveTargzProc, SIGNAL( processExited() ), 1100 connect( retrieveTargzProc, SIGNAL( processExited() ),
1101 SIGNAL( completed() ) ); 1101 SIGNAL( completed() ) );
1102 connect( retrieveTargzProc, SIGNAL( processExited() ), 1102 connect( retrieveTargzProc, SIGNAL( processExited() ),
1103 SLOT( extractTarDone() ) ); 1103 SLOT( extractTarDone() ) );
1104} 1104}
1105 1105
1106ServerDTP::~ServerDTP() 1106ServerDTP::~ServerDTP()
1107{ 1107{
1108 buf.close(); 1108 buf.close();
1109 if ( RetrieveFile == mode && file.isOpen() ) { 1109 if ( RetrieveFile == mode && file.isOpen() ) {
1110 // We're being shutdown before the client closed. 1110 // We're being shutdown before the client closed.
1111 file.close(); 1111 file.close();
1112 if ( recvFileSize >= 0 && (int)file.size() != recvFileSize ) { 1112 if ( recvFileSize >= 0 && (int)file.size() != recvFileSize ) {
1113 qDebug( "STOR incomplete" ); 1113 qDebug( "STOR incomplete" );
1114 file.remove(); 1114 file.remove();
1115 } 1115 }
1116 } else { 1116 } else {
1117 file.close(); 1117 file.close();
1118 } 1118 }
1119 createTargzProc->kill(); 1119 createTargzProc->kill();
1120} 1120}
1121 1121
1122void ServerDTP::extractTarDone() 1122void ServerDTP::extractTarDone()
1123{ 1123{
1124 qDebug("extract done"); 1124 qDebug("extract done");
1125#ifndef QT_NO_COP 1125#ifndef QT_NO_COP
1126 QCopEnvelope e( "QPE/System", "restoreDone(QString)" ); 1126 QCopEnvelope e( "QPE/System", "restoreDone(QString)" );
1127 e << file.name(); 1127 e << file.name();
1128#endif 1128#endif
1129} 1129}
1130 1130
1131void ServerDTP::connected() 1131void ServerDTP::connected()
1132{ 1132{
1133 // send file mode 1133 // send file mode
1134 switch ( mode ) { 1134 switch ( mode ) {
1135 case SendFile : 1135 case SendFile :
1136 if ( !file.exists() || !file.open( IO_ReadOnly) ) { 1136 if ( !file.exists() || !file.open( IO_ReadOnly) ) {
1137 emit failed(); 1137 emit failed();
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp
index 82242a3..4ed5921 100644
--- a/core/multimedia/opieplayer/loopcontrol.cpp
+++ b/core/multimedia/opieplayer/loopcontrol.cpp
@@ -396,90 +396,90 @@ bool LoopControl::init( const QString& filename ) {
396 // qDebug("total samples %d", total_audio_samples); 396 // qDebug("total samples %d", total_audio_samples);
397 mediaPlayerState->setLength( total_audio_samples ); 397 mediaPlayerState->setLength( total_audio_samples );
398 398
399 freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); 399 freq = mediaPlayerState->curDecoder()->audioFrequency( astream );
400 // qDebug( "LC- frequency = %d", freq ); 400 // qDebug( "LC- frequency = %d", freq );
401 401
402 audioSampleCounter = 0; 402 audioSampleCounter = 0;
403 int bits_per_sample; 403 int bits_per_sample;
404 if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibWavPlugin") ) { 404 if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibWavPlugin") ) {
405 bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime(); 405 bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime();
406 // qDebug("using stupid hack"); 406 // qDebug("using stupid hack");
407 } else { 407 } else {
408 bits_per_sample=0; 408 bits_per_sample=0;
409 } 409 }
410 410
411 audioDevice = new AudioDevice( freq, channels, bits_per_sample); 411 audioDevice = new AudioDevice( freq, channels, bits_per_sample);
412 audioBuffer = new char[ audioDevice->bufferSize() ]; 412 audioBuffer = new char[ audioDevice->bufferSize() ];
413 channels = audioDevice->channels(); 413 channels = audioDevice->channels();
414 414
415 //### must check which frequency is actually used. 415 //### must check which frequency is actually used.
416 static const int size = 1; 416 static const int size = 1;
417 short int buf[size]; 417 short int buf[size];
418 long samplesRead = 0; 418 long samplesRead = 0;
419 mediaPlayerState->curDecoder()->audioReadSamples( buf, channels, size, samplesRead, stream ); 419 mediaPlayerState->curDecoder()->audioReadSamples( buf, channels, size, samplesRead, stream );
420 } 420 }
421 421
422 if ( hasVideoChannel ) { 422 if ( hasVideoChannel ) {
423 total_video_frames = mediaPlayerState->curDecoder()->videoFrames( stream ); 423 total_video_frames = mediaPlayerState->curDecoder()->videoFrames( stream );
424 424
425 mediaPlayerState->setLength( total_video_frames ); 425 mediaPlayerState->setLength( total_video_frames );
426 426
427 framerate = mediaPlayerState->curDecoder()->videoFrameRate( stream ); 427 framerate = mediaPlayerState->curDecoder()->videoFrameRate( stream );
428 DecodeLoopDebug(( "Frame rate %g total %ld", framerate, total_video_frames )); 428 DecodeLoopDebug(( "Frame rate %g total %ld", framerate, total_video_frames ));
429 429
430 if ( framerate <= 1.0 ) { 430 if ( framerate <= 1.0 ) {
431 DecodeLoopDebug(( "Crazy frame rate, resetting to sensible" )); 431 DecodeLoopDebug(( "Crazy frame rate, resetting to sensible" ));
432 framerate = 25; 432 framerate = 25;
433 } 433 }
434 434
435 if ( total_video_frames == 1 ) { 435 if ( total_video_frames == 1 ) {
436 DecodeLoopDebug(( "Cannot seek to frame" )); 436 DecodeLoopDebug(( "Cannot seek to frame" ));
437 } 437 }
438 438
439 } 439 }
440 440
441 current_frame = 0; 441 current_frame = 0;
442 prev_frame = -1; 442 prev_frame = -1;
443 443
444 connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( setPosition( long ) ) ); 444 connect( mediaPlayerState, SIGNAL( positionChanged(long) ), this, SLOT( setPosition(long) ) );
445 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( setPaused( bool ) ) ); 445 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
446 446
447 audioMutex->unlock(); 447 audioMutex->unlock();
448 448
449 return TRUE; 449 return TRUE;
450} 450}
451 451
452 452
453void LoopControl::play() { 453void LoopControl::play() {
454 // qDebug("LC- play"); 454 // qDebug("LC- play");
455 mediaPlayerState->setPosition( 0); //uglyhack 455 mediaPlayerState->setPosition( 0); //uglyhack
456 456
457#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 457#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
458 if ( !disabledSuspendScreenSaver || previousSuspendMode != hasVideoChannel ) { 458 if ( !disabledSuspendScreenSaver || previousSuspendMode != hasVideoChannel ) {
459 disabledSuspendScreenSaver = TRUE; 459 disabledSuspendScreenSaver = TRUE;
460 previousSuspendMode = hasVideoChannel; 460 previousSuspendMode = hasVideoChannel;
461 // Stop the screen from blanking and power saving state 461 // Stop the screen from blanking and power saving state
462 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) 462 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" )
463 << ( hasVideoChannel ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 463 << ( hasVideoChannel ? QPEApplication::Disable : QPEApplication::DisableSuspend );
464 } 464 }
465#endif 465#endif
466 466
467 playtime.start(); 467 playtime.start();
468 startTimers(); 468 startTimers();
469} 469}
470 470
471 471
472void LoopControl::setMute( bool on ) { 472void LoopControl::setMute( bool on ) {
473 if ( on != isMuted ) { 473 if ( on != isMuted ) {
474 isMuted = on; 474 isMuted = on;
475 if ( !on ) { 475 if ( !on ) {
476 // Force an update of the position 476 // Force an update of the position
477 mediaPlayerState->setPosition( mediaPlayerState->position() + 1 ); 477 mediaPlayerState->setPosition( mediaPlayerState->position() + 1 );
478 mediaPlayerState->setPosition( mediaPlayerState->position() - 1 ); 478 mediaPlayerState->setPosition( mediaPlayerState->position() - 1 );
479 // Resume playing audio 479 // Resume playing audio
480 moreAudio = TRUE; 480 moreAudio = TRUE;
481 } 481 }
482 } 482 }
483} 483}
484 484
485 485
diff --git a/core/multimedia/opieplayer/loopcontrol_threaded.cpp b/core/multimedia/opieplayer/loopcontrol_threaded.cpp
index 3796549..0a1fc17 100644
--- a/core/multimedia/opieplayer/loopcontrol_threaded.cpp
+++ b/core/multimedia/opieplayer/loopcontrol_threaded.cpp
@@ -536,89 +536,89 @@ bool LoopControl::init( const QString& filename ) {
536 536
537 if ( !total_audio_samples ) 537 if ( !total_audio_samples )
538 total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream ); 538 total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream );
539 539
540 mediaPlayerState->setLength( total_audio_samples ); 540 mediaPlayerState->setLength( total_audio_samples );
541 541
542 freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); 542 freq = mediaPlayerState->curDecoder()->audioFrequency( astream );
543 DecodeLoopDebug(( "frequency = %d\n", freq )); 543 DecodeLoopDebug(( "frequency = %d\n", freq ));
544 544
545 audioSampleCounter = 0; 545 audioSampleCounter = 0;
546 546
547 static const int bytes_per_sample = 2; //16 bit 547 static const int bytes_per_sample = 2; //16 bit
548 548
549 audioDevice = new AudioDevice( freq, channels, bytes_per_sample ); 549 audioDevice = new AudioDevice( freq, channels, bytes_per_sample );
550 audioBuffer = new char[ audioDevice->bufferSize() ]; 550 audioBuffer = new char[ audioDevice->bufferSize() ];
551 channels = audioDevice->channels(); 551 channels = audioDevice->channels();
552 552
553 //### must check which frequency is actually used. 553 //### must check which frequency is actually used.
554 static const int size = 1; 554 static const int size = 1;
555 short int buf[size]; 555 short int buf[size];
556 long samplesRead = 0; 556 long samplesRead = 0;
557 mediaPlayerState->curDecoder()->audioReadSamples( buf, channels, size, samplesRead, stream ); 557 mediaPlayerState->curDecoder()->audioReadSamples( buf, channels, size, samplesRead, stream );
558 } 558 }
559 559
560 if ( hasVideoChannel ) { 560 if ( hasVideoChannel ) {
561 total_video_frames = mediaPlayerState->curDecoder()->videoFrames( stream ); 561 total_video_frames = mediaPlayerState->curDecoder()->videoFrames( stream );
562 562
563 mediaPlayerState->setLength( total_video_frames ); 563 mediaPlayerState->setLength( total_video_frames );
564 564
565 framerate = mediaPlayerState->curDecoder()->videoFrameRate( stream ); 565 framerate = mediaPlayerState->curDecoder()->videoFrameRate( stream );
566 DecodeLoopDebug(( "Frame rate %g total %ld", framerate, total_video_frames )); 566 DecodeLoopDebug(( "Frame rate %g total %ld", framerate, total_video_frames ));
567 567
568 if ( framerate <= 1.0 ) { 568 if ( framerate <= 1.0 ) {
569 DecodeLoopDebug(( "Crazy frame rate, resetting to sensible" )); 569 DecodeLoopDebug(( "Crazy frame rate, resetting to sensible" ));
570 framerate = 25; 570 framerate = 25;
571 } 571 }
572 572
573 if ( total_video_frames == 1 ) { 573 if ( total_video_frames == 1 ) {
574 DecodeLoopDebug(( "Cannot seek to frame" )); 574 DecodeLoopDebug(( "Cannot seek to frame" ));
575 } 575 }
576 576
577 } 577 }
578 578
579 videoMutex->lock(); 579 videoMutex->lock();
580 current_frame = 0; 580 current_frame = 0;
581 prev_frame = -1; 581 prev_frame = -1;
582 videoMutex->unlock(); 582 videoMutex->unlock();
583 583
584 connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( setPosition( long ) ) ); 584 connect( mediaPlayerState, SIGNAL( positionChanged(long) ), this, SLOT( setPosition(long) ) );
585 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( setPaused( bool ) ) ); 585 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
586 586
587 //setBackgroundColor( black ); 587 //setBackgroundColor( black );
588 return TRUE; 588 return TRUE;
589} 589}
590 590
591 591
592void LoopControl::play() { 592void LoopControl::play() {
593 593
594#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 594#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
595 if ( !disabledSuspendScreenSaver ) { 595 if ( !disabledSuspendScreenSaver ) {
596 disabledSuspendScreenSaver = TRUE; 596 disabledSuspendScreenSaver = TRUE;
597 // Stop the screen from blanking and power saving state 597 // Stop the screen from blanking and power saving state
598 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) 598 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" )
599 << ( hasVideoChannel ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 599 << ( hasVideoChannel ? QPEApplication::Disable : QPEApplication::DisableSuspend );
600 } 600 }
601#endif 601#endif
602 602
603 //begin = clock(); 603 //begin = clock();
604 playtime.start(); 604 playtime.start();
605 startTimers(); 605 startTimers();
606 //updateGeometry(); 606 //updateGeometry();
607} 607}
608 608
609 609
610void LoopControl::setMute( bool on ) { 610void LoopControl::setMute( bool on ) {
611 if ( isMuted != on ) { 611 if ( isMuted != on ) {
612 isMuted = on; 612 isMuted = on;
613 if ( isMuted ) { 613 if ( isMuted ) {
614 } else { 614 } else {
615 int frame = current_frame; // mediaPlayerState->curDecoder()->videoGetFrame( stream ); 615 int frame = current_frame; // mediaPlayerState->curDecoder()->videoGetFrame( stream );
616 playtime.restart(); 616 playtime.restart();
617 playtime = playtime.addMSecs( -frame * 1000 / framerate ); 617 playtime = playtime.addMSecs( -frame * 1000 / framerate );
618 //begin = clock() - (double)frame * CLOCKS_PER_SEC / framerate; 618 //begin = clock() - (double)frame * CLOCKS_PER_SEC / framerate;
619 mediaPlayerState->curDecoder()->audioSetSample( frame*freq/framerate, stream ); 619 mediaPlayerState->curDecoder()->audioSetSample( frame*freq/framerate, stream );
620 } 620 }
621 } 621 }
622} 622}
623 623
624 624
diff --git a/core/multimedia/opieplayer/mediaplayer.cpp b/core/multimedia/opieplayer/mediaplayer.cpp
index b77708c..6c743ec 100644
--- a/core/multimedia/opieplayer/mediaplayer.cpp
+++ b/core/multimedia/opieplayer/mediaplayer.cpp
@@ -1,94 +1,94 @@
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 21
22#include <qmessagebox.h> 22#include <qmessagebox.h>
23 23
24#include "mediaplayer.h" 24#include "mediaplayer.h"
25#include "playlistwidget.h" 25#include "playlistwidget.h"
26#include "audiowidget.h" 26#include "audiowidget.h"
27#include "loopcontrol.h" 27#include "loopcontrol.h"
28#include "audiodevice.h" 28#include "audiodevice.h"
29 29
30#include "mediaplayerstate.h" 30#include "mediaplayerstate.h"
31 31
32 32
33extern AudioWidget *audioUI; 33extern AudioWidget *audioUI;
34extern PlayListWidget *playList; 34extern PlayListWidget *playList;
35extern LoopControl *loopControl; 35extern LoopControl *loopControl;
36extern MediaPlayerState *mediaPlayerState; 36extern MediaPlayerState *mediaPlayerState;
37 37
38 38
39MediaPlayer::MediaPlayer( QObject *parent, const char *name ) 39MediaPlayer::MediaPlayer( QObject *parent, const char *name )
40 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { 40 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) {
41 41
42// QPEApplication::grabKeyboard(); 42// QPEApplication::grabKeyboard();
43 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 43 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
44 44
45 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 45 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
46 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 46 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pauseCheck(bool) ) );
47 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 47 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
48 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 48 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
49 49
50 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 50 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
51 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 51 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
52 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 52 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
53 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 53 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
54} 54}
55 55
56 56
57MediaPlayer::~MediaPlayer() { 57MediaPlayer::~MediaPlayer() {
58 58
59} 59}
60 60
61 61
62void MediaPlayer::pauseCheck( bool b ) { 62void MediaPlayer::pauseCheck( bool b ) {
63 // Only pause if playing 63 // Only pause if playing
64 if ( b && !mediaPlayerState->playing() ) 64 if ( b && !mediaPlayerState->playing() )
65 mediaPlayerState->setPaused( FALSE ); 65 mediaPlayerState->setPaused( FALSE );
66} 66}
67 67
68 68
69void MediaPlayer::play() { 69void MediaPlayer::play() {
70 mediaPlayerState->setPlaying( FALSE ); 70 mediaPlayerState->setPlaying( FALSE );
71 mediaPlayerState->setPlaying( TRUE ); 71 mediaPlayerState->setPlaying( TRUE );
72} 72}
73 73
74 74
75void MediaPlayer::setPlaying( bool play ) { 75void MediaPlayer::setPlaying( bool play ) {
76 // qDebug("MediaPlayer setPlaying %d", play); 76 // qDebug("MediaPlayer setPlaying %d", play);
77 if ( !play ) { 77 if ( !play ) {
78 mediaPlayerState->setPaused( FALSE ); 78 mediaPlayerState->setPaused( FALSE );
79 loopControl->stop( FALSE ); 79 loopControl->stop( FALSE );
80 return; 80 return;
81 } 81 }
82 82
83 if ( mediaPlayerState->paused() ) { 83 if ( mediaPlayerState->paused() ) {
84 mediaPlayerState->setPaused( FALSE ); 84 mediaPlayerState->setPaused( FALSE );
85 return; 85 return;
86 } 86 }
87 // qDebug("about to ctrash"); 87 // qDebug("about to ctrash");
88 const DocLnk *playListCurrent = playList->current(); 88 const DocLnk *playListCurrent = playList->current();
89 89
90 if ( playListCurrent != NULL ) { 90 if ( playListCurrent != NULL ) {
91 loopControl->stop( TRUE ); 91 loopControl->stop( TRUE );
92 currentFile = playListCurrent; 92 currentFile = playListCurrent;
93 } 93 }
94 if ( currentFile == NULL ) { 94 if ( currentFile == NULL ) {
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index a359843..efb5df3 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -74,163 +74,163 @@ class PlayListWidgetPrivate {
74public: 74public:
75 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; 75 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
76 QFrame *playListFrame; 76 QFrame *playListFrame;
77 FileSelector *files; 77 FileSelector *files;
78 PlayListSelection *selectedFiles; 78 PlayListSelection *selectedFiles;
79 bool setDocumentUsed; 79 bool setDocumentUsed;
80 DocLnk *current; 80 DocLnk *current;
81}; 81};
82 82
83 83
84class ToolButton : public QToolButton { 84class ToolButton : public QToolButton {
85public: 85public:
86 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 86 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
87 : QToolButton( parent, name ) { 87 : QToolButton( parent, name ) {
88 setTextLabel( name ); 88 setTextLabel( name );
89 setPixmap( Resource::loadPixmap( icon ) ); 89 setPixmap( Resource::loadPixmap( icon ) );
90 setAutoRaise( TRUE ); 90 setAutoRaise( TRUE );
91 setFocusPolicy( QWidget::NoFocus ); 91 setFocusPolicy( QWidget::NoFocus );
92 setToggleButton( t ); 92 setToggleButton( t );
93 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 93 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
94 QPEMenuToolFocusManager::manager()->addWidget( this ); 94 QPEMenuToolFocusManager::manager()->addWidget( this );
95 } 95 }
96}; 96};
97 97
98 98
99class MenuItem : public QAction { 99class MenuItem : public QAction {
100public: 100public:
101 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) 101 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
102 : QAction( text, QString::null, 0, 0 ) { 102 : QAction( text, QString::null, 0, 0 ) {
103 connect( this, SIGNAL( activated() ), handler, slot ); 103 connect( this, SIGNAL( activated() ), handler, slot );
104 addTo( parent ); 104 addTo( parent );
105 } 105 }
106}; 106};
107 107
108 108
109PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 109PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
110 : QMainWindow( parent, name, fl ) { 110 : QMainWindow( parent, name, fl ) {
111 111
112 d = new PlayListWidgetPrivate; 112 d = new PlayListWidgetPrivate;
113 d->setDocumentUsed = FALSE; 113 d->setDocumentUsed = FALSE;
114 d->current = NULL; 114 d->current = NULL;
115 fromSetDocument = FALSE; 115 fromSetDocument = FALSE;
116 insanityBool=FALSE; 116 insanityBool=FALSE;
117 audioScan = FALSE; 117 audioScan = FALSE;
118 videoScan = FALSE; 118 videoScan = FALSE;
119// menuTimer = new QTimer( this ,"menu timer"), 119// menuTimer = new QTimer( this ,"menu timer"),
120// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); 120// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) );
121 channel = new QCopChannel( "QPE/Application/opieplayer", this ); 121 channel = new QCopChannel( "QPE/Application/opieplayer", this );
122 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 122 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
123 this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); 123 this, SLOT( qcopReceive(const QCString&,const QByteArray&)) );
124 124
125 setBackgroundMode( PaletteButton ); 125 setBackgroundMode( PaletteButton );
126 126
127 setCaption( tr("OpiePlayer") ); 127 setCaption( tr("OpiePlayer") );
128 setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); 128 setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) );
129 129
130 setToolBarsMovable( FALSE ); 130 setToolBarsMovable( FALSE );
131 131
132 // Create Toolbar 132 // Create Toolbar
133 QToolBar *toolbar = new QToolBar( this ); 133 QToolBar *toolbar = new QToolBar( this );
134 toolbar->setHorizontalStretchable( TRUE ); 134 toolbar->setHorizontalStretchable( TRUE );
135 135
136 // Create Menubar 136 // Create Menubar
137 QMenuBar *menu = new QMenuBar( toolbar ); 137 QMenuBar *menu = new QMenuBar( toolbar );
138 menu->setMargin( 0 ); 138 menu->setMargin( 0 );
139 139
140 QToolBar *bar = new QToolBar( this ); 140 QToolBar *bar = new QToolBar( this );
141 bar->setLabel( tr( "Play Operations" ) ); 141 bar->setLabel( tr( "Play Operations" ) );
142// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", 142// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list",
143// this , SLOT( addSelected()) ); 143// this , SLOT( addSelected()) );
144 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); 144 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close");
145 tbDeletePlaylist->setFlat(TRUE); 145 tbDeletePlaylist->setFlat(TRUE);
146 146
147 tbDeletePlaylist->setFixedSize(20,20); 147 tbDeletePlaylist->setFixedSize(20,20);
148 148
149 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", 149 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist",
150 this , SLOT(addSelected()) ); 150 this , SLOT(addSelected()) );
151 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", 151 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist",
152 this , SLOT(removeSelected()) ); 152 this , SLOT(removeSelected()) );
153// d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); 153// d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool)/*btnPlay()*/), TRUE );
154 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", 154 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play",
155 this , SLOT( btnPlay(bool) ), TRUE ); 155 this , SLOT( btnPlay(bool) ), TRUE );
156 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", 156 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle",
157 mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); 157 mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
158 d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", 158 d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop",
159 mediaPlayerState, SLOT(setLooping(bool)), TRUE ); 159 mediaPlayerState, SLOT(setLooping(bool)), TRUE );
160 tbDeletePlaylist->hide(); 160 tbDeletePlaylist->hide();
161 161
162 QPopupMenu *pmPlayList = new QPopupMenu( this ); 162 QPopupMenu *pmPlayList = new QPopupMenu( this );
163 menu->insertItem( tr( "File" ), pmPlayList ); 163 menu->insertItem( tr( "File" ), pmPlayList );
164 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 164 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
165 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); 165 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
166 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); 166 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
167 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); 167 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
168 pmPlayList->insertSeparator(-1); 168 pmPlayList->insertSeparator(-1);
169 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); 169 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
170 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); 170 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) );
171 pmPlayList->insertSeparator(-1); 171 pmPlayList->insertSeparator(-1);
172 new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); 172 new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) );
173 new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); 173 new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) );
174 174
175 QPopupMenu *pmView = new QPopupMenu( this ); 175 QPopupMenu *pmView = new QPopupMenu( this );
176 menu->insertItem( tr( "View" ), pmView ); 176 menu->insertItem( tr( "View" ), pmView );
177 177
178 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); 178 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0);
179 fullScreenButton->addTo(pmView); 179 fullScreenButton->addTo(pmView);
180 scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); 180 scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0);
181 scaleButton->addTo(pmView); 181 scaleButton->addTo(pmView);
182 182
183 183
184 skinsMenu = new QPopupMenu( this ); 184 skinsMenu = new QPopupMenu( this );
185 menu->insertItem( tr( "Skins" ), skinsMenu ); 185 menu->insertItem( tr( "Skins" ), skinsMenu );
186 skinsMenu->isCheckable(); 186 skinsMenu->isCheckable();
187 connect( skinsMenu, SIGNAL( activated( int ) ) , 187 connect( skinsMenu, SIGNAL( activated(int) ) ,
188 this, SLOT( skinsMenuActivated( int ) ) ); 188 this, SLOT( skinsMenuActivated(int) ) );
189 populateSkinsMenu(); 189 populateSkinsMenu();
190 190
191 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); 191 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton );
192 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); 192 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
193 193
194 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); 194 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
195 195
196 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 196 tabWidget = new QTabWidget( hbox6, "tabWidget" );
197// tabWidget->setTabShape(QTabWidget::Triangular); 197// tabWidget->setTabShape(QTabWidget::Triangular);
198 198
199 QWidget *pTab; 199 QWidget *pTab;
200 pTab = new QWidget( tabWidget, "pTab" ); 200 pTab = new QWidget( tabWidget, "pTab" );
201// playlistView = new QListView( pTab, "playlistview" ); 201// playlistView = new QListView( pTab, "playlistview" );
202// playlistView->setMinimumSize(236,260); 202// playlistView->setMinimumSize(236,260);
203 tabWidget->insertTab( pTab,"Playlist"); 203 tabWidget->insertTab( pTab,"Playlist");
204 204
205 205
206 // Add the playlist area 206 // Add the playlist area
207 207
208 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); 208 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
209 d->playListFrame = vbox3; 209 d->playListFrame = vbox3;
210 210
211 QGridLayout *layoutF = new QGridLayout( pTab ); 211 QGridLayout *layoutF = new QGridLayout( pTab );
212 layoutF->setSpacing( 2); 212 layoutF->setSpacing( 2);
213 layoutF->setMargin( 2); 213 layoutF->setMargin( 2);
214 layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 ); 214 layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 );
215 215
216 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); 216 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
217 217
218 d->selectedFiles = new PlayListSelection( hbox2); 218 d->selectedFiles = new PlayListSelection( hbox2);
219 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); 219 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
220 220
221 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); 221 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold);
222 222
223 223
224 224
225 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch 225 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
226 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); 226 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) );
227 new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); 227 new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) );
228 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); 228 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) );
229 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch 229 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch
230 230
231 QWidget *aTab; 231 QWidget *aTab;
232 aTab = new QWidget( tabWidget, "aTab" ); 232 aTab = new QWidget( tabWidget, "aTab" );
233 audioView = new QListView( aTab, "Audioview" ); 233 audioView = new QListView( aTab, "Audioview" );
234 234
235 QGridLayout *layoutA = new QGridLayout( aTab ); 235 QGridLayout *layoutA = new QGridLayout( aTab );
236 layoutA->setSpacing( 2); 236 layoutA->setSpacing( 2);
@@ -251,128 +251,128 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
251 audioView->setSorting( 3, TRUE ); 251 audioView->setSorting( 3, TRUE );
252 252
253 tabWidget->insertTab(aTab,tr("Audio")); 253 tabWidget->insertTab(aTab,tr("Audio"));
254 254
255 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); 255 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold);
256 256
257// audioView 257// audioView
258// populateAudioView(); 258// populateAudioView();
259// videowidget 259// videowidget
260 260
261 QWidget *vTab; 261 QWidget *vTab;
262 vTab = new QWidget( tabWidget, "vTab" ); 262 vTab = new QWidget( tabWidget, "vTab" );
263 videoView = new QListView( vTab, "Videoview" ); 263 videoView = new QListView( vTab, "Videoview" );
264 264
265 QGridLayout *layoutV = new QGridLayout( vTab ); 265 QGridLayout *layoutV = new QGridLayout( vTab );
266 layoutV->setSpacing( 2); 266 layoutV->setSpacing( 2);
267 layoutV->setMargin( 2); 267 layoutV->setMargin( 2);
268 layoutV->addMultiCellWidget( videoView, 0, 0, 0, 1 ); 268 layoutV->addMultiCellWidget( videoView, 0, 0, 0, 1 );
269 269
270 videoView->addColumn(tr("Title"),-1); 270 videoView->addColumn(tr("Title"),-1);
271 videoView->addColumn(tr("Size"),-1); 271 videoView->addColumn(tr("Size"),-1);
272 videoView->addColumn(tr("Media"),-1); 272 videoView->addColumn(tr("Media"),-1);
273 videoView->addColumn(tr( "Path" ), -1 ); 273 videoView->addColumn(tr( "Path" ), -1 );
274 videoView->setColumnAlignment(1, Qt::AlignRight); 274 videoView->setColumnAlignment(1, Qt::AlignRight);
275 videoView->setColumnAlignment(2, Qt::AlignRight); 275 videoView->setColumnAlignment(2, Qt::AlignRight);
276 videoView->setAllColumnsShowFocus(TRUE); 276 videoView->setAllColumnsShowFocus(TRUE);
277 videoView->setMultiSelection( TRUE ); 277 videoView->setMultiSelection( TRUE );
278 videoView->setSelectionMode( QListView::Extended); 278 videoView->setSelectionMode( QListView::Extended);
279 279
280 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); 280 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
281 281
282 tabWidget->insertTab( vTab,tr("Video")); 282 tabWidget->insertTab( vTab,tr("Video"));
283 283
284 QWidget *LTab; 284 QWidget *LTab;
285 LTab = new QWidget( tabWidget, "LTab" ); 285 LTab = new QWidget( tabWidget, "LTab" );
286 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE); 286 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE);
287 287
288 QGridLayout *layoutL = new QGridLayout( LTab ); 288 QGridLayout *layoutL = new QGridLayout( LTab );
289 layoutL->setSpacing( 2); 289 layoutL->setSpacing( 2);
290 layoutL->setMargin( 2); 290 layoutL->setMargin( 2);
291 layoutL->addMultiCellWidget( playLists, 0, 0, 0, 1 ); 291 layoutL->addMultiCellWidget( playLists, 0, 0, 0, 1 );
292 292
293 tabWidget->insertTab(LTab,tr("Lists")); 293 tabWidget->insertTab(LTab,tr("Lists"));
294 294
295 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); 295 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
296 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); 296 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) );
297 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); 297 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) );
298 298
299 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 299 connect( d->selectedFiles, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
300 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); 300 this,SLOT( playlistViewPressed(int,QListViewItem*,const QPoint&,int)) );
301 301
302 302
303///audioView 303///audioView
304 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 304 connect( audioView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
305 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 305 this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int)) );
306 306
307 connect( audioView, SIGNAL( returnPressed( QListViewItem *)), 307 connect( audioView, SIGNAL( returnPressed(QListViewItem*)),
308 this,SLOT( playIt( QListViewItem *)) ); 308 this,SLOT( playIt(QListViewItem*)) );
309 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 309 connect( audioView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( addToSelection(QListViewItem*) ) );
310 310
311 311
312//videoView 312//videoView
313 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 313 connect( videoView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
314 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 314 this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int)) );
315 connect( videoView, SIGNAL( returnPressed( QListViewItem *)), 315 connect( videoView, SIGNAL( returnPressed(QListViewItem*)),
316 this,SLOT( playIt( QListViewItem *)) ); 316 this,SLOT( playIt(QListViewItem*)) );
317 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 317 connect( videoView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( addToSelection(QListViewItem*) ) );
318 318
319//playlists 319//playlists
320 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); 320 connect( playLists, SIGNAL( fileSelected(const DocLnk&) ), this, SLOT( loadList(const DocLnk&) ) );
321 321
322 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); 322 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
323 323
324 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 324 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), d->tbPlay, SLOT( setOn(bool) ) );
325 325
326 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); 326 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), d->tbLoop, SLOT( setOn(bool) ) );
327 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); 327 connect( mediaPlayerState, SIGNAL( shuffledToggled(bool) ), d->tbShuffle, SLOT( setOn(bool) ) );
328 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 328 connect( mediaPlayerState, SIGNAL( playlistToggled(bool) ), this, SLOT( setPlaylist(bool) ) );
329 329
330 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 330 connect( d->selectedFiles, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( playIt(QListViewItem*) ) );
331 331
332 setCentralWidget( vbox5 ); 332 setCentralWidget( vbox5 );
333 333
334 Config cfg( "OpiePlayer" ); 334 Config cfg( "OpiePlayer" );
335 readConfig( cfg ); 335 readConfig( cfg );
336 336
337 currentPlayList = cfg.readEntry("CurrentPlaylist","default"); 337 currentPlayList = cfg.readEntry("CurrentPlaylist","default");
338 loadList(DocLnk( currentPlayList)); 338 loadList(DocLnk( currentPlayList));
339 setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlayList))); 339 setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlayList)));
340 340
341 initializeStates(); 341 initializeStates();
342} 342}
343 343
344 344
345PlayListWidget::~PlayListWidget() { 345PlayListWidget::~PlayListWidget() {
346 Config cfg( "OpiePlayer" ); 346 Config cfg( "OpiePlayer" );
347 writeConfig( cfg ); 347 writeConfig( cfg );
348 348
349 if ( d->current ) 349 if ( d->current )
350 delete d->current; 350 delete d->current;
351 if(d) delete d; 351 if(d) delete d;
352} 352}
353 353
354 354
355void PlayListWidget::initializeStates() { 355void PlayListWidget::initializeStates() {
356 356
357 d->tbPlay->setOn( mediaPlayerState->playing() ); 357 d->tbPlay->setOn( mediaPlayerState->playing() );
358 d->tbLoop->setOn( mediaPlayerState->looping() ); 358 d->tbLoop->setOn( mediaPlayerState->looping() );
359 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 359 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
360 setPlaylist( true); 360 setPlaylist( true);
361} 361}
362 362
363 363
364void PlayListWidget::readConfig( Config& cfg ) { 364void PlayListWidget::readConfig( Config& cfg ) {
365 cfg.setGroup("PlayList"); 365 cfg.setGroup("PlayList");
366 QString currentString = cfg.readEntry("current", "" ); 366 QString currentString = cfg.readEntry("current", "" );
367 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 367 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
368 for ( int i = 0; i < noOfFiles; i++ ) { 368 for ( int i = 0; i < noOfFiles; i++ ) {
369 QString entryName; 369 QString entryName;
370 entryName.sprintf( "File%i", i + 1 ); 370 entryName.sprintf( "File%i", i + 1 );
371 QString linkFile = cfg.readEntry( entryName ); 371 QString linkFile = cfg.readEntry( entryName );
372 DocLnk lnk( linkFile ); 372 DocLnk lnk( linkFile );
373 if ( lnk.isValid() ) { 373 if ( lnk.isValid() ) {
374 d->selectedFiles->addToSelection( lnk ); 374 d->selectedFiles->addToSelection( lnk );
375 } 375 }
376 } 376 }
377 d->selectedFiles->setSelectedItem( currentString); 377 d->selectedFiles->setSelectedItem( currentString);
378} 378}
@@ -895,97 +895,97 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoi
895 case 1: 895 case 1:
896 896
897 break; 897 break;
898 case 2:{ 898 case 2:{
899 QPopupMenu m; 899 QPopupMenu m;
900 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 900 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
901 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 901 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
902 // m.insertSeparator(); 902 // m.insertSeparator();
903 // m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); 903 // m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
904 m.exec( QCursor::pos() ); 904 m.exec( QCursor::pos() );
905 } 905 }
906 break; 906 break;
907 }; 907 };
908 908
909} 909}
910 910
911void PlayListWidget::listDelete() { 911void PlayListWidget::listDelete() {
912 Config cfg( "OpiePlayer" ); 912 Config cfg( "OpiePlayer" );
913 cfg.setGroup("PlayList"); 913 cfg.setGroup("PlayList");
914 currentPlayList = cfg.readEntry("CurrentPlaylist",""); 914 currentPlayList = cfg.readEntry("CurrentPlaylist","");
915 QString file; 915 QString file;
916 // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 916 // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
917 switch ( tabWidget->currentPageIndex()) { 917 switch ( tabWidget->currentPageIndex()) {
918 case 0: 918 case 0:
919 break; 919 break;
920 case 1: 920 case 1:
921 { 921 {
922 file = audioView->currentItem()->text(0); 922 file = audioView->currentItem()->text(0);
923 QListIterator<DocLnk> Pdit( files.children() ); 923 QListIterator<DocLnk> Pdit( files.children() );
924 for ( ; Pdit.current(); ++Pdit ) { 924 for ( ; Pdit.current(); ++Pdit ) {
925 if( Pdit.current()->name() == file) { 925 if( Pdit.current()->name() == file) {
926 LnkProperties prop( Pdit.current() ); 926 LnkProperties prop( Pdit.current() );
927 QPEApplication::execDialog( &prop ); 927 QPEApplication::execDialog( &prop );
928 } 928 }
929 } 929 }
930 populateAudioView(); 930 populateAudioView();
931 } 931 }
932 break; 932 break;
933 case 2: 933 case 2:
934 { 934 {
935 // file = videoView->selectedItem()->text(0); 935 // file = videoView->selectedItem()->text(0);
936 // for ( int i = 0; i < noOfFiles; i++ ) { 936 // for ( int i = 0; i < noOfFiles; i++ ) {
937 // QString entryName; 937 // QString entryName;
938 // entryName.sprintf( "File%i", i + 1 ); 938 // entryName.sprintf( "File%i", i + 1 );
939 // QString linkFile = cfg.readEntry( entryName ); 939 // QString linkFile = cfg.readEntry( entryName );
940 // AppLnk lnk( AppLnk(linkFile)); 940 // AppLnk lnk( AppLnk(linkFile));
941 // if( lnk.name() == file ) { 941 // if( lnk.name() == file ) {
942 // LnkProperties prop( &lnk); 942 // LnkProperties prop( &lnk);
943 // // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 943 // // connect(&prop, SIGNAL(select(const AppLnk*)), this, SLOT(externalSelected(const AppLnk*)));
944 // prop.showMaximized(); 944 // prop.showMaximized();
945 // prop.exec(); 945 // prop.exec();
946 // } 946 // }
947 // } 947 // }
948 } 948 }
949 break; 949 break;
950 }; 950 };
951} 951}
952 952
953void PlayListWidget::scanForAudio() { 953void PlayListWidget::scanForAudio() {
954 // qDebug("scan for audio"); 954 // qDebug("scan for audio");
955 files.detachChildren(); 955 files.detachChildren();
956 QListIterator<DocLnk> sdit( files.children() ); 956 QListIterator<DocLnk> sdit( files.children() );
957 for ( ; sdit.current(); ++sdit ) { 957 for ( ; sdit.current(); ++sdit ) {
958 delete sdit.current(); 958 delete sdit.current();
959 } 959 }
960 Global::findDocuments( &files, audioMimes); 960 Global::findDocuments( &files, audioMimes);
961 audioScan = true; 961 audioScan = true;
962} 962}
963void PlayListWidget::scanForVideo() { 963void PlayListWidget::scanForVideo() {
964 // qDebug("scan for video"); 964 // qDebug("scan for video");
965 vFiles.detachChildren(); 965 vFiles.detachChildren();
966 QListIterator<DocLnk> sdit( vFiles.children() ); 966 QListIterator<DocLnk> sdit( vFiles.children() );
967 for ( ; sdit.current(); ++sdit ) { 967 for ( ; sdit.current(); ++sdit ) {
968 delete sdit.current(); 968 delete sdit.current();
969 } 969 }
970 Global::findDocuments(&vFiles, "video/*"); 970 Global::findDocuments(&vFiles, "video/*");
971 videoScan = true; 971 videoScan = true;
972} 972}
973 973
974void PlayListWidget::populateAudioView() { 974void PlayListWidget::populateAudioView() {
975 975
976 audioView->clear(); 976 audioView->clear();
977 StorageInfo storageInfo; 977 StorageInfo storageInfo;
978 const QList<FileSystem> &fs = storageInfo.fileSystems(); 978 const QList<FileSystem> &fs = storageInfo.fileSystems();
979 if(!audioScan) scanForAudio(); 979 if(!audioScan) scanForAudio();
980 980
981 QListIterator<DocLnk> dit( files.children() ); 981 QListIterator<DocLnk> dit( files.children() );
982 QListIterator<FileSystem> it ( fs ); 982 QListIterator<FileSystem> it ( fs );
983 983
984 QString storage; 984 QString storage;
985 for ( ; dit.current(); ++dit ) { 985 for ( ; dit.current(); ++dit ) {
986 for( ; it.current(); ++it ){ 986 for( ; it.current(); ++it ){
987 const QString name = (*it)->name(); 987 const QString name = (*it)->name();
988 const QString path = (*it)->path(); 988 const QString path = (*it)->path();
989 if(dit.current()->file().find(path) != -1 ) storage=name; 989 if(dit.current()->file().find(path) != -1 ) storage=name;
990 } 990 }
991 991
diff --git a/core/obex/obexhandler.cpp b/core/obex/obexhandler.cpp
index 4034560..28f9b5b 100644
--- a/core/obex/obexhandler.cpp
+++ b/core/obex/obexhandler.cpp
@@ -1,67 +1,67 @@
1 1
2#include <qpe/qcopenvelope_qws.h> 2#include <qpe/qcopenvelope_qws.h>
3#include <qpe/qpeapplication.h> 3#include <qpe/qpeapplication.h>
4 4
5#include "obexsend.h" 5#include "obexsend.h"
6#include "receiver.h" 6#include "receiver.h"
7#include "obexhandler.h" 7#include "obexhandler.h"
8 8
9using namespace OpieObex; 9using namespace OpieObex;
10 10
11/* TRANSLATOR OpieObex::ObexHandler */ 11/* TRANSLATOR OpieObex::ObexHandler */
12 12
13ObexHandler::ObexHandler() { 13ObexHandler::ObexHandler() {
14 m_wasRec = false; 14 m_wasRec = false;
15 m_sender = 0l; 15 m_sender = 0l;
16 m_receiver = 0l; 16 m_receiver = 0l;
17 QCopChannel* chan = new QCopChannel("QPE/Obex"); 17 QCopChannel* chan = new QCopChannel("QPE/Obex");
18 connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ), 18 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
19 this, SLOT(irdaMessage(const QCString&, const QByteArray& ) ) ); 19 this, SLOT(irdaMessage(const QCString&,const QByteArray&) ) );
20} 20}
21ObexHandler::~ObexHandler() { 21ObexHandler::~ObexHandler() {
22 delete m_sender; 22 delete m_sender;
23 delete m_receiver; 23 delete m_receiver;
24} 24}
25void ObexHandler::doSend(const QString& str, const QString& desc) { 25void ObexHandler::doSend(const QString& str, const QString& desc) {
26 delete m_sender; 26 delete m_sender;
27 m_sender = new SendWidget; 27 m_sender = new SendWidget;
28 m_sender->raise(); 28 m_sender->raise();
29 QPEApplication::showWidget( m_sender ); 29 QPEApplication::showWidget( m_sender );
30 connect(m_sender, SIGNAL(done() ), 30 connect(m_sender, SIGNAL(done() ),
31 this, SLOT(slotSent() ) ); 31 this, SLOT(slotSent() ) );
32 m_sender->send( str, desc ); 32 m_sender->send( str, desc );
33} 33}
34void ObexHandler::doReceive(bool b) { 34void ObexHandler::doReceive(bool b) {
35 if (m_receiver && b ) return; // we should enable receiver and it is on 35 if (m_receiver && b ) return; // we should enable receiver and it is on
36 else if (!m_receiver && !b ) return; // we should disbale receiver and it is off 36 else if (!m_receiver && !b ) return; // we should disbale receiver and it is off
37 else if (m_receiver && !b ) { 37 else if (m_receiver && !b ) {
38 delete m_receiver; 38 delete m_receiver;
39 m_receiver=0; 39 m_receiver=0;
40 }else if (!m_receiver && b ) { 40 }else if (!m_receiver && b ) {
41 m_receiver= new Receiver; 41 m_receiver= new Receiver;
42 } 42 }
43} 43}
44void ObexHandler::slotSent() { 44void ObexHandler::slotSent() {
45 QString file = m_sender->file(); 45 QString file = m_sender->file();
46 delete m_sender; 46 delete m_sender;
47 m_sender = 0; 47 m_sender = 0;
48 QCopEnvelope e ("QPE/Obex", "done(QString)" ); 48 QCopEnvelope e ("QPE/Obex", "done(QString)" );
49 e << file; 49 e << file;
50 doReceive(m_wasRec ); 50 doReceive(m_wasRec );
51 m_wasRec = false; 51 m_wasRec = false;
52} 52}
53void ObexHandler::irdaMessage( const QCString& msg, const QByteArray& data) { 53void ObexHandler::irdaMessage( const QCString& msg, const QByteArray& data) {
54 QDataStream stream( data, IO_ReadOnly ); 54 QDataStream stream( data, IO_ReadOnly );
55 if ( msg == "send(QString,QString,QString)" ) { 55 if ( msg == "send(QString,QString,QString)" ) {
56 QString name, desc; 56 QString name, desc;
57 stream >> desc; 57 stream >> desc;
58 stream >> name; 58 stream >> name;
59 m_wasRec = (m_receiver != 0 ); 59 m_wasRec = (m_receiver != 0 );
60 doReceive( false ); 60 doReceive( false );
61 doSend(name, desc); 61 doSend(name, desc);
62 }else if (msg == "receive(int)") { 62 }else if (msg == "receive(int)") {
63 int rec; 63 int rec;
64 stream >> rec; 64 stream >> rec;
65 doReceive(rec); 65 doReceive(rec);
66 } 66 }
67} 67}
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp
index 6b8d467..cd8d58e 100644
--- a/core/obex/obexsend.cpp
+++ b/core/obex/obexsend.cpp
@@ -1,110 +1,110 @@
1#include <qpushbutton.h> 1#include <qpushbutton.h>
2#include <qlabel.h> 2#include <qlabel.h>
3#include <qlayout.h> 3#include <qlayout.h>
4#include <qtimer.h> 4#include <qtimer.h>
5 5
6 6
7#include <qpe/qcopenvelope_qws.h> 7#include <qpe/qcopenvelope_qws.h>
8 8
9#include "obex.h" 9#include "obex.h"
10#include "obexsend.h" 10#include "obexsend.h"
11 11
12using namespace OpieObex; 12using namespace OpieObex;
13 13
14/* TRANSLATOR OpieObex::SendWidget */ 14/* TRANSLATOR OpieObex::SendWidget */
15 15
16 16
17SendWidget::SendWidget( QWidget* parent, const char* name ) 17SendWidget::SendWidget( QWidget* parent, const char* name )
18 : QWidget( parent, name ) { 18 : QWidget( parent, name ) {
19 initUI(); 19 initUI();
20} 20}
21SendWidget::~SendWidget() { 21SendWidget::~SendWidget() {
22} 22}
23void SendWidget::initUI() { 23void SendWidget::initUI() {
24 m_obex = new Obex(this, "obex"); 24 m_obex = new Obex(this, "obex");
25 connect(m_obex, SIGNAL(error(int) ), 25 connect(m_obex, SIGNAL(error(int) ),
26 this, SLOT(slotIrError(int) ) ); 26 this, SLOT(slotIrError(int) ) );
27 connect(m_obex, SIGNAL(sent(bool) ), 27 connect(m_obex, SIGNAL(sent(bool) ),
28 this, SLOT(slotIrSent(bool) ) ); 28 this, SLOT(slotIrSent(bool) ) );
29 connect(m_obex, SIGNAL(currentTry(unsigned int ) ), 29 connect(m_obex, SIGNAL(currentTry(unsigned int) ),
30 this, SLOT(slotIrTry(unsigned int ) ) ); 30 this, SLOT(slotIrTry(unsigned int) ) );
31 31
32 QCopChannel* chan = new QCopChannel("QPE/IrDaAppletBack", this ); 32 QCopChannel* chan = new QCopChannel("QPE/IrDaAppletBack", this );
33 connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ), 33 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
34 this, SLOT(dispatchIrda(const QCString&, const QByteArray& ) ) ); 34 this, SLOT(dispatchIrda(const QCString&,const QByteArray&) ) );
35 35
36 chan = new QCopChannel("QPE/BluetoothBack", this ); 36 chan = new QCopChannel("QPE/BluetoothBack", this );
37 connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ), 37 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
38 this, SLOT(dispatchBt(const QCString&, const QByteArray& ) ) ); 38 this, SLOT(dispatchBt(const QCString&,const QByteArray&) ) );
39 39
40 QVBoxLayout* lay = new QVBoxLayout(this); 40 QVBoxLayout* lay = new QVBoxLayout(this);
41 41
42 QHBox* nameBox = new QHBox(this); 42 QHBox* nameBox = new QHBox(this);
43 QLabel* name = new QLabel(nameBox); 43 QLabel* name = new QLabel(nameBox);
44 name->setText( tr("<qt><h1>Sending:</h1></qt>") ); 44 name->setText( tr("<qt><h1>Sending:</h1></qt>") );
45 name->setAlignment( AlignLeft | AlignTop ); 45 name->setAlignment( AlignLeft | AlignTop );
46 m_lblFile = new QLabel(nameBox); 46 m_lblFile = new QLabel(nameBox);
47 lay->addWidget(nameBox, 0); 47 lay->addWidget(nameBox, 0);
48 48
49 QFrame* frame = new QFrame(this); 49 QFrame* frame = new QFrame(this);
50 frame->setFrameShape( QFrame::HLine ); 50 frame->setFrameShape( QFrame::HLine );
51 frame->setFrameShadow( QFrame::Sunken ); 51 frame->setFrameShadow( QFrame::Sunken );
52 lay->addWidget(frame, 10); 52 lay->addWidget(frame, 10);
53 53
54 QLabel* devices = new QLabel(this); 54 QLabel* devices = new QLabel(this);
55 devices->setText("<qt><b>Devices:</b></qt>"); 55 devices->setText("<qt><b>Devices:</b></qt>");
56 devices->setAlignment( AlignLeft | AlignTop ); 56 devices->setAlignment( AlignLeft | AlignTop );
57 lay->addWidget( devices,10 ); 57 lay->addWidget( devices,10 );
58 58
59 m_devBox = new DeviceBox(this); 59 m_devBox = new DeviceBox(this);
60 lay->addWidget( m_devBox, 50 ); 60 lay->addWidget( m_devBox, 50 );
61 connect(m_devBox, SIGNAL(selectedDevice(int, int ) ), 61 connect(m_devBox, SIGNAL(selectedDevice(int,int) ),
62 this, SLOT(slotSelectedDevice(int, int) ) ); 62 this, SLOT(slotSelectedDevice(int,int) ) );
63 63
64 QPushButton *but = new QPushButton(this); 64 QPushButton *but = new QPushButton(this);
65 but->setText(tr("Done") ); 65 but->setText(tr("Done") );
66 connect(but, SIGNAL(clicked() ), 66 connect(but, SIGNAL(clicked() ),
67 this, SLOT(slotDone() ) ); 67 this, SLOT(slotDone() ) );
68 68
69 lay->addWidget( but ); 69 lay->addWidget( but );
70 m_lay = lay; 70 m_lay = lay;
71 71
72 // QT does not like if you add items to an layout which already exits.... 72 // QT does not like if you add items to an layout which already exits....
73 // and was layouted invalidate() does not help too 73 // and was layouted invalidate() does not help too
74 // so we use RichText.... 74 // so we use RichText....
75} 75}
76 76
77/* 77/*
78 * in send we'll first set everything up 78 * in send we'll first set everything up
79 * and then wait for a list of devices. 79 * and then wait for a list of devices.
80 */ 80 */
81void SendWidget::send( const QString& file, const QString& desc ) { 81void SendWidget::send( const QString& file, const QString& desc ) {
82 m_file = file; 82 m_file = file;
83 m_irDa.clear(); 83 m_irDa.clear();
84 m_start = 0; 84 m_start = 0;
85 m_lblFile->setText(desc.isEmpty() ? file : desc ); 85 m_lblFile->setText(desc.isEmpty() ? file : desc );
86 86
87 if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) { 87 if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) {
88 m_irDeSearch = m_devBox->addDevice( tr("IrDa is not enabled!"), DeviceBox::Error ); 88 m_irDeSearch = m_devBox->addDevice( tr("IrDa is not enabled!"), DeviceBox::Error );
89 m_start++; 89 m_start++;
90 }else 90 }else
91 m_irDeSearch = m_devBox->addDevice( tr("Searching for IrDa Devices."), DeviceBox::Search ); 91 m_irDeSearch = m_devBox->addDevice( tr("Searching for IrDa Devices."), DeviceBox::Search );
92 92
93 if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) { 93 if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) {
94 m_btDeSearch = m_devBox->addDevice( tr("Bluetooth is not available"), DeviceBox::Error ); 94 m_btDeSearch = m_devBox->addDevice( tr("Bluetooth is not available"), DeviceBox::Error );
95 m_start++; 95 m_start++;
96 }else 96 }else
97 m_btDeSearch = m_devBox->addDevice( tr("Searching for bluetooth Devices."), DeviceBox::Search ); 97 m_btDeSearch = m_devBox->addDevice( tr("Searching for bluetooth Devices."), DeviceBox::Search );
98 98
99 if (m_start != 2 ) { 99 if (m_start != 2 ) {
100 QCopEnvelope e0("QPE/IrDaApplet", "enableIrda()"); 100 QCopEnvelope e0("QPE/IrDaApplet", "enableIrda()");
101 QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); 101 QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()");
102 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); 102 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()");
103 QCopEnvelope e3("QPE/Bluetooth", "listDevices()"); 103 QCopEnvelope e3("QPE/Bluetooth", "listDevices()");
104 } 104 }
105} 105}
106void SendWidget::slotIrDaDevices( const QStringList& list) { 106void SendWidget::slotIrDaDevices( const QStringList& list) {
107 qWarning("slot it irda devices "); 107 qWarning("slot it irda devices ");
108 for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) { 108 for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) {
109 int id = m_devBox->addDevice( (*it), DeviceBox::IrDa, tr("Scheduling for beam.") ); 109 int id = m_devBox->addDevice( (*it), DeviceBox::IrDa, tr("Scheduling for beam.") );
110 m_irDa.insert( id, (*it) ); 110 m_irDa.insert( id, (*it) );
diff --git a/core/obex/receiver.cpp b/core/obex/receiver.cpp
index 7d9f7ec..ee2668b 100644
--- a/core/obex/receiver.cpp
+++ b/core/obex/receiver.cpp
@@ -1,76 +1,76 @@
1#include <sys/types.h> 1#include <sys/types.h>
2#include <sys/stat.h> 2#include <sys/stat.h>
3#include <sys/mman.h> 3#include <sys/mman.h>
4#include <stdlib.h> // int system 4#include <stdlib.h> // int system
5#include <unistd.h> 5#include <unistd.h>
6 6
7#include <fcntl.h> 7#include <fcntl.h>
8 8
9#include <qfileinfo.h> 9#include <qfileinfo.h>
10#include <qlabel.h> 10#include <qlabel.h>
11#include <qtextview.h> 11#include <qtextview.h>
12#include <qpushbutton.h> 12#include <qpushbutton.h>
13 13
14#include <qpe/applnk.h> 14#include <qpe/applnk.h>
15#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
16#include <qpe/qcopenvelope_qws.h> 16#include <qpe/qcopenvelope_qws.h>
17 17
18#include "obex.h" 18#include "obex.h"
19#include "receiver.h" 19#include "receiver.h"
20 20
21using namespace OpieObex; 21using namespace OpieObex;
22 22
23/* TRANSLATOR OpieObex::Receiver */ 23/* TRANSLATOR OpieObex::Receiver */
24 24
25Receiver::Receiver() { 25Receiver::Receiver() {
26 m_obex = new Obex(this, "Receiver"); 26 m_obex = new Obex(this, "Receiver");
27 connect(m_obex, SIGNAL(receivedFile(const QString& ) ), 27 connect(m_obex, SIGNAL(receivedFile(const QString&) ),
28 this, SLOT(slotReceived(const QString& ) ) ); 28 this, SLOT(slotReceived(const QString&) ) );
29 m_obex->receive(); 29 m_obex->receive();
30} 30}
31Receiver::~Receiver() { 31Receiver::~Receiver() {
32 m_obex->setReceiveEnabled( false ); 32 m_obex->setReceiveEnabled( false );
33 delete m_obex; 33 delete m_obex;
34} 34}
35void Receiver::slotReceived( const QString& _file ) { 35void Receiver::slotReceived( const QString& _file ) {
36 QString file = _file; 36 QString file = _file;
37 int check = checkFile(file); 37 int check = checkFile(file);
38 if ( check == AddressBook ) 38 if ( check == AddressBook )
39 handleAddr( file ); 39 handleAddr( file );
40 else if ( check == Datebook ) 40 else if ( check == Datebook )
41 handleDateTodo( file ); 41 handleDateTodo( file );
42 else 42 else
43 handleOther( file ); 43 handleOther( file );
44} 44}
45void Receiver::handleAddr( const QString& str ) { 45void Receiver::handleAddr( const QString& str ) {
46 QCopEnvelope e("QPE/Application/addressbook", "setDocument(QString)" ); 46 QCopEnvelope e("QPE/Application/addressbook", "setDocument(QString)" );
47 e << str; 47 e << str;
48} 48}
49/* we can not say for sure if it's a VEevent ot VTodo */ 49/* we can not say for sure if it's a VEevent ot VTodo */
50void Receiver::handleDateTodo( const QString& str ) { 50void Receiver::handleDateTodo( const QString& str ) {
51 QCopEnvelope e0("QPE/Application/todolist", "setDocument(QString)"); 51 QCopEnvelope e0("QPE/Application/todolist", "setDocument(QString)");
52 e0 << str; 52 e0 << str;
53 QCopEnvelope e1("QPE/Application/datebook", "setDocument(QString)" ); 53 QCopEnvelope e1("QPE/Application/datebook", "setDocument(QString)" );
54 e1 << str; 54 e1 << str;
55} 55}
56/* 56/*
57 * Handle other asks if it should accept the 57 * Handle other asks if it should accept the
58 * beamed object and creates a DocLnk 58 * beamed object and creates a DocLnk
59 */ 59 */
60void Receiver::handleOther( const QString& other ) { 60void Receiver::handleOther( const QString& other ) {
61 OtherHandler* hand = new OtherHandler(); 61 OtherHandler* hand = new OtherHandler();
62 hand->handle( other ); 62 hand->handle( other );
63} 63}
64void Receiver::tidyUp( QString& _file, const QString& ending) { 64void Receiver::tidyUp( QString& _file, const QString& ending) {
65 /* libversit fails on BASE64 encoding we try to sed it away */ 65 /* libversit fails on BASE64 encoding we try to sed it away */
66 QString file = _file; 66 QString file = _file;
67 char foo[24]; // big enough 67 char foo[24]; // big enough
68 (void)::strcpy(foo, "/tmp/opie-XXXXXX"); 68 (void)::strcpy(foo, "/tmp/opie-XXXXXX");
69 69
70 int fd = ::mkstemp(foo); 70 int fd = ::mkstemp(foo);
71 71
72 if ( fd == -1 ) 72 if ( fd == -1 )
73 return; 73 return;
74 74
75 (void)::strncat( foo, ending.latin1(), 4 ); 75 (void)::strncat( foo, ending.latin1(), 4 );
76 _file = QString::fromLatin1( foo ); 76 _file = QString::fromLatin1( foo );
diff --git a/core/opie-login/loginwindowimpl.cpp b/core/opie-login/loginwindowimpl.cpp
index 3037ba3..e1b9360 100644
--- a/core/opie-login/loginwindowimpl.cpp
+++ b/core/opie-login/loginwindowimpl.cpp
@@ -12,117 +12,117 @@
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27#include <qpe/version.h> 27#include <qpe/version.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qlineedit.h> 30#include <qlineedit.h>
31#include <qtimer.h> 31#include <qtimer.h>
32#include <qcombobox.h> 32#include <qcombobox.h>
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qmessagebox.h> 35#include <qmessagebox.h>
36#if QT_VERSION < 300 36#if QT_VERSION < 300
37#include <qgfx_qws.h> 37#include <qgfx_qws.h>
38#endif 38#endif
39#include <qwindowsystem_qws.h> 39#include <qwindowsystem_qws.h>
40 40
41#include <qpe/resource.h> 41#include <qpe/resource.h>
42#include <qpe/qcopenvelope_qws.h> 42#include <qpe/qcopenvelope_qws.h>
43#include <qpe/config.h> 43#include <qpe/config.h>
44 44
45#include <opie/odevice.h> 45#include <opie/odevice.h>
46 46
47#include <stdio.h> 47#include <stdio.h>
48#include <stdlib.h> 48#include <stdlib.h>
49 49
50#include "loginwindowimpl.h" 50#include "loginwindowimpl.h"
51#include "loginapplication.h" 51#include "loginapplication.h"
52#include "inputmethods.h" 52#include "inputmethods.h"
53 53
54using namespace Opie; 54using namespace Opie;
55 55
56 56
57LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose ) 57LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose )
58{ 58{
59 QPopupMenu *pop = new QPopupMenu ( this ); 59 QPopupMenu *pop = new QPopupMenu ( this );
60 pop-> insertItem ( tr( "Restart" ), this, SLOT( restart ( ))); 60 pop-> insertItem ( tr( "Restart" ), this, SLOT( restart()));
61 pop-> insertItem ( tr( "Quit" ), this, SLOT( quit ( ))); 61 pop-> insertItem ( tr( "Quit" ), this, SLOT( quit()));
62 m_menu-> setPopup ( pop ); 62 m_menu-> setPopup ( pop );
63 63
64 QCopChannel *channel = new QCopChannel ( "QPE/TaskBar", this ); 64 QCopChannel *channel = new QCopChannel ( "QPE/TaskBar", this );
65 connect ( channel, SIGNAL( received ( const QCString &, const QByteArray & )), this, SLOT( receive ( const QCString &, const QByteArray & ))); 65 connect ( channel, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( receive(const QCString&,const QByteArray&)));
66 66
67 QHBoxLayout *lay = new QHBoxLayout ( m_taskbar, 4, 4 ); 67 QHBoxLayout *lay = new QHBoxLayout ( m_taskbar, 4, 4 );
68 m_input = new InputMethods ( m_taskbar ); 68 m_input = new InputMethods ( m_taskbar );
69 connect ( m_input, SIGNAL( inputToggled ( bool )), this, SLOT( calcMaxWindowRect ( ))); 69 connect ( m_input, SIGNAL( inputToggled(bool)), this, SLOT( calcMaxWindowRect()));
70 lay-> addWidget ( m_input ); 70 lay-> addWidget ( m_input );
71 lay-> addStretch ( 10 ); 71 lay-> addStretch ( 10 );
72 72
73 setActiveWindow ( ); 73 setActiveWindow ( );
74 m_password-> setFocus ( ); 74 m_password-> setFocus ( );
75 75
76 m_user-> insertStringList ( lApp-> allUsers ( )); 76 m_user-> insertStringList ( lApp-> allUsers ( ));
77 77
78 //there is no point in displaying the IM for a zaurus 78 //there is no point in displaying the IM for a zaurus
79 if (ODevice::inst ( )-> series ( ) != Model_Zaurus){ 79 if (ODevice::inst ( )-> series ( ) != Model_Zaurus){
80 QTimer::singleShot ( 0, this, SLOT( showIM ( ))); 80 QTimer::singleShot ( 0, this, SLOT( showIM()));
81 } 81 }
82 82
83 QString opiedir = ::getenv ( "OPIEDIR" ); 83 QString opiedir = ::getenv ( "OPIEDIR" );
84 QPixmap bgpix ( opiedir + "/pics/launcher/opie-background.jpg" ); 84 QPixmap bgpix ( opiedir + "/pics/launcher/opie-background.jpg" );
85 85
86 if ( !bgpix. isNull ( )) { 86 if ( !bgpix. isNull ( )) {
87 setBackgroundPixmap ( bgpix ); 87 setBackgroundPixmap ( bgpix );
88 m_caption-> setBackgroundPixmap ( bgpix); 88 m_caption-> setBackgroundPixmap ( bgpix);
89 TextLabel1-> setBackgroundPixmap ( bgpix); 89 TextLabel1-> setBackgroundPixmap ( bgpix);
90 TextLabel2-> setBackgroundPixmap ( bgpix); 90 TextLabel2-> setBackgroundPixmap ( bgpix);
91 } 91 }
92 92
93 m_caption-> setText ( tr("<center>Welcome to OPIE %1</center><center>& %2 %3</center>"). arg(QPE_VERSION). arg ( ODevice::inst ( )-> systemString ( )). arg ( ODevice::inst ( )-> systemVersionString ( ))); 93 m_caption-> setText ( tr("<center>Welcome to OPIE %1</center><center>& %2 %3</center>"). arg(QPE_VERSION). arg ( ODevice::inst ( )-> systemString ( )). arg ( ODevice::inst ( )-> systemVersionString ( )));
94 94
95 Config cfg ( "opie-login" ); 95 Config cfg ( "opie-login" );
96 cfg. setGroup ( "General" ); 96 cfg. setGroup ( "General" );
97 QString last = cfg. readEntry ( "LastLogin" ); 97 QString last = cfg. readEntry ( "LastLogin" );
98 98
99 if ( !last. isEmpty ( )) 99 if ( !last. isEmpty ( ))
100 m_user-> setEditText ( last ); 100 m_user-> setEditText ( last );
101 101
102 calcMaxWindowRect ( ); 102 calcMaxWindowRect ( );
103} 103}
104 104
105LoginWindowImpl::~LoginWindowImpl ( ) 105LoginWindowImpl::~LoginWindowImpl ( )
106{ 106{
107} 107}
108 108
109 109
110void LoginWindowImpl::receive ( const QCString &msg, const QByteArray &data ) 110void LoginWindowImpl::receive ( const QCString &msg, const QByteArray &data )
111{ 111{
112 QDataStream stream ( data, IO_ReadOnly ); 112 QDataStream stream ( data, IO_ReadOnly );
113 113
114 if ( msg == "hideInputMethod()" ) 114 if ( msg == "hideInputMethod()" )
115 m_input-> hideInputMethod ( ); 115 m_input-> hideInputMethod ( );
116 else if ( msg == "showInputMethod()" ) 116 else if ( msg == "showInputMethod()" )
117 m_input-> showInputMethod ( ); 117 m_input-> showInputMethod ( );
118 else if ( msg == "reloadInputMethods()" ) 118 else if ( msg == "reloadInputMethods()" )
119 m_input-> loadInputMethods ( ); 119 m_input-> loadInputMethods ( );
120} 120}
121 121
122void LoginWindowImpl::calcMaxWindowRect ( ) 122void LoginWindowImpl::calcMaxWindowRect ( )
123{ 123{
124#ifdef Q_WS_QWS 124#ifdef Q_WS_QWS
125 QRect wr; 125 QRect wr;
126 int displayWidth = qApp-> desktop ( )-> width ( ); 126 int displayWidth = qApp-> desktop ( )-> width ( );
127 QRect ir = m_input-> inputRect ( ); 127 QRect ir = m_input-> inputRect ( );
128 if ( ir.isValid() ) 128 if ( ir.isValid() )
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp
index 7d5792e..8d0976f 100644
--- a/core/opie-login/main.cpp
+++ b/core/opie-login/main.cpp
@@ -126,97 +126,97 @@ int main ( int argc, char **argv )
126 126
127 if (( ::time ( 0 ) - started ) < 3 ) { 127 if (( ::time ( 0 ) - started ) < 3 ) {
128 if ( autolog ) { 128 if ( autolog ) {
129 ::syslog ( LOG_ERR, "Respawning too fast -- disabling auto-login\n" ); 129 ::syslog ( LOG_ERR, "Respawning too fast -- disabling auto-login\n" );
130 autolog = 0; 130 autolog = 0;
131 } 131 }
132 else { 132 else {
133 ::syslog ( LOG_ERR, "Respawning too fast -- going down\n" ); 133 ::syslog ( LOG_ERR, "Respawning too fast -- going down\n" );
134 break; 134 break;
135 } 135 }
136 } 136 }
137 int killedbysig = 0; 137 int killedbysig = 0;
138 userExited=0; 138 userExited=0;
139 if (WIFEXITED(status)!=0 ) { 139 if (WIFEXITED(status)!=0 ) {
140 if (WEXITSTATUS(status)==137) { 140 if (WEXITSTATUS(status)==137) {
141 userExited=1; 141 userExited=1;
142 } 142 }
143 } 143 }
144 144
145 if ( WIFSIGNALED( status )) { 145 if ( WIFSIGNALED( status )) {
146 switch ( WTERMSIG( status )) { 146 switch ( WTERMSIG( status )) {
147 case SIGTERM: 147 case SIGTERM:
148 case SIGINT : 148 case SIGINT :
149 case SIGKILL: 149 case SIGKILL:
150 break; 150 break;
151 151
152 default : 152 default :
153 killedbysig = WTERMSIG( status ); 153 killedbysig = WTERMSIG( status );
154 break; 154 break;
155 } 155 }
156 } 156 }
157 if ( killedbysig ) { // qpe was killed by an uncaught signal 157 if ( killedbysig ) { // qpe was killed by an uncaught signal
158 qApp = 0; 158 qApp = 0;
159 159
160 ::syslog ( LOG_ERR, "Opie was killed by a signal #%d", killedbysig ); 160 ::syslog ( LOG_ERR, "Opie was killed by a signal #%d", killedbysig );
161 161
162 QWSServer::setDesktopBackground ( QImage ( )); 162 QWSServer::setDesktopBackground ( QImage ( ));
163 QApplication *app = new QApplication ( argc, argv, QApplication::GuiServer ); 163 QApplication *app = new QApplication ( argc, argv, QApplication::GuiServer );
164 app-> setFont ( QFont ( "Helvetica", 10 )); 164 app-> setFont ( QFont ( "Helvetica", 10 ));
165 app-> setStyle ( new QPEStyle ( )); 165 app-> setStyle ( new QPEStyle ( ));
166 166
167 const char *sig = ::strsignal ( killedbysig ); 167 const char *sig = ::strsignal ( killedbysig );
168 QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool ); 168 QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool );
169 l-> setText ( LoginWindowImpl::tr( "Opie was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig )); 169 l-> setText ( LoginWindowImpl::tr( "Opie was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig ));
170 l-> setAlignment ( Qt::AlignCenter ); 170 l-> setAlignment ( Qt::AlignCenter );
171 l-> move ( 0, 0 ); 171 l-> move ( 0, 0 );
172 l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); 172 l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( ));
173 l-> show ( ); 173 l-> show ( );
174 QTimer::singleShot ( 3000, app, SLOT( quit ( ))); 174 QTimer::singleShot ( 3000, app, SLOT( quit()));
175 app-> exec ( ); 175 app-> exec ( );
176 delete app; 176 delete app;
177 qApp = 0; 177 qApp = 0;
178 } 178 }
179 } 179 }
180 else { 180 else {
181 if ( !autolog ) { 181 if ( !autolog ) {
182 QString confFile=QPEApplication::qpeDir() + "/etc/opie-login.conf"; 182 QString confFile=QPEApplication::qpeDir() + "/etc/opie-login.conf";
183 Config cfg ( confFile, Config::File ); 183 Config cfg ( confFile, Config::File );
184 cfg. setGroup ( "General" ); 184 cfg. setGroup ( "General" );
185 QString user = cfg. readEntry ( "AutoLogin" ); 185 QString user = cfg. readEntry ( "AutoLogin" );
186 186
187 if ( !user. isEmpty ( )) 187 if ( !user. isEmpty ( ))
188 autolog = ::strdup ( user. latin1 ( )); 188 autolog = ::strdup ( user. latin1 ( ));
189 } 189 }
190 190
191 if ( autolog && !userExited ) { 191 if ( autolog && !userExited ) {
192 192
193 QWSServer::setDesktopBackground( QImage() ); 193 QWSServer::setDesktopBackground( QImage() );
194 ODevice::inst ( )-> setDisplayStatus ( true ); 194 ODevice::inst ( )-> setDisplayStatus ( true );
195 ODevice::inst ( )-> setSoftSuspend ( false ); 195 ODevice::inst ( )-> setSoftSuspend ( false );
196 LoginApplication *app = new LoginApplication ( argc, argv, ppid ); 196 LoginApplication *app = new LoginApplication ( argc, argv, ppid );
197 LoginApplication::setLoginAs ( autolog ); 197 LoginApplication::setLoginAs ( autolog );
198 198
199 199
200 if ( LoginApplication::changeIdentity ( )) 200 if ( LoginApplication::changeIdentity ( ))
201 ::exit ( LoginApplication::login ( )); 201 ::exit ( LoginApplication::login ( ));
202 else 202 else
203 ::exit ( 0 ); 203 ::exit ( 0 );
204 } 204 }
205 else { 205 else {
206 ::exit ( login_main ( argc, argv, ppid )); 206 ::exit ( login_main ( argc, argv, ppid ));
207 } 207 }
208 } 208 }
209 } 209 }
210 return 0; 210 return 0;
211} 211}
212 212
213void sigterm ( int /*sig*/ ) 213void sigterm ( int /*sig*/ )
214{ 214{
215 ::exit ( 0 ); 215 ::exit ( 0 );
216} 216}
217 217
218 218
219void exit_closelog ( ) 219void exit_closelog ( )
220{ 220{
221 ::closelog ( ); 221 ::closelog ( );
222} 222}
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index f7bff58..29f4383 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -82,97 +82,97 @@ AbPickItem::AbPickItem( QTable *t ) :
82} 82}
83 83
84QWidget *AbPickItem::createEditor() const 84QWidget *AbPickItem::createEditor() const
85{ 85{
86 QComboBox* combo = new QComboBox( table()->viewport() ); 86 QComboBox* combo = new QComboBox( table()->viewport() );
87 ( (AbPickItem*)this )->cb = combo; 87 ( (AbPickItem*)this )->cb = combo;
88 AbTable* t = static_cast<AbTable*>(table()); 88 AbTable* t = static_cast<AbTable*>(table());
89 QStringList c = t->choiceNames(); 89 QStringList c = t->choiceNames();
90 int cur = 0; 90 int cur = 0;
91 for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) { 91 for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) {
92 if ( *it == text() ) 92 if ( *it == text() )
93 cur = combo->count(); 93 cur = combo->count();
94 combo->insertItem(*it); 94 combo->insertItem(*it);
95 } 95 }
96 combo->setCurrentItem(cur); 96 combo->setCurrentItem(cur);
97 return combo; 97 return combo;
98} 98}
99 99
100void AbPickItem::setContentFromEditor( QWidget *w ) 100void AbPickItem::setContentFromEditor( QWidget *w )
101{ 101{
102 if ( w->inherits("QComboBox") ) 102 if ( w->inherits("QComboBox") )
103 setText( ( (QComboBox*)w )->currentText() ); 103 setText( ( (QComboBox*)w )->currentText() );
104 else 104 else
105 QTableItem::setContentFromEditor( w ); 105 QTableItem::setContentFromEditor( w );
106} 106}
107 107
108#endif 108#endif
109 109
110/*! 110/*!
111 \class AbTable abtable.h 111 \class AbTable abtable.h
112 112
113 \brief QTable based class for showing a list of entries 113 \brief QTable based class for showing a list of entries
114*/ 114*/
115 115
116AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name ) 116AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name )
117 : QTable( parent, name ), 117 : QTable( parent, name ),
118 lastSortCol( -1 ), 118 lastSortCol( -1 ),
119 asc( TRUE ), 119 asc( TRUE ),
120 intFields( order ), 120 intFields( order ),
121 enablePainting( true ), 121 enablePainting( true ),
122 columnVisible( true ), 122 columnVisible( true ),
123 countNested( 0 ) 123 countNested( 0 )
124{ 124{
125 //qWarning("C'tor start"); 125 //qWarning("C'tor start");
126 126
127 setSelectionMode( NoSelection ); 127 setSelectionMode( NoSelection );
128 init(); 128 init();
129 setSorting( TRUE ); 129 setSorting( TRUE );
130 connect( this, SIGNAL(clicked(int,int,int,const QPoint &)), 130 connect( this, SIGNAL(clicked(int,int,int,const QPoint&)),
131 this, SLOT(itemClicked(int,int)) ); 131 this, SLOT(itemClicked(int,int)) );
132 132
133 // contactList.clear(); 133 // contactList.clear();
134 //qWarning("C'tor end"); 134 //qWarning("C'tor end");
135} 135}
136 136
137AbTable::~AbTable() 137AbTable::~AbTable()
138{ 138{
139} 139}
140 140
141void AbTable::init() 141void AbTable::init()
142{ 142{
143 // :SX showChar = '\0'; 143 // :SX showChar = '\0';
144 setNumRows( 0 ); 144 setNumRows( 0 );
145 setNumCols( 2 ); 145 setNumCols( 2 );
146 146
147 horizontalHeader()->setLabel( 0, tr( "Full Name" )); 147 horizontalHeader()->setLabel( 0, tr( "Full Name" ));
148 horizontalHeader()->setLabel( 1, tr( "Contact" )); 148 horizontalHeader()->setLabel( 1, tr( "Contact" ));
149 setLeftMargin( 0 ); 149 setLeftMargin( 0 );
150 verticalHeader()->hide(); 150 verticalHeader()->hide();
151 columnVisible = true; 151 columnVisible = true;
152} 152}
153 153
154void AbTable::setContacts( const OContactAccess::List& viewList ) 154void AbTable::setContacts( const OContactAccess::List& viewList )
155{ 155{
156 qWarning("AbTable::setContacts()"); 156 qWarning("AbTable::setContacts()");
157 157
158 clear(); 158 clear();
159 m_viewList = viewList; 159 m_viewList = viewList;
160 160
161 setSorting( false ); 161 setSorting( false );
162 setPaintingEnabled( FALSE ); 162 setPaintingEnabled( FALSE );
163 163
164 OContactAccess::List::Iterator it; 164 OContactAccess::List::Iterator it;
165 setNumRows( m_viewList.count() ); 165 setNumRows( m_viewList.count() );
166 //int row = 0; 166 //int row = 0;
167 // for ( it = m_viewList.begin(); it != m_viewList.end(); ++it ) 167 // for ( it = m_viewList.begin(); it != m_viewList.end(); ++it )
168 // insertIntoTable( *it, row++ ); 168 // insertIntoTable( *it, row++ );
169 169
170 // setSorting( true ); 170 // setSorting( true );
171 171
172 // resort(); 172 // resort();
173 173
174 updateVisible(); 174 updateVisible();
175 175
176 setPaintingEnabled( TRUE ); 176 setPaintingEnabled( TRUE );
177 177
178} 178}
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp
index 670cdb0..8d61582 100644
--- a/core/pim/addressbook/abview.cpp
+++ b/core/pim/addressbook/abview.cpp
@@ -32,100 +32,100 @@ QString addressbookPersonalVCardName()
32{ 32{
33 QString filename = Global::applicationFileName("addressbook", 33 QString filename = Global::applicationFileName("addressbook",
34 "businesscard.vcf"); 34 "businesscard.vcf");
35 return filename; 35 return filename;
36} 36}
37 37
38 38
39AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): 39AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ):
40 QWidget(parent), 40 QWidget(parent),
41 mCat(0), 41 mCat(0),
42 m_inSearch( false ), 42 m_inSearch( false ),
43 m_inPersonal( false ), 43 m_inPersonal( false ),
44 m_curr_category( -1 ), 44 m_curr_category( -1 ),
45 m_curr_View( TableView ), 45 m_curr_View( TableView ),
46 m_prev_View( TableView ), 46 m_prev_View( TableView ),
47 m_curr_Contact ( 0 ), 47 m_curr_Contact ( 0 ),
48 m_contactdb ( 0l ), 48 m_contactdb ( 0l ),
49 m_storedDB ( 0l ), 49 m_storedDB ( 0l ),
50 m_viewStack( 0l ), 50 m_viewStack( 0l ),
51 m_abTable( 0l ), 51 m_abTable( 0l ),
52 m_orderedFields( ordered ) 52 m_orderedFields( ordered )
53{ 53{
54 qWarning("AbView::c'tor"); 54 qWarning("AbView::c'tor");
55 // Load default database and handle syncing myself.. ! 55 // Load default database and handle syncing myself.. !
56 m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ); 56 m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false );
57 m_contactdb -> setReadAhead( 16 ); // Use ReadAhead-Cache if available 57 m_contactdb -> setReadAhead( 16 ); // Use ReadAhead-Cache if available
58 mCat.load( categoryFileName() ); 58 mCat.load( categoryFileName() );
59 59
60 // Create Layout and put WidgetStack into it. 60 // Create Layout and put WidgetStack into it.
61 QVBoxLayout *vb = new QVBoxLayout( this ); 61 QVBoxLayout *vb = new QVBoxLayout( this );
62 m_viewStack = new QWidgetStack( this ); 62 m_viewStack = new QWidgetStack( this );
63 vb->addWidget( m_viewStack ); 63 vb->addWidget( m_viewStack );
64 64
65 // Creat TableView 65 // Creat TableView
66 QVBox* tableBox = new QVBox( m_viewStack ); 66 QVBox* tableBox = new QVBox( m_viewStack );
67 m_abTable = new AbTable( m_orderedFields, tableBox, "table" ); 67 m_abTable = new AbTable( m_orderedFields, tableBox, "table" );
68 m_abTable->setCurrentCell( 0, 0 ); 68 m_abTable->setCurrentCell( 0, 0 );
69 m_abTable->setFocus(); 69 m_abTable->setFocus();
70 70
71 // Add TableView to WidgetStack and raise it 71 // Add TableView to WidgetStack and raise it
72 m_viewStack -> addWidget( tableBox , TableView ); 72 m_viewStack -> addWidget( tableBox , TableView );
73 73
74 // Create CardView and add it to WidgetStack 74 // Create CardView and add it to WidgetStack
75 QVBox* cardBox = new QVBox( m_viewStack ); 75 QVBox* cardBox = new QVBox( m_viewStack );
76 m_ablabel = new AbLabel( cardBox, "CardView"); 76 m_ablabel = new AbLabel( cardBox, "CardView");
77 m_viewStack -> addWidget( cardBox , CardView ); 77 m_viewStack -> addWidget( cardBox , CardView );
78 78
79 // Connect views to me 79 // Connect views to me
80 connect ( m_abTable, SIGNAL( signalSwitch( void ) ), 80 connect ( m_abTable, SIGNAL( signalSwitch(void) ),
81 this, SLOT( slotSwitch( void ) ) ); 81 this, SLOT( slotSwitch(void) ) );
82 connect ( m_ablabel, SIGNAL( signalOkPressed( void ) ), 82 connect ( m_ablabel, SIGNAL( signalOkPressed(void) ),
83 this, SLOT( slotSwitch( void ) ) ); 83 this, SLOT( slotSwitch(void) ) );
84 84
85 load(); 85 load();
86} 86}
87 87
88AbView::~AbView() 88AbView::~AbView()
89{ 89{
90 m_contactdb -> save(); 90 m_contactdb -> save();
91 delete m_contactdb; 91 delete m_contactdb;
92 92
93 if ( m_storedDB ){ 93 if ( m_storedDB ){
94 m_storedDB -> save(); 94 m_storedDB -> save();
95 delete m_storedDB; 95 delete m_storedDB;
96 } 96 }
97} 97}
98 98
99 99
100void AbView::setView( Views view ) 100void AbView::setView( Views view )
101{ 101{
102 qWarning("AbView::setView( Views view )"); 102 qWarning("AbView::setView( Views view )");
103 m_curr_View = view; 103 m_curr_View = view;
104 load(); 104 load();
105} 105}
106 106
107void AbView::addEntry( const OContact &newContact ) 107void AbView::addEntry( const OContact &newContact )
108{ 108{
109 qWarning("abview:AddContact"); 109 qWarning("abview:AddContact");
110 m_contactdb->add ( newContact ); 110 m_contactdb->add ( newContact );
111 load(); 111 load();
112 112
113} 113}
114void AbView::removeEntry( const int UID ) 114void AbView::removeEntry( const int UID )
115{ 115{
116 qWarning("abview:RemoveContact"); 116 qWarning("abview:RemoveContact");
117 m_contactdb->remove( UID ); 117 m_contactdb->remove( UID );
118 load(); 118 load();
119} 119}
120 120
121void AbView::replaceEntry( const OContact &contact ) 121void AbView::replaceEntry( const OContact &contact )
122{ 122{
123 qWarning("abview:ReplaceContact"); 123 qWarning("abview:ReplaceContact");
124 m_contactdb->replace( contact ); 124 m_contactdb->replace( contact );
125 load(); 125 load();
126 126
127} 127}
128 128
129OContact AbView::currentEntry() 129OContact AbView::currentEntry()
130{ 130{
131 OContact currentContact; 131 OContact currentContact;
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 9cf55b3..8a5f9d5 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -90,217 +90,217 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
90 mbList->insertItem( tr("View"), catMenu ); 90 mbList->insertItem( tr("View"), catMenu );
91 91
92 // Create Toolbar 92 // Create Toolbar
93 listTools = new QToolBar( this, "list operations" ); 93 listTools = new QToolBar( this, "list operations" );
94 listTools->setHorizontalStretchable( true ); 94 listTools->setHorizontalStretchable( true );
95 addToolBar( listTools ); 95 addToolBar( listTools );
96 moveToolBar( listTools, m_config.getToolBarPos() ); 96 moveToolBar( listTools, m_config.getToolBarPos() );
97 97
98 // View Icons 98 // View Icons
99 m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/listview" ), 99 m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/listview" ),
100 QString::null, 0, this, 0 ); 100 QString::null, 0, this, 0 );
101 connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); 101 connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) );
102 m_tableViewButton->setToggleAction( true ); 102 m_tableViewButton->setToggleAction( true );
103 m_tableViewButton->addTo( listTools ); 103 m_tableViewButton->addTo( listTools );
104 m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "addressbook/cardview" ), QString::null, 0, this, 0 ); 104 m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "addressbook/cardview" ), QString::null, 0, this, 0 );
105 connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); 105 connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) );
106 m_cardViewButton->setToggleAction( true ); 106 m_cardViewButton->setToggleAction( true );
107 m_cardViewButton->addTo( listTools ); 107 m_cardViewButton->addTo( listTools );
108 108
109 listTools->addSeparator(); 109 listTools->addSeparator();
110 110
111 // Other Buttons 111 // Other Buttons
112 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 112 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null,
113 0, this, 0 ); 113 0, this, 0 );
114 actionNew = a; 114 actionNew = a;
115 connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); 115 connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) );
116 a->addTo( edit ); 116 a->addTo( edit );
117 a->addTo( listTools ); 117 a->addTo( listTools );
118 118
119 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, 119 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null,
120 0, this, 0 ); 120 0, this, 0 );
121 actionEdit = a; 121 actionEdit = a;
122 connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); 122 connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) );
123 a->addTo( edit ); 123 a->addTo( edit );
124 a->addTo( listTools ); 124 a->addTo( listTools );
125 125
126 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 126 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null,
127 0, this, 0 ); 127 0, this, 0 );
128 actionTrash = a; 128 actionTrash = a;
129 connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); 129 connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) );
130 a->addTo( edit ); 130 a->addTo( edit );
131 a->addTo( listTools ); 131 a->addTo( listTools );
132 132
133 133
134 // make it possible to go directly to businesscard via qcop call 134 // make it possible to go directly to businesscard via qcop call
135 //#if defined(Q_WS_QWS) // Why this ? (se) 135 //#if defined(Q_WS_QWS) // Why this ? (se)
136#if !defined(QT_NO_COP) 136#if !defined(QT_NO_COP)
137 QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); 137 QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this );
138 connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), 138 connect (addressChannel, SIGNAL( received(const QCString&,const QByteArray&)),
139 this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); 139 this, SLOT ( appMessage(const QCString&,const QByteArray&) ) );
140#endif 140#endif
141 // #endif 141 // #endif
142 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), 142 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ),
143 QString::null, 0, this, 0 ); 143 QString::null, 0, this, 0 );
144 actionFind = a; 144 actionFind = a;
145 connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); 145 connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) );
146 a->addTo( edit ); 146 a->addTo( edit );
147 a->addTo( listTools ); 147 a->addTo( listTools );
148 148
149 // Much better search widget, taken from QTReader.. (se) 149 // Much better search widget, taken from QTReader.. (se)
150 searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); 150 searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE );
151 searchBar->setHorizontalStretchable( TRUE ); 151 searchBar->setHorizontalStretchable( TRUE );
152 searchBar->hide(); 152 searchBar->hide();
153 searchEdit = new QLineEdit( searchBar, "searchEdit" ); 153 searchEdit = new QLineEdit( searchBar, "searchEdit" );
154 154
155 // QFont f("unifont", 16 /*, QFont::Bold*/); 155 // QFont f("unifont", 16 /*, QFont::Bold*/);
156 // searchEdit->setFont( f ); 156 // searchEdit->setFont( f );
157 157
158 searchBar->setStretchableWidget( searchEdit ); 158 searchBar->setStretchableWidget( searchEdit );
159 connect( searchEdit, SIGNAL( returnPressed( ) ), 159 connect( searchEdit, SIGNAL( returnPressed() ),
160 this, SLOT( slotFind( ) ) ); 160 this, SLOT( slotFind() ) );
161 161
162 a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); 162 a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 );
163 connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); 163 connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) );
164 a->addTo( searchBar ); 164 a->addTo( searchBar );
165 165
166 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 166 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
167 connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); 167 connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) );
168 a->addTo( searchBar ); 168 a->addTo( searchBar );
169 169
170 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), 170 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ),
171 QString::null, 0, this, 0 ); 171 QString::null, 0, this, 0 );
172 //a->setEnabled( FALSE ); we got support for it now :) zecke 172 //a->setEnabled( FALSE ); we got support for it now :) zecke
173 actionMail = a; 173 actionMail = a;
174 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); 174 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) );
175 a->addTo( edit ); 175 a->addTo( edit );
176 a->addTo( listTools ); 176 a->addTo( listTools );
177 177
178 if ( Ir::supported() ) { 178 if ( Ir::supported() ) {
179 a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, 179 a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null,
180 0, this, 0 ); 180 0, this, 0 );
181 actionBeam = a; 181 actionBeam = a;
182 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); 182 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) );
183 a->addTo( edit ); 183 a->addTo( edit );
184 a->addTo( listTools ); 184 a->addTo( listTools );
185 } 185 }
186 186
187 edit->insertSeparator(); 187 edit->insertSeparator();
188 188
189 a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), QString::null, 189 a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), QString::null,
190 0, this, 0); 190 0, this, 0);
191 actionPersonal = a; 191 actionPersonal = a;
192 connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); 192 connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) );
193 a->addTo( edit ); 193 a->addTo( edit );
194 194
195 a = new QAction( tr("Export vCard"), Resource::loadPixmap( "addressbook/fileexport"), QString::null, 195 a = new QAction( tr("Export vCard"), Resource::loadPixmap( "addressbook/fileexport"), QString::null,
196 0, this, 0); 196 0, this, 0);
197 actionPersonal = a; 197 actionPersonal = a;
198 connect( a, SIGNAL( activated() ), this, SLOT( exportvCard() ) ); 198 connect( a, SIGNAL( activated() ), this, SLOT( exportvCard() ) );
199 a->addTo( edit ); 199 a->addTo( edit );
200 200
201 edit->insertSeparator(); 201 edit->insertSeparator();
202 202
203 a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), 203 a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ),
204 QString::null, 0, this, 0 , TRUE ); 204 QString::null, 0, this, 0 , TRUE );
205 actionPersonal = a; 205 actionPersonal = a;
206 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); 206 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) );
207 a->addTo( edit ); 207 a->addTo( edit );
208 208
209 209
210#ifdef __DEBUG_RELEASE 210#ifdef __DEBUG_RELEASE
211 // Remove this function for public Release ! This is only 211 // Remove this function for public Release ! This is only
212 // for debug purposes .. 212 // for debug purposes ..
213 a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); 213 a = new QAction( tr( "Save all Data"), QString::null, 0, 0 );
214 connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); 214 connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) );
215 a->addTo( edit ); 215 a->addTo( edit );
216#endif 216#endif
217 a = new QAction( tr( "Config" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 217 a = new QAction( tr( "Config" ), Resource::loadPixmap( "SettingsIcon" ), QString::null,
218 0, this, 0 ); 218 0, this, 0 );
219 connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); 219 connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) );
220 a->addTo( edit ); 220 a->addTo( edit );
221 221
222 // Create Views 222 // Create Views
223 listContainer = new QWidget( this ); 223 listContainer = new QWidget( this );
224 QVBoxLayout *vb = new QVBoxLayout( listContainer ); 224 QVBoxLayout *vb = new QVBoxLayout( listContainer );
225 225
226 m_abView = new AbView( listContainer, m_config.orderList() ); 226 m_abView = new AbView( listContainer, m_config.orderList() );
227 vb->addWidget( m_abView ); 227 vb->addWidget( m_abView );
228 // abList->setHScrollBarMode( QScrollView::AlwaysOff ); 228 // abList->setHScrollBarMode( QScrollView::AlwaysOff );
229 connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), 229 connect( m_abView, SIGNAL( signalViewSwitched(int) ),
230 this, SLOT( slotViewSwitched( int ) ) ); 230 this, SLOT( slotViewSwitched(int) ) );
231 231
232 232
233 QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); 233 QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) );
234 234
235 // m_abView->load(); // Already done by c'tor . 235 // m_abView->load(); // Already done by c'tor .
236 236
237 // Letter Picker 237 // Letter Picker
238 pLabel = new LetterPicker( listContainer ); 238 pLabel = new LetterPicker( listContainer );
239 connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); 239 connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char)));
240 connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); 240 connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) );
241 241
242 vb->addWidget( pLabel ); 242 vb->addWidget( pLabel );
243 243
244 // All Categories into view-menu.. 244 // All Categories into view-menu..
245 populateCategories(); 245 populateCategories();
246 246
247 // Fontsize 247 // Fontsize
248 defaultFont = new QFont( m_abView->font() ); 248 defaultFont = new QFont( m_abView->font() );
249 slotSetFont(m_config.fontSize()); 249 slotSetFont(m_config.fontSize());
250 m_curFontSize = m_config.fontSize(); 250 m_curFontSize = m_config.fontSize();
251 251
252 setCentralWidget(listContainer); 252 setCentralWidget(listContainer);
253 253
254 // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); 254 // qDebug("adressbook contrsuction: t=%d", t.elapsed() );
255 connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) ); 255 connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) );
256 connect( qApp, SIGNAL( reload() ), this, SLOT( reload() ) ); 256 connect( qApp, SIGNAL( reload() ), this, SLOT( reload() ) );
257 connect( qApp, SIGNAL( appMessage(const QCString &, const QByteArray &) ), 257 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
258 this, SLOT( appMessage(const QCString &, const QByteArray &) ) ); 258 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
259 259
260 260
261 isLoading = false; 261 isLoading = false;
262} 262}
263 263
264 264
265void AddressbookWindow::slotConfig() 265void AddressbookWindow::slotConfig()
266{ 266{
267 ConfigDlg* dlg = new ConfigDlg( this, "Config" ); 267 ConfigDlg* dlg = new ConfigDlg( this, "Config" );
268 dlg -> setConfig( m_config ); 268 dlg -> setConfig( m_config );
269 if ( QPEApplication::execDialog( dlg ) ) { 269 if ( QPEApplication::execDialog( dlg ) ) {
270 qWarning ("Config Dialog accepted!"); 270 qWarning ("Config Dialog accepted!");
271 m_config = dlg -> getConfig(); 271 m_config = dlg -> getConfig();
272 if ( m_curFontSize != m_config.fontSize() ){ 272 if ( m_curFontSize != m_config.fontSize() ){
273 qWarning("Font was changed!"); 273 qWarning("Font was changed!");
274 m_curFontSize = m_config.fontSize(); 274 m_curFontSize = m_config.fontSize();
275 emit slotSetFont( m_curFontSize ); 275 emit slotSetFont( m_curFontSize );
276 } 276 }
277 m_abView -> setListOrder( m_config.orderList() ); 277 m_abView -> setListOrder( m_config.orderList() );
278 } 278 }
279 279
280 delete dlg; 280 delete dlg;
281} 281}
282 282
283 283
284void AddressbookWindow::slotSetFont( int size ) 284void AddressbookWindow::slotSetFont( int size )
285{ 285{
286 qWarning("void AddressbookWindow::slotSetFont( %d )", size); 286 qWarning("void AddressbookWindow::slotSetFont( %d )", size);
287 287
288 if (size > 2 || size < 0) 288 if (size > 2 || size < 0)
289 size = 1; 289 size = 1;
290 290
291 m_config.setFontSize( size ); 291 m_config.setFontSize( size );
292 292
293 QFont *currentFont; 293 QFont *currentFont;
294 294
295 switch (size) { 295 switch (size) {
296 case 0: 296 case 0:
297 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); 297 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) );
298 currentFont = new QFont (m_abView->font()); 298 currentFont = new QFont (m_abView->font());
299 // abList->resizeRows(currentFont->pixelSize() + 7); :SX 299 // abList->resizeRows(currentFont->pixelSize() + 7); :SX
300 // abList->resizeRows(); 300 // abList->resizeRows();
301 break; 301 break;
302 case 1: 302 case 1:
303 m_abView->setFont( *defaultFont ); 303 m_abView->setFont( *defaultFont );
304 currentFont = new QFont (m_abView->font()); 304 currentFont = new QFont (m_abView->font());
305 // // abList->resizeRows(currentFont->pixelSize() + 7); 305 // // abList->resizeRows(currentFont->pixelSize() + 7);
306 // abList->resizeRows(); 306 // abList->resizeRows();
@@ -550,175 +550,175 @@ void AddressbookWindow::writeMail()
550 if ( m_config.useOpieMail() ){ 550 if ( m_config.useOpieMail() ){
551 qWarning ("Accessing: %s", (basepath + "/bin/opiemail").latin1()); 551 qWarning ("Accessing: %s", (basepath + "/bin/opiemail").latin1());
552 if ( QFile::exists( basepath + "/bin/opiemail" ) ){ 552 if ( QFile::exists( basepath + "/bin/opiemail" ) ){
553 qWarning ("QCop"); 553 qWarning ("QCop");
554 QCopEnvelope e("QPE/Application/opiemail", "writeMail(QString,QString)"); 554 QCopEnvelope e("QPE/Application/opiemail", "writeMail(QString,QString)");
555 e << name << email; 555 e << name << email;
556 return; 556 return;
557 } else 557 } else
558 m_config.setUseQtMail( true ); 558 m_config.setUseQtMail( true );
559 } 559 }
560 560
561} 561}
562 562
563static const char * beamfile = "/tmp/obex/contact.vcf"; 563static const char * beamfile = "/tmp/obex/contact.vcf";
564 564
565void AddressbookWindow::slotBeam() 565void AddressbookWindow::slotBeam()
566{ 566{
567 QString beamFilename; 567 QString beamFilename;
568 OContact c; 568 OContact c;
569 if ( actionPersonal->isOn() ) { 569 if ( actionPersonal->isOn() ) {
570 beamFilename = addressbookPersonalVCardName(); 570 beamFilename = addressbookPersonalVCardName();
571 if ( !QFile::exists( beamFilename ) ) 571 if ( !QFile::exists( beamFilename ) )
572 return; // can't beam a non-existent file 572 return; // can't beam a non-existent file
573 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 573 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
574 beamFilename ); 574 beamFilename );
575 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 575 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
576 OContactAccess::List allList = access->allRecords(); 576 OContactAccess::List allList = access->allRecords();
577 OContactAccess::List::Iterator it = allList.begin(); // Just take first 577 OContactAccess::List::Iterator it = allList.begin(); // Just take first
578 c = *it; 578 c = *it;
579 579
580 delete access; 580 delete access;
581 } else { 581 } else {
582 unlink( beamfile ); // delete if exists 582 unlink( beamfile ); // delete if exists
583 mkdir("/tmp/obex/", 0755); 583 mkdir("/tmp/obex/", 0755);
584 c = m_abView -> currentEntry(); 584 c = m_abView -> currentEntry();
585 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 585 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
586 beamfile ); 586 beamfile );
587 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 587 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
588 access->add( c ); 588 access->add( c );
589 access->save(); 589 access->save();
590 delete access; 590 delete access;
591 591
592 beamFilename = beamfile; 592 beamFilename = beamfile;
593 } 593 }
594 594
595 qWarning("Beaming: %s", beamFilename.latin1() ); 595 qWarning("Beaming: %s", beamFilename.latin1() );
596 596
597 Ir *ir = new Ir( this ); 597 Ir *ir = new Ir( this );
598 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 598 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
599 QString description = c.fullName(); 599 QString description = c.fullName();
600 ir->send( beamFilename, description, "text/x-vCard" ); 600 ir->send( beamFilename, description, "text/x-vCard" );
601} 601}
602 602
603void AddressbookWindow::beamDone( Ir *ir ) 603void AddressbookWindow::beamDone( Ir *ir )
604{ 604{
605 605
606 delete ir; 606 delete ir;
607 unlink( beamfile ); 607 unlink( beamfile );
608} 608}
609 609
610 610
611static void parseName( const QString& name, QString *first, QString *middle, 611static void parseName( const QString& name, QString *first, QString *middle,
612 QString * last ) 612 QString * last )
613{ 613{
614 614
615 int comma = name.find ( "," ); 615 int comma = name.find ( "," );
616 QString rest; 616 QString rest;
617 if ( comma > 0 ) { 617 if ( comma > 0 ) {
618 *last = name.left( comma ); 618 *last = name.left( comma );
619 comma++; 619 comma++;
620 while ( comma < int(name.length()) && name[comma] == ' ' ) 620 while ( comma < int(name.length()) && name[comma] == ' ' )
621 comma++; 621 comma++;
622 rest = name.mid( comma ); 622 rest = name.mid( comma );
623 } else { 623 } else {
624 int space = name.findRev( ' ' ); 624 int space = name.findRev( ' ' );
625 *last = name.mid( space+1 ); 625 *last = name.mid( space+1 );
626 rest = name.left( space ); 626 rest = name.left( space );
627 } 627 }
628 int space = rest.find( ' ' ); 628 int space = rest.find( ' ' );
629 if ( space <= 0 ) { 629 if ( space <= 0 ) {
630 *first = rest; 630 *first = rest;
631 } else { 631 } else {
632 *first = rest.left( space ); 632 *first = rest.left( space );
633 *middle = rest.mid( space+1 ); 633 *middle = rest.mid( space+1 );
634 } 634 }
635 635
636} 636}
637 637
638 638
639void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) 639void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
640{ 640{
641 bool needShow = FALSE; 641 bool needShow = FALSE;
642 qWarning("Receiving QCop-Call with message %s", QString( msg ).latin1() ); 642 qWarning("Receiving QCop-Call with message %s", QString( msg ).latin1() );
643 643
644 644
645 if (msg == "editPersonal()") { 645 if (msg == "editPersonal()") {
646 editPersonal(); 646 editPersonal();
647 } else if (msg == "editPersonalAndClose()") { 647 } else if (msg == "editPersonalAndClose()") {
648 editPersonal(); 648 editPersonal();
649 close(); 649 close();
650 } else if ( msg == "addContact(QString,QString)" ) { 650 } else if ( msg == "addContact(QString,QString)" ) {
651 QDataStream stream(data,IO_ReadOnly); 651 QDataStream stream(data,IO_ReadOnly);
652 QString name, email; 652 QString name, email;
653 stream >> name >> email; 653 stream >> name >> email;
654 654
655 OContact cnt; 655 OContact cnt;
656 QString fn, mn, ln; 656 QString fn, mn, ln;
657 parseName( name, &fn, &mn, &ln ); 657 parseName( name, &fn, &mn, &ln );
658 // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); 658 // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() );
659 cnt.setFirstName( fn ); 659 cnt.setFirstName( fn );
660 cnt.setMiddleName( mn ); 660 cnt.setMiddleName( mn );
661 cnt.setLastName( ln ); 661 cnt.setLastName( ln );
662 cnt.insertEmails( email ); 662 cnt.insertEmails( email );
663 cnt.setDefaultEmail( email ); 663 cnt.setDefaultEmail( email );
664 cnt.setFileAs(); 664 cnt.setFileAs();
665 665
666 m_abView -> addEntry( cnt ); 666 m_abView -> addEntry( cnt );
667 667
668 // :SXm_abView()->init( cnt ); 668 // :SXm_abView()->init( cnt );
669 editEntry( EditEntry ); 669 editEntry( EditEntry );
670 } else if ( msg == "beamBusinessCard()" ) { 670 } else if ( msg == "beamBusinessCard()" ) {
671 QString beamFilename = addressbookPersonalVCardName(); 671 QString beamFilename = addressbookPersonalVCardName();
672 if ( !QFile::exists( beamFilename ) ) 672 if ( !QFile::exists( beamFilename ) )
673 return; // can't beam a non-existent file 673 return; // can't beam a non-existent file
674 674
675 Ir *ir = new Ir( this ); 675 Ir *ir = new Ir( this );
676 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 676 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
677 QString description = "mycard.vcf"; 677 QString description = "mycard.vcf";
678 ir->send( beamFilename, description, "text/x-vCard" ); 678 ir->send( beamFilename, description, "text/x-vCard" );
679 } else if ( msg == "show(int)" ) { 679 } else if ( msg == "show(int)" ) {
680 raise(); 680 raise();
681 QDataStream stream(data,IO_ReadOnly); 681 QDataStream stream(data,IO_ReadOnly);
682 int uid; 682 int uid;
683 stream >> uid; 683 stream >> uid;
684 684
685 qWarning( "Showing uid: %d" , uid ); 685 qWarning( "Showing uid: %d" , uid );
686 686
687 // Deactivate Personal View.. 687 // Deactivate Personal View..
688 if ( actionPersonal->isOn() ){ 688 if ( actionPersonal->isOn() ){
689 actionPersonal->setOn( false ); 689 actionPersonal->setOn( false );
690 slotPersonalView(); 690 slotPersonalView();
691 } 691 }
692 692
693 // Reset category and show as card.. 693 // Reset category and show as card..
694 m_abView -> setShowByCategory( QString::null ); 694 m_abView -> setShowByCategory( QString::null );
695 m_abView -> setCurrentUid( uid ); 695 m_abView -> setCurrentUid( uid );
696 slotViewSwitched ( AbView::CardView ); 696 slotViewSwitched ( AbView::CardView );
697 697
698 needShow = true; 698 needShow = true;
699 699
700 700
701 } else if ( msg == "edit(int)" ) { 701 } else if ( msg == "edit(int)" ) {
702 QDataStream stream(data,IO_ReadOnly); 702 QDataStream stream(data,IO_ReadOnly);
703 int uid; 703 int uid;
704 stream >> uid; 704 stream >> uid;
705 705
706 // Deactivate Personal View.. 706 // Deactivate Personal View..
707 if ( actionPersonal->isOn() ){ 707 if ( actionPersonal->isOn() ){
708 actionPersonal->setOn( false ); 708 actionPersonal->setOn( false );
709 slotPersonalView(); 709 slotPersonalView();
710 } 710 }
711 711
712 // Reset category and edit.. 712 // Reset category and edit..
713 m_abView -> setShowByCategory( QString::null ); 713 m_abView -> setShowByCategory( QString::null );
714 m_abView -> setCurrentUid( uid ); 714 m_abView -> setCurrentUid( uid );
715 slotViewEdit(); 715 slotViewEdit();
716 } 716 }
717 717
718 if (needShow) 718 if (needShow)
719 QPEApplication::setKeepRunning(); 719 QPEApplication::setKeepRunning();
720 720
721} 721}
722 722
723void AddressbookWindow::editEntry( EntryMode entryMode ) 723void AddressbookWindow::editEntry( EntryMode entryMode )
724{ 724{
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index b1eb042..8acf570 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -490,231 +490,231 @@ void ContactEditor::init() {
490 m_widgetStack4 = new QWidgetStack( container ); 490 m_widgetStack4 = new QWidgetStack( container );
491 txtChooserField4 = new QLineEdit( m_widgetStack4 ); 491 txtChooserField4 = new QLineEdit( m_widgetStack4 );
492 m_widgetStack4 -> addWidget( txtChooserField4, TextField ); 492 m_widgetStack4 -> addWidget( txtChooserField4, TextField );
493 gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); 493 gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 );
494 m_widgetStack4 -> raiseWidget( TextField ); 494 m_widgetStack4 -> raiseWidget( TextField );
495 495
496 QSpacerItem *space = new QSpacerItem(1,1, 496 QSpacerItem *space = new QSpacerItem(1,1,
497 QSizePolicy::Maximum, 497 QSizePolicy::Maximum,
498 QSizePolicy::MinimumExpanding ); 498 QSizePolicy::MinimumExpanding );
499 gl->addItem( space, 7, 0 ); 499 gl->addItem( space, 7, 0 );
500 500
501 tabMain->insertTab( tabViewport, tr( "Address" ) ); 501 tabMain->insertTab( tabViewport, tr( "Address" ) );
502 502
503 tabViewport = new QWidget ( tabMain ); 503 tabViewport = new QWidget ( tabMain );
504 504
505 vb = new QVBoxLayout( tabViewport ); 505 vb = new QVBoxLayout( tabViewport );
506 506
507 svDetails = new QScrollView( tabViewport ); 507 svDetails = new QScrollView( tabViewport );
508 vb->addWidget( svDetails, 0, 0 ); 508 vb->addWidget( svDetails, 0, 0 );
509 svDetails->setResizePolicy( QScrollView::AutoOneFit ); 509 svDetails->setResizePolicy( QScrollView::AutoOneFit );
510 svDetails->setFrameStyle( QFrame::NoFrame ); 510 svDetails->setFrameStyle( QFrame::NoFrame );
511 511
512 container = new QWidget( svDetails->viewport() ); 512 container = new QWidget( svDetails->viewport() );
513 svDetails->addChild( container ); 513 svDetails->addChild( container );
514 514
515 gl = new QGridLayout( container, 1, 2, 2, 4 ); 515 gl = new QGridLayout( container, 1, 2, 2, 4 );
516 516
517 int counter = 0; 517 int counter = 0;
518 518
519 // Birthday 519 // Birthday
520 QHBox* hBox = new QHBox( container ); 520 QHBox* hBox = new QHBox( container );
521 l = new QLabel( tr("Birthday"), container ); 521 l = new QLabel( tr("Birthday"), container );
522 gl->addWidget( l, counter, 0 ); 522 gl->addWidget( l, counter, 0 );
523 523
524 QPopupMenu* m1 = new QPopupMenu( container ); 524 QPopupMenu* m1 = new QPopupMenu( container );
525 birthdayPicker = new DateBookMonth( m1, 0, TRUE ); 525 birthdayPicker = new DateBookMonth( m1, 0, TRUE );
526 m1->insertItem( birthdayPicker ); 526 m1->insertItem( birthdayPicker );
527 527
528 birthdayButton= new QToolButton( hBox, "buttonStart" ); 528 birthdayButton= new QToolButton( hBox, "buttonStart" );
529 birthdayButton->setPopup( m1 ); 529 birthdayButton->setPopup( m1 );
530 birthdayButton->setPopupDelay(0); 530 birthdayButton->setPopupDelay(0);
531 531
532 QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), 532 QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
533 tr( "Delete" ), 533 tr( "Delete" ),
534 hBox, 0 ); 534 hBox, 0 );
535 535
536 gl->addWidget( hBox, counter , 1 ); 536 gl->addWidget( hBox, counter , 1 );
537 537
538 connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), 538 connect( birthdayPicker, SIGNAL( dateClicked(int,int,int) ),
539 this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); 539 this, SLOT( slotBirthdayDateChanged(int,int,int) ) );
540 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); 540 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) );
541 541
542 ++counter; 542 ++counter;
543 543
544 // Anniversary 544 // Anniversary
545 hBox = new QHBox( container ); 545 hBox = new QHBox( container );
546 l = new QLabel( tr("Anniversary"), container ); 546 l = new QLabel( tr("Anniversary"), container );
547 gl->addWidget( l, counter, 0 ); 547 gl->addWidget( l, counter, 0 );
548 548
549 m1 = new QPopupMenu( container ); 549 m1 = new QPopupMenu( container );
550 anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); 550 anniversaryPicker = new DateBookMonth( m1, 0, TRUE );
551 m1->insertItem( anniversaryPicker ); 551 m1->insertItem( anniversaryPicker );
552 552
553 anniversaryButton= new QToolButton( hBox, "buttonStart" ); 553 anniversaryButton= new QToolButton( hBox, "buttonStart" );
554 anniversaryButton->setPopup( m1 ); 554 anniversaryButton->setPopup( m1 );
555 anniversaryButton->setPopupDelay(0); 555 anniversaryButton->setPopupDelay(0);
556 556
557 deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), 557 deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
558 tr( "Delete" ), 558 tr( "Delete" ),
559 hBox, 0 ); 559 hBox, 0 );
560 gl->addWidget( hBox, counter , 1 ); 560 gl->addWidget( hBox, counter , 1 );
561 561
562 connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), 562 connect( anniversaryPicker, SIGNAL( dateClicked(int,int,int) ),
563 this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); 563 this, SLOT( slotAnniversaryDateChanged(int,int,int) ) );
564 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); 564 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) );
565 565
566 ++counter; 566 ++counter;
567 567
568 // Gender 568 // Gender
569 l = new QLabel( tr("Gender"), container ); 569 l = new QLabel( tr("Gender"), container );
570 gl->addWidget( l, counter, 0 ); 570 gl->addWidget( l, counter, 0 );
571 cmbGender = new QComboBox( container ); 571 cmbGender = new QComboBox( container );
572 cmbGender->insertItem( "", 0 ); 572 cmbGender->insertItem( "", 0 );
573 cmbGender->insertItem( tr("Male"), 1); 573 cmbGender->insertItem( tr("Male"), 1);
574 cmbGender->insertItem( tr("Female"), 2); 574 cmbGender->insertItem( tr("Female"), 2);
575 gl->addWidget( cmbGender, counter, 1 ); 575 gl->addWidget( cmbGender, counter, 1 );
576 576
577 ++counter; 577 ++counter;
578 578
579 // Create Labels and lineedit fields for every dynamic entry 579 // Create Labels and lineedit fields for every dynamic entry
580 QStringList::ConstIterator it = slDynamicEntries.begin(); 580 QStringList::ConstIterator it = slDynamicEntries.begin();
581 QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId(); 581 QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId();
582 QMap<int, QString> mapIdToStr = OContactFields::idToTrFields(); 582 QMap<int, QString> mapIdToStr = OContactFields::idToTrFields();
583 for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { 583 for (i = counter; it != slDynamicEntries.end(); i++, ++it ) {
584 584
585 if (((*it) == "Anniversary") || 585 if (((*it) == "Anniversary") ||
586 ((*it) == "Birthday")|| ((*it) == "Gender")) continue; 586 ((*it) == "Birthday")|| ((*it) == "Gender")) continue;
587 587
588 l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); 588 l = new QLabel( mapIdToStr[mapStrToID[*it]], container );
589 listName.append( l ); 589 listName.append( l );
590 gl->addWidget( l, i, 0 ); 590 gl->addWidget( l, i, 0 );
591 QLineEdit *e = new QLineEdit( container ); 591 QLineEdit *e = new QLineEdit( container );
592 listValue.append( e ); 592 listValue.append( e );
593 gl->addWidget( e, i, 1); 593 gl->addWidget( e, i, 1);
594 } 594 }
595 // Fill labels with names.. 595 // Fill labels with names..
596 //loadFields(); 596 //loadFields();
597 597
598 598
599 tabMain->insertTab( tabViewport, tr( "Details" ) ); 599 tabMain->insertTab( tabViewport, tr( "Details" ) );
600 600
601 dlgNote = new QDialog( this, "Note Dialog", TRUE ); 601 dlgNote = new QDialog( this, "Note Dialog", TRUE );
602 dlgNote->setCaption( tr("Enter Note") ); 602 dlgNote->setCaption( tr("Enter Note") );
603 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); 603 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote );
604 txtNote = new QMultiLineEdit( dlgNote ); 604 txtNote = new QMultiLineEdit( dlgNote );
605 vbNote->addWidget( txtNote ); 605 vbNote->addWidget( txtNote );
606 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); 606 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) );
607 607
608 dlgName = new QDialog( this, "Name Dialog", TRUE ); 608 dlgName = new QDialog( this, "Name Dialog", TRUE );
609 dlgName->setCaption( tr("Edit Name") ); 609 dlgName->setCaption( tr("Edit Name") );
610 gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); 610 gl = new QGridLayout( dlgName, 5, 2, 2, 3 );
611 611
612 l = new QLabel( tr("First Name"), dlgName ); 612 l = new QLabel( tr("First Name"), dlgName );
613 gl->addWidget( l, 0, 0 ); 613 gl->addWidget( l, 0, 0 );
614 txtFirstName = new QLineEdit( dlgName ); 614 txtFirstName = new QLineEdit( dlgName );
615 gl->addWidget( txtFirstName, 0, 1 ); 615 gl->addWidget( txtFirstName, 0, 1 );
616 616
617 l = new QLabel( tr("Middle Name"), dlgName ); 617 l = new QLabel( tr("Middle Name"), dlgName );
618 gl->addWidget( l, 1, 0 ); 618 gl->addWidget( l, 1, 0 );
619 txtMiddleName = new QLineEdit( dlgName ); 619 txtMiddleName = new QLineEdit( dlgName );
620 gl->addWidget( txtMiddleName, 1, 1 ); 620 gl->addWidget( txtMiddleName, 1, 1 );
621 621
622 l = new QLabel( tr("Last Name"), dlgName ); 622 l = new QLabel( tr("Last Name"), dlgName );
623 gl->addWidget( l, 2, 0 ); 623 gl->addWidget( l, 2, 0 );
624 txtLastName = new QLineEdit( dlgName ); 624 txtLastName = new QLineEdit( dlgName );
625 gl->addWidget( txtLastName, 2, 1 ); 625 gl->addWidget( txtLastName, 2, 1 );
626 626
627 // l = new QLabel( tr("Suffix"), dlgName ); 627 // l = new QLabel( tr("Suffix"), dlgName );
628 // gl->addWidget( l, 3, 0 ); 628 // gl->addWidget( l, 3, 0 );
629 // txtSuffix = new QLineEdit( dlgName ); 629 // txtSuffix = new QLineEdit( dlgName );
630 // gl->addWidget( txtSuffix, 3, 1 ); 630 // gl->addWidget( txtSuffix, 3, 1 );
631 space = new QSpacerItem(1,1, 631 space = new QSpacerItem(1,1,
632 QSizePolicy::Maximum, 632 QSizePolicy::Maximum,
633 QSizePolicy::MinimumExpanding ); 633 QSizePolicy::MinimumExpanding );
634 gl->addItem( space, 4, 0 ); 634 gl->addItem( space, 4, 0 );
635 635
636 cmbChooserField1->insertStringList( trlChooserNames ); 636 cmbChooserField1->insertStringList( trlChooserNames );
637 cmbChooserField2->insertStringList( trlChooserNames ); 637 cmbChooserField2->insertStringList( trlChooserNames );
638 cmbChooserField3->insertStringList( trlChooserNames ); 638 cmbChooserField3->insertStringList( trlChooserNames );
639 cmbChooserField4->insertStringList( trlChooserNames ); 639 cmbChooserField4->insertStringList( trlChooserNames );
640 640
641 cmbChooserField1->setCurrentItem( 0 ); 641 cmbChooserField1->setCurrentItem( 0 );
642 cmbChooserField2->setCurrentItem( 1 ); 642 cmbChooserField2->setCurrentItem( 1 );
643 cmbChooserField3->setCurrentItem( 2 ); 643 cmbChooserField3->setCurrentItem( 2 );
644 644
645 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 645 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
646 646
647 connect( txtFullName, SIGNAL(textChanged(const QString &)), 647 connect( txtFullName, SIGNAL(textChanged(const QString&)),
648 this, SLOT(slotFullNameChange(const QString &)) ); 648 this, SLOT(slotFullNameChange(const QString&)) );
649 connect( txtSuffix, SIGNAL(textChanged(const QString &)), 649 connect( txtSuffix, SIGNAL(textChanged(const QString&)),
650 this, SLOT(slotSuffixChange(const QString &)) ); 650 this, SLOT(slotSuffixChange(const QString&)) );
651 connect( txtOrganization, SIGNAL(textChanged(const QString &)), 651 connect( txtOrganization, SIGNAL(textChanged(const QString&)),
652 this, SLOT(slotOrganizationChange(const QString &)) ); 652 this, SLOT(slotOrganizationChange(const QString&)) );
653 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), 653 connect( txtChooserField1, SIGNAL(textChanged(const QString&)),
654 this, SLOT(slotChooser1Change(const QString &)) ); 654 this, SLOT(slotChooser1Change(const QString&)) );
655 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), 655 connect( txtChooserField2, SIGNAL(textChanged(const QString&)),
656 this, SLOT(slotChooser2Change(const QString &)) ); 656 this, SLOT(slotChooser2Change(const QString&)) );
657 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), 657 connect( txtChooserField3, SIGNAL(textChanged(const QString&)),
658 this, SLOT(slotChooser3Change(const QString &)) ); 658 this, SLOT(slotChooser3Change(const QString&)) );
659 connect( txtChooserField4, SIGNAL(textChanged(const QString &)), 659 connect( txtChooserField4, SIGNAL(textChanged(const QString&)),
660 this, SLOT(slotChooser4Change(const QString &)) ); 660 this, SLOT(slotChooser4Change(const QString&)) );
661 connect( txtAddress, SIGNAL(textChanged(const QString &)), 661 connect( txtAddress, SIGNAL(textChanged(const QString&)),
662 this, SLOT(slotAddressChange(const QString &)) ); 662 this, SLOT(slotAddressChange(const QString&)) );
663 connect( txtCity, SIGNAL(textChanged(const QString &)), 663 connect( txtCity, SIGNAL(textChanged(const QString&)),
664 this, SLOT(slotCityChange(const QString &)) ); 664 this, SLOT(slotCityChange(const QString&)) );
665 connect( txtState, SIGNAL(textChanged(const QString &)), 665 connect( txtState, SIGNAL(textChanged(const QString&)),
666 this, SLOT(slotStateChange(const QString &)) ); 666 this, SLOT(slotStateChange(const QString&)) );
667 connect( txtZip, SIGNAL(textChanged(const QString &)), 667 connect( txtZip, SIGNAL(textChanged(const QString&)),
668 this, SLOT(slotZipChange(const QString &)) ); 668 this, SLOT(slotZipChange(const QString&)) );
669 connect( cmbCountry, SIGNAL(textChanged(const QString &)), 669 connect( cmbCountry, SIGNAL(textChanged(const QString&)),
670 this, SLOT(slotCountryChange(const QString &)) ); 670 this, SLOT(slotCountryChange(const QString&)) );
671 connect( cmbCountry, SIGNAL(activated(const QString &)), 671 connect( cmbCountry, SIGNAL(activated(const QString&)),
672 this, SLOT(slotCountryChange(const QString &)) ); 672 this, SLOT(slotCountryChange(const QString&)) );
673 connect( cmbChooserField1, SIGNAL(activated(int)), 673 connect( cmbChooserField1, SIGNAL(activated(int)),
674 this, SLOT(slotCmbChooser1Change(int)) ); 674 this, SLOT(slotCmbChooser1Change(int)) );
675 connect( cmbChooserField2, SIGNAL(activated(int)), 675 connect( cmbChooserField2, SIGNAL(activated(int)),
676 this, SLOT(slotCmbChooser2Change(int)) ); 676 this, SLOT(slotCmbChooser2Change(int)) );
677 connect( cmbChooserField3, SIGNAL(activated(int)), 677 connect( cmbChooserField3, SIGNAL(activated(int)),
678 this, SLOT(slotCmbChooser3Change(int)) ); 678 this, SLOT(slotCmbChooser3Change(int)) );
679 connect( cmbChooserField4, SIGNAL(activated(int)), 679 connect( cmbChooserField4, SIGNAL(activated(int)),
680 this, SLOT(slotCmbChooser4Change(int)) ); 680 this, SLOT(slotCmbChooser4Change(int)) );
681 connect( cmbAddress, SIGNAL(activated(int)), 681 connect( cmbAddress, SIGNAL(activated(int)),
682 this, SLOT(slotAddressTypeChange(int)) ); 682 this, SLOT(slotAddressTypeChange(int)) );
683 683
684 new QPEDialogListener(this); 684 new QPEDialogListener(this);
685 685
686 setPersonalView ( m_personalView ); 686 setPersonalView ( m_personalView );
687 687
688 qWarning("init() END"); 688 qWarning("init() END");
689} 689}
690 690
691void ContactEditor::defaultEmailChanged(int i){ 691void ContactEditor::defaultEmailChanged(int i){
692 qDebug("defaultEmailChanged"); 692 qDebug("defaultEmailChanged");
693 693
694 // was sollte das ? (se) 694 // was sollte das ? (se)
695 // int index = cmbChooserField1->currentItem(); 695 // int index = cmbChooserField1->currentItem();
696 // slChooserValues[index] = cmbDefaultEmail->text(i); 696 // slChooserValues[index] = cmbDefaultEmail->text(i);
697 697
698 defaultEmail = cmbDefaultEmail->text(i); 698 defaultEmail = cmbDefaultEmail->text(i);
699 qDebug ("Changed to: %s", defaultEmail.latin1()); 699 qDebug ("Changed to: %s", defaultEmail.latin1());
700 700
701} 701}
702 702
703void ContactEditor::populateDefaultEmailCmb(){ 703void ContactEditor::populateDefaultEmailCmb(){
704 704
705 // if the default-email combo was not selected and therfore not created 705 // if the default-email combo was not selected and therfore not created
706 // we get a lot of trouble.. Therfore create an invisible one.. 706 // we get a lot of trouble.. Therfore create an invisible one..
707 if ( !cmbDefaultEmail ){ 707 if ( !cmbDefaultEmail ){
708 cmbDefaultEmail = new QComboBox(this); 708 cmbDefaultEmail = new QComboBox(this);
709 cmbDefaultEmail -> hide(); 709 cmbDefaultEmail -> hide();
710 } 710 }
711 cmbDefaultEmail->clear(); 711 cmbDefaultEmail->clear();
712 cmbDefaultEmail->insertStringList( emails ); 712 cmbDefaultEmail->insertStringList( emails );
713 // cmbDefaultEmail->show(); 713 // cmbDefaultEmail->show();
714 714
715 // Select default email in combo.. 715 // Select default email in combo..
716 bool found = false; 716 bool found = false;
717 for ( int i = 0; i < cmbDefaultEmail->count(); i++){ 717 for ( int i = 0; i < cmbDefaultEmail->count(); i++){
718 qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", 718 qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<",
719 cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); 719 cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1());
720 720
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index af26302..3934411 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -116,106 +116,106 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
116 a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); 116 a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 );
117 connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); 117 connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) );
118 a->addTo( sub_bar ); 118 a->addTo( sub_bar );
119// a->addTo( view ); 119// a->addTo( view );
120 a->setToggleAction( TRUE ); 120 a->setToggleAction( TRUE );
121 a->setOn( TRUE ); 121 a->setOn( TRUE );
122 dayAction = a; 122 dayAction = a;
123 123
124 a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); 124 a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 );
125 connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); 125 connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) );
126 a->addTo( sub_bar ); 126 a->addTo( sub_bar );
127// a->addTo( view ); 127// a->addTo( view );
128 a->setToggleAction( TRUE ); 128 a->setToggleAction( TRUE );
129 weekAction = a; 129 weekAction = a;
130 130
131 a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 ); 131 a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 );
132 connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) ); 132 connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) );
133 a->addTo( sub_bar ); 133 a->addTo( sub_bar );
134// a->addTo( view ); 134// a->addTo( view );
135 a->setToggleAction( TRUE ); 135 a->setToggleAction( TRUE );
136 weekLstAction = a; 136 weekLstAction = a;
137 137
138 a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); 138 a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 );
139 connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); 139 connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) );
140 a->addTo( sub_bar ); 140 a->addTo( sub_bar );
141// a->addTo( view ); 141// a->addTo( view );
142 a->setToggleAction( TRUE ); 142 a->setToggleAction( TRUE );
143 monthAction = a; 143 monthAction = a;
144 144
145 sub_bar->addSeparator(); 145 sub_bar->addSeparator();
146 146
147 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 ); 147 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 );
148 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); 148 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) );
149 a->addTo( sub_bar ); 149 a->addTo( sub_bar );
150 150
151 a = new QAction( tr( "Edit..." ), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0 ); 151 a = new QAction( tr( "Edit..." ), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0 );
152 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); 152 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
153 a->addTo( sub_bar ); 153 a->addTo( sub_bar );
154 154
155 if(defaultView==DAY) viewDay(); 155 if(defaultView==DAY) viewDay();
156 if(defaultView==WEEK) needEvilHack=true;// viewWeek(); 156 if(defaultView==WEEK) needEvilHack=true;// viewWeek();
157 if(defaultView==WEEKLST) viewWeekLst(); 157 if(defaultView==WEEKLST) viewWeekLst();
158 if(defaultView==MONTH) viewMonth(); 158 if(defaultView==MONTH) viewMonth();
159 159
160 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); 160 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) );
161 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) ); 161 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) );
162 162
163#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 163#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
164 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), this, SLOT(appMessage(const QCString&, const QByteArray&)) ); 164 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), this, SLOT(appMessage(const QCString&,const QByteArray&)) );
165#endif 165#endif
166 166
167 // listen on QPE/System 167 // listen on QPE/System
168#if defined(Q_WS_QWS) 168#if defined(Q_WS_QWS)
169#if !defined(QT_NO_COP) 169#if !defined(QT_NO_COP)
170 QCopChannel *channel = new QCopChannel( "QPE/System", this ); 170 QCopChannel *channel = new QCopChannel( "QPE/System", this );
171 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); 171 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) );
172 channel = new QCopChannel( "QPE/Datebook", this ); 172 channel = new QCopChannel( "QPE/Datebook", this );
173 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); 173 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) );
174#endif 174#endif
175#endif 175#endif
176 176
177 qDebug("done t=%d", t.elapsed() ); 177 qDebug("done t=%d", t.elapsed() );
178 178
179 connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) ); 179 connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) );
180 connect( qApp, SIGNAL( reload()), this, SLOT( reload() ) ); 180 connect( qApp, SIGNAL( reload()), this, SLOT( reload() ) );
181 /* 181 /*
182 * Here is a problem description: 182 * Here is a problem description:
183 * When Weekview is the default view 183 * When Weekview is the default view
184 * a DateBookWeekView get's created 184 * a DateBookWeekView get's created
185 * redraw() get's called. So what? 185 * redraw() get's called. So what?
186 * Remember that we're still in the c'tor 186 * Remember that we're still in the c'tor
187 * and no final layout has happened? Ok 187 * and no final layout has happened? Ok
188 * now all Events get arranged. Their x 188 * now all Events get arranged. Their x
189 * position get's determined by a QHeader 189 * position get's determined by a QHeader
190 * position. But the QHeader isn't layouted or 190 * position. But the QHeader isn't layouted or
191 * at the right position. redraw() is a slot 191 * at the right position. redraw() is a slot
192 * so we'll call it then via a singleShot 192 * so we'll call it then via a singleShot
193 * from view() 193 * from view()
194 */ 194 */
195 if( needEvilHack ){ 195 if( needEvilHack ){
196 QTimer::singleShot( 500, this, SLOT(viewWeek()) ); 196 QTimer::singleShot( 500, this, SLOT(viewWeek()) );
197 } 197 }
198} 198}
199 199
200void DateBook::receive( const QCString &msg, const QByteArray &data ) 200void DateBook::receive( const QCString &msg, const QByteArray &data )
201{ 201{
202 QDataStream stream( data, IO_ReadOnly ); 202 QDataStream stream( data, IO_ReadOnly );
203 if ( msg == "timeChange(QString)" ) { 203 if ( msg == "timeChange(QString)" ) {
204 // update active view! 204 // update active view!
205 if ( dayAction->isOn() ) 205 if ( dayAction->isOn() )
206 viewDay(); 206 viewDay();
207 else if ( weekAction->isOn() ) 207 else if ( weekAction->isOn() )
208 viewWeek(); 208 viewWeek();
209 else if ( monthAction->isOn() ) 209 else if ( monthAction->isOn() )
210 viewMonth(); 210 viewMonth();
211 } 211 }
212 else if (msg == "editEvent(int)") { 212 else if (msg == "editEvent(int)") {
213 int uid; 213 int uid;
214 stream >> uid; 214 stream >> uid;
215 Event e=db->eventByUID(uid); 215 Event e=db->eventByUID(uid);
216 editEvent(e); 216 editEvent(e);
217 }else if (msg == "viewDefault(QDate)"){ 217 }else if (msg == "viewDefault(QDate)"){
218 QDate day; 218 QDate day;
219 stream >> day; 219 stream >> day;
220 viewDefault(day); 220 viewDefault(day);
221 } 221 }
@@ -472,150 +472,150 @@ void DateBook::editEvent( const Event &e )
472 } 472 }
473 db->editEvent(e, newEv); 473 db->editEvent(e, newEv);
474 emit newEvent(); 474 emit newEvent();
475 break; 475 break;
476 } 476 }
477} 477}
478 478
479void DateBook::removeEvent( const Event &e ) 479void DateBook::removeEvent( const Event &e )
480{ 480{
481 if (syncing) { 481 if (syncing) {
482 QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") ); 482 QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") );
483 return; 483 return;
484 } 484 }
485 485
486 QString strName = e.description(); 486 QString strName = e.description();
487 487
488 if ( !QPEMessageBox::confirmDelete( this, tr( "Calendar" ),strName ) ) 488 if ( !QPEMessageBox::confirmDelete( this, tr( "Calendar" ),strName ) )
489 return; 489 return;
490 490
491 db->removeEvent( e ); 491 db->removeEvent( e );
492 if ( views->visibleWidget() == dayView && dayView ) 492 if ( views->visibleWidget() == dayView && dayView )
493 dayView->redraw(); 493 dayView->redraw();
494 494
495} 495}
496 496
497void DateBook::addEvent( const Event &e ) 497void DateBook::addEvent( const Event &e )
498{ 498{
499 QDate d = e.start().date(); 499 QDate d = e.start().date();
500 initDay(); 500 initDay();
501 dayView->setDate( d ); 501 dayView->setDate( d );
502} 502}
503 503
504void DateBook::showDay( int year, int month, int day ) 504void DateBook::showDay( int year, int month, int day )
505{ 505{
506 QDate d(year, month, day); 506 QDate d(year, month, day);
507 view(DAY,d); 507 view(DAY,d);
508} 508}
509 509
510void DateBook::initDay() 510void DateBook::initDay()
511{ 511{
512 if ( !dayView ) { 512 if ( !dayView ) {
513 dayView = new DateBookDay( ampm, onMonday, db, views, "day view" ); 513 dayView = new DateBookDay( ampm, onMonday, db, views, "day view" );
514 views->addWidget( dayView, DAY ); 514 views->addWidget( dayView, DAY );
515 dayView->setJumpToCurTime( bJumpToCurTime ); 515 dayView->setJumpToCurTime( bJumpToCurTime );
516 dayView->setStartViewTime( startTime ); 516 dayView->setStartViewTime( startTime );
517 dayView->setRowStyle( rowStyle ); 517 dayView->setRowStyle( rowStyle );
518 connect( this, SIGNAL( newEvent() ), dayView, SLOT( redraw() ) ); 518 connect( this, SIGNAL( newEvent() ), dayView, SLOT( redraw() ) );
519 connect( dayView, SIGNAL( newEvent() ), this, SLOT( fileNew() ) ); 519 connect( dayView, SIGNAL( newEvent() ), this, SLOT( fileNew() ) );
520 connect( dayView, SIGNAL( removeEvent( const Event & ) ), this, SLOT( removeEvent( const Event & ) ) ); 520 connect( dayView, SIGNAL( removeEvent(const Event&) ), this, SLOT( removeEvent(const Event&) ) );
521 connect( dayView, SIGNAL( editEvent( const Event & ) ), this, SLOT( editEvent( const Event & ) ) ); 521 connect( dayView, SIGNAL( editEvent(const Event&) ), this, SLOT( editEvent(const Event&) ) );
522 connect( dayView, SIGNAL( duplicateEvent( const Event & ) ), this, SLOT( duplicateEvent( const Event & ) ) ); 522 connect( dayView, SIGNAL( duplicateEvent(const Event&) ), this, SLOT( duplicateEvent(const Event&) ) );
523 connect( dayView, SIGNAL( beamEvent( const Event & ) ), this, SLOT( beamEvent( const Event & ) ) ); 523 connect( dayView, SIGNAL( beamEvent(const Event&) ), this, SLOT( beamEvent(const Event&) ) );
524 connect( dayView, SIGNAL(sigNewEvent(const QString &)), this, SLOT(slotNewEventFromKey(const QString &)) ); 524 connect( dayView, SIGNAL(sigNewEvent(const QString&)), this, SLOT(slotNewEventFromKey(const QString&)) );
525 } 525 }
526} 526}
527 527
528void DateBook::initWeek() 528void DateBook::initWeek()
529{ 529{
530 if ( !weekView ) { 530 if ( !weekView ) {
531 weekView = new DateBookWeek( ampm, onMonday, db, views, "week view" ); 531 weekView = new DateBookWeek( ampm, onMonday, db, views, "week view" );
532 weekView->setStartViewTime( startTime ); 532 weekView->setStartViewTime( startTime );
533 views->addWidget( weekView, WEEK ); 533 views->addWidget( weekView, WEEK );
534 connect( weekView, SIGNAL( showDate( int, int, int ) ), this, SLOT( showDay( int, int, int ) ) ); 534 connect( weekView, SIGNAL( showDate(int,int,int) ), this, SLOT( showDay(int,int,int) ) );
535 connect( this, SIGNAL( newEvent() ), weekView, SLOT( redraw() ) ); 535 connect( this, SIGNAL( newEvent() ), weekView, SLOT( redraw() ) );
536 } 536 }
537 537
538 //But also get it right: the year that we display can be different 538 //But also get it right: the year that we display can be different
539 //from the year of the current date. So, first find the year 539 //from the year of the current date. So, first find the year
540 //number of the current week. 540 //number of the current week.
541 int yearNumber, totWeeks; 541 int yearNumber, totWeeks;
542 calcWeek( currentDate(), totWeeks, yearNumber, onMonday ); 542 calcWeek( currentDate(), totWeeks, yearNumber, onMonday );
543 543
544 QDate d = QDate( yearNumber, 12, 31 ); 544 QDate d = QDate( yearNumber, 12, 31 );
545 calcWeek( d, totWeeks, yearNumber, onMonday ); 545 calcWeek( d, totWeeks, yearNumber, onMonday );
546 546
547 while ( totWeeks == 1 ) { 547 while ( totWeeks == 1 ) {
548 d = d.addDays( -1 ); 548 d = d.addDays( -1 );
549 calcWeek( d, totWeeks, yearNumber, onMonday ); 549 calcWeek( d, totWeeks, yearNumber, onMonday );
550 } 550 }
551} 551}
552 552
553void DateBook::initWeekLst() { 553void DateBook::initWeekLst() {
554 if ( !weekLstView ) { 554 if ( !weekLstView ) {
555 weekLstView = new DateBookWeekLst( ampm, onMonday, db, views, "weeklst view" ); 555 weekLstView = new DateBookWeekLst( ampm, onMonday, db, views, "weeklst view" );
556 views->addWidget( weekLstView, WEEKLST ); 556 views->addWidget( weekLstView, WEEKLST );
557 557
558 //weekLstView->setStartViewTime( startTime ); 558 //weekLstView->setStartViewTime( startTime );
559 connect( weekLstView, SIGNAL( showDate( int, int, int ) ), this, SLOT( showDay( int, int, int ) ) ); 559 connect( weekLstView, SIGNAL( showDate(int,int,int) ), this, SLOT( showDay(int,int,int) ) );
560 connect( weekLstView, SIGNAL( addEvent( const QDateTime &, const QDateTime &, const QString & , const QString &) ), 560 connect( weekLstView, SIGNAL( addEvent(const QDateTime&,const QDateTime&,const QString&, const QString&) ),
561 this, SLOT( slotNewEntry( const QDateTime &, const QDateTime &, const QString & , const QString &) ) ); 561 this, SLOT( slotNewEntry(const QDateTime&,const QDateTime&,const QString&, const QString&) ) );
562 connect( this, SIGNAL( newEvent() ), weekLstView, SLOT( redraw() ) ); 562 connect( this, SIGNAL( newEvent() ), weekLstView, SLOT( redraw() ) );
563 connect( weekLstView, SIGNAL( editEvent( const Event & ) ), this, SLOT( editEvent( const Event & ) ) ); 563 connect( weekLstView, SIGNAL( editEvent(const Event&) ), this, SLOT( editEvent(const Event&) ) );
564 } 564 }
565} 565}
566 566
567 567
568void DateBook::initMonth() 568void DateBook::initMonth()
569{ 569{
570 if ( !monthView ) { 570 if ( !monthView ) {
571 monthView = new DateBookMonth( views, "month view", FALSE, db ); 571 monthView = new DateBookMonth( views, "month view", FALSE, db );
572 views->addWidget( monthView, MONTH ); 572 views->addWidget( monthView, MONTH );
573 connect( monthView, SIGNAL( dateClicked( int, int, int ) ), this, SLOT( showDay( int, int, int ) ) ); 573 connect( monthView, SIGNAL( dateClicked(int,int,int) ), this, SLOT( showDay(int,int,int) ) );
574 connect( this, SIGNAL( newEvent() ), monthView, SLOT( redraw() ) ); 574 connect( this, SIGNAL( newEvent() ), monthView, SLOT( redraw() ) );
575 qApp->processEvents(); 575 qApp->processEvents();
576 } 576 }
577} 577}
578 578
579void DateBook::loadSettings() 579void DateBook::loadSettings()
580{ 580{
581 Config qpeconfig( "qpe" ); 581 Config qpeconfig( "qpe" );
582 qpeconfig.setGroup("Time"); 582 qpeconfig.setGroup("Time");
583 ampm = qpeconfig.readBoolEntry( "AMPM", TRUE ); 583 ampm = qpeconfig.readBoolEntry( "AMPM", TRUE );
584 onMonday = qpeconfig.readBoolEntry( "MONDAY" ); 584 onMonday = qpeconfig.readBoolEntry( "MONDAY" );
585 585
586 Config config("DateBook"); 586 Config config("DateBook");
587 config.setGroup("Main"); 587 config.setGroup("Main");
588 startTime = config.readNumEntry("startviewtime", 8); 588 startTime = config.readNumEntry("startviewtime", 8);
589 aPreset = config.readBoolEntry("alarmpreset"); 589 aPreset = config.readBoolEntry("alarmpreset");
590 presetTime = config.readNumEntry("presettime"); 590 presetTime = config.readNumEntry("presettime");
591 bJumpToCurTime = config.readBoolEntry("jumptocurtime"); 591 bJumpToCurTime = config.readBoolEntry("jumptocurtime");
592 rowStyle = config.readNumEntry("rowstyle"); 592 rowStyle = config.readNumEntry("rowstyle");
593 defaultView = config.readNumEntry("defaultview",DAY); 593 defaultView = config.readNumEntry("defaultview",DAY);
594 weeklistviewconfig = config.readNumEntry("weeklistviewconfig",NORMAL); 594 weeklistviewconfig = config.readNumEntry("weeklistviewconfig",NORMAL);
595 595
596 defaultLocation=config.readEntry("defaultLocation"); 596 defaultLocation=config.readEntry("defaultLocation");
597 QString tmpString=config.readEntry("defaultCategories"); 597 QString tmpString=config.readEntry("defaultCategories");
598 QStringList tmpStringList=QStringList::split(",",tmpString); 598 QStringList tmpStringList=QStringList::split(",",tmpString);
599 defaultCategories.truncate(0); 599 defaultCategories.truncate(0);
600 600
601 for( QStringList::Iterator i=tmpStringList.begin(); i!=tmpStringList.end(); i++) { 601 for( QStringList::Iterator i=tmpStringList.begin(); i!=tmpStringList.end(); i++) {
602 defaultCategories.resize(defaultCategories.count()+1); 602 defaultCategories.resize(defaultCategories.count()+1);
603 defaultCategories[defaultCategories.count()-1]=(*i).toInt(); 603 defaultCategories[defaultCategories.count()-1]=(*i).toInt();
604 } 604 }
605} 605}
606 606
607void DateBook::saveSettings() 607void DateBook::saveSettings()
608{ 608{
609 Config config( "qpe" ); 609 Config config( "qpe" );
610 Config configDB( "DateBook" ); 610 Config configDB( "DateBook" );
611 configDB.setGroup( "Main" ); 611 configDB.setGroup( "Main" );
612 configDB.writeEntry("startviewtime",startTime); 612 configDB.writeEntry("startviewtime",startTime);
613 configDB.writeEntry("alarmpreset",aPreset); 613 configDB.writeEntry("alarmpreset",aPreset);
614 configDB.writeEntry("presettime",presetTime); 614 configDB.writeEntry("presettime",presetTime);
615 configDB.writeEntry("jumptocurtime", bJumpToCurTime); 615 configDB.writeEntry("jumptocurtime", bJumpToCurTime);
616 configDB.writeEntry("rowstyle", rowStyle); 616 configDB.writeEntry("rowstyle", rowStyle);
617 configDB.writeEntry("defaultview",defaultView); 617 configDB.writeEntry("defaultview",defaultView);
618 configDB.writeEntry("weeklistviewconfig",weeklistviewconfig); 618 configDB.writeEntry("weeklistviewconfig",weeklistviewconfig);
619 619
620 configDB.writeEntry("defaultLocation",defaultLocation); 620 configDB.writeEntry("defaultLocation",defaultLocation);
621 QStringList tmpStringList; 621 QStringList tmpStringList;
@@ -860,120 +860,118 @@ void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const
860 if(defaultLocation.isEmpty()) { 860 if(defaultLocation.isEmpty()) {
861 ev.setLocation(tr("(Unknown)")); 861 ev.setLocation(tr("(Unknown)"));
862 } else { 862 } else {
863 ev.setLocation( defaultLocation ); 863 ev.setLocation( defaultLocation );
864 } 864 }
865 } else { 865 } else {
866 ev.setLocation(location); 866 ev.setLocation(location);
867 } 867 }
868 ev.setCategories(defaultCategories); 868 ev.setCategories(defaultCategories);
869 ev.setStart( start ); 869 ev.setStart( start );
870 ev.setEnd( end ); 870 ev.setEnd( end );
871 871
872 e = new DateEntry( onMonday, ev, ampm, &newDlg ); 872 e = new DateEntry( onMonday, ev, ampm, &newDlg );
873 e->setAlarmEnabled( aPreset, presetTime, Event::Loud ); 873 e->setAlarmEnabled( aPreset, presetTime, Event::Loud );
874 sv->addChild( e ); 874 sv->addChild( e );
875 while ( QPEApplication::execDialog( &newDlg ) ) { 875 while ( QPEApplication::execDialog( &newDlg ) ) {
876 ev = e->event(); 876 ev = e->event();
877 ev.assignUid(); 877 ev.assignUid();
878 QString error = checkEvent( ev ); 878 QString error = checkEvent( ev );
879 if ( !error.isNull() ) { 879 if ( !error.isNull() ) {
880 if ( QMessageBox::warning( this, tr("Error!"), error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 ) 880 if ( QMessageBox::warning( this, tr("Error!"), error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 )
881 continue; 881 continue;
882 } 882 }
883 db->addEvent( ev ); 883 db->addEvent( ev );
884 emit newEvent(); 884 emit newEvent();
885 break; 885 break;
886 } 886 }
887} 887}
888 888
889void DateBook::setDocument( const QString &filename ) 889void DateBook::setDocument( const QString &filename )
890{ 890{
891 if ( filename.find(".vcs") != int(filename.length()) - 4 ) return; 891 if ( filename.find(".vcs") != int(filename.length()) - 4 ) return;
892 892
893 QValueList<Event> tl = Event::readVCalendar( filename ); 893 QValueList<Event> tl = Event::readVCalendar( filename );
894 for( QValueList<Event>::Iterator it = tl.begin(); it != tl.end(); ++it ) { 894 for( QValueList<Event>::Iterator it = tl.begin(); it != tl.end(); ++it ) {
895 db->addEvent( *it ); 895 db->addEvent( *it );
896 } 896 }
897} 897}
898 898
899static const char * beamfile = "/tmp/obex/event.vcs"; 899static const char * beamfile = "/tmp/obex/event.vcs";
900 900
901void DateBook::beamEvent( const Event &e ) 901void DateBook::beamEvent( const Event &e )
902{ 902{
903 qDebug("trying to beamn"); 903 qDebug("trying to beamn");
904 unlink( beamfile ); // delete if exists 904 unlink( beamfile ); // delete if exists
905 mkdir("/tmp/obex/", 0755); 905 mkdir("/tmp/obex/", 0755);
906 Event::writeVCalendar( beamfile, e ); 906 Event::writeVCalendar( beamfile, e );
907 Ir *ir = new Ir( this ); 907 Ir *ir = new Ir( this );
908 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 908 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
909 QString description = e.description(); 909 QString description = e.description();
910 ir->send( beamfile, description, "text/x-vCalendar" ); 910 ir->send( beamfile, description, "text/x-vCalendar" );
911} 911}
912 912
913void DateBook::beamDone( Ir *ir ) 913void DateBook::beamDone( Ir *ir )
914{ 914{
915 delete ir; 915 delete ir;
916 unlink( beamfile ); 916 unlink( beamfile );
917} 917}
918 918
919void DateBook::slotFind() 919void DateBook::slotFind()
920{ 920{
921 // move it to the day view... 921 // move it to the day view...
922 viewDay(); 922 viewDay();
923 FindDialog frmFind( "Calendar", this ); // no tr needed 923 FindDialog frmFind( "Calendar", this ); // no tr needed
924 frmFind.setUseDate( true ); 924 frmFind.setUseDate( true );
925 frmFind.setDate( currentDate() ); 925 frmFind.setDate( currentDate() );
926 QObject::connect( &frmFind, 926 QObject::connect( &frmFind,
927 SIGNAL(signalFindClicked(const QString&, const QDate&, 927 SIGNAL(signalFindClicked(const QString&,const QDate&,bool,bool,int)),
928 bool, bool, int)),
929 this, 928 this,
930 SLOT(slotDoFind(const QString&, const QDate&, 929 SLOT(slotDoFind(const QString&,const QDate&,bool,bool,int)) );
931 bool, bool, int)) );
932 QObject::connect( this, 930 QObject::connect( this,
933 SIGNAL(signalNotFound()), 931 SIGNAL(signalNotFound()),
934 &frmFind, 932 &frmFind,
935 SLOT(slotNotFound()) ); 933 SLOT(slotNotFound()) );
936 QObject::connect( this, 934 QObject::connect( this,
937 SIGNAL(signalWrapAround()), 935 SIGNAL(signalWrapAround()),
938 &frmFind, 936 &frmFind,
939 SLOT(slotWrapAround()) ); 937 SLOT(slotWrapAround()) );
940 frmFind.move(0,0); 938 frmFind.move(0,0);
941 frmFind.exec(); 939 frmFind.exec();
942 inSearch = false; 940 inSearch = false;
943} 941}
944 942
945bool catComp( QArray<int> cats, int category ) 943bool catComp( QArray<int> cats, int category )
946{ 944{
947 bool returnMe; 945 bool returnMe;
948 int i, 946 int i,
949 count; 947 count;
950 948
951 count = int(cats.count()); 949 count = int(cats.count());
952 returnMe = false; 950 returnMe = false;
953 if ( (category == -1 && count == 0) || category == -2 ) 951 if ( (category == -1 && count == 0) || category == -2 )
954 returnMe = true; 952 returnMe = true;
955 else { 953 else {
956 for ( i = 0; i < count; i++ ) { 954 for ( i = 0; i < count; i++ ) {
957 if ( category == cats[i] ) { 955 if ( category == cats[i] ) {
958 returnMe = true; 956 returnMe = true;
959 break; 957 break;
960 } 958 }
961 } 959 }
962 } 960 }
963 return returnMe; 961 return returnMe;
964} 962}
965 963
966 964
967void DateBook::slotDoFind( const QString& txt, const QDate &dt, 965void DateBook::slotDoFind( const QString& txt, const QDate &dt,
968 bool caseSensitive, bool /*backwards*/, 966 bool caseSensitive, bool /*backwards*/,
969 int category ) 967 int category )
970{ 968{
971 QDateTime dtEnd( QDate(3001, 1, 1), QTime(0, 0, 0) ), 969 QDateTime dtEnd( QDate(3001, 1, 1), QTime(0, 0, 0) ),
972 next; 970 next;
973 971
974 QRegExp r( txt ); 972 QRegExp r( txt );
975 r.setCaseSensitive( caseSensitive ); 973 r.setCaseSensitive( caseSensitive );
976 974
977 975
978 static Event rev, nonrev; 976 static Event rev, nonrev;
979 if ( !inSearch ) { 977 if ( !inSearch ) {
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp
index 751a1da..ca63dc5 100644
--- a/core/pim/datebook/datebookday.cpp
+++ b/core/pim/datebook/datebookday.cpp
@@ -163,131 +163,131 @@ void DateBookDayView::keyPressEvent( QKeyEvent *e )
163 // I don't know what this key is, do you? 163 // I don't know what this key is, do you?
164 e->ignore(); 164 e->ignore();
165 } 165 }
166} 166}
167 167
168void DateBookDayView::setRowStyle( int style ) 168void DateBookDayView::setRowStyle( int style )
169{ 169{
170 if (style<0) style = 0; 170 if (style<0) style = 0;
171 171
172 for (int i=0; i<numRows(); i++) 172 for (int i=0; i<numRows(); i++)
173 setRowHeight(i, style*10+20); 173 setRowHeight(i, style*10+20);
174} 174}
175 175
176void DateBookDayView::contentsMouseReleaseEvent( QMouseEvent* /* e */ ) 176void DateBookDayView::contentsMouseReleaseEvent( QMouseEvent* /* e */ )
177{ 177{
178 int sh=99,eh=-1; 178 int sh=99,eh=-1;
179 179
180 for(int i=0;i<this->numSelections();i++) { 180 for(int i=0;i<this->numSelections();i++) {
181 QTableSelection sel = this->selection( i ); 181 QTableSelection sel = this->selection( i );
182 sh = QMIN(sh,sel.topRow()); 182 sh = QMIN(sh,sel.topRow());
183 eh = QMAX(sh,sel.bottomRow()+1); 183 eh = QMAX(sh,sel.bottomRow()+1);
184 } 184 }
185 if (sh > 23 || eh < 1) { 185 if (sh > 23 || eh < 1) {
186 sh=8; 186 sh=8;
187 eh=9; 187 eh=9;
188 } 188 }
189 189
190 quickLineEdit=new DateBookDayViewQuickLineEdit(QDateTime(currDate,QTime(sh,0,0,0)),QDateTime(currDate,QTime(eh,0,0,0)),this->viewport(),"quickedit"); 190 quickLineEdit=new DateBookDayViewQuickLineEdit(QDateTime(currDate,QTime(sh,0,0,0)),QDateTime(currDate,QTime(eh,0,0,0)),this->viewport(),"quickedit");
191 quickLineEdit->setGeometry(0,0,this->columnWidth(0)-1,this->rowHeight(0)); 191 quickLineEdit->setGeometry(0,0,this->columnWidth(0)-1,this->rowHeight(0));
192 this->moveChild(quickLineEdit,0,sh*this->rowHeight(0)); 192 this->moveChild(quickLineEdit,0,sh*this->rowHeight(0));
193 quickLineEdit->setFocus(); 193 quickLineEdit->setFocus();
194 quickLineEdit->show(); 194 quickLineEdit->show();
195} 195}
196 196
197//=========================================================================== 197//===========================================================================
198 198
199DateBookDayViewQuickLineEdit::DateBookDayViewQuickLineEdit(const QDateTime &start, const QDateTime &end,QWidget * parent, const char *name) : QLineEdit(parent,name) 199DateBookDayViewQuickLineEdit::DateBookDayViewQuickLineEdit(const QDateTime &start, const QDateTime &end,QWidget * parent, const char *name) : QLineEdit(parent,name)
200{ 200{
201 active=1; 201 active=1;
202 quickEvent.setStart(start); 202 quickEvent.setStart(start);
203 quickEvent.setEnd(end); 203 quickEvent.setEnd(end);
204 connect(this,SIGNAL(returnPressed()),this,SLOT(slotReturnPressed())); 204 connect(this,SIGNAL(returnPressed()),this,SLOT(slotReturnPressed()));
205} 205}
206 206
207void DateBookDayViewQuickLineEdit::slotReturnPressed() 207void DateBookDayViewQuickLineEdit::slotReturnPressed()
208{ 208{
209 if(active && (!this->text().isEmpty())) {// Fix to avoid having this event beeing added multiple times. 209 if(active && (!this->text().isEmpty())) {// Fix to avoid having this event beeing added multiple times.
210 quickEvent.setDescription(this->text()); 210 quickEvent.setDescription(this->text());
211 connect(this,SIGNAL(insertEvent(const Event &)),this->topLevelWidget(),SLOT(insertEvent(const Event &))); 211 connect(this,SIGNAL(insertEvent(const Event&)),this->topLevelWidget(),SLOT(insertEvent(const Event&)));
212 emit(insertEvent(quickEvent)); 212 emit(insertEvent(quickEvent));
213 active=0; 213 active=0;
214 } 214 }
215 /* we need to return to this object.. */ 215 /* we need to return to this object.. */
216 QTimer::singleShot(500, this, SLOT(finallyCallClose()) );// Close and also delete this widget 216 QTimer::singleShot(500, this, SLOT(finallyCallClose()) );// Close and also delete this widget
217} 217}
218void DateBookDayViewQuickLineEdit::finallyCallClose() { 218void DateBookDayViewQuickLineEdit::finallyCallClose() {
219 close(true); // also deletes this widget... 219 close(true); // also deletes this widget...
220} 220}
221 221
222void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent* /* e */) 222void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent* /* e */)
223{ 223{
224 slotReturnPressed(); // Reuse code to add event and close this widget. 224 slotReturnPressed(); // Reuse code to add event and close this widget.
225} 225}
226 226
227//=========================================================================== 227//===========================================================================
228 228
229DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, QWidget *parent, const char *name ) 229DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, QWidget *parent, const char *name )
230 : QVBox( parent, name ), currDate( QDate::currentDate() ), db( newDb ), startTime( 0 ) 230 : QVBox( parent, name ), currDate( QDate::currentDate() ), db( newDb ), startTime( 0 )
231{ 231{
232 widgetList.setAutoDelete( true ); 232 widgetList.setAutoDelete( true );
233 header = new DateBookDayHeader( startOnMonday, this, "day header" ); 233 header = new DateBookDayHeader( startOnMonday, this, "day header" );
234 header->setDate( currDate.year(), currDate.month(), currDate.day() ); 234 header->setDate( currDate.year(), currDate.month(), currDate.day() );
235 235
236 m_allDays = new DatebookdayAllday(newDb, this, "all day event list" ); 236 m_allDays = new DatebookdayAllday(newDb, this, "all day event list" );
237 m_allDays->hide(); 237 m_allDays->hide();
238 238
239 view = new DateBookDayView( ampm, this, "day view" ); 239 view = new DateBookDayView( ampm, this, "day view" );
240 240
241 connect( header, SIGNAL( dateChanged( int, int, int ) ), this, SLOT( dateChanged( int, int, int ) ) ); 241 connect( header, SIGNAL( dateChanged(int,int,int) ), this, SLOT( dateChanged(int,int,int) ) );
242 connect( header, SIGNAL( dateChanged( int, int, int ) ), view, SLOT( slotDateChanged( int, int, int ) ) ); 242 connect( header, SIGNAL( dateChanged(int,int,int) ), view, SLOT( slotDateChanged(int,int,int) ) );
243 connect( view, SIGNAL( sigColWidthChanged() ), this, SLOT( slotColWidthChanged() ) ); 243 connect( view, SIGNAL( sigColWidthChanged() ), this, SLOT( slotColWidthChanged() ) );
244 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) ); 244 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) );
245 connect( view, SIGNAL(sigCapturedKey(const QString &)), this, SIGNAL(sigNewEvent(const QString&)) ); 245 connect( view, SIGNAL(sigCapturedKey(const QString&)), this, SIGNAL(sigNewEvent(const QString&)) );
246 246
247 QTimer *timer = new QTimer( this ); 247 QTimer *timer = new QTimer( this );
248 248
249 connect( timer, SIGNAL(timeout()), this, SLOT(updateView()) );//connect timer for updating timeMarker & daywidgetcolors 249 connect( timer, SIGNAL(timeout()), this, SLOT(updateView()) );//connect timer for updating timeMarker & daywidgetcolors
250 timer->start( 1000*60*5, FALSE ); //update every 5min 250 timer->start( 1000*60*5, FALSE ); //update every 5min
251 251
252 selectedWidget = 0; 252 selectedWidget = 0;
253 253
254 timeMarker = new DateBookDayTimeMarker( this ); 254 timeMarker = new DateBookDayTimeMarker( this );
255 timeMarker->setTime( QTime::currentTime() ); 255 timeMarker->setTime( QTime::currentTime() );
256 rowStyle = -1; // initialize with bogus values 256 rowStyle = -1; // initialize with bogus values
257 jumpToCurTime = false; 257 jumpToCurTime = false;
258} 258}
259 259
260void DateBookDay::setJumpToCurTime( bool bJump ) 260void DateBookDay::setJumpToCurTime( bool bJump )
261{ 261{
262 jumpToCurTime = bJump; 262 jumpToCurTime = bJump;
263} 263}
264 264
265void DateBookDay::setRowStyle( int style ) 265void DateBookDay::setRowStyle( int style )
266{ 266{
267 if (rowStyle != style) view->setRowStyle( style ); 267 if (rowStyle != style) view->setRowStyle( style );
268 rowStyle = style; 268 rowStyle = style;
269} 269}
270 270
271void DateBookDay::updateView( void ) 271void DateBookDay::updateView( void )
272{ 272{
273 timeMarker->setTime( QTime::currentTime() ); 273 timeMarker->setTime( QTime::currentTime() );
274 //need to find a way to update all DateBookDayWidgets 274 //need to find a way to update all DateBookDayWidgets
275} 275}
276 276
277void DateBookDay::setSelectedWidget( DateBookDayWidget *w ) 277void DateBookDay::setSelectedWidget( DateBookDayWidget *w )
278{ 278{
279 selectedWidget = w; 279 selectedWidget = w;
280} 280}
281 281
282DateBookDayWidget * DateBookDay::getSelectedWidget( void ) 282DateBookDayWidget * DateBookDay::getSelectedWidget( void )
283{ 283{
284 return selectedWidget; 284 return selectedWidget;
285} 285}
286 286
287void DateBookDay::selectedDates( QDateTime &start, QDateTime &end ) 287void DateBookDay::selectedDates( QDateTime &start, QDateTime &end )
288{ 288{
289 start.setDate( currDate ); 289 start.setDate( currDate );
290 end.setDate( currDate ); 290 end.setDate( currDate );
291 291
292 int sh=99,eh=-1; 292 int sh=99,eh=-1;
293 293
@@ -328,100 +328,100 @@ void DateBookDay::dateChanged( int y, int m, int d )
328 currDate.setYMD( y, m, d ); 328 currDate.setYMD( y, m, d );
329 relayoutPage(); 329 relayoutPage();
330 dayView()->clearSelection(); 330 dayView()->clearSelection();
331 QTableSelection ts; 331 QTableSelection ts;
332 332
333 if (jumpToCurTime && this->date() == QDate::currentDate()) 333 if (jumpToCurTime && this->date() == QDate::currentDate())
334 { 334 {
335 ts.init( QTime::currentTime().hour(), 0); 335 ts.init( QTime::currentTime().hour(), 0);
336 ts.expandTo( QTime::currentTime().hour(), 0); 336 ts.expandTo( QTime::currentTime().hour(), 0);
337 } else { 337 } else {
338 ts.init( startTime, 0 ); 338 ts.init( startTime, 0 );
339 ts.expandTo( startTime, 0 ); 339 ts.expandTo( startTime, 0 );
340 } 340 }
341 341
342 dayView()->addSelection( ts ); 342 dayView()->addSelection( ts );
343 selectedWidget = 0; 343 selectedWidget = 0;
344} 344}
345 345
346void DateBookDay::redraw() 346void DateBookDay::redraw()
347{ 347{
348 if ( isUpdatesEnabled() ) 348 if ( isUpdatesEnabled() )
349 relayoutPage(); 349 relayoutPage();
350} 350}
351 351
352void DateBookDay::getEvents() 352void DateBookDay::getEvents()
353{ 353{
354 widgetList.clear(); 354 widgetList.clear();
355 355
356 /* clear the AllDay List */ 356 /* clear the AllDay List */
357 m_allDays->hide(); // just in case 357 m_allDays->hide(); // just in case
358 m_allDays->removeAllEvents(); 358 m_allDays->removeAllEvents();
359 359
360 QValueList<EffectiveEvent> eventList = db->getEffectiveEvents( currDate, currDate ); 360 QValueList<EffectiveEvent> eventList = db->getEffectiveEvents( currDate, currDate );
361 QValueListIterator<EffectiveEvent> it; 361 QValueListIterator<EffectiveEvent> it;
362 QObject* object = 0; 362 QObject* object = 0;
363 for ( it = eventList.begin(); it != eventList.end(); ++it ) { 363 for ( it = eventList.begin(); it != eventList.end(); ++it ) {
364 EffectiveEvent ev=*it; 364 EffectiveEvent ev=*it;
365 if(!((ev.end().hour()==0) && (ev.end().minute()==0) && (ev.startDate()!=ev.date()))) {// Skip events ending at 00:00 starting at another day. 365 if(!((ev.end().hour()==0) && (ev.end().minute()==0) && (ev.startDate()!=ev.date()))) {// Skip events ending at 00:00 starting at another day.
366 if (ev.event().type() == Event::AllDay ) { 366 if (ev.event().type() == Event::AllDay ) {
367 object = m_allDays->addEvent( ev ); 367 object = m_allDays->addEvent( ev );
368 if (!object) 368 if (!object)
369 continue; 369 continue;
370 }else { 370 }else {
371 DateBookDayWidget* w = new DateBookDayWidget( *it, this ); 371 DateBookDayWidget* w = new DateBookDayWidget( *it, this );
372 widgetList.append( w ); 372 widgetList.append( w );
373 object = w; 373 object = w;
374 } 374 }
375 375
376 connect( object, SIGNAL( deleteMe( const Event & ) ), this, SIGNAL( removeEvent( const Event & ) ) ); 376 connect( object, SIGNAL( deleteMe(const Event&) ), this, SIGNAL( removeEvent(const Event&) ) );
377 connect( object, SIGNAL( duplicateMe( const Event & ) ), this, SIGNAL( duplicateEvent( const Event & ) ) ); 377 connect( object, SIGNAL( duplicateMe(const Event&) ), this, SIGNAL( duplicateEvent(const Event&) ) );
378 connect( object, SIGNAL( editMe( const Event & ) ), this, SIGNAL( editEvent( const Event & ) ) ); 378 connect( object, SIGNAL( editMe(const Event&) ), this, SIGNAL( editEvent(const Event&) ) );
379 connect( object, SIGNAL( beamMe( const Event & ) ), this, SIGNAL( beamEvent( const Event & ) ) ); 379 connect( object, SIGNAL( beamMe(const Event&) ), this, SIGNAL( beamEvent(const Event&) ) );
380 380
381 } 381 }
382 } 382 }
383} 383}
384 384
385static int place( const DateBookDayWidget *item, bool *used, int maxn ) 385static int place( const DateBookDayWidget *item, bool *used, int maxn )
386{ 386{
387 int place = 0; 387 int place = 0;
388 int start = item->event().start().hour(); 388 int start = item->event().start().hour();
389 QTime e = item->event().end(); 389 QTime e = item->event().end();
390 int end = e.hour(); 390 int end = e.hour();
391 if ( e.minute() < 5 ) 391 if ( e.minute() < 5 )
392 end--; 392 end--;
393 if ( end < start ) 393 if ( end < start )
394 end = start; 394 end = start;
395 while ( place < maxn ) { 395 while ( place < maxn ) {
396 bool free = TRUE; 396 bool free = TRUE;
397 int s = start; 397 int s = start;
398 while( s <= end ) { 398 while( s <= end ) {
399 if ( used[10*s+place] ) { 399 if ( used[10*s+place] ) {
400 free = FALSE; 400 free = FALSE;
401 break; 401 break;
402 } 402 }
403 s++; 403 s++;
404 } 404 }
405 if ( free ) 405 if ( free )
406 break; 406 break;
407 place++; 407 place++;
408 } 408 }
409 if ( place == maxn ) { 409 if ( place == maxn ) {
410 return -1; 410 return -1;
411 } 411 }
412 while( start <= end ) { 412 while( start <= end ) {
413 used[10*start+place] = TRUE; 413 used[10*start+place] = TRUE;
414 start++; 414 start++;
415 } 415 }
416 return place; 416 return place;
417} 417}
418 418
419 419
420void DateBookDay::relayoutPage( bool fromResize ) 420void DateBookDay::relayoutPage( bool fromResize )
421{ 421{
422 setUpdatesEnabled( FALSE ); 422 setUpdatesEnabled( FALSE );
423 if ( !fromResize ) { 423 if ( !fromResize ) {
424 getEvents(); // no need we already have them! 424 getEvents(); // no need we already have them!
425 425
426 if (m_allDays->items() > 0 ) 426 if (m_allDays->items() > 0 )
427 m_allDays->show(); 427 m_allDays->show();
diff --git a/core/pim/datebook/datebookdayallday.cpp b/core/pim/datebook/datebookdayallday.cpp
index d43d31a..a0aefd3 100644
--- a/core/pim/datebook/datebookdayallday.cpp
+++ b/core/pim/datebook/datebookdayallday.cpp
@@ -15,97 +15,97 @@
15 15
16#include "datebookday.h" 16#include "datebookday.h"
17 17
18/* 18/*
19 * Constructs a DatebookdayAllday which is a child of 'parent', with the 19 * Constructs a DatebookdayAllday which is a child of 'parent', with the
20 * name 'name' and widget flags set to 'f' 20 * name 'name' and widget flags set to 'f'
21 */ 21 */
22DatebookdayAllday::DatebookdayAllday(DateBookDB* db, QWidget* parent, const char* name, WFlags ) 22DatebookdayAllday::DatebookdayAllday(DateBookDB* db, QWidget* parent, const char* name, WFlags )
23 : QScrollView( parent, name ),item_count(0),dateBook(db) 23 : QScrollView( parent, name ),item_count(0),dateBook(db)
24{ 24{
25 if ( !name ) 25 if ( !name )
26 setName( "DatebookdayAllday" ); 26 setName( "DatebookdayAllday" );
27 setMinimumSize( QSize( 0, 0 ) ); 27 setMinimumSize( QSize( 0, 0 ) );
28 setMaximumHeight(3* (QFontMetrics(font()).height()+4) ); 28 setMaximumHeight(3* (QFontMetrics(font()).height()+4) );
29 29
30 m_MainFrame = new QFrame(viewport()); 30 m_MainFrame = new QFrame(viewport());
31 m_MainFrame->setFrameStyle(QFrame::NoFrame|QFrame::Plain); 31 m_MainFrame->setFrameStyle(QFrame::NoFrame|QFrame::Plain);
32 setFrameStyle(QFrame::NoFrame|QFrame::Plain); 32 setFrameStyle(QFrame::NoFrame|QFrame::Plain);
33 setResizePolicy( QScrollView::Default ); 33 setResizePolicy( QScrollView::Default );
34 setHScrollBarMode( AlwaysOff ); 34 setHScrollBarMode( AlwaysOff );
35 addChild(m_MainFrame); 35 addChild(m_MainFrame);
36 36
37 datebookdayalldayLayout = new QVBoxLayout( m_MainFrame ); 37 datebookdayalldayLayout = new QVBoxLayout( m_MainFrame );
38 datebookdayalldayLayout->setSpacing( 0 ); 38 datebookdayalldayLayout->setSpacing( 0 );
39 datebookdayalldayLayout->setMargin( 0 ); 39 datebookdayalldayLayout->setMargin( 0 );
40 40
41 lblDesc = new DatebookEventDesc(parent->parentWidget(),""); 41 lblDesc = new DatebookEventDesc(parent->parentWidget(),"");
42 lblDesc->setBackgroundColor(Qt::yellow); 42 lblDesc->setBackgroundColor(Qt::yellow);
43 lblDesc->hide(); 43 lblDesc->hide();
44 subWidgets.setAutoDelete(true); 44 subWidgets.setAutoDelete(true);
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 */
50DatebookdayAllday::~DatebookdayAllday() 50DatebookdayAllday::~DatebookdayAllday()
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} 53}
54 54
55DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev) 55DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev)
56{ 56{
57 DatebookAlldayDisp * lb; 57 DatebookAlldayDisp * lb;
58 lb = new DatebookAlldayDisp(dateBook,ev,m_MainFrame,NULL); 58 lb = new DatebookAlldayDisp(dateBook,ev,m_MainFrame,NULL);
59 lb->show(); 59 lb->show();
60 datebookdayalldayLayout->addWidget(lb); 60 datebookdayalldayLayout->addWidget(lb);
61 subWidgets.append(lb); 61 subWidgets.append(lb);
62 62
63 connect(lb,SIGNAL(displayMe(const Event &)),lblDesc,SLOT(disp_event(const Event&))); 63 connect(lb,SIGNAL(displayMe(const Event&)),lblDesc,SLOT(disp_event(const Event&)));
64 ++item_count; 64 ++item_count;
65 65
66 return lb; 66 return lb;
67} 67}
68 68
69void DatebookdayAllday::removeAllEvents() 69void DatebookdayAllday::removeAllEvents()
70{ 70{
71 subWidgets.clear(); 71 subWidgets.clear();
72 item_count = 0; 72 item_count = 0;
73} 73}
74 74
75DatebookAlldayDisp::DatebookAlldayDisp(DateBookDB *db,const EffectiveEvent& ev, 75DatebookAlldayDisp::DatebookAlldayDisp(DateBookDB *db,const EffectiveEvent& ev,
76 QWidget* parent,const char* name,WFlags f) 76 QWidget* parent,const char* name,WFlags f)
77 : QLabel(parent,name,f),m_Ev(ev),dateBook(db) 77 : QLabel(parent,name,f),m_Ev(ev),dateBook(db)
78{ 78{
79 QString strDesc = m_Ev.description(); 79 QString strDesc = m_Ev.description();
80 strDesc = strDesc.replace(QRegExp("<"),"&#60;"); 80 strDesc = strDesc.replace(QRegExp("<"),"&#60;");
81 setBackgroundColor(yellow); 81 setBackgroundColor(yellow);
82 setText(strDesc); 82 setText(strDesc);
83 setFrameStyle(QFrame::Raised|QFrame::Panel); 83 setFrameStyle(QFrame::Raised|QFrame::Panel);
84 84
85 int s = QFontMetrics(font()).height()+4; 85 int s = QFontMetrics(font()).height()+4;
86 setMaximumHeight( s ); 86 setMaximumHeight( s );
87 setMinimumSize( QSize( 0, s ) ); 87 setMinimumSize( QSize( 0, s ) );
88} 88}
89 89
90DatebookAlldayDisp::~DatebookAlldayDisp() 90DatebookAlldayDisp::~DatebookAlldayDisp()
91{ 91{
92} 92}
93 93
94void DatebookAlldayDisp::beam_single_event() 94void DatebookAlldayDisp::beam_single_event()
95{ 95{
96 // create an Event and beam it... 96 // create an Event and beam it...
97 /* 97 /*
98 * Start with the easy stuff. If start and end date is the same we can just use 98 * Start with the easy stuff. If start and end date is the same we can just use
99 * the values of effective m_Events 99 * the values of effective m_Events
100 * If it is a multi day m_Event we need to find the real start and end date... 100 * If it is a multi day m_Event we need to find the real start and end date...
101 */ 101 */
102 if ( m_Ev.event().start().date() == m_Ev.event().end().date() ) { 102 if ( m_Ev.event().start().date() == m_Ev.event().end().date() ) {
103 Event m_Event( m_Ev.event() ); 103 Event m_Event( m_Ev.event() );
104 104
105 QDateTime dt( m_Ev.date(), m_Ev.start() ); 105 QDateTime dt( m_Ev.date(), m_Ev.start() );
106 m_Event.setStart( dt ); 106 m_Event.setStart( dt );
107 107
108 dt.setTime( m_Ev.end() ); 108 dt.setTime( m_Ev.end() );
109 m_Event.setEnd( dt ); 109 m_Event.setEnd( dt );
110 emit beamMe( m_Event ); 110 emit beamMe( m_Event );
111 }else { 111 }else {
diff --git a/core/pim/datebook/datebookdayheaderimpl.cpp b/core/pim/datebook/datebookdayheaderimpl.cpp
index 213c843..51b78ca 100644
--- a/core/pim/datebook/datebookdayheaderimpl.cpp
+++ b/core/pim/datebook/datebookdayheaderimpl.cpp
@@ -51,98 +51,98 @@ DateBookDayHeader::DateBookDayHeader( bool useMonday,
51 grpDays->setBackgroundMode( PaletteButton ); 51 grpDays->setBackgroundMode( PaletteButton );
52} 52}
53 53
54/* 54/*
55 * Destroys the object and frees any allocated resources 55 * Destroys the object and frees any allocated resources
56 */ 56 */
57DateBookDayHeader::~DateBookDayHeader() 57DateBookDayHeader::~DateBookDayHeader()
58{ 58{
59 // no need to delete child widgets, Qt does it all for us 59 // no need to delete child widgets, Qt does it all for us
60} 60}
61 61
62void DateBookDayHeader::setStartOfWeek( bool onMonday ) 62void DateBookDayHeader::setStartOfWeek( bool onMonday )
63{ 63{
64 bUseMonday = onMonday; 64 bUseMonday = onMonday;
65 setupNames(); 65 setupNames();
66 setDate( currDate.year(), currDate.month(), currDate.day() ); 66 setDate( currDate.year(), currDate.month(), currDate.day() );
67} 67}
68 68
69void DateBookDayHeader::setupNames() 69void DateBookDayHeader::setupNames()
70{ 70{
71 if ( bUseMonday ) { 71 if ( bUseMonday ) {
72 cmdDay1->setText( DateBookDayHeaderBase::tr("Monday").left(1) ); 72 cmdDay1->setText( DateBookDayHeaderBase::tr("Monday").left(1) );
73 cmdDay2->setText( DateBookDayHeaderBase::tr("Tuesday").left(1) ); 73 cmdDay2->setText( DateBookDayHeaderBase::tr("Tuesday").left(1) );
74 cmdDay3->setText( DateBookDayHeaderBase::tr("Wednesday").left(1) ); 74 cmdDay3->setText( DateBookDayHeaderBase::tr("Wednesday").left(1) );
75 cmdDay4->setText( DateBookDayHeaderBase::tr("Thursday").left(1) ); 75 cmdDay4->setText( DateBookDayHeaderBase::tr("Thursday").left(1) );
76 cmdDay5->setText( DateBookDayHeaderBase::tr("Friday").left(1) ); 76 cmdDay5->setText( DateBookDayHeaderBase::tr("Friday").left(1) );
77 cmdDay6->setText( DateBookDayHeaderBase::tr("Saturday").left(1) ); 77 cmdDay6->setText( DateBookDayHeaderBase::tr("Saturday").left(1) );
78 cmdDay7->setText( DateBookDayHeaderBase::tr("Sunday").left(1) ); 78 cmdDay7->setText( DateBookDayHeaderBase::tr("Sunday").left(1) );
79 } else { 79 } else {
80 cmdDay1->setText( DateBookDayHeaderBase::tr("Sunday").left(1) ); 80 cmdDay1->setText( DateBookDayHeaderBase::tr("Sunday").left(1) );
81 cmdDay2->setText( DateBookDayHeaderBase::tr("Monday").left(1) ); 81 cmdDay2->setText( DateBookDayHeaderBase::tr("Monday").left(1) );
82 cmdDay3->setText( DateBookDayHeaderBase::tr("Tuesday").left(1) ); 82 cmdDay3->setText( DateBookDayHeaderBase::tr("Tuesday").left(1) );
83 cmdDay4->setText( DateBookDayHeaderBase::tr("Wednesday").left(1) ); 83 cmdDay4->setText( DateBookDayHeaderBase::tr("Wednesday").left(1) );
84 cmdDay5->setText( DateBookDayHeaderBase::tr("Thursday").left(1) ); 84 cmdDay5->setText( DateBookDayHeaderBase::tr("Thursday").left(1) );
85 cmdDay6->setText( DateBookDayHeaderBase::tr("Friday").left(1) ); 85 cmdDay6->setText( DateBookDayHeaderBase::tr("Friday").left(1) );
86 cmdDay7->setText( DateBookDayHeaderBase::tr("Saturday").left(1) ); 86 cmdDay7->setText( DateBookDayHeaderBase::tr("Saturday").left(1) );
87 } 87 }
88} 88}
89 89
90 90
91void DateBookDayHeader::pickDate() 91void DateBookDayHeader::pickDate()
92{ 92{
93 static QPopupMenu *m1 = 0; 93 static QPopupMenu *m1 = 0;
94 static DateBookMonth *picker = 0; 94 static DateBookMonth *picker = 0;
95 if ( !m1 ) { 95 if ( !m1 ) {
96 m1 = new QPopupMenu( this ); 96 m1 = new QPopupMenu( this );
97 picker = new DateBookMonth( m1, 0, TRUE ); 97 picker = new DateBookMonth( m1, 0, TRUE );
98 m1->insertItem( picker ); 98 m1->insertItem( picker );
99 connect( picker, SIGNAL( dateClicked( int, int, int ) ), 99 connect( picker, SIGNAL( dateClicked(int,int,int) ),
100 this, SLOT( setDate( int, int, int ) ) ); 100 this, SLOT( setDate(int,int,int) ) );
101 connect( m1, SIGNAL( aboutToHide() ), 101 connect( m1, SIGNAL( aboutToHide() ),
102 this, SLOT( gotHide() ) ); 102 this, SLOT( gotHide() ) );
103 } 103 }
104 picker->setDate( currDate.year(), currDate.month(), currDate.day() ); 104 picker->setDate( currDate.year(), currDate.month(), currDate.day() );
105 m1->popup(mapToGlobal(date->pos()+QPoint(0,date->height()))); 105 m1->popup(mapToGlobal(date->pos()+QPoint(0,date->height())));
106 picker->setFocus(); 106 picker->setFocus();
107} 107}
108 108
109void DateBookDayHeader::gotHide() 109void DateBookDayHeader::gotHide()
110{ 110{
111 // we have to redo the button... 111 // we have to redo the button...
112 date->setDown( false ); 112 date->setDown( false );
113} 113}
114 114
115/* 115/*
116 * public slot 116 * public slot
117 */ 117 */
118void DateBookDayHeader::goBack() 118void DateBookDayHeader::goBack()
119{ 119{
120 currDate = currDate.addDays( -1 ); 120 currDate = currDate.addDays( -1 );
121 setDate( currDate.year(), currDate.month(), currDate.day() ); 121 setDate( currDate.year(), currDate.month(), currDate.day() );
122} 122}
123/* 123/*
124 * public slot 124 * public slot
125 */ 125 */
126void DateBookDayHeader::goForward() 126void DateBookDayHeader::goForward()
127{ 127{
128 currDate = currDate.addDays( 1 ); 128 currDate = currDate.addDays( 1 );
129 setDate( currDate.year(), currDate.month(), currDate.day() ); 129 setDate( currDate.year(), currDate.month(), currDate.day() );
130} 130}
131/* 131/*
132 * public slot 132 * public slot
133 */ 133 */
134void DateBookDayHeader::goBackWeek() 134void DateBookDayHeader::goBackWeek()
135{ 135{
136 currDate = currDate.addDays( -7 ); 136 currDate = currDate.addDays( -7 );
137 setDate( currDate.year(), currDate.month(), currDate.day() ); 137 setDate( currDate.year(), currDate.month(), currDate.day() );
138} 138}
139/* 139/*
140 * public slot 140 * public slot
141 */ 141 */
142void DateBookDayHeader::goForwardWeek() 142void DateBookDayHeader::goForwardWeek()
143{ 143{
144 currDate = currDate.addDays( 7 ); 144 currDate = currDate.addDays( 7 );
145 setDate( currDate.year(), currDate.month(), currDate.day() ); 145 setDate( currDate.year(), currDate.month(), currDate.day() );
146} 146}
147 147
148 148
diff --git a/core/pim/datebook/datebooksettings.cpp b/core/pim/datebook/datebooksettings.cpp
index a6d04ba..cb4b73b 100644
--- a/core/pim/datebook/datebooksettings.cpp
+++ b/core/pim/datebook/datebooksettings.cpp
@@ -1,82 +1,82 @@
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 "datebooksettings.h" 21#include "datebooksettings.h"
22 22
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24 24
25#include <qspinbox.h> 25#include <qspinbox.h>
26#include <qcheckbox.h> 26#include <qcheckbox.h>
27 27
28DateBookSettings::DateBookSettings( bool whichClock, QWidget *parent, 28DateBookSettings::DateBookSettings( bool whichClock, QWidget *parent,
29 const char *name, bool modal, WFlags fl ) 29 const char *name, bool modal, WFlags fl )
30 : DateBookSettingsBase( parent, name, modal, fl ), 30 : DateBookSettingsBase( parent, name, modal, fl ),
31 ampm( whichClock ) 31 ampm( whichClock )
32{ 32{
33 init(); 33 init();
34 QObject::connect( qApp, SIGNAL( clockChanged( bool ) ), this, SLOT( slotChangeClock( bool ) ) ); 34 QObject::connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( slotChangeClock(bool) ) );
35 QArray<int> categories; 35 QArray<int> categories;
36 comboCategory->setCategories( categories, "Calendar", tr("Calendar") ); 36 comboCategory->setCategories( categories, "Calendar", tr("Calendar") );
37} 37}
38 38
39DateBookSettings::~DateBookSettings() 39DateBookSettings::~DateBookSettings()
40{ 40{
41} 41}
42 42
43void DateBookSettings::setStartTime( int newStartViewTime ) 43void DateBookSettings::setStartTime( int newStartViewTime )
44{ 44{
45 if ( ampm ) { 45 if ( ampm ) {
46 if ( newStartViewTime >= 12 ) { 46 if ( newStartViewTime >= 12 ) {
47 newStartViewTime %= 12; 47 newStartViewTime %= 12;
48 if ( newStartViewTime == 0 ) 48 if ( newStartViewTime == 0 )
49 newStartViewTime = 12; 49 newStartViewTime = 12;
50 spinStart->setSuffix( tr(":00 PM") ); 50 spinStart->setSuffix( tr(":00 PM") );
51 } 51 }
52 else if ( newStartViewTime == 0 ) { 52 else if ( newStartViewTime == 0 ) {
53 newStartViewTime = 12; 53 newStartViewTime = 12;
54 spinStart->setSuffix( tr(":00 AM") ); 54 spinStart->setSuffix( tr(":00 AM") );
55 } 55 }
56 oldtime = newStartViewTime; 56 oldtime = newStartViewTime;
57 } 57 }
58 spinStart->setValue( newStartViewTime ); 58 spinStart->setValue( newStartViewTime );
59} 59}
60 60
61int DateBookSettings::startTime() const 61int DateBookSettings::startTime() const
62{ 62{
63 int returnMe = spinStart->value(); 63 int returnMe = spinStart->value();
64 if ( ampm ) { 64 if ( ampm ) {
65 if ( returnMe != 12 && spinStart->suffix().contains(tr("PM"), FALSE) ) 65 if ( returnMe != 12 && spinStart->suffix().contains(tr("PM"), FALSE) )
66 returnMe += 12; 66 returnMe += 12;
67 else if (returnMe == 12 && spinStart->suffix().contains(tr("AM"), TRUE)) 67 else if (returnMe == 12 && spinStart->suffix().contains(tr("AM"), TRUE))
68 returnMe = 0; 68 returnMe = 0;
69 } 69 }
70 return returnMe; 70 return returnMe;
71} 71}
72 72
73 73
74void DateBookSettings::setAlarmPreset( bool bAlarm, int presetTime ) 74void DateBookSettings::setAlarmPreset( bool bAlarm, int presetTime )
75{ 75{
76 chkAlarmPreset->setChecked( bAlarm ); 76 chkAlarmPreset->setChecked( bAlarm );
77 if ( presetTime >=5 ) 77 if ( presetTime >=5 )
78 spinPreset->setValue( presetTime ); 78 spinPreset->setValue( presetTime );
79} 79}
80 80
81bool DateBookSettings::alarmPreset() const 81bool DateBookSettings::alarmPreset() const
82{ 82{
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp
index 933e191..7503751 100644
--- a/core/pim/datebook/datebookweek.cpp
+++ b/core/pim/datebook/datebookweek.cpp
@@ -317,100 +317,100 @@ void DateBookWeekView::resizeEvent( QResizeEvent *e )
317 int avail = visibleWidth(); 317 int avail = visibleWidth();
318 header->setGeometry( leftMargin()+frameWidth()+frameRect().left() , frameWidth(), 318 header->setGeometry( leftMargin()+frameWidth()+frameRect().left() , frameWidth(),
319 visibleWidth(), header->sizeHint().height() ); 319 visibleWidth(), header->sizeHint().height() );
320 setMargins( 0, header->sizeHint().height(), 0, 0 ); 320 setMargins( 0, header->sizeHint().height(), 0, 0 );
321 */ 321 */
322 //BRANCH_1_0 322 //BRANCH_1_0
323 int avail = width()-qApp->style().scrollBarExtent().width()-1; 323 int avail = width()-qApp->style().scrollBarExtent().width()-1;
324 header->setGeometry( 0, 0, avail, header->sizeHint().height() ); 324 header->setGeometry( 0, 0, avail, header->sizeHint().height() );
325 setMargins( 0, header->height(), 0, 0 ); 325 setMargins( 0, header->height(), 0, 0 );
326 326
327 327
328 header->resizeSection( 0, hourWidth ); 328 header->resizeSection( 0, hourWidth );
329 int sw = (avail - hourWidth) / 7; 329 int sw = (avail - hourWidth) / 7;
330 for ( int i = 1; i < 7; i++ ) 330 for ( int i = 1; i < 7; i++ )
331 header->resizeSection( i, sw ); 331 header->resizeSection( i, sw );
332 header->resizeSection( 7, avail - hourWidth - sw*6 ); 332 header->resizeSection( 7, avail - hourWidth - sw*6 );
333} 333}
334 334
335void DateBookWeekView::setStartOfWeek( bool bStartOnMonday ) 335void DateBookWeekView::setStartOfWeek( bool bStartOnMonday )
336{ 336{
337 bOnMonday = bStartOnMonday; 337 bOnMonday = bStartOnMonday;
338 initNames(); 338 initNames();
339} 339}
340 340
341//------------------------------------------------------------------- 341//-------------------------------------------------------------------
342 342
343DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDB *newDB, 343DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDB *newDB,
344 QWidget *parent, const char *name ) 344 QWidget *parent, const char *name )
345 : QWidget( parent, name ), 345 : QWidget( parent, name ),
346 db( newDB ), 346 db( newDB ),
347 startTime( 0 ), 347 startTime( 0 ),
348 ampm( ap ), 348 ampm( ap ),
349 bStartOnMonday( startOnMonday ) 349 bStartOnMonday( startOnMonday )
350{ 350{
351 setFocusPolicy(StrongFocus); 351 setFocusPolicy(StrongFocus);
352 QVBoxLayout *vb = new QVBoxLayout( this ); 352 QVBoxLayout *vb = new QVBoxLayout( this );
353 header = new DateBookWeekHeader( bStartOnMonday, this ); 353 header = new DateBookWeekHeader( bStartOnMonday, this );
354 view = new DateBookWeekView( ampm, startOnMonday, this ); 354 view = new DateBookWeekView( ampm, startOnMonday, this );
355 vb->addWidget( header ); 355 vb->addWidget( header );
356 vb->addWidget( view ); 356 vb->addWidget( view );
357 357
358 lblDesc = new QLabel( this, "event label" ); 358 lblDesc = new QLabel( this, "event label" );
359 lblDesc->setFrameStyle( QFrame::Plain | QFrame::Box ); 359 lblDesc->setFrameStyle( QFrame::Plain | QFrame::Box );
360 lblDesc->setBackgroundColor( yellow ); 360 lblDesc->setBackgroundColor( yellow );
361 lblDesc->hide(); 361 lblDesc->hide();
362 362
363 tHide = new QTimer( this ); 363 tHide = new QTimer( this );
364 364
365 connect( view, SIGNAL( showDay( int ) ), this, SLOT( showDay( int ) ) ); 365 connect( view, SIGNAL( showDay(int) ), this, SLOT( showDay(int) ) );
366 connect( view, SIGNAL(signalShowEvent(const EffectiveEvent&)), this, SLOT(slotShowEvent(const EffectiveEvent&)) ); 366 connect( view, SIGNAL(signalShowEvent(const EffectiveEvent&)), this, SLOT(slotShowEvent(const EffectiveEvent&)) );
367 connect( view, SIGNAL(signalHideEvent()), this, SLOT(slotHideEvent()) ); 367 connect( view, SIGNAL(signalHideEvent()), this, SLOT(slotHideEvent()) );
368 connect( header, SIGNAL( dateChanged( QDate &) ), this, SLOT( dateChanged( QDate &) ) ); 368 connect( header, SIGNAL( dateChanged(QDate&) ), this, SLOT( dateChanged(QDate&) ) );
369 connect( tHide, SIGNAL( timeout() ), lblDesc, SLOT( hide() ) ); 369 connect( tHide, SIGNAL( timeout() ), lblDesc, SLOT( hide() ) );
370 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) ); 370 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) );
371 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(slotClockChanged(bool))); 371 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(slotClockChanged(bool)));
372 setDate(QDate::currentDate()); 372 setDate(QDate::currentDate());
373} 373}
374 374
375void DateBookWeek::keyPressEvent(QKeyEvent *e) 375void DateBookWeek::keyPressEvent(QKeyEvent *e)
376{ 376{
377 switch(e->key()) { 377 switch(e->key()) {
378 case Key_Up: 378 case Key_Up:
379 view->scrollBy(0, -20); 379 view->scrollBy(0, -20);
380 break; 380 break;
381 case Key_Down: 381 case Key_Down:
382 view->scrollBy(0, 20); 382 view->scrollBy(0, 20);
383 break; 383 break;
384 case Key_Left: 384 case Key_Left:
385 setDate(date().addDays(-7)); 385 setDate(date().addDays(-7));
386 break; 386 break;
387 case Key_Right: 387 case Key_Right:
388 setDate(date().addDays(7)); 388 setDate(date().addDays(7));
389 break; 389 break;
390 default: 390 default:
391 e->ignore(); 391 e->ignore();
392 } 392 }
393} 393}
394 394
395void DateBookWeek::showDay( int day ) 395void DateBookWeek::showDay( int day )
396{ 396{
397 QDate d=bdate; 397 QDate d=bdate;
398 398
399 // Calculate offset to first day of week. 399 // Calculate offset to first day of week.
400 int dayoffset=d.dayOfWeek() % 7; 400 int dayoffset=d.dayOfWeek() % 7;
401 401
402 if(bStartOnMonday) dayoffset--; 402 if(bStartOnMonday) dayoffset--;
403 403
404 day--; 404 day--;
405 d=d.addDays(day-dayoffset); 405 d=d.addDays(day-dayoffset);
406 emit showDate( d.year(), d.month(), d.day() ); 406 emit showDate( d.year(), d.month(), d.day() );
407} 407}
408 408
409void DateBookWeek::setDate( int y, int m, int d ) 409void DateBookWeek::setDate( int y, int m, int d )
410{ 410{
411 setDate(QDate(y, m, d)); 411 setDate(QDate(y, m, d));
412} 412}
413 413
414void DateBookWeek::setDate(QDate newdate) 414void DateBookWeek::setDate(QDate newdate)
415{ 415{
416 bdate=newdate; 416 bdate=newdate;
diff --git a/core/pim/datebook/datebookweekheaderimpl.cpp b/core/pim/datebook/datebookweekheaderimpl.cpp
index eaa9730..c237b2d 100644
--- a/core/pim/datebook/datebookweekheaderimpl.cpp
+++ b/core/pim/datebook/datebookweekheaderimpl.cpp
@@ -11,97 +11,97 @@
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 "datebookweekheaderimpl.h" 20#include "datebookweekheaderimpl.h"
21#include "datebookweek.h" 21#include "datebookweek.h"
22#include <qpe/resource.h> 22#include <qpe/resource.h>
23#include <qpe/datebookmonth.h> 23#include <qpe/datebookmonth.h>
24 24
25#include <qtoolbutton.h> 25#include <qtoolbutton.h>
26 26
27/* 27/*
28 * Constructs a DateBookWeekHeader which is a child of 'parent', with the 28 * Constructs a DateBookWeekHeader which is a child of 'parent', with the
29 * name 'name' and widget flags set to 'f' 29 * name 'name' and widget flags set to 'f'
30 */ 30 */
31DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent, const char* name, WFlags fl ) 31DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent, const char* name, WFlags fl )
32 : DateBookWeekHeaderBase( parent, name, fl ), 32 : DateBookWeekHeaderBase( parent, name, fl ),
33 bStartOnMonday( startOnMonday ) 33 bStartOnMonday( startOnMonday )
34{ 34{
35 setBackgroundMode( PaletteButton ); 35 setBackgroundMode( PaletteButton );
36 labelDate->setBackgroundMode( PaletteButton ); 36 labelDate->setBackgroundMode( PaletteButton );
37 backmonth->setPixmap( Resource::loadPixmap("fastback") ); 37 backmonth->setPixmap( Resource::loadPixmap("fastback") );
38 backweek->setPixmap( Resource::loadPixmap("back") ); 38 backweek->setPixmap( Resource::loadPixmap("back") );
39 forwardweek->setPixmap( Resource::loadPixmap("forward") ); 39 forwardweek->setPixmap( Resource::loadPixmap("forward") );
40 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); 40 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") );
41} 41}
42 42
43/* 43/*
44 * Destroys the object and frees any allocated resources 44 * Destroys the object and frees any allocated resources
45 */ 45 */
46DateBookWeekHeader::~DateBookWeekHeader() 46DateBookWeekHeader::~DateBookWeekHeader()
47{ 47{
48 // no need to delete child widgets, Qt does it all for us 48 // no need to delete child widgets, Qt does it all for us
49} 49}
50 50
51void DateBookWeekHeader::pickDate() 51void DateBookWeekHeader::pickDate()
52{ 52{
53 static QPopupMenu *m1 = 0; 53 static QPopupMenu *m1 = 0;
54 static DateBookMonth *picker = 0; 54 static DateBookMonth *picker = 0;
55 if ( !m1 ) { 55 if ( !m1 ) {
56 m1 = new QPopupMenu( this ); 56 m1 = new QPopupMenu( this );
57 picker = new DateBookMonth( m1, 0, TRUE ); 57 picker = new DateBookMonth( m1, 0, TRUE );
58 m1->insertItem( picker ); 58 m1->insertItem( picker );
59 connect( picker, SIGNAL( dateClicked( int, int, int ) ), this, SLOT( setDate( int, int, int ) ) ); 59 connect( picker, SIGNAL( dateClicked(int,int,int) ), this, SLOT( setDate(int,int,int) ) );
60 // connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) ); 60 // connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) );
61 } 61 }
62 picker->setDate( date.year(), date.month(), date.day() ); 62 picker->setDate( date.year(), date.month(), date.day() );
63 m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); 63 m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height())));
64 picker->setFocus(); 64 picker->setFocus();
65} 65}
66 66
67void DateBookWeekHeader::nextMonth() 67void DateBookWeekHeader::nextMonth()
68{ 68{
69 qWarning("nextMonth() " ); 69 qWarning("nextMonth() " );
70 setDate(date.addDays(28)); 70 setDate(date.addDays(28));
71} 71}
72void DateBookWeekHeader::prevMonth() 72void DateBookWeekHeader::prevMonth()
73{ 73{
74 qWarning("prevMonth() " ); 74 qWarning("prevMonth() " );
75 setDate(date.addDays(-28)); 75 setDate(date.addDays(-28));
76} 76}
77void DateBookWeekHeader::nextWeek() 77void DateBookWeekHeader::nextWeek()
78{ 78{
79 qWarning("nextWeek() " ); 79 qWarning("nextWeek() " );
80 setDate(date.addDays(7)); 80 setDate(date.addDays(7));
81} 81}
82void DateBookWeekHeader::prevWeek() 82void DateBookWeekHeader::prevWeek()
83{ 83{
84 qWarning("prevWeek() "); 84 qWarning("prevWeek() ");
85 setDate(date.addDays(-7)); 85 setDate(date.addDays(-7));
86} 86}
87 87
88void DateBookWeekHeader::setDate( int y, int m, int d ) 88void DateBookWeekHeader::setDate( int y, int m, int d )
89{ 89{
90 setDate(QDate(y,m,d)); 90 setDate(QDate(y,m,d));
91} 91}
92 92
93void DateBookWeekHeader::setDate(const QDate &d) { 93void DateBookWeekHeader::setDate(const QDate &d) {
94 int year,week,dayofweek; 94 int year,week,dayofweek;
95 date=d; 95 date=d;
96 dayofweek=d.dayOfWeek(); 96 dayofweek=d.dayOfWeek();
97 if(bStartOnMonday) 97 if(bStartOnMonday)
98 dayofweek--; 98 dayofweek--;
99 else if( dayofweek == 7 ) 99 else if( dayofweek == 7 )
100 // we already have the right day -7 would lead to the current week.. 100 // we already have the right day -7 would lead to the current week..
101 dayofweek = 0; 101 dayofweek = 0;
102 102
103 date=date.addDays(-dayofweek); 103 date=date.addDays(-dayofweek);
104 calcWeek(date,week,year,bStartOnMonday); 104 calcWeek(date,week,year,bStartOnMonday);
105 QDate start=date; 105 QDate start=date;
106 QDate stop=start.addDays(6); 106 QDate stop=start.addDays(6);
107 labelDate->setText( QString::number(start.day()) + "." + 107 labelDate->setText( QString::number(start.day()) + "." +
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index 42a1753..af40143 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -27,97 +27,97 @@ DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const ch
27 backmonth->setBackgroundMode( PaletteButton ); 27 backmonth->setBackgroundMode( PaletteButton );
28 backmonth->setPixmap( Resource::loadPixmap("fastback") ); 28 backmonth->setPixmap( Resource::loadPixmap("fastback") );
29 DateBookWeekLstHeaderBaseLayout->setSpacing(0); 29 DateBookWeekLstHeaderBaseLayout->setSpacing(0);
30 DateBookWeekLstHeaderBaseLayout->setMargin(0); 30 DateBookWeekLstHeaderBaseLayout->setMargin(0);
31 //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); 31 //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding));
32 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); 32 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
33 33
34 connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth())); 34 connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth()));
35 connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek())); 35 connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek()));
36 connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek())); 36 connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek()));
37 connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth())); 37 connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth()));
38 connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate())); 38 connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate()));
39 connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); 39 connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool)));
40 bStartOnMonday=onM; 40 bStartOnMonday=onM;
41} 41}
42DateBookWeekLstHeader::~DateBookWeekLstHeader(){} 42DateBookWeekLstHeader::~DateBookWeekLstHeader(){}
43 43
44void DateBookWeekLstHeader::setDate(const QDate &d) { 44void DateBookWeekLstHeader::setDate(const QDate &d) {
45 int year,week,dayofweek; 45 int year,week,dayofweek;
46 date=d; 46 date=d;
47 dayofweek=d.dayOfWeek(); 47 dayofweek=d.dayOfWeek();
48 if(bStartOnMonday) 48 if(bStartOnMonday)
49 dayofweek--; 49 dayofweek--;
50 else if( dayofweek == 7 ) 50 else if( dayofweek == 7 )
51 /* we already have the right day -7 would lead to the same week */ 51 /* we already have the right day -7 would lead to the same week */
52 dayofweek = 0; 52 dayofweek = 0;
53 53
54 date=date.addDays(-dayofweek); 54 date=date.addDays(-dayofweek);
55 55
56 calcWeek(date,week,year,bStartOnMonday); 56 calcWeek(date,week,year,bStartOnMonday);
57 QDate start=date; 57 QDate start=date;
58 QDate stop=start.addDays(6); 58 QDate stop=start.addDays(6);
59 labelDate->setText( QString::number(start.day()) + "." + 59 labelDate->setText( QString::number(start.day()) + "." +
60 Calendar::nameOfMonth( start.month() ) + "-" + 60 Calendar::nameOfMonth( start.month() ) + "-" +
61 QString::number(stop.day()) + "." + 61 QString::number(stop.day()) + "." +
62 Calendar::nameOfMonth( stop.month()) +" ("+ 62 Calendar::nameOfMonth( stop.month()) +" ("+
63 tr("w")+":"+QString::number( week ) +")"); 63 tr("w")+":"+QString::number( week ) +")");
64 date = d; // bugfix: 0001126 - date has to be the selected date, not monday! 64 date = d; // bugfix: 0001126 - date has to be the selected date, not monday!
65 emit dateChanged(date); 65 emit dateChanged(date);
66} 66}
67 67
68void DateBookWeekLstHeader::pickDate() { 68void DateBookWeekLstHeader::pickDate() {
69 static QPopupMenu *m1 = 0; 69 static QPopupMenu *m1 = 0;
70 static DateBookMonth *picker = 0; 70 static DateBookMonth *picker = 0;
71 if ( !m1 ) { 71 if ( !m1 ) {
72 m1 = new QPopupMenu( this ); 72 m1 = new QPopupMenu( this );
73 picker = new DateBookMonth( m1, 0, TRUE ); 73 picker = new DateBookMonth( m1, 0, TRUE );
74 m1->insertItem( picker ); 74 m1->insertItem( picker );
75 connect( picker, SIGNAL( dateClicked( int, int, int ) ),this, SLOT( setDate( int, int, int ) ) ); 75 connect( picker, SIGNAL( dateClicked(int,int,int) ),this, SLOT( setDate(int,int,int) ) );
76 //connect( m1, SIGNAL( aboutToHide() ), 76 //connect( m1, SIGNAL( aboutToHide() ),
77 //this, SLOT( gotHide() ) ); 77 //this, SLOT( gotHide() ) );
78 } 78 }
79 picker->setDate( date.year(), date.month(), date.day() ); 79 picker->setDate( date.year(), date.month(), date.day() );
80 m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); 80 m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height())));
81 picker->setFocus(); 81 picker->setFocus();
82} 82}
83void DateBookWeekLstHeader::setDate(int y, int m, int d) { 83void DateBookWeekLstHeader::setDate(int y, int m, int d) {
84 setDate(QDate(y,m,d)); 84 setDate(QDate(y,m,d));
85} 85}
86 86
87void DateBookWeekLstHeader::nextWeek() { 87void DateBookWeekLstHeader::nextWeek() {
88 setDate(date.addDays(7)); 88 setDate(date.addDays(7));
89} 89}
90void DateBookWeekLstHeader::prevWeek() { 90void DateBookWeekLstHeader::prevWeek() {
91 setDate(date.addDays(-7)); 91 setDate(date.addDays(-7));
92} 92}
93void DateBookWeekLstHeader::nextMonth() 93void DateBookWeekLstHeader::nextMonth()
94{ 94{
95 setDate(date.addDays(28)); 95 setDate(date.addDays(28));
96} 96}
97void DateBookWeekLstHeader::prevMonth() 97void DateBookWeekLstHeader::prevMonth()
98{ 98{
99 setDate(date.addDays(-28)); 99 setDate(date.addDays(-28));
100} 100}
101 101
102DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */, 102DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */,
103 QWidget* parent, 103 QWidget* parent,
104 const char* name, 104 const char* name,
105 WFlags fl ) 105 WFlags fl )
106 : DateBookWeekLstDayHdrBase(parent, name, fl) { 106 : DateBookWeekLstDayHdrBase(parent, name, fl) {
107 107
108 date=d; 108 date=d;
109 109
110 static const QString wdays=tr("MTWTFSSM", "Week days"); 110 static const QString wdays=tr("MTWTFSSM", "Week days");
111 char day=wdays[d.dayOfWeek()-1]; 111 char day=wdays[d.dayOfWeek()-1];
112 112
113 //dont use dayOfWeek() to save space ! 113 //dont use dayOfWeek() to save space !
114 label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) ); 114 label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) );
115 115
116 add->setText("+"); 116 add->setText("+");
117 117
118 if (d == QDate::currentDate()) { 118 if (d == QDate::currentDate()) {
119 QPalette pal=label->palette(); 119 QPalette pal=label->palette();
120 pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); 120 pal.setColor(QColorGroup::Foreground, QColor(0,0,255));
121 label->setPalette(pal); 121 label->setPalette(pal);
122 122
123 /* 123 /*
@@ -190,205 +190,205 @@ DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev,
190 } 190 }
191 setText(QString(s) + " " + ev.description()); 191 setText(QString(s) + " " + ev.description());
192 connect(this, SIGNAL(clicked()), this, SLOT(editMe())); 192 connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
193 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); 193 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
194} 194}
195void DateBookWeekLstEvent::editMe() { 195void DateBookWeekLstEvent::editMe() {
196 emit editEvent(event.event()); 196 emit editEvent(event.event());
197} 197}
198 198
199 199
200DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, 200DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
201 const QDate &d, bool onM, 201 const QDate &d, bool onM,
202 QWidget* parent, 202 QWidget* parent,
203 const char* name, WFlags fl) 203 const char* name, WFlags fl)
204 : QWidget( parent, name, fl ) 204 : QWidget( parent, name, fl )
205{ 205{
206 Config config("DateBook"); 206 Config config("DateBook");
207 config.setGroup("Main"); 207 config.setGroup("Main");
208 int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL); 208 int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL);
209 qDebug("Read weeklistviewconfig: %d",weeklistviewconfig); 209 qDebug("Read weeklistviewconfig: %d",weeklistviewconfig);
210 210
211 bStartOnMonday=onM; 211 bStartOnMonday=onM;
212 setPalette(white); 212 setPalette(white);
213 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); 213 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
214 214
215 QVBoxLayout *layout = new QVBoxLayout( this ); 215 QVBoxLayout *layout = new QVBoxLayout( this );
216 216
217 qBubbleSort(ev); 217 qBubbleSort(ev);
218 QValueListIterator<EffectiveEvent> it; 218 QValueListIterator<EffectiveEvent> it;
219 it=ev.begin(); 219 it=ev.begin();
220 220
221 int dayOrder[7]; 221 int dayOrder[7];
222 if (bStartOnMonday) { 222 if (bStartOnMonday) {
223 for (int d=0; d<7; d++) dayOrder[d]=d+1; 223 for (int d=0; d<7; d++) dayOrder[d]=d+1;
224 } else { 224 } else {
225 for (int d=0; d<7; d++) dayOrder[d]=d; 225 for (int d=0; d<7; d++) dayOrder[d]=d;
226 dayOrder[0]=7; 226 dayOrder[0]=7;
227 } 227 }
228 228
229 // Calculate offset to first day of week. 229 // Calculate offset to first day of week.
230 int dayoffset=d.dayOfWeek(); 230 int dayoffset=d.dayOfWeek();
231 if(bStartOnMonday) dayoffset--; 231 if(bStartOnMonday) dayoffset--;
232 else if( dayoffset == 7 ) dayoffset = 0; 232 else if( dayoffset == 7 ) dayoffset = 0;
233 233
234 for (int i=0; i<7; i++) { 234 for (int i=0; i<7; i++) {
235 // Header 235 // Header
236 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this); 236 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this);
237 connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); 237 connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
238 connect(hdr, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)), 238 connect(hdr, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
239 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &))); 239 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
240 layout->addWidget(hdr); 240 layout->addWidget(hdr);
241 241
242 // Events 242 // Events
243 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { 243 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) {
244 if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) {// Skip events ending at 00:00 starting at another day. 244 if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) {// Skip events ending at 00:00 starting at another day.
245 DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this); 245 DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this);
246 layout->addWidget(l); 246 layout->addWidget(l);
247 connect (l, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &))); 247 connect (l, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
248 } 248 }
249 it++; 249 it++;
250 } 250 }
251 layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); 251 layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
252 } 252 }
253} 253}
254DateBookWeekLstView::~DateBookWeekLstView(){} 254DateBookWeekLstView::~DateBookWeekLstView(){}
255void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} 255void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();}
256 256
257DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, 257DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
258 QValueList<EffectiveEvent> &ev2, 258 QValueList<EffectiveEvent> &ev2,
259 QDate &d, bool onM, 259 QDate &d, bool onM,
260 QWidget* parent, 260 QWidget* parent,
261 const char* name, WFlags fl) 261 const char* name, WFlags fl)
262 : QWidget( parent, name, fl ) 262 : QWidget( parent, name, fl )
263{ 263{
264 QHBoxLayout *layout = new QHBoxLayout( this ); 264 QHBoxLayout *layout = new QHBoxLayout( this );
265 265
266 DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); 266 DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this);
267 layout->addWidget(w); 267 layout->addWidget(w);
268 connect (w, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &))); 268 connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
269 connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); 269 connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
270 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &,const QString &)), 270 connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
271 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &))); 271 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
272 272
273 273
274 w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); 274 w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this);
275 layout->addWidget(w); 275 layout->addWidget(w);
276 connect (w, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &))); 276 connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
277 connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); 277 connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
278 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)), 278 connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
279 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &))); 279 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
280} 280}
281 281
282DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, 282DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
283 QWidget *parent, 283 QWidget *parent,
284 const char *name ) 284 const char *name )
285 : QWidget( parent, name ), 285 : QWidget( parent, name ),
286 db( newDB ), 286 db( newDB ),
287 startTime( 0 ), 287 startTime( 0 ),
288 ampm( ap ), 288 ampm( ap ),
289 bStartOnMonday(onM) 289 bStartOnMonday(onM)
290{ 290{
291 setFocusPolicy(StrongFocus); 291 setFocusPolicy(StrongFocus);
292 layout = new QVBoxLayout( this ); 292 layout = new QVBoxLayout( this );
293 layout->setMargin(0); 293 layout->setMargin(0);
294 294
295 header=new DateBookWeekLstHeader(onM, this); 295 header=new DateBookWeekLstHeader(onM, this);
296 layout->addWidget( header ); 296 layout->addWidget( header );
297 connect(header, SIGNAL(dateChanged(QDate &)), this, SLOT(dateChanged(QDate &))); 297 connect(header, SIGNAL(dateChanged(QDate&)), this, SLOT(dateChanged(QDate&)));
298 connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool))); 298 connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool)));
299 299
300 scroll=new QScrollView(this); 300 scroll=new QScrollView(this);
301 scroll->setResizePolicy(QScrollView::AutoOneFit); 301 scroll->setResizePolicy(QScrollView::AutoOneFit);
302 layout->addWidget(scroll); 302 layout->addWidget(scroll);
303 303
304 view=NULL; 304 view=NULL;
305 Config config("DateBook"); 305 Config config("DateBook");
306 config.setGroup("Main"); 306 config.setGroup("Main");
307 dbl=config.readBoolEntry("weeklst_dbl", false); 307 dbl=config.readBoolEntry("weeklst_dbl", false);
308 header->dbl->setOn(dbl); 308 header->dbl->setOn(dbl);
309} 309}
310DateBookWeekLst::~DateBookWeekLst(){ 310DateBookWeekLst::~DateBookWeekLst(){
311 Config config("DateBook"); 311 Config config("DateBook");
312 config.setGroup("Main"); 312 config.setGroup("Main");
313 config.writeEntry("weeklst_dbl", dbl); 313 config.writeEntry("weeklst_dbl", dbl);
314} 314}
315 315
316void DateBookWeekLst::setDate(const QDate &d) { 316void DateBookWeekLst::setDate(const QDate &d) {
317 bdate=d; 317 bdate=d;
318 header->setDate(d); 318 header->setDate(d);
319} 319}
320 320
321void DateBookWeekLst::setDbl(bool on) { 321void DateBookWeekLst::setDbl(bool on) {
322 dbl=on; 322 dbl=on;
323 redraw(); 323 redraw();
324} 324}
325void DateBookWeekLst::redraw() {getEvents();} 325void DateBookWeekLst::redraw() {getEvents();}
326 326
327QDate DateBookWeekLst::date() { 327QDate DateBookWeekLst::date() {
328 return bdate; 328 return bdate;
329} 329}
330 330
331// return the date at the beginning of the week... 331// return the date at the beginning of the week...
332// copied from DateBookWeek 332// copied from DateBookWeek
333QDate DateBookWeekLst::weekDate() const 333QDate DateBookWeekLst::weekDate() const
334{ 334{
335 QDate d=bdate; 335 QDate d=bdate;
336 336
337 // Calculate offset to first day of week. 337 // Calculate offset to first day of week.
338 int dayoffset=d.dayOfWeek(); 338 int dayoffset=d.dayOfWeek();
339 if(bStartOnMonday) dayoffset--; 339 if(bStartOnMonday) dayoffset--;
340 else if( dayoffset == 7 ) 340 else if( dayoffset == 7 )
341 dayoffset = 0; 341 dayoffset = 0;
342 342
343 return d.addDays(-dayoffset); 343 return d.addDays(-dayoffset);
344} 344}
345 345
346void DateBookWeekLst::getEvents() { 346void DateBookWeekLst::getEvents() {
347 QDate start = weekDate(); //date(); 347 QDate start = weekDate(); //date();
348 QDate stop = start.addDays(6); 348 QDate stop = start.addDays(6);
349 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); 349 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop);
350 350
351 if (view) delete view; 351 if (view) delete view;
352 if (dbl) { 352 if (dbl) {
353 QDate start2=start.addDays(7); 353 QDate start2=start.addDays(7);
354 stop=start2.addDays(6); 354 stop=start2.addDays(6);
355 QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); 355 QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop);
356 view=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll); 356 view=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll);
357 } else { 357 } else {
358 view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll); 358 view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll);
359 } 359 }
360 360
361 connect (view, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &))); 361 connect (view, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
362 connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); 362 connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
363 connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)), 363 connect (view, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
364 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &))); 364 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
365 365
366 scroll->addChild(view); 366 scroll->addChild(view);
367 view->show(); 367 view->show();
368 scroll->updateScrollBars(); 368 scroll->updateScrollBars();
369} 369}
370 370
371void DateBookWeekLst::dateChanged(QDate &newdate) { 371void DateBookWeekLst::dateChanged(QDate &newdate) {
372 bdate=newdate; 372 bdate=newdate;
373 getEvents(); 373 getEvents();
374} 374}
375 375
376void DateBookWeekLst::keyPressEvent(QKeyEvent *e) 376void DateBookWeekLst::keyPressEvent(QKeyEvent *e)
377{ 377{
378 switch(e->key()) { 378 switch(e->key()) {
379 case Key_Up: 379 case Key_Up:
380 scroll->scrollBy(0, -20); 380 scroll->scrollBy(0, -20);
381 break; 381 break;
382 case Key_Down: 382 case Key_Down:
383 scroll->scrollBy(0, 20); 383 scroll->scrollBy(0, 20);
384 break; 384 break;
385 case Key_Left: 385 case Key_Left:
386 header->prevWeek(); 386 header->prevWeek();
387 break; 387 break;
388 case Key_Right: 388 case Key_Right:
389 header->nextWeek(); 389 header->nextWeek();
390 break; 390 break;
391 default: 391 default:
392 e->ignore(); 392 e->ignore();
393 } 393 }
394} 394}
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp
index 018bb5a..57bcd89 100644
--- a/core/pim/datebook/dateentryimpl.cpp
+++ b/core/pim/datebook/dateentryimpl.cpp
@@ -145,119 +145,119 @@ void DateEntry::setDates( const QDateTime& s, const QDateTime& e )
145 145
146void DateEntry::updateTimeEdit(bool s, bool e) { 146void DateEntry::updateTimeEdit(bool s, bool e) {
147 147
148 // Comboboxes 148 // Comboboxes
149 QString strStart, strEnd; 149 QString strStart, strEnd;
150 int shour, ehour; 150 int shour, ehour;
151 if ( ampm ) { 151 if ( ampm ) {
152 shour = startTime.hour(); 152 shour = startTime.hour();
153 ehour = endTime.hour(); 153 ehour = endTime.hour();
154 if ( shour >= 12 ) { 154 if ( shour >= 12 ) {
155 if ( shour > 12 ) 155 if ( shour > 12 )
156 shour -= 12; 156 shour -= 12;
157 strStart.sprintf( "%d:%02d PM", shour, startTime.minute() ); 157 strStart.sprintf( "%d:%02d PM", shour, startTime.minute() );
158 } else { 158 } else {
159 if ( shour == 0 ) 159 if ( shour == 0 )
160 shour = 12; 160 shour = 12;
161 strStart.sprintf( "%d:%02d AM", shour, startTime.minute() ); 161 strStart.sprintf( "%d:%02d AM", shour, startTime.minute() );
162 } 162 }
163 if ( ehour == 24 && endTime.minute() == 0 ) { 163 if ( ehour == 24 && endTime.minute() == 0 ) {
164 strEnd = "11:59 PM"; // or "midnight" 164 strEnd = "11:59 PM"; // or "midnight"
165 } else if ( ehour >= 12 ) { 165 } else if ( ehour >= 12 ) {
166 if ( ehour > 12 ) 166 if ( ehour > 12 )
167 ehour -= 12; 167 ehour -= 12;
168 strEnd.sprintf( "%d:%02d PM", ehour, endTime.minute() ); 168 strEnd.sprintf( "%d:%02d PM", ehour, endTime.minute() );
169 } else { 169 } else {
170 if ( ehour == 0 ) 170 if ( ehour == 0 )
171 ehour = 12; 171 ehour = 12;
172 strEnd.sprintf( "%d:%02d AM", ehour, endTime.minute() ); 172 strEnd.sprintf( "%d:%02d AM", ehour, endTime.minute() );
173 } 173 }
174 } else { 174 } else {
175 strStart.sprintf( "%02d:%02d", startTime.hour(), startTime.minute() ); 175 strStart.sprintf( "%02d:%02d", startTime.hour(), startTime.minute() );
176 strEnd.sprintf( "%02d:%02d", endTime.hour(), endTime.minute() ); 176 strEnd.sprintf( "%02d:%02d", endTime.hour(), endTime.minute() );
177 } 177 }
178 178
179 if (s) comboStart->setText(strStart); 179 if (s) comboStart->setText(strStart);
180 if (e) comboEnd->setText(strEnd); 180 if (e) comboEnd->setText(strEnd);
181} 181}
182 182
183void DateEntry::init() 183void DateEntry::init()
184{ 184{
185 comboDescription->setInsertionPolicy(QComboBox::AtCurrent); 185 comboDescription->setInsertionPolicy(QComboBox::AtCurrent);
186 comboLocation->setInsertionPolicy(QComboBox::AtCurrent); 186 comboLocation->setInsertionPolicy(QComboBox::AtCurrent);
187 187
188 initCombos(); 188 initCombos();
189 QPopupMenu *m1 = new QPopupMenu( this ); 189 QPopupMenu *m1 = new QPopupMenu( this );
190 startPicker = new DateBookMonth( m1, 0, TRUE ); 190 startPicker = new DateBookMonth( m1, 0, TRUE );
191 m1->insertItem( startPicker ); 191 m1->insertItem( startPicker );
192 buttonStart->setPopup( m1 ); 192 buttonStart->setPopup( m1 );
193 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), 193 connect( startPicker, SIGNAL( dateClicked(int,int,int) ),
194 this, SLOT( startDateChanged( int, int, int ) ) ); 194 this, SLOT( startDateChanged(int,int,int) ) );
195 195
196 //Let start button change both start and end dates 196 //Let start button change both start and end dates
197 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), 197 connect( startPicker, SIGNAL( dateClicked(int,int,int) ),
198 this, SLOT( endDateChanged( int, int, int ) ) ); 198 this, SLOT( endDateChanged(int,int,int) ) );
199 connect( qApp, SIGNAL( clockChanged( bool ) ), 199 connect( qApp, SIGNAL( clockChanged(bool) ),
200 this, SLOT( slotChangeClock( bool ) ) ); 200 this, SLOT( slotChangeClock(bool) ) );
201 connect( qApp, SIGNAL(weekChanged(bool)), 201 connect( qApp, SIGNAL(weekChanged(bool)),
202 this, SLOT(slotChangeStartOfWeek(bool)) ); 202 this, SLOT(slotChangeStartOfWeek(bool)) );
203 203
204 connect( editNote, SIGNAL(clicked()), 204 connect( editNote, SIGNAL(clicked()),
205 this, SLOT(slotEditNote()) ); 205 this, SLOT(slotEditNote()) );
206 206
207 QPopupMenu *m2 = new QPopupMenu( this ); 207 QPopupMenu *m2 = new QPopupMenu( this );
208 endPicker = new DateBookMonth( m2, 0, TRUE ); 208 endPicker = new DateBookMonth( m2, 0, TRUE );
209 m2->insertItem( endPicker ); 209 m2->insertItem( endPicker );
210 buttonEnd->setPopup( m2 ); 210 buttonEnd->setPopup( m2 );
211 connect( endPicker, SIGNAL( dateClicked( int, int, int ) ), 211 connect( endPicker, SIGNAL( dateClicked(int,int,int) ),
212 this, SLOT( endDateChanged( int, int, int ) ) ); 212 this, SLOT( endDateChanged(int,int,int) ) );
213 213
214 connect(timePickerStart, SIGNAL( timeChanged(const QTime &) ), 214 connect(timePickerStart, SIGNAL( timeChanged(const QTime&) ),
215 this, SLOT( startTimePicked(const QTime &) )); 215 this, SLOT( startTimePicked(const QTime&) ));
216 // install eventFilters 216 // install eventFilters
217 comboEnd->installEventFilter( this ); 217 comboEnd->installEventFilter( this );
218 comboStart->installEventFilter( this ); 218 comboStart->installEventFilter( this );
219} 219}
220 220
221/* 221/*
222 * Destroys the object and frees any allocated resources 222 * Destroys the object and frees any allocated resources
223 */ 223 */
224DateEntry::~DateEntry() 224DateEntry::~DateEntry()
225{ 225{
226 // no need to delete child widgets, Qt does it all for us 226 // no need to delete child widgets, Qt does it all for us
227 //cout << "Del: " << comboStart->currentText() << endl; 227 //cout << "Del: " << comboStart->currentText() << endl;
228} 228}
229 229
230/* 230/*
231 * public slot 231 * public slot
232 */ 232 */
233 233
234void DateEntry::slotEditNote() { 234void DateEntry::slotEditNote() {
235 QString s; 235 QString s;
236 s = "<B>"+ TimeString::longDateString( startDate ) + "</B>"; 236 s = "<B>"+ TimeString::longDateString( startDate ) + "</B>";
237// s.sprintf("<B>%d/%d</B> ", startDate.day(), startDate.month()); 237// s.sprintf("<B>%d/%d</B> ", startDate.day(), startDate.month());
238 NoteEntry noteDlg(s+comboDescription->currentText(), noteStr, 238 NoteEntry noteDlg(s+comboDescription->currentText(), noteStr,
239 this,0,TRUE); 239 this,0,TRUE);
240 240
241 if ( QPEApplication::execDialog( &noteDlg ) ) { 241 if ( QPEApplication::execDialog( &noteDlg ) ) {
242 noteStr=noteDlg.note->text(); 242 noteStr=noteDlg.note->text();
243 } 243 }
244 244
245} 245}
246 246
247void DateEntry::endDateChanged( int y, int m, int d ) 247void DateEntry::endDateChanged( int y, int m, int d )
248{ 248{
249 endDate.setYMD( y, m, d ); 249 endDate.setYMD( y, m, d );
250 if ( endDate < startDate ) { 250 if ( endDate < startDate ) {
251 endDate = startDate; 251 endDate = startDate;
252 } 252 }
253 253
254 buttonEnd->setText( TimeString::shortDate( endDate ) ); 254 buttonEnd->setText( TimeString::shortDate( endDate ) );
255 255
256 endPicker->setDate( endDate.year(), endDate.month(), endDate.day() ); 256 endPicker->setDate( endDate.year(), endDate.month(), endDate.day() );
257} 257}
258 258
259static QTime parseTime( const QString& s, bool ampm ) 259static QTime parseTime( const QString& s, bool ampm )
260{ 260{
261 QTime tmpTime; 261 QTime tmpTime;
262 QStringList l = QStringList::split( ':', s ); 262 QStringList l = QStringList::split( ':', s );
263 int hour = l[0].toInt(); 263 int hour = l[0].toInt();
diff --git a/core/pim/datebook/repeatentry.cpp b/core/pim/datebook/repeatentry.cpp
index 7cf36da..04c3cf3 100644
--- a/core/pim/datebook/repeatentry.cpp
+++ b/core/pim/datebook/repeatentry.cpp
@@ -314,98 +314,98 @@ void RepeatEntry::setupWeekly()
314 lblFreq->setText( tr("week(s)") ); 314 lblFreq->setText( tr("week(s)") );
315 lblVar2->show(); 315 lblVar2->show();
316 showRepeatStuff(); 316 showRepeatStuff();
317 setupRepeatLabel( 1 ); 317 setupRepeatLabel( 1 );
318} 318}
319 319
320void RepeatEntry::setupMonthly() 320void RepeatEntry::setupMonthly()
321{ 321{
322 hideExtras(); 322 hideExtras();
323 lblWeekVar->hide(); 323 lblWeekVar->hide();
324 fraExtra->setTitle( tr("Repeat By") ); 324 fraExtra->setTitle( tr("Repeat By") );
325 fraExtra->setExclusive( TRUE ); 325 fraExtra->setExclusive( TRUE );
326 fraExtra->show(); 326 fraExtra->show();
327 cmdExtra1->setText( tr("Day") ); 327 cmdExtra1->setText( tr("Day") );
328 cmdExtra1->show(); 328 cmdExtra1->show();
329 cmdExtra2->setText( tr("Date") ); 329 cmdExtra2->setText( tr("Date") );
330 cmdExtra2->show(); 330 cmdExtra2->show();
331 spinFreq->setValue( 1 ); 331 spinFreq->setValue( 1 );
332 lblFreq->setText( tr("month(s)") ); 332 lblFreq->setText( tr("month(s)") );
333 lblVar2->show(); 333 lblVar2->show();
334 showRepeatStuff(); 334 showRepeatStuff();
335 setupRepeatLabel( 1 ); 335 setupRepeatLabel( 1 );
336} 336}
337 337
338void RepeatEntry::setupYearly() 338void RepeatEntry::setupYearly()
339{ 339{
340 hideExtras(); 340 hideExtras();
341 lblWeekVar->hide(); 341 lblWeekVar->hide();
342 spinFreq->setValue( 1 ); 342 spinFreq->setValue( 1 );
343 lblFreq->setText( tr("year(s)") ); 343 lblFreq->setText( tr("year(s)") );
344 lblFreq->show(); 344 lblFreq->show();
345 lblFreq->show(); 345 lblFreq->show();
346 showRepeatStuff(); 346 showRepeatStuff();
347 lblVar2->show(); 347 lblVar2->show();
348 QString strEvery = strYearTemplate.arg( start.monthName(start.month()) ).arg( numberPlacing(start.day()) ); 348 QString strEvery = strYearTemplate.arg( start.monthName(start.month()) ).arg( numberPlacing(start.day()) );
349 lblRepeat->setText( strEvery ); 349 lblRepeat->setText( strEvery );
350 setupRepeatLabel( 1 ); 350 setupRepeatLabel( 1 );
351 351
352} 352}
353 353
354void RepeatEntry::init() 354void RepeatEntry::init()
355{ 355{
356 QPopupMenu *m1 = new QPopupMenu( this ); 356 QPopupMenu *m1 = new QPopupMenu( this );
357 repeatPicker = new DateBookMonth( m1, 0, TRUE ); 357 repeatPicker = new DateBookMonth( m1, 0, TRUE );
358 m1->insertItem( repeatPicker ); 358 m1->insertItem( repeatPicker );
359 cmdEnd->setPopup( m1 ); 359 cmdEnd->setPopup( m1 );
360 cmdEnd->setPopupDelay( 0 ); 360 cmdEnd->setPopupDelay( 0 );
361 361
362 QObject::connect( repeatPicker, SIGNAL(dateClicked(int, int, int)), 362 QObject::connect( repeatPicker, SIGNAL(dateClicked(int,int,int)),
363 this, SLOT(endDateChanged(int, int, int)) ); 363 this, SLOT(endDateChanged(int,int,int)) );
364 QObject::connect( qApp, SIGNAL(weekChanged(bool)), 364 QObject::connect( qApp, SIGNAL(weekChanged(bool)),
365 this, SLOT(slotChangeStartOfWeek(bool)) ); 365 this, SLOT(slotChangeStartOfWeek(bool)) );
366 366
367 listRTypeButtons.setAutoDelete( TRUE ); 367 listRTypeButtons.setAutoDelete( TRUE );
368 listRTypeButtons.append( cmdNone ); 368 listRTypeButtons.append( cmdNone );
369 listRTypeButtons.append( cmdDay ); 369 listRTypeButtons.append( cmdDay );
370 listRTypeButtons.append( cmdWeek ); 370 listRTypeButtons.append( cmdWeek );
371 listRTypeButtons.append( cmdMonth ); 371 listRTypeButtons.append( cmdMonth );
372 listRTypeButtons.append( cmdYear ); 372 listRTypeButtons.append( cmdYear );
373 373
374 listExtra.setAutoDelete( TRUE ); 374 listExtra.setAutoDelete( TRUE );
375 listExtra.append( cmdExtra1 ); 375 listExtra.append( cmdExtra1 );
376 listExtra.append( cmdExtra2 ); 376 listExtra.append( cmdExtra2 );
377 listExtra.append( cmdExtra3 ); 377 listExtra.append( cmdExtra3 );
378 listExtra.append( cmdExtra4 ); 378 listExtra.append( cmdExtra4 );
379 listExtra.append( cmdExtra5 ); 379 listExtra.append( cmdExtra5 );
380 listExtra.append( cmdExtra6 ); 380 listExtra.append( cmdExtra6 );
381 listExtra.append( cmdExtra7 ); 381 listExtra.append( cmdExtra7 );
382} 382}
383 383
384void RepeatEntry::slotNoEnd( bool unused ) 384void RepeatEntry::slotNoEnd( bool unused )
385{ 385{
386 // if the item was toggled, then go ahead and set it to the maximum date 386 // if the item was toggled, then go ahead and set it to the maximum date
387 if ( unused ) { 387 if ( unused ) {
388 end.setYMD( 3000, 12, 31 ); 388 end.setYMD( 3000, 12, 31 );
389 cmdEnd->setText( RepeatEntryBase::tr("No End Date") ); 389 cmdEnd->setText( RepeatEntryBase::tr("No End Date") );
390 } else { 390 } else {
391 end = start; 391 end = start;
392 cmdEnd->setText( TimeString::shortDate(end) ); 392 cmdEnd->setText( TimeString::shortDate(end) );
393 } 393 }
394} 394}
395 395
396void RepeatEntry::endDateChanged( int y, int m, int d ) 396void RepeatEntry::endDateChanged( int y, int m, int d )
397{ 397{
398 end.setYMD( y, m, d ); 398 end.setYMD( y, m, d );
399 if ( end < start ) 399 if ( end < start )
400 end = start; 400 end = start;
401 cmdEnd->setText( TimeString::shortDate( end ) ); 401 cmdEnd->setText( TimeString::shortDate( end ) );
402 repeatPicker->setDate( end.year(), end.month(), end.day() ); 402 repeatPicker->setDate( end.year(), end.month(), end.day() );
403} 403}
404 404
405void RepeatEntry::setupRepeatLabel( const QString &s ) 405void RepeatEntry::setupRepeatLabel( const QString &s )
406{ 406{
407 lblVar1->setText( s ); 407 lblVar1->setText( s );
408} 408}
409 409
410void RepeatEntry::setupRepeatLabel( int x ) 410void RepeatEntry::setupRepeatLabel( int x )
411{ 411{
diff --git a/core/pim/datebook2/mainwindow.cpp b/core/pim/datebook2/mainwindow.cpp
index 7ff2204..3937796 100644
--- a/core/pim/datebook2/mainwindow.cpp
+++ b/core/pim/datebook2/mainwindow.cpp
@@ -1,90 +1,90 @@
1 1
2#include <qcopchannel_qws.h> 2#include <qcopchannel_qws.h>
3#include <qwidgetstack.h> 3#include <qwidgetstack.h>
4#include <qlabel.h> 4#include <qlabel.h>
5#include <qaction.h> 5#include <qaction.h>
6#include <qpopupmenu.h> 6#include <qpopupmenu.h>
7#include <qtimer.h> 7#include <qtimer.h>
8 8
9#include <qpe/qpeapplication.h> 9#include <qpe/qpeapplication.h>
10#include <qpe/ir.h> 10#include <qpe/ir.h>
11#include <qmenubar.h> 11#include <qmenubar.h>
12#include <qtoolbar.h> 12#include <qtoolbar.h>
13#include <qpe/qpemessagebox.h> 13#include <qpe/qpemessagebox.h>
14#include <qpe/resource.h> 14#include <qpe/resource.h>
15 15
16#include "editor.h" 16#include "editor.h"
17#include "show.h" 17#include "show.h"
18#include "templatemanager.h" 18#include "templatemanager.h"
19#include "bookmanager.h" 19#include "bookmanager.h"
20#include "mainwindow.h" 20#include "mainwindow.h"
21 21
22 22
23using namespace Datebook; 23using namespace Datebook;
24 24
25MainWindow::MainWindow() 25MainWindow::MainWindow()
26 : OPimMainWindow( "Datebook", 0, 0 ), m_descMan( "Descriptions" ), m_locMan( "Locations" ) 26 : OPimMainWindow( "Datebook", 0, 0 ), m_descMan( "Descriptions" ), m_locMan( "Locations" )
27{ 27{
28 setIcon( Resource::loadPixmap( "datebook_icon" ) ); 28 setIcon( Resource::loadPixmap( "datebook_icon" ) );
29 initUI(); 29 initUI();
30 initManagers(); 30 initManagers();
31 initView(); 31 initView();
32 initConfig(); 32 initConfig();
33 33
34 QTimer::singleShot(0, this, SLOT(populate() ) ); 34 QTimer::singleShot(0, this, SLOT(populate() ) );
35 35
36 QCopChannel* chan = new QCopChannel( "QPE/System", this ); 36 QCopChannel* chan = new QCopChannel( "QPE/System", this );
37 connect( chan, SIGNAL( received(const QCString&, const QByteArray& ) ), 37 connect( chan, SIGNAL( received(const QCString&,const QByteArray&) ),
38 this, SLOT( slotReceive( const QCString&, const QByteArray& ) ) ); 38 this, SLOT( slotReceive(const QCString&,const QByteArray&) ) );
39 39
40 chan = new QCopChannel( "QPE/Datebook", this ); 40 chan = new QCopChannel( "QPE/Datebook", this );
41 connect( chan, SIGNAL( received(const QCString&, const QByteArray& ) ), 41 connect( chan, SIGNAL( received(const QCString&,const QByteArray&) ),
42 this, SLOT( slotReceive( const QCString&, const QByteArray& ) ) ); 42 this, SLOT( slotReceive(const QCString&,const QByteArray&) ) );
43} 43}
44MainWindow::~MainWindow() { 44MainWindow::~MainWindow() {
45 m_tempMan.save(); 45 m_tempMan.save();
46 m_locMan.save(); 46 m_locMan.save();
47 m_descMan.save(); 47 m_descMan.save();
48 48
49 manager()->save(); 49 manager()->save();
50 delete m_manager; 50 delete m_manager;
51} 51}
52void MainWindow::doSetDocument( const QString& str ) { 52void MainWindow::doSetDocument( const QString& str ) {
53 53
54} 54}
55void MainWindow::flush() { 55void MainWindow::flush() {
56 manager()->save(); 56 manager()->save();
57} 57}
58void MainWindow::reload() { 58void MainWindow::reload() {
59 manager()->reload(); 59 manager()->reload();
60} 60}
61int MainWindow::create() { 61int MainWindow::create() {
62 return 0; 62 return 0;
63} 63}
64bool MainWindow::remove( int uid ) { 64bool MainWindow::remove( int uid ) {
65 manager()->remove( uid ); 65 manager()->remove( uid );
66 return true; 66 return true;
67} 67}
68void MainWindow::beam( int uid ) { 68void MainWindow::beam( int uid ) {
69 69
70} 70}
71void MainWindow::show( int uid ) { 71void MainWindow::show( int uid ) {
72 72
73 eventShow()->show( manager()->event( uid ) ); 73 eventShow()->show( manager()->event( uid ) );
74} 74}
75void MainWindow::add( const OPimRecord& ad) { 75void MainWindow::add( const OPimRecord& ad) {
76 manager()->add( ad ); 76 manager()->add( ad );
77} 77}
78void MainWindow::edit() { 78void MainWindow::edit() {
79 edit ( currentView()->currentItem() ); 79 edit ( currentView()->currentItem() );
80} 80}
81void MainWindow::edit( int uid ) { 81void MainWindow::edit( int uid ) {
82 82
83} 83}
84/* 84/*
85 * init tool bars layout and so on 85 * init tool bars layout and so on
86 */ 86 */
87void MainWindow::initUI() { 87void MainWindow::initUI() {
88 setToolBarsMovable( false ); 88 setToolBarsMovable( false );
89 89
90 m_stack = new QWidgetStack( this ); 90 m_stack = new QWidgetStack( this );
@@ -105,98 +105,98 @@ void MainWindow::initUI() {
105 m_popTemplate->setCheckable( TRUE ); 105 m_popTemplate->setCheckable( TRUE );
106 connect( m_popTemplate, SIGNAL(activated(int) ), 106 connect( m_popTemplate, SIGNAL(activated(int) ),
107 this, SLOT(slotNewFromTemplate(int) ) ); 107 this, SLOT(slotNewFromTemplate(int) ) );
108 m_popView->insertItem(tr("New from template"), m_popTemplate, -1, 0); 108 m_popView->insertItem(tr("New from template"), m_popTemplate, -1, 0);
109 109
110 110
111 QAction* a = new QAction( tr("New Event"), Resource::loadPixmap("new"), 111 QAction* a = new QAction( tr("New Event"), Resource::loadPixmap("new"),
112 QString::null, 0, this, 0 ); 112 QString::null, 0, this, 0 );
113 a->addTo( m_toolBar ); 113 a->addTo( m_toolBar );
114 a->addTo( m_popView ); 114 a->addTo( m_popView );
115 connect(a, SIGNAL( activated() ), this, SLOT( create() ) ); 115 connect(a, SIGNAL( activated() ), this, SLOT( create() ) );
116 116
117 a = new QAction( tr("Edit Event"), Resource::loadPixmap("edit"), 117 a = new QAction( tr("Edit Event"), Resource::loadPixmap("edit"),
118 QString::null, 0, this, 0 ); 118 QString::null, 0, this, 0 );
119 a->addTo( m_popView ); 119 a->addTo( m_popView );
120 connect(a, SIGNAL( activated() ), this, SLOT( edit() ) ); 120 connect(a, SIGNAL( activated() ), this, SLOT( edit() ) );
121 121
122 a = new QAction( tr("Today" ), Resource::loadPixmap( "datebook/to_day"), 122 a = new QAction( tr("Today" ), Resource::loadPixmap( "datebook/to_day"),
123 QString::null, 0, this, 0 ); 123 QString::null, 0, this, 0 );
124 a->addTo( m_toolBar ); 124 a->addTo( m_toolBar );
125 connect(a, SIGNAL( activated() ), this, SLOT( slotGoToNow() ) ); 125 connect(a, SIGNAL( activated() ), this, SLOT( slotGoToNow() ) );
126 126
127 a = new QAction( tr("Find"), Resource::loadPixmap( "mag" ), 127 a = new QAction( tr("Find"), Resource::loadPixmap( "mag" ),
128 QString::null, 0, this, 0 ); 128 QString::null, 0, this, 0 );
129 a->addTo( m_toolBar ); 129 a->addTo( m_toolBar );
130 connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); 130 connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) );
131 131
132 a = new QAction( tr("Configure"), QString::null, 0, 0 ); 132 a = new QAction( tr("Configure"), QString::null, 0, 0 );
133 a->addTo( m_popSetting ); 133 a->addTo( m_popSetting );
134 connect(a, SIGNAL( activated() ), this, SLOT( slotConfigure() ) ); 134 connect(a, SIGNAL( activated() ), this, SLOT( slotConfigure() ) );
135 135
136 a = new QAction( tr("Configure Locations"), QString::null, 0, 0 ); 136 a = new QAction( tr("Configure Locations"), QString::null, 0, 0 );
137 a->addTo( m_popSetting ); 137 a->addTo( m_popSetting );
138 connect(a, SIGNAL( activated() ), this, SLOT( slotConfigureLocs() ) ); 138 connect(a, SIGNAL( activated() ), this, SLOT( slotConfigureLocs() ) );
139 139
140 a = new QAction( tr("Configure Descriptions"), QString::null, 0, 0 ); 140 a = new QAction( tr("Configure Descriptions"), QString::null, 0, 0 );
141 a->addTo( m_popSetting ); 141 a->addTo( m_popSetting );
142 connect(a, SIGNAL( activated() ), this, SLOT(slotConfigureDesc() ) ); 142 connect(a, SIGNAL( activated() ), this, SLOT(slotConfigureDesc() ) );
143 143
144 a = new QAction( tr("Configure Templates"), QString::null, 0, 0 ); 144 a = new QAction( tr("Configure Templates"), QString::null, 0, 0 );
145 a->addTo( m_popSetting ); 145 a->addTo( m_popSetting );
146 connect(a, SIGNAL( activated() ), this, SLOT(slotConfigureTemp() ) ); 146 connect(a, SIGNAL( activated() ), this, SLOT(slotConfigureTemp() ) );
147 147
148 connect( qApp, SIGNAL(clockChanged(bool) ), 148 connect( qApp, SIGNAL(clockChanged(bool) ),
149 this, SLOT(slotClockChanged(bool) ) ); 149 this, SLOT(slotClockChanged(bool) ) );
150 connect( qApp, SIGNAL(weekChanged(bool) ), 150 connect( qApp, SIGNAL(weekChanged(bool) ),
151 this, SLOT(slotWeekChanged(bool) ) ); 151 this, SLOT(slotWeekChanged(bool) ) );
152 152
153 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray& ) ), 153 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&) ),
154 this, SLOT(slotAppMessage( const QCString&, const QByteArray& ) ) ); 154 this, SLOT(slotAppMessage(const QCString&,const QByteArray&) ) );
155} 155}
156void MainWindow::initConfig() { 156void MainWindow::initConfig() {
157 157
158} 158}
159void MainWindow::initView() { 159void MainWindow::initView() {
160 160
161} 161}
162void MainWindow::initManagers() { 162void MainWindow::initManagers() {
163 m_manager = new BookManager; 163 m_manager = new BookManager;
164 164
165 m_tempMan.load(); 165 m_tempMan.load();
166 m_locMan.load(); 166 m_locMan.load();
167 m_descMan.load(); 167 m_descMan.load();
168 168
169 setTemplateMenu(); 169 setTemplateMenu();
170} 170}
171void MainWindow::raiseCurrentView() { 171void MainWindow::raiseCurrentView() {
172 172
173} 173}
174/* 174/*
175 * populate the view 175 * populate the view
176 */ 176 */
177void MainWindow::populate() { 177void MainWindow::populate() {
178 if (!manager()->isLoaded() ) 178 if (!manager()->isLoaded() )
179 manager()->load(); 179 manager()->load();
180} 180}
181void MainWindow::slotGoToNow() { 181void MainWindow::slotGoToNow() {
182 182
183} 183}
184View* MainWindow::currentView() { 184View* MainWindow::currentView() {
185 185
186} 186}
187void MainWindow::slotFind() { 187void MainWindow::slotFind() {
188 188
189} 189}
190void MainWindow::slotConfigure() { 190void MainWindow::slotConfigure() {
191 191
192} 192}
193void MainWindow::slotClockChanged( bool ) { 193void MainWindow::slotClockChanged( bool ) {
194 194
195} 195}
196void MainWindow::slotWeekChanged(bool ) { 196void MainWindow::slotWeekChanged(bool ) {
197 197
198} 198}
199void MainWindow::slotAppMessage( const QCString&, const QByteArray& ) { 199void MainWindow::slotAppMessage( const QCString&, const QByteArray& ) {
200 200
201} 201}
202void MainWindow::slotReceive( const QCString&, const QByteArray& ) { 202void MainWindow::slotReceive( const QCString&, const QByteArray& ) {
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index bfe95b0..8b6a5df 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -156,97 +156,97 @@ void MainWindow::makeMenu()
156 QPopupMenu *pop; 156 QPopupMenu *pop;
157 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ 157 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
158 pop = s->popupMenu(); 158 pop = s->popupMenu();
159 if (pop){ 159 if (pop){
160 cfgMenu->insertItem( s->text(0), pop ); 160 cfgMenu->insertItem( s->text(0), pop );
161 } 161 }
162 } 162 }
163 163
164 164
165 //SEARCH 165 //SEARCH
166 SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); 166 SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 );
167 SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); 167 SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) );
168 // QWhatsThis::add( SearchAllAction, tr("Search everything...") ); 168 // QWhatsThis::add( SearchAllAction, tr("Search everything...") );
169 connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); 169 connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) );
170 SearchAllAction->addTo( searchMenu ); 170 SearchAllAction->addTo( searchMenu );
171 searchMenu->insertItem( tr( "Options" ), searchOptions ); 171 searchMenu->insertItem( tr( "Options" ), searchOptions );
172 172
173 //SEARCH OPTIONS 173 //SEARCH OPTIONS
174 //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); 174 //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true );
175 //actionWholeWordsOnly->addTo( searchOptions ); 175 //actionWholeWordsOnly->addTo( searchOptions );
176 actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); 176 actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true );
177 actionCaseSensitiv->addTo( searchOptions ); 177 actionCaseSensitiv->addTo( searchOptions );
178 actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); 178 actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true );
179 actionWildcards->addTo( searchOptions ); 179 actionWildcards->addTo( searchOptions );
180 180
181 //SEARCH BAR 181 //SEARCH BAR
182 LabelEnterText = new QLabel( searchBar, "Label" ); 182 LabelEnterText = new QLabel( searchBar, "Label" );
183 LabelEnterText->setAutoMask( FALSE ); 183 LabelEnterText->setAutoMask( FALSE );
184 LabelEnterText->setText( tr( "Search for: " ) ); 184 LabelEnterText->setText( tr( "Search for: " ) );
185 185
186 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 186 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
187 QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); 187 QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" );
188 QWhatsThis::add( searchEdit, tr("Enter your search terms here") ); 188 QWhatsThis::add( searchEdit, tr("Enter your search terms here") );
189 searchEdit->setFocus(); 189 searchEdit->setFocus();
190 searchBar->setHorizontalStretchable( TRUE ); 190 searchBar->setHorizontalStretchable( TRUE );
191 searchBar->setStretchableWidget( searchEdit ); 191 searchBar->setStretchableWidget( searchEdit );
192 192
193 //Search button 193 //Search button
194 SearchAllAction->addTo( searchBar ); 194 SearchAllAction->addTo( searchBar );
195 195
196 //image ripped of off opie-login/loginwindow.cpp 196 //image ripped of off opie-login/loginwindow.cpp
197 QPixmap image1( ( const char** ) image1_data ); 197 QPixmap image1( ( const char** ) image1_data );
198 198
199 //Clear text 199 //Clear text
200 ClearSearchText = new QToolButton( searchBar, "ClearSearchText"); 200 ClearSearchText = new QToolButton( searchBar, "ClearSearchText");
201 ClearSearchText->setText( tr( "" ) ); 201 ClearSearchText->setText( tr( "" ) );
202 ClearSearchText->setPixmap( image1 ); 202 ClearSearchText->setPixmap( image1 );
203 203
204 connect( searchEdit, SIGNAL( textChanged( const QString & ) ),this, SLOT( setSearch( const QString & ) ) ); 204 connect( searchEdit, SIGNAL( textChanged(const QString&) ),this, SLOT( setSearch(const QString&) ) );
205 connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) ); 205 connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) );
206 206
207} 207}
208 208
209MainWindow::~MainWindow() 209MainWindow::~MainWindow()
210{ 210{
211 Config cfg( "osearch", Config::User ); 211 Config cfg( "osearch", Config::User );
212 cfg.setGroup( "search_settings" ); 212 cfg.setGroup( "search_settings" );
213 cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); 213 cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() );
214 cfg.writeEntry( "wildcards", actionWildcards->isOn() ); 214 cfg.writeEntry( "wildcards", actionWildcards->isOn() );
215 //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); 215 //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() );
216} 216}
217 217
218void MainWindow::setCurrent(QListViewItem *item) 218void MainWindow::setCurrent(QListViewItem *item)
219{ 219{
220 if (!item) return; 220 if (!item) return;
221 _currentItem = (OListViewItem*)item; 221 _currentItem = (OListViewItem*)item;
222 //_currentItem = dynamic_cast<OListViewItem*>(item); 222 //_currentItem = dynamic_cast<OListViewItem*>(item);
223 if (_currentItem->rtti() == OListViewItem::Result){ 223 if (_currentItem->rtti() == OListViewItem::Result){
224 ResultItem *res = (ResultItem*)item; 224 ResultItem *res = (ResultItem*)item;
225 // ResultItem *res = dynamic_cast<ResultItem*>(item); 225 // ResultItem *res = dynamic_cast<ResultItem*>(item);
226 richEdit->setText( res->toRichText() ); 226 richEdit->setText( res->toRichText() );
227 QIntDict<QString> acts = res->actions(); 227 QIntDict<QString> acts = res->actions();
228 QButton *button; 228 QButton *button;
229 for (uint i = 0; i < acts.count(); i++){ 229 for (uint i = 0; i < acts.count(); i++){
230 button = buttonMap[i]; 230 button = buttonMap[i];
231 if (!button) { 231 if (!button) {
232 qWarning(" no button for %s", (*acts[i]).latin1() ); 232 qWarning(" no button for %s", (*acts[i]).latin1() );
233 button = new QPushButton( buttonBox ); 233 button = new QPushButton( buttonBox );
234 buttonMap.insert( i, button ); 234 buttonMap.insert( i, button );
235 signalMapper->setMapping(button, i ); 235 signalMapper->setMapping(button, i );
236 connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) ); 236 connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) );
237 } 237 }
238 button->setText( *acts[i] ); 238 button->setText( *acts[i] );
239 button->show(); 239 button->show();
240 } 240 }
241 for (uint i = acts.count(); i < _buttonCount; i++){ 241 for (uint i = acts.count(); i < _buttonCount; i++){
242 button = buttonMap[i]; 242 button = buttonMap[i];
243 if (button) button->hide(); 243 if (button) button->hide();
244 } 244 }
245 _buttonCount = acts.count(); 245 _buttonCount = acts.count();
246 detailsFrame->show(); 246 detailsFrame->show();
247 buttonBox->show(); 247 buttonBox->show();
248 248
249 }else { 249 }else {
250 detailsFrame->hide(); 250 detailsFrame->hide();
251 buttonBox->hide(); 251 buttonBox->hide();
252 } 252 }
diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
index c8652f3..b0d456d 100644
--- a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
+++ b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
@@ -1,89 +1,89 @@
1/* 1/*
2 * addresspluginwidget.cpp 2 * addresspluginwidget.cpp
3 * 3 *
4 * copyright : (c) 2003 by Stefan Eilers 4 * copyright : (c) 2003 by Stefan Eilers
5 * email : eilers.stefan@epost.de 5 * email : eilers.stefan@epost.de
6 * 6 *
7 * This implementation was derived from the todolist plugin implementation 7 * This implementation was derived from the todolist plugin implementation
8 * 8 *
9 */ 9 */
10/*************************************************************************** 10/***************************************************************************
11 * * 11 * *
12 * This program is free software; you can redistribute it and/or modify * 12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by * 13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or * 14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. * 15 * (at your option) any later version. *
16 * * 16 * *
17 ***************************************************************************/ 17 ***************************************************************************/
18 18
19#include "addresspluginwidget.h" 19#include "addresspluginwidget.h"
20 20
21 21
22#include <qpe/config.h> 22#include <qpe/config.h>
23 23
24#include <opie/ocontact.h> 24#include <opie/ocontact.h>
25 25
26AddressBookPluginWidget::AddressBookPluginWidget( QWidget *parent, const char* name ) 26AddressBookPluginWidget::AddressBookPluginWidget( QWidget *parent, const char* name )
27 : QWidget( parent, name ) { 27 : QWidget( parent, name ) {
28 28
29 addressLabel = 0l; 29 addressLabel = 0l;
30 m_contactdb = 0l; 30 m_contactdb = 0l;
31 layoutTodo = 0l; 31 layoutTodo = 0l;
32 32
33 // Hä ? Nonsense ! (se) 33 // Hä ? Nonsense ! (se)
34 if ( m_contactdb ) { 34 if ( m_contactdb ) {
35 delete m_contactdb; 35 delete m_contactdb;
36 } 36 }
37 37
38 m_contactdb = new OContactAccess("addressplugin"); 38 m_contactdb = new OContactAccess("addressplugin");
39 39
40 connect( m_contactdb, SIGNAL( signalChanged( const OContactAccess * ) ), 40 connect( m_contactdb, SIGNAL( signalChanged(const OContactAccess*) ),
41 this, SLOT( refresh( const OContactAccess * ) ) ); 41 this, SLOT( refresh(const OContactAccess*) ) );
42 42
43 43
44 readConfig(); 44 readConfig();
45 getAddress(); 45 getAddress();
46} 46}
47 47
48AddressBookPluginWidget::~AddressBookPluginWidget() { 48AddressBookPluginWidget::~AddressBookPluginWidget() {
49 delete m_contactdb; 49 delete m_contactdb;
50} 50}
51 51
52void AddressBookPluginWidget::refresh( const OContactAccess* ) 52void AddressBookPluginWidget::refresh( const OContactAccess* )
53{ 53{
54 qWarning(" AddressBookPluginWidget::Database was changed externally ! "); 54 qWarning(" AddressBookPluginWidget::Database was changed externally ! ");
55 m_contactdb->reload(); 55 m_contactdb->reload();
56 getAddress(); 56 getAddress();
57} 57}
58 58
59void AddressBookPluginWidget::reinitialize() { 59void AddressBookPluginWidget::reinitialize() {
60 readConfig(); 60 readConfig();
61 getAddress(); 61 getAddress();
62} 62}
63 63
64void AddressBookPluginWidget::readConfig() { 64void AddressBookPluginWidget::readConfig() {
65 Config cfg( "todayaddressplugin" ); 65 Config cfg( "todayaddressplugin" );
66 cfg.setGroup( "config" ); 66 cfg.setGroup( "config" );
67 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); 67 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 );
68 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); 68 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
69 m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); 69 m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 );
70 m_urgentDays = cfg.readNumEntry( "urgentdays", 7 ); 70 m_urgentDays = cfg.readNumEntry( "urgentdays", 7 );
71 m_entryColor = cfg.readEntry("entrycolor", Qt::black.name() ); 71 m_entryColor = cfg.readEntry("entrycolor", Qt::black.name() );
72 m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() ); 72 m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() );
73 m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); 73 m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() );
74 m_showBirthdays = cfg.readBoolEntry( "showBirthdays", true ); 74 m_showBirthdays = cfg.readBoolEntry( "showBirthdays", true );
75 m_showAnniversaries = cfg.readBoolEntry( "showAnniversaries", true ); 75 m_showAnniversaries = cfg.readBoolEntry( "showAnniversaries", true );
76} 76}
77 77
78 78
79/** 79/**
80 * Get the addresss 80 * Get the addresss
81 */ 81 */
82void AddressBookPluginWidget::getAddress() { 82void AddressBookPluginWidget::getAddress() {
83 83
84 if ( ! layoutTodo ){ 84 if ( ! layoutTodo ){
85 layoutTodo = new QVBoxLayout( this ); 85 layoutTodo = new QVBoxLayout( this );
86 } 86 }
87 87
88 if ( ! addressLabel ) { 88 if ( ! addressLabel ) {
89 addressLabel = new OClickableLabel( this ); 89 addressLabel = new OClickableLabel( this );
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
index b6707df..0820802 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
@@ -54,87 +54,87 @@ void DatebookPluginWidget::readConfig() {
54 m_onlyLater = cfg.readNumEntry( "onlylater", 1 ); 54 m_onlyLater = cfg.readNumEntry( "onlylater", 1 );
55 m_moreDays = cfg.readNumEntry( "moredays", 0 ); 55 m_moreDays = cfg.readNumEntry( "moredays", 0 );
56 m_timeExtraLine = cfg.readNumEntry( "timeextraline", 1 ); 56 m_timeExtraLine = cfg.readNumEntry( "timeextraline", 1 );
57} 57}
58 58
59void DatebookPluginWidget::reinitialize() { 59void DatebookPluginWidget::reinitialize() {
60 readConfig(); 60 readConfig();
61 refresh(); 61 refresh();
62} 62}
63 63
64void DatebookPluginWidget::refresh() { 64void DatebookPluginWidget::refresh() {
65 m_eventsList.clear(); 65 m_eventsList.clear();
66 66
67 if ( m_layoutDates ) { 67 if ( m_layoutDates ) {
68 delete m_layoutDates; 68 delete m_layoutDates;
69 } 69 }
70 m_layoutDates = new QVBoxLayout( this ); 70 m_layoutDates = new QVBoxLayout( this );
71 m_layoutDates->setAutoAdd( true ); 71 m_layoutDates->setAutoAdd( true );
72 72
73 getDates(); 73 getDates();
74} 74}
75 75
76/** 76/**
77 * Get all events that are in the datebook xml file for today 77 * Get all events that are in the datebook xml file for today
78 */ 78 */
79void DatebookPluginWidget::getDates() { 79void DatebookPluginWidget::getDates() {
80 80
81 81
82 if ( db ) { 82 if ( db ) {
83 delete db; 83 delete db;
84 } 84 }
85 db = new DateBookDB; 85 db = new DateBookDB;
86 86
87 QDate date = QDate::currentDate(); 87 QDate date = QDate::currentDate();
88 QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); 88 QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) );
89 qBubbleSort( list ); 89 qBubbleSort( list );
90 int count = 0; 90 int count = 0;
91 91
92 if ( list.count() > 0 ) { 92 if ( list.count() > 0 ) {
93 93
94 for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) { 94 for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) {
95 95
96 if ( count < m_max_lines_meet ) { 96 if ( count < m_max_lines_meet ) {
97 if ( !m_onlyLater ) { 97 if ( !m_onlyLater ) {
98 count++; 98 count++;
99 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine ); 99 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine );
100 m_eventsList.append( l ); 100 m_eventsList.append( l );
101 l->show(); 101 l->show();
102 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); 102 QObject::connect ( l, SIGNAL( editEvent(const Event&) ), l, SLOT( editEventSlot(const Event&) ) );
103 } else { 103 } else {
104 if ( ( QDateTime::currentDateTime() <= (*it).event().end() ) 104 if ( ( QDateTime::currentDateTime() <= (*it).event().end() )
105 // Show events which span over many days and are not elapsed. 105 // Show events which span over many days and are not elapsed.
106 || ( ( (*it).event().start().date() != date ) && ( QDateTime::currentDateTime() <= (*it).event().end() ) ) 106 || ( ( (*it).event().start().date() != date ) && ( QDateTime::currentDateTime() <= (*it).event().end() ) )
107 // Show repeated event for today that is not elapsed. 107 // Show repeated event for today that is not elapsed.
108 || ( ( (*it).event().repeatType() != Event::NoRepeat ) 108 || ( ( (*it).event().repeatType() != Event::NoRepeat )
109 && ( ( date.dayOfWeek() == (*it).date().dayOfWeek() ) 109 && ( ( date.dayOfWeek() == (*it).date().dayOfWeek() )
110 && ( QTime::currentTime() < (*it).event().start().time() ) ) ) 110 && ( QTime::currentTime() < (*it).event().start().time() ) ) )
111 // Show repeated event for next days. 111 // Show repeated event for next days.
112 || ( ( (*it).event().repeatType() != Event::NoRepeat ) 112 || ( ( (*it).event().repeatType() != Event::NoRepeat )
113 && ( date.dayOfWeek() != (*it).date().dayOfWeek() ) ) 113 && ( date.dayOfWeek() != (*it).date().dayOfWeek() ) )
114 ) 114 )
115 { 115 {
116 count++; 116 count++;
117 // show only later appointments 117 // show only later appointments
118 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine ); 118 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine );
119 m_eventsList.append( l ); 119 m_eventsList.append( l );
120 l->show(); 120 l->show();
121 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); 121 QObject::connect ( l, SIGNAL( editEvent(const Event&) ), l, SLOT( editEventSlot(const Event&) ) );
122 } 122 }
123 } 123 }
124 } 124 }
125 } 125 }
126 if ( m_onlyLater && count == 0 ) { 126 if ( m_onlyLater && count == 0 ) {
127 QLabel* noMoreEvents = new QLabel( this ); 127 QLabel* noMoreEvents = new QLabel( this );
128 m_eventsList.append( noMoreEvents ); 128 m_eventsList.append( noMoreEvents );
129 noMoreEvents->show(); 129 noMoreEvents->show();
130 noMoreEvents->setText( QObject::tr( "No more appointments today" ) ); 130 noMoreEvents->setText( QObject::tr( "No more appointments today" ) );
131 } 131 }
132 } else { 132 } else {
133 QLabel* noEvents = new QLabel( this ); 133 QLabel* noEvents = new QLabel( this );
134 m_eventsList.append( noEvents ); 134 m_eventsList.append( noEvents );
135 noEvents->show(); 135 noEvents->show();
136 noEvents->setText( QObject::tr( "No appointments today" ) ); 136 noEvents->setText( QObject::tr( "No appointments today" ) );
137 } 137 }
138} 138}
139 139
140 140
diff --git a/core/pim/today/plugins/mail/mailpluginwidget.cpp b/core/pim/today/plugins/mail/mailpluginwidget.cpp
index 4194270..a8e4c41 100644
--- a/core/pim/today/plugins/mail/mailpluginwidget.cpp
+++ b/core/pim/today/plugins/mail/mailpluginwidget.cpp
@@ -1,92 +1,92 @@
1/* 1/*
2 * mailpluginwidget.cpp 2 * mailpluginwidget.cpp
3 * 3 *
4 * copyright : (c) 2002,2003,2004 by Maximilian Reiß 4 * copyright : (c) 2002,2003,2004 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#include "mailpluginwidget.h" 16#include "mailpluginwidget.h"
17 17
18#include <qpe/config.h> 18#include <qpe/config.h>
19#include <qpe/qcopenvelope_qws.h> 19#include <qpe/qcopenvelope_qws.h>
20 20
21MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name) 21MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name)
22 : QWidget(parent, name ) { 22 : QWidget(parent, name ) {
23 23
24 m_mailLabel = 0l; 24 m_mailLabel = 0l;
25 m_layout = 0l; 25 m_layout = 0l;
26 26
27 if ( m_mailLabel ) { 27 if ( m_mailLabel ) {
28 delete m_mailLabel; 28 delete m_mailLabel;
29 } 29 }
30 m_mailLabel = new OClickableLabel( this ); 30 m_mailLabel = new OClickableLabel( this );
31 connect( m_mailLabel, SIGNAL( clicked() ), this, SLOT( startMail() ) ); 31 connect( m_mailLabel, SIGNAL( clicked() ), this, SLOT( startMail() ) );
32 32
33 if ( m_layout ) { 33 if ( m_layout ) {
34 delete m_layout; 34 delete m_layout;
35 } 35 }
36 m_layout = new QHBoxLayout( this ); 36 m_layout = new QHBoxLayout( this );
37 m_layout->setAutoAdd( true ); 37 m_layout->setAutoAdd( true );
38 38
39 39
40#if defined(Q_WS_QWS) 40#if defined(Q_WS_QWS)
41#if !defined(QT_NO_COP) 41#if !defined(QT_NO_COP)
42 QCopChannel *qCopChannel = new QCopChannel( "QPE/Pim" , this ); 42 QCopChannel *qCopChannel = new QCopChannel( "QPE/Pim" , this );
43 connect ( qCopChannel, SIGNAL( received( const QCString &, const QByteArray &) ), 43 connect ( qCopChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
44 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); 44 this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) );
45#endif 45#endif
46#endif 46#endif
47 47
48 readConfig(); 48 readConfig();
49 getInfo(); 49 getInfo();
50} 50}
51 51
52 52
53void MailPluginWidget::channelReceived( const QCString &msg, const QByteArray & data ) { 53void MailPluginWidget::channelReceived( const QCString &msg, const QByteArray & data ) {
54 QDataStream stream( data, IO_ReadOnly ); 54 QDataStream stream( data, IO_ReadOnly );
55 if ( msg == "outgoingMails(int)" ) { 55 if ( msg == "outgoingMails(int)" ) {
56 stream >> m_outgoing; 56 stream >> m_outgoing;
57 } else if ( msg == "newMails(int)" ) { 57 } else if ( msg == "newMails(int)" ) {
58 stream >> m_newMails; 58 stream >> m_newMails;
59 } 59 }
60 getInfo(); 60 getInfo();
61} 61}
62MailPluginWidget::~MailPluginWidget() { 62MailPluginWidget::~MailPluginWidget() {
63 delete m_mailLabel; 63 delete m_mailLabel;
64 delete m_layout; 64 delete m_layout;
65} 65}
66 66
67 67
68void MailPluginWidget::readConfig() { 68void MailPluginWidget::readConfig() {
69 Config cfg( "todaymailplugin" ); 69 Config cfg( "todaymailplugin" );
70 cfg.setGroup( "config" ); 70 cfg.setGroup( "config" );
71 71
72 Config cfg2( "mail" ); 72 Config cfg2( "mail" );
73 cfg2.setGroup( "Status" ); 73 cfg2.setGroup( "Status" );
74 74
75 m_newMails = cfg2.readNumEntry( "newMails", 0 ); 75 m_newMails = cfg2.readNumEntry( "newMails", 0 );
76 m_outgoing = cfg2.readNumEntry( "outgoing", 0 ); 76 m_outgoing = cfg2.readNumEntry( "outgoing", 0 );
77} 77}
78 78
79 79
80void MailPluginWidget::refresh() { 80void MailPluginWidget::refresh() {
81 getInfo(); 81 getInfo();
82} 82}
83 83
84void MailPluginWidget::getInfo() { 84void MailPluginWidget::getInfo() {
85 85
86 86
87 87
88 m_mailLabel->setText( QObject::tr( "<b>%1</b> new mail(s), <b>%2</b> outgoing" ).arg( m_newMails ).arg( m_outgoing ) ); 88 m_mailLabel->setText( QObject::tr( "<b>%1</b> new mail(s), <b>%2</b> outgoing" ).arg( m_newMails ).arg( m_outgoing ) );
89} 89}
90 90
91/** 91/**
92 * launches datebook 92 * launches datebook
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 72cdfd6..812f8b5 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -8,98 +8,98 @@
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#define QTOPIA_INTERNAL_LANGLIST 17#define QTOPIA_INTERNAL_LANGLIST
18 18
19#include "today.h" 19#include "today.h"
20 20
21#include <qpe/config.h> 21#include <qpe/config.h>
22#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23#include <qpe/resource.h> 23#include <qpe/resource.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/contact.h> 25#include <qpe/contact.h>
26 26
27#include <qdir.h> 27#include <qdir.h>
28#include <qtimer.h> 28#include <qtimer.h>
29#include <qwhatsthis.h> 29#include <qwhatsthis.h>
30 30
31struct TodayPlugin { 31struct TodayPlugin {
32 TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} 32 TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {}
33 QLibrary *library; 33 QLibrary *library;
34 QInterfacePtr<TodayPluginInterface> iface; 34 QInterfacePtr<TodayPluginInterface> iface;
35 TodayPluginObject *guiPart; 35 TodayPluginObject *guiPart;
36 QWidget *guiBox; 36 QWidget *guiBox;
37 QString name; 37 QString name;
38 bool active; 38 bool active;
39 bool excludeRefresh; 39 bool excludeRefresh;
40 int pos; 40 int pos;
41}; 41};
42 42
43static QValueList<TodayPlugin> pluginList; 43static QValueList<TodayPlugin> pluginList;
44 44
45static QMap<QString, TodayPlugin> tempList; 45static QMap<QString, TodayPlugin> tempList;
46 46
47Today::Today( QWidget* parent, const char* name, WFlags fl ) 47Today::Today( QWidget* parent, const char* name, WFlags fl )
48 : TodayBase( parent, name, fl ) { 48 : TodayBase( parent, name, fl ) {
49 49
50 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); 50 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) );
51 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); 51 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) );
52 52
53#if defined(Q_WS_QWS) 53#if defined(Q_WS_QWS)
54#if !defined(QT_NO_COP) 54#if !defined(QT_NO_COP)
55 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); 55 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this );
56 connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), 56 connect ( todayChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
57 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); 57 this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) );
58#endif 58#endif
59#endif 59#endif
60 60
61 setOwnerField(); 61 setOwnerField();
62 m_refreshTimer = new QTimer( this ); 62 m_refreshTimer = new QTimer( this );
63 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 63 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
64 m_refreshTimer->start( 15000 ); 64 m_refreshTimer->start( 15000 );
65 m_big_box = 0L; 65 m_big_box = 0L;
66 66
67 67
68 layout = new QVBoxLayout( this ); 68 layout = new QVBoxLayout( this );
69 layout->addWidget( Frame ); 69 layout->addWidget( Frame );
70 layout->addWidget( OwnerField ); 70 layout->addWidget( OwnerField );
71 71
72 m_sv = new QScrollView( this ); 72 m_sv = new QScrollView( this );
73 m_sv->setResizePolicy( QScrollView::AutoOneFit ); 73 m_sv->setResizePolicy( QScrollView::AutoOneFit );
74 m_sv->setHScrollBarMode( QScrollView::AlwaysOff ); 74 m_sv->setHScrollBarMode( QScrollView::AlwaysOff );
75 m_sv->setFrameShape( QFrame::NoFrame ); 75 m_sv->setFrameShape( QFrame::NoFrame );
76 76
77 layout->addWidget( m_sv ); 77 layout->addWidget( m_sv );
78 layout->setStretchFactor( m_sv,4 ); 78 layout->setStretchFactor( m_sv,4 );
79 79
80 qApp->processEvents(); 80 qApp->processEvents();
81 loadPlugins(); 81 loadPlugins();
82 QPEApplication::showWidget( this ); 82 QPEApplication::showWidget( this );
83} 83}
84 84
85/** 85/**
86 * Qcop receive method. 86 * Qcop receive method.
87 */ 87 */
88void Today::channelReceived( const QCString &msg, const QByteArray & data ) { 88void Today::channelReceived( const QCString &msg, const QByteArray & data ) {
89 QDataStream stream( data, IO_ReadOnly ); 89 QDataStream stream( data, IO_ReadOnly );
90 if ( msg == "message(QString)" ) { 90 if ( msg == "message(QString)" ) {
91 QString message; 91 QString message;
92 stream >> message; 92 stream >> message;
93 setOwnerField( message ); 93 setOwnerField( message );
94 } 94 }
95} 95}
96 96
97void Today::setRefreshTimer( int interval ) { 97void Today::setRefreshTimer( int interval ) {
98 98
99 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 99 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
100 100
101 // 0 is "never" case 101 // 0 is "never" case
102 if ( !interval == 0 ) { 102 if ( !interval == 0 ) {
103 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 103 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
104 m_refreshTimer->changeInterval( interval ); 104 m_refreshTimer->changeInterval( interval );
105 } 105 }
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp
index 5c51515..a6f53e1 100644
--- a/core/pim/today/todayconfig.cpp
+++ b/core/pim/today/todayconfig.cpp
@@ -40,97 +40,97 @@ public:
40 setFocusPolicy( QWidget::NoFocus ); 40 setFocusPolicy( QWidget::NoFocus );
41 setToggleButton( t ); 41 setToggleButton( t );
42 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 42 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
43 } 43 }
44}; 44};
45 45
46 46
47/** 47/**
48 * The class has currently quite some duplicate code. 48 * The class has currently quite some duplicate code.
49 * By that way it would be real easy to have it as seperate app in settings tab 49 * By that way it would be real easy to have it as seperate app in settings tab
50 * 50 *
51 */ 51 */
52TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal ) 52TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal )
53 : QDialog( parent, name, modal, WStyle_ContextHelp ) { 53 : QDialog( parent, name, modal, WStyle_ContextHelp ) {
54 54
55 setCaption( tr( "Today Config" ) ); 55 setCaption( tr( "Today Config" ) );
56 56
57 QVBoxLayout *layout = new QVBoxLayout( this ); 57 QVBoxLayout *layout = new QVBoxLayout( this );
58 TabWidget3 = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 58 TabWidget3 = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
59 layout->addWidget( TabWidget3 ); 59 layout->addWidget( TabWidget3 );
60 60
61 tab_2 = new QWidget( TabWidget3, "tab_2" ); 61 tab_2 = new QWidget( TabWidget3, "tab_2" );
62 QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 ); 62 QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 );
63 QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 ); 63 QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 );
64 tab2Layout->addWidget( l ); 64 tab2Layout->addWidget( l );
65 QHBox *hbox1 = new QHBox( tab_2 ); 65 QHBox *hbox1 = new QHBox( tab_2 );
66 m_appletListView = new QListView( hbox1 ); 66 m_appletListView = new QListView( hbox1 );
67 m_appletListView->addColumn( "PluginList" ); 67 m_appletListView->addColumn( "PluginList" );
68 m_appletListView->header()->hide(); 68 m_appletListView->header()->hide();
69 m_appletListView->setSorting( -1 ); 69 m_appletListView->setSorting( -1 );
70 QWhatsThis::add( m_appletListView, tr( "Check a checkbox to activate/deactivate a plugin or use the arrow buttons on the right to change the appearance order" ) ); 70 QWhatsThis::add( m_appletListView, tr( "Check a checkbox to activate/deactivate a plugin or use the arrow buttons on the right to change the appearance order" ) );
71 QVBox *vbox1 = new QVBox( hbox1 ); 71 QVBox *vbox1 = new QVBox( hbox1 );
72 new ToolButton( vbox1, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) ); 72 new ToolButton( vbox1, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) );
73 new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); 73 new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) );
74 tab2Layout->addWidget( hbox1 ); 74 tab2Layout->addWidget( hbox1 );
75 TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) ); 75 TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) );
76 76
77 // Misc tab 77 // Misc tab
78 tab_3 = new QWidget( TabWidget3, "tab_3" ); 78 tab_3 = new QWidget( TabWidget3, "tab_3" );
79 QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); 79 QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 );
80 80
81 m_guiMisc = new TodayConfigMiscBase( tab_3 ); 81 m_guiMisc = new TodayConfigMiscBase( tab_3 );
82 82
83 tab3Layout->addWidget( m_guiMisc ); 83 tab3Layout->addWidget( m_guiMisc );
84 TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); 84 TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) );
85 85
86 m_applets_changed = false; 86 m_applets_changed = false;
87 87
88 connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); 88 connect ( m_appletListView , SIGNAL( clicked(QListViewItem*) ), this, SLOT( appletChanged() ) );
89 89
90 readConfig(); 90 readConfig();
91 QPEApplication::showDialog( this ); 91 QPEApplication::showDialog( this );
92} 92}
93 93
94 94
95/** 95/**
96 * Autostart, uses the new (opie only) autostart method in the launcher code. 96 * Autostart, uses the new (opie only) autostart method in the launcher code.
97 * If registered against that today ist started on each resume. 97 * If registered against that today ist started on each resume.
98 */ 98 */
99void TodayConfig::setAutoStart() { 99void TodayConfig::setAutoStart() {
100 Config cfg( "today" ); 100 Config cfg( "today" );
101 cfg.setGroup( "Autostart" ); 101 cfg.setGroup( "Autostart" );
102 if ( m_autoStart ) { 102 if ( m_autoStart ) {
103 QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); 103 QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" );
104 e << QString( "add" ); 104 e << QString( "add" );
105 e << QString( "today" ); 105 e << QString( "today" );
106 e << QString( "%1" ).arg( m_autoStartTimer ); 106 e << QString( "%1" ).arg( m_autoStartTimer );
107 } else { 107 } else {
108 QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); 108 QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" );
109 e << QString( "remove" ); 109 e << QString( "remove" );
110 e << QString( "today" ); 110 e << QString( "today" );
111 } 111 }
112} 112}
113 113
114/** 114/**
115 * Read the config part 115 * Read the config part
116 */ 116 */
117void TodayConfig::readConfig() { 117void TodayConfig::readConfig() {
118 Config cfg( "today" ); 118 Config cfg( "today" );
119 cfg.setGroup( "Autostart" ); 119 cfg.setGroup( "Autostart" );
120 m_autoStart = cfg.readNumEntry( "autostart", 1 ); 120 m_autoStart = cfg.readNumEntry( "autostart", 1 );
121 m_guiMisc->CheckBoxAuto->setChecked( m_autoStart ); 121 m_guiMisc->CheckBoxAuto->setChecked( m_autoStart );
122 m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 ); 122 m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 );
123 m_guiMisc->SpinBoxTime->setValue( m_autoStartTimer ); 123 m_guiMisc->SpinBoxTime->setValue( m_autoStartTimer );
124 124
125 cfg.setGroup( "General" ); 125 cfg.setGroup( "General" );
126 m_iconSize = cfg.readNumEntry( "IconSize", 18 ); 126 m_iconSize = cfg.readNumEntry( "IconSize", 18 );
127 m_guiMisc->SpinBoxIconSize->setValue( m_iconSize ); 127 m_guiMisc->SpinBoxIconSize->setValue( m_iconSize );
128 m_guiMisc->SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 ); 128 m_guiMisc->SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 );
129 m_guiMisc->CheckBoxHide->setChecked( cfg.readNumEntry( "HideBanner", 0 ) ); 129 m_guiMisc->CheckBoxHide->setChecked( cfg.readNumEntry( "HideBanner", 0 ) );
130 130
131 131
132 cfg.setGroup( "Plugins" ); 132 cfg.setGroup( "Plugins" );
133 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 133 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
134} 134}
135 135
136/** 136/**
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index b68aad2..a244e58 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -144,97 +144,97 @@ void MainWindow::initActions() {
144 m_deleteCompleteAction = a; 144 m_deleteCompleteAction = a;
145 145
146 m_edit->insertSeparator(); 146 m_edit->insertSeparator();
147 147
148 a = new QAction( QString::null, QWidget::tr("Duplicate"), 0, this, 0 ); 148 a = new QAction( QString::null, QWidget::tr("Duplicate"), 0, this, 0 );
149 connect(a, SIGNAL( activated() ), 149 connect(a, SIGNAL( activated() ),
150 this, SLOT( slotDuplicate() ) ); 150 this, SLOT( slotDuplicate() ) );
151 a->addTo(m_edit ); 151 a->addTo(m_edit );
152 m_duplicateAction = a; 152 m_duplicateAction = a;
153 153
154 m_edit->insertSeparator(); 154 m_edit->insertSeparator();
155 155
156 if ( Ir::supported() ) { 156 if ( Ir::supported() ) {
157 a = new QAction( QWidget::tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 ); 157 a = new QAction( QWidget::tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 );
158 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); 158 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) );
159 a->setWhatsThis( QWidget::tr( "Click here to send the current task to another device." ) ); 159 a->setWhatsThis( QWidget::tr( "Click here to send the current task to another device." ) );
160 a->addTo( m_edit ); 160 a->addTo( m_edit );
161 a->addTo( m_tool ); 161 a->addTo( m_tool );
162 } 162 }
163 163
164#if 0 164#if 0
165 // Options menu 165 // Options menu
166 a = new QAction( QWidget::tr("Find"), Resource::loadIconSet( "mag" ), 166 a = new QAction( QWidget::tr("Find"), Resource::loadIconSet( "mag" ),
167 QString::null, 0, this, 0 ); 167 QString::null, 0, this, 0 );
168 connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); 168 connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) );
169 a->addTo( m_options ); 169 a->addTo( m_options );
170 m_findAction = a; 170 m_findAction = a;
171 171
172 172
173 m_options->insertSeparator(); 173 m_options->insertSeparator();
174#endif 174#endif
175 175
176 m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"), 176 m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"),
177 0, this, 0, TRUE ); 177 0, this, 0, TRUE );
178 m_completedAction->addTo( m_options ); 178 m_completedAction->addTo( m_options );
179 m_completedAction->setOn( showCompleted() ); 179 m_completedAction->setOn( showCompleted() );
180 connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); 180 connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) );
181 181
182 a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"), 182 a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"),
183 0, this, 0, TRUE ); 183 0, this, 0, TRUE );
184 a->addTo( m_options ); 184 a->addTo( m_options );
185 a->setOn( showOverDue() ); 185 a->setOn( showOverDue() );
186 connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); 186 connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) );
187 187
188 m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"), 188 m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"),
189 0, this, 0, TRUE ); 189 0, this, 0, TRUE );
190 m_showDeadLineAction->addTo( m_options ); 190 m_showDeadLineAction->addTo( m_options );
191 m_showDeadLineAction->setOn( showDeadline() ); 191 m_showDeadLineAction->setOn( showDeadline() );
192 connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine( bool ) ) ); 192 connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine(bool) ) );
193 193
194 m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"), 194 m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"),
195 0, this, 0, TRUE ); 195 0, this, 0, TRUE );
196 m_showQuickTaskAction->addTo( m_options ); 196 m_showQuickTaskAction->addTo( m_options );
197 m_showQuickTaskAction->setOn( showQuickTask() ); 197 m_showQuickTaskAction->setOn( showQuickTask() );
198 connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) ); 198 connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) );
199 199
200 m_options->insertSeparator(); 200 m_options->insertSeparator();
201 201
202 m_bar->insertItem( QWidget::tr("Data") ,m_edit ); 202 m_bar->insertItem( QWidget::tr("Data") ,m_edit );
203 m_bar->insertItem( QWidget::tr("Category"), m_catMenu ); 203 m_bar->insertItem( QWidget::tr("Category"), m_catMenu );
204 m_bar->insertItem( QWidget::tr("Options"), m_options ); 204 m_bar->insertItem( QWidget::tr("Options"), m_options );
205 205
206 m_curQuick = new QuickEditImpl( this, m_quicktask ); 206 m_curQuick = new QuickEditImpl( this, m_quicktask );
207 addToolBar( (QToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), QMainWindow::Top, TRUE ); 207 addToolBar( (QToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), QMainWindow::Top, TRUE );
208 m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); 208 m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) );
209 209
210} 210}
211/* m_curCat from Config */ 211/* m_curCat from Config */
212void MainWindow::initConfig() { 212void MainWindow::initConfig() {
213 Config config( "todo" ); 213 Config config( "todo" );
214 config.setGroup( "View" ); 214 config.setGroup( "View" );
215 m_completed = config.readBoolEntry( "ShowComplete", TRUE ); 215 m_completed = config.readBoolEntry( "ShowComplete", TRUE );
216 m_curCat = config.readEntry( "Category", QString::null ); 216 m_curCat = config.readEntry( "Category", QString::null );
217 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); 217 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE);
218 m_overdue = config.readBoolEntry("ShowOverDue", FALSE ); 218 m_overdue = config.readBoolEntry("ShowOverDue", FALSE );
219 m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE); 219 m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE);
220} 220}
221void MainWindow::initUI() { 221void MainWindow::initUI() {
222 222
223 m_stack = new OWidgetStack(this, "main stack"); 223 m_stack = new OWidgetStack(this, "main stack");
224 224
225 setCentralWidget( m_stack ); 225 setCentralWidget( m_stack );
226 226
227 setToolBarsMovable( FALSE ); 227 setToolBarsMovable( FALSE );
228 228
229 QToolBar *menubarholder = new QToolBar( this ); 229 QToolBar *menubarholder = new QToolBar( this );
230 menubarholder->setHorizontalStretchable( TRUE ); 230 menubarholder->setHorizontalStretchable( TRUE );
231 m_bar = new QMenuBar( menubarholder ); 231 m_bar = new QMenuBar( menubarholder );
232 232
233 m_tool = new QToolBar( this ); 233 m_tool = new QToolBar( this );
234 234
235 /** QPopupMenu */ 235 /** QPopupMenu */
236 m_edit = new QPopupMenu( this ); 236 m_edit = new QPopupMenu( this );
237 m_options = new QPopupMenu( this ); 237 m_options = new QPopupMenu( this );
238 m_catMenu = new QPopupMenu( this ); 238 m_catMenu = new QPopupMenu( this );
239 m_template = new QPopupMenu( this ); 239 m_template = new QPopupMenu( this );
240 240
diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp
index ab1ce94..d1e50f7 100644
--- a/core/pim/todo/otaskeditor.cpp
+++ b/core/pim/todo/otaskeditor.cpp
@@ -38,53 +38,53 @@ OPimTodo OTaskEditor::todo()const{
38 m_alarm->save( to ); 38 m_alarm->save( to );
39 39
40 return to; 40 return to;
41} 41}
42void OTaskEditor::load(const OPimTodo& to) { 42void OTaskEditor::load(const OPimTodo& to) {
43 m_overView->load( to ); 43 m_overView->load( to );
44 m_stat->load( to ); 44 m_stat->load( to );
45 m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); 45 m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() );
46 m_alarm->load( to ); 46 m_alarm->load( to );
47 47
48 m_todo = to; 48 m_todo = to;
49} 49}
50void OTaskEditor::init() { 50void OTaskEditor::init() {
51 setCaption(tr("Task Editor") ); 51 setCaption(tr("Task Editor") );
52 52
53 QVBoxLayout* layo = new QVBoxLayout( this ); 53 QVBoxLayout* layo = new QVBoxLayout( this );
54 m_tab = new OTabWidget( this ); 54 m_tab = new OTabWidget( this );
55 layo->addWidget( m_tab ); 55 layo->addWidget( m_tab );
56 56
57 /* 57 /*
58 * Add the Widgets 58 * Add the Widgets
59 */ 59 */
60 m_overView = new TaskEditorOverView( m_tab ); 60 m_overView = new TaskEditorOverView( m_tab );
61 m_tab->addTab( m_overView, "todo/info", tr("Information") ); 61 m_tab->addTab( m_overView, "todo/info", tr("Information") );
62 62
63 m_stat = new TaskEditorStatus( m_tab ); 63 m_stat = new TaskEditorStatus( m_tab );
64 m_tab->addTab( m_stat, "todo/TodoList", tr("Status") ); 64 m_tab->addTab( m_stat, "todo/TodoList", tr("Status") );
65 65
66 m_alarm = new TaskEditorAlarms( m_tab ); 66 m_alarm = new TaskEditorAlarms( m_tab );
67 m_tab->addTab( m_alarm, "todo/alarm", tr("Alarms") ); 67 m_tab->addTab( m_alarm, "todo/alarm", tr("Alarms") );
68 68
69// m_remind = new TaskEditorAlarms( m_tab ); 69// m_remind = new TaskEditorAlarms( m_tab );
70// m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") ); 70// m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") );
71 71
72// QLabel* lbl = new QLabel( m_tab ); 72// QLabel* lbl = new QLabel( m_tab );
73// lbl->setText( tr("X-Ref") ); 73// lbl->setText( tr("X-Ref") );
74// m_tab->addTab( lbl, "todo/xref", tr("X-Ref") ); 74// m_tab->addTab( lbl, "todo/xref", tr("X-Ref") );
75 75
76 m_rec = new OPimRecurrenceWidget( true, QDate::currentDate(), this ); 76 m_rec = new OPimRecurrenceWidget( true, QDate::currentDate(), this );
77 m_tab->addTab( m_rec, "repeat", tr("Recurrence") ); 77 m_tab->addTab( m_rec, "repeat", tr("Recurrence") );
78 78
79 79
80 /* signal and slots */ 80 /* signal and slots */
81 connect(m_overView, SIGNAL(recurranceEnabled(bool) ), 81 connect(m_overView, SIGNAL(recurranceEnabled(bool) ),
82 m_rec, SLOT(setEnabled(bool) ) ); 82 m_rec, SLOT(setEnabled(bool) ) );
83 83
84 /* connect due date changed to the recurrence tab */ 84 /* connect due date changed to the recurrence tab */
85 connect(m_stat, SIGNAL(dueDateChanged(const QDate&) ), 85 connect(m_stat, SIGNAL(dueDateChanged(const QDate&) ),
86 m_rec, SLOT(setStartDate(const QDate& ) ) ); 86 m_rec, SLOT(setStartDate(const QDate&) ) );
87 87
88 88
89 m_tab->setCurrentTab( m_overView ); 89 m_tab->setCurrentTab( m_overView );
90} 90}
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp
index 5bbf880..0d298f4 100644
--- a/core/pim/todo/tableview.cpp
+++ b/core/pim/todo/tableview.cpp
@@ -71,104 +71,104 @@ int TableView::EditorWidget::cellCol()const {
71 return m_col; 71 return m_col;
72} 72}
73 73
74 74
75void TableView::initConfig() { 75void TableView::initConfig() {
76 Config config( "todo" ); 76 Config config( "todo" );
77 config.setGroup( "Options" ); 77 config.setGroup( "Options" );
78 m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 ); 78 m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 );
79 for (int i = 0; i < numCols(); i++ ) { 79 for (int i = 0; i < numCols(); i++ ) {
80 int width = config.readNumEntry("Width"+QString::number(i), -1 ); 80 int width = config.readNumEntry("Width"+QString::number(i), -1 );
81 setColumnWidth(i, width == -1 ? columnWidth(i) : width ); 81 setColumnWidth(i, width == -1 ? columnWidth(i) : width );
82 } 82 }
83} 83}
84 84
85TableView::TableView( MainWindow* window, QWidget* wid ) 85TableView::TableView( MainWindow* window, QWidget* wid )
86 : QTable( wid ), TodoView( window ) { 86 : QTable( wid ), TodoView( window ) {
87 87
88 setName("TableView"); 88 setName("TableView");
89 // Load icons 89 // Load icons
90 // TODO - probably should be done globally somewhere else, 90 // TODO - probably should be done globally somewhere else,
91 // see also quickeditimpl.cpp/h, taskeditoroverview.cpp/h 91 // see also quickeditimpl.cpp/h, taskeditoroverview.cpp/h
92 m_pic_completed = Resource::loadPixmap( "todo/completed" ); 92 m_pic_completed = Resource::loadPixmap( "todo/completed" );
93 QString namestr; 93 QString namestr;
94 for ( unsigned int i = 1; i < 6; i++ ) { 94 for ( unsigned int i = 1; i < 6; i++ ) {
95 namestr = "todo/priority"; 95 namestr = "todo/priority";
96 namestr.append( QString::number( i ) ); 96 namestr.append( QString::number( i ) );
97 m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr ); 97 m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr );
98 } 98 }
99 99
100 setUpdatesEnabled( false ); 100 setUpdatesEnabled( false );
101 viewport()->setUpdatesEnabled( false ); 101 viewport()->setUpdatesEnabled( false );
102 m_enablePaint = false; 102 m_enablePaint = false;
103 setNumRows(0); 103 setNumRows(0);
104 setNumCols(4); 104 setNumCols(4);
105 105
106 horizontalHeader()->setLabel( 0, QWidget::tr("C.") ); 106 horizontalHeader()->setLabel( 0, QWidget::tr("C.") );
107 horizontalHeader()->setLabel( 1, QWidget::tr("Priority") ); 107 horizontalHeader()->setLabel( 1, QWidget::tr("Priority") );
108 horizontalHeader()->setLabel( 2, QWidget::tr("Summary" ) ); 108 horizontalHeader()->setLabel( 2, QWidget::tr("Summary" ) );
109 horizontalHeader()->setLabel( 3, QWidget::tr("Deadline") ); 109 horizontalHeader()->setLabel( 3, QWidget::tr("Deadline") );
110 110
111 setShowDeadline( todoWindow()->showDeadline() ); 111 setShowDeadline( todoWindow()->showDeadline() );
112 112
113 setSorting( TRUE ); 113 setSorting( TRUE );
114 setSelectionMode( NoSelection ); 114 setSelectionMode( NoSelection );
115 115
116 setLeftMargin( 0 ); 116 setLeftMargin( 0 );
117 verticalHeader()->hide(); 117 verticalHeader()->hide();
118 118
119 connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ), 119 connect((QTable*)this, SIGNAL( clicked(int,int,int,const QPoint&) ),
120 this, SLOT( slotClicked(int, int, int, const QPoint& ) ) ); 120 this, SLOT( slotClicked(int,int,int,const QPoint&) ) );
121 connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ), 121 connect((QTable*)this, SIGNAL( pressed(int,int,int,const QPoint&) ),
122 this, SLOT( slotPressed(int, int, int, const QPoint& ) ) ); 122 this, SLOT( slotPressed(int,int,int,const QPoint&) ) );
123 connect((QTable*)this, SIGNAL(valueChanged(int, int) ), 123 connect((QTable*)this, SIGNAL(valueChanged(int,int) ),
124 this, SLOT( slotValueChanged(int, int) ) ); 124 this, SLOT( slotValueChanged(int,int) ) );
125 connect((QTable*)this, SIGNAL(currentChanged(int, int) ), 125 connect((QTable*)this, SIGNAL(currentChanged(int,int) ),
126 this, SLOT( slotCurrentChanged(int, int) ) ); 126 this, SLOT( slotCurrentChanged(int,int) ) );
127 127
128 m_menuTimer = new QTimer( this ); 128 m_menuTimer = new QTimer( this );
129 connect( m_menuTimer, SIGNAL(timeout()), 129 connect( m_menuTimer, SIGNAL(timeout()),
130 this, SLOT(slotShowMenu()) ); 130 this, SLOT(slotShowMenu()) );
131 131
132 /* now let's init the config */ 132 /* now let's init the config */
133 initConfig(); 133 initConfig();
134 134
135 135
136 m_enablePaint = true; 136 m_enablePaint = true;
137 setUpdatesEnabled( true ); 137 setUpdatesEnabled( true );
138 viewport()->setUpdatesEnabled( true ); 138 viewport()->setUpdatesEnabled( true );
139 viewport()->update(); 139 viewport()->update();
140 setSortOrder( 0 ); 140 setSortOrder( 0 );
141 setAscending( TRUE ); 141 setAscending( TRUE );
142 m_first = true; 142 m_first = true;
143 143
144 144
145} 145}
146/* a new day has started 146/* a new day has started
147 * update the day 147 * update the day
148 */ 148 */
149void TableView::newDay() { 149void TableView::newDay() {
150 clear(); 150 clear();
151 updateView(); 151 updateView();
152} 152}
153TableView::~TableView() { 153TableView::~TableView() {
154 Config config( "todo" ); 154 Config config( "todo" );
155 config.setGroup( "Options" ); 155 config.setGroup( "Options" );
156 for (int i = 0; i < numCols(); i++ ) 156 for (int i = 0; i < numCols(); i++ )
157 config.writeEntry("Width"+QString::number(i), columnWidth(i) ); 157 config.writeEntry("Width"+QString::number(i), columnWidth(i) );
158} 158}
159void TableView::slotShowMenu() { 159void TableView::slotShowMenu() {
160 QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); 160 QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() );
161 menu->exec(QCursor::pos() ); 161 menu->exec(QCursor::pos() );
162 delete menu; 162 delete menu;
163} 163}
164QString TableView::type() const { 164QString TableView::type() const {
165 return QString::fromLatin1( tr("Table View") ); 165 return QString::fromLatin1( tr("Table View") );
166} 166}
167int TableView::current() { 167int TableView::current() {
168 if (numRows() == 0 ) return 0; 168 if (numRows() == 0 ) return 0;
169 int uid = sorted().uidAt(currentRow() ); 169 int uid = sorted().uidAt(currentRow() );
170 170
171 return uid; 171 return uid;
172} 172}
173int TableView::next() { 173int TableView::next() {
174 if ( numRows() == 0 ) return 0; 174 if ( numRows() == 0 ) return 0;
diff --git a/core/pim/todo/taskeditoralarms.cpp b/core/pim/todo/taskeditoralarms.cpp
index 930c94e..a512fb0 100644
--- a/core/pim/todo/taskeditoralarms.cpp
+++ b/core/pim/todo/taskeditoralarms.cpp
@@ -34,98 +34,98 @@
34#include <qpe/datebookmonth.h> 34#include <qpe/datebookmonth.h>
35#include <qpe/resource.h> 35#include <qpe/resource.h>
36 36
37#include <qlistview.h> 37#include <qlistview.h>
38#include <qlayout.h> 38#include <qlayout.h>
39 39
40 40
41class AlarmItem : public QListViewItem { 41class AlarmItem : public QListViewItem {
42public: 42public:
43 AlarmItem( QListView*, const OPimAlarm& ); 43 AlarmItem( QListView*, const OPimAlarm& );
44 ~AlarmItem(); 44 ~AlarmItem();
45 45
46 OPimAlarm alarm()const; 46 OPimAlarm alarm()const;
47 void setAlarm( const OPimAlarm& ); 47 void setAlarm( const OPimAlarm& );
48private: 48private:
49 QDateTime m_dt; 49 QDateTime m_dt;
50 int m_type; 50 int m_type;
51}; 51};
52AlarmItem::AlarmItem( QListView* view, const OPimAlarm& dt) 52AlarmItem::AlarmItem( QListView* view, const OPimAlarm& dt)
53 : QListViewItem(view) { 53 : QListViewItem(view) {
54 setAlarm( dt ); 54 setAlarm( dt );
55} 55}
56void AlarmItem::setAlarm( const OPimAlarm& dt ) { 56void AlarmItem::setAlarm( const OPimAlarm& dt ) {
57 m_dt = dt.dateTime(); 57 m_dt = dt.dateTime();
58 m_type = dt.sound(); 58 m_type = dt.sound();
59 setText( 0, TimeString::dateString( m_dt.date() ) ); 59 setText( 0, TimeString::dateString( m_dt.date() ) );
60 setText( 1, TimeString::timeString( m_dt.time() ) ); 60 setText( 1, TimeString::timeString( m_dt.time() ) );
61 setText( 2, m_type == 0 ? QObject::tr("silent") : QObject::tr("loud") ); 61 setText( 2, m_type == 0 ? QObject::tr("silent") : QObject::tr("loud") );
62} 62}
63AlarmItem::~AlarmItem() { 63AlarmItem::~AlarmItem() {
64} 64}
65OPimAlarm AlarmItem::alarm()const{ 65OPimAlarm AlarmItem::alarm()const{
66 OPimAlarm al( m_type, m_dt ); 66 OPimAlarm al( m_type, m_dt );
67 67
68 return al; 68 return al;
69} 69}
70 70
71TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, int, const char* name, WFlags fl ) 71TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, int, const char* name, WFlags fl )
72 : QWidget( parent, name, fl ) 72 : QWidget( parent, name, fl )
73{ 73{
74 m_date = m_type = m_time = 0; 74 m_date = m_type = m_time = 0;
75 QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 4 ); 75 QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 4 );
76 76
77 lstAlarms = new QListView( this ); 77 lstAlarms = new QListView( this );
78 lstAlarms->addColumn( tr("Date") ); 78 lstAlarms->addColumn( tr("Date") );
79 lstAlarms->addColumn( tr("Time") ); 79 lstAlarms->addColumn( tr("Time") );
80 lstAlarms->addColumn( tr("Type") ); 80 lstAlarms->addColumn( tr("Type") );
81 81
82 connect( lstAlarms, SIGNAL(clicked ( QListViewItem *, const QPoint &, int ) ), 82 connect( lstAlarms, SIGNAL(clicked(QListViewItem*,const QPoint&,int) ),
83 this, SLOT(inlineEdit(QListViewItem*, const QPoint&, int ) ) ); 83 this, SLOT(inlineEdit(QListViewItem*,const QPoint&,int) ) );
84 84
85 layout->addMultiCellWidget( lstAlarms, 0, 0, 0, 2 ); 85 layout->addMultiCellWidget( lstAlarms, 0, 0, 0, 2 );
86 86
87 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), this ); 87 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), this );
88 //QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); 88 //QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) );
89 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNew() ) ); 89 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNew() ) );
90 layout->addWidget( btn, 1, 0 ); 90 layout->addWidget( btn, 1, 0 );
91/* use when we've reminders too */ 91/* use when we've reminders too */
92#if 0 92#if 0
93 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), this ); 93 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), this );
94 //QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); 94 //QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) );
95 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEdit() ) ); 95 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEdit() ) );
96 layout->addWidget( btn, 1, 1 ); 96 layout->addWidget( btn, 1, 1 );
97#endif 97#endif
98 98
99 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); 99 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this );
100 //QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); 100 //QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) );
101 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDelete() ) ); 101 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDelete() ) );
102 layout->addWidget( btn, 1, 2 ); 102 layout->addWidget( btn, 1, 2 );
103} 103}
104 104
105TaskEditorAlarms::~TaskEditorAlarms(){ 105TaskEditorAlarms::~TaskEditorAlarms(){
106} 106}
107 107
108void TaskEditorAlarms::slotNew(){ 108void TaskEditorAlarms::slotNew(){
109 (void)new AlarmItem(lstAlarms, OPimAlarm(0, QDateTime::currentDateTime() ) ); 109 (void)new AlarmItem(lstAlarms, OPimAlarm(0, QDateTime::currentDateTime() ) );
110} 110}
111 111
112void TaskEditorAlarms::slotEdit(){ 112void TaskEditorAlarms::slotEdit(){
113} 113}
114 114
115void TaskEditorAlarms::slotDelete(){ 115void TaskEditorAlarms::slotDelete(){
116 QListViewItem* item = lstAlarms->currentItem(); 116 QListViewItem* item = lstAlarms->currentItem();
117 if (!item) return; 117 if (!item) return;
118 118
119 lstAlarms->takeItem( item ); delete item; 119 lstAlarms->takeItem( item ); delete item;
120 120
121 121
122} 122}
123 123
124void TaskEditorAlarms::load( const OPimTodo& todo) { 124void TaskEditorAlarms::load( const OPimTodo& todo) {
125 lstAlarms->clear(); 125 lstAlarms->clear();
126 if (!todo.hasNotifiers() ) return; 126 if (!todo.hasNotifiers() ) return;
127 127
128 OPimNotifyManager::Alarms als = todo.notifiers().alarms(); 128 OPimNotifyManager::Alarms als = todo.notifiers().alarms();
129 129
130 if (als.isEmpty() ) return; 130 if (als.isEmpty() ) return;
131 131
diff --git a/core/pim/todo/taskeditorstatus.cpp b/core/pim/todo/taskeditorstatus.cpp
index 367dd58..16351e0 100644
--- a/core/pim/todo/taskeditorstatus.cpp
+++ b/core/pim/todo/taskeditorstatus.cpp
@@ -55,130 +55,130 @@ TaskEditorStatus::TaskEditorStatus( QWidget* parent, const char* name, WFlags f
55 vb->addWidget( sv ); 55 vb->addWidget( sv );
56 sv->setResizePolicy( QScrollView::AutoOneFit ); 56 sv->setResizePolicy( QScrollView::AutoOneFit );
57 sv->setFrameStyle( QFrame::NoFrame ); 57 sv->setFrameStyle( QFrame::NoFrame );
58 58
59 QWidget *container = new QWidget( sv->viewport() ); 59 QWidget *container = new QWidget( sv->viewport() );
60 sv->addChild( container ); 60 sv->addChild( container );
61 61
62 QGridLayout *layout = new QGridLayout( container, 7, 3, 4, 4 ); 62 QGridLayout *layout = new QGridLayout( container, 7, 3, 4, 4 );
63 63
64 // Status 64 // Status
65 QLabel *label = new QLabel( tr( "Status:" ), container ); 65 QLabel *label = new QLabel( tr( "Status:" ), container );
66 layout->addWidget( label, 0, 0 ); 66 layout->addWidget( label, 0, 0 );
67 QWhatsThis::add( label, tr( "Click here to set the current status of this task." ) ); 67 QWhatsThis::add( label, tr( "Click here to set the current status of this task." ) );
68 cmbStatus = new QComboBox( FALSE, container ); 68 cmbStatus = new QComboBox( FALSE, container );
69 cmbStatus->insertItem( tr( "Started" ) ); 69 cmbStatus->insertItem( tr( "Started" ) );
70 cmbStatus->insertItem( tr( "Postponed" ) ); 70 cmbStatus->insertItem( tr( "Postponed" ) );
71 cmbStatus->insertItem( tr( "Finished" ) ); 71 cmbStatus->insertItem( tr( "Finished" ) );
72 cmbStatus->insertItem( tr( "Not started" ) ); 72 cmbStatus->insertItem( tr( "Not started" ) );
73 layout->addMultiCellWidget( cmbStatus, 0, 0, 1, 2 ); 73 layout->addMultiCellWidget( cmbStatus, 0, 0, 1, 2 );
74 QWhatsThis::add( cmbStatus, tr( "Click here to set the current status of this task." ) ); 74 QWhatsThis::add( cmbStatus, tr( "Click here to set the current status of this task." ) );
75 75
76 // Progress 76 // Progress
77 label = new QLabel( tr( "Progress:" ), container ); 77 label = new QLabel( tr( "Progress:" ), container );
78 layout->addWidget( label, 1, 0 ); 78 layout->addWidget( label, 1, 0 );
79 QWhatsThis::add( label, tr( "Select progress made on this task here." ) ); 79 QWhatsThis::add( label, tr( "Select progress made on this task here." ) );
80 cmbProgress = new QComboBox( FALSE, container ); 80 cmbProgress = new QComboBox( FALSE, container );
81 cmbProgress->insertItem( tr( "0 %" ) ); 81 cmbProgress->insertItem( tr( "0 %" ) );
82 cmbProgress->insertItem( tr( "20 %" ) ); 82 cmbProgress->insertItem( tr( "20 %" ) );
83 cmbProgress->insertItem( tr( "40 %" ) ); 83 cmbProgress->insertItem( tr( "40 %" ) );
84 cmbProgress->insertItem( tr( "60 %" ) ); 84 cmbProgress->insertItem( tr( "60 %" ) );
85 cmbProgress->insertItem( tr( "80 %" ) ); 85 cmbProgress->insertItem( tr( "80 %" ) );
86 cmbProgress->insertItem( tr( "100 %" ) ); 86 cmbProgress->insertItem( tr( "100 %" ) );
87 layout->addMultiCellWidget( cmbProgress, 1, 1, 1, 2 ); 87 layout->addMultiCellWidget( cmbProgress, 1, 1, 1, 2 );
88 QWhatsThis::add( cmbProgress, tr( "Select progress made on this task here." ) ); 88 QWhatsThis::add( cmbProgress, tr( "Select progress made on this task here." ) );
89 89
90 // Start date 90 // Start date
91 ckbStart = new QCheckBox( tr( "Start Date:" ), container ); 91 ckbStart = new QCheckBox( tr( "Start Date:" ), container );
92 layout->addWidget( ckbStart, 2, 0 ); 92 layout->addWidget( ckbStart, 2, 0 );
93 QWhatsThis::add( ckbStart, tr( "Click here to set the date this task was started." ) ); 93 QWhatsThis::add( ckbStart, tr( "Click here to set the date this task was started." ) );
94 connect( ckbStart, SIGNAL( clicked() ), this, SLOT( slotStartChecked() ) ); 94 connect( ckbStart, SIGNAL( clicked() ), this, SLOT( slotStartChecked() ) );
95 btnStart = new QPushButton( curDateStr, container ); 95 btnStart = new QPushButton( curDateStr, container );
96 btnStart->setEnabled( FALSE ); 96 btnStart->setEnabled( FALSE );
97 layout->addMultiCellWidget( btnStart, 2, 2, 1, 2 ); 97 layout->addMultiCellWidget( btnStart, 2, 2, 1, 2 );
98 QWhatsThis::add( btnStart, tr( "Click here to set the date this task was started." ) ); 98 QWhatsThis::add( btnStart, tr( "Click here to set the date this task was started." ) );
99 QPopupMenu *popup = new QPopupMenu( this ); 99 QPopupMenu *popup = new QPopupMenu( this );
100 m_startBook = new DateBookMonth( popup, 0, TRUE ); 100 m_startBook = new DateBookMonth( popup, 0, TRUE );
101 popup->insertItem( m_startBook ); 101 popup->insertItem( m_startBook );
102 btnStart->setPopup( popup ); 102 btnStart->setPopup( popup );
103 connect( m_startBook, SIGNAL( dateClicked( int, int, int ) ), 103 connect( m_startBook, SIGNAL( dateClicked(int,int,int) ),
104 this, SLOT( slotStartChanged( int, int, int ) ) ); 104 this, SLOT( slotStartChanged(int,int,int) ) );
105 105
106 // Due date 106 // Due date
107 ckbDue = new QCheckBox( tr( "Due Date:" ), container ); 107 ckbDue = new QCheckBox( tr( "Due Date:" ), container );
108 layout->addWidget( ckbDue, 3, 0 ); 108 layout->addWidget( ckbDue, 3, 0 );
109 QWhatsThis::add( ckbDue, tr( "Click here to set the date this task needs to be completed by." ) ); 109 QWhatsThis::add( ckbDue, tr( "Click here to set the date this task needs to be completed by." ) );
110 connect( ckbDue, SIGNAL( clicked() ), this, SLOT( slotDueChecked() ) ); 110 connect( ckbDue, SIGNAL( clicked() ), this, SLOT( slotDueChecked() ) );
111 btnDue = new QPushButton( curDateStr, container ); 111 btnDue = new QPushButton( curDateStr, container );
112 btnDue->setEnabled( FALSE ); 112 btnDue->setEnabled( FALSE );
113 layout->addMultiCellWidget( btnDue, 3, 3, 1, 2 ); 113 layout->addMultiCellWidget( btnDue, 3, 3, 1, 2 );
114 QWhatsThis::add( btnDue, tr( "Click here to set the date this task needs to be completed by." ) ); 114 QWhatsThis::add( btnDue, tr( "Click here to set the date this task needs to be completed by." ) );
115 popup = new QPopupMenu( this ); 115 popup = new QPopupMenu( this );
116 m_dueBook = new DateBookMonth( popup, 0, TRUE ); 116 m_dueBook = new DateBookMonth( popup, 0, TRUE );
117 popup->insertItem( m_dueBook ); 117 popup->insertItem( m_dueBook );
118 btnDue->setPopup( popup ); 118 btnDue->setPopup( popup );
119 connect( m_dueBook, SIGNAL( dateClicked( int, int, int ) ), 119 connect( m_dueBook, SIGNAL( dateClicked(int,int,int) ),
120 this, SLOT( slotDueChanged( int, int, int ) ) ); 120 this, SLOT( slotDueChanged(int,int,int) ) );
121 121
122 // Completed 122 // Completed
123 ckbComp = new QCheckBox( tr( "Completed:" ), container ); 123 ckbComp = new QCheckBox( tr( "Completed:" ), container );
124 layout->addWidget( ckbComp, 4, 0 ); 124 layout->addWidget( ckbComp, 4, 0 );
125 QWhatsThis::add( ckbComp, tr( "Click here to mark this task as completed." ) ); 125 QWhatsThis::add( ckbComp, tr( "Click here to mark this task as completed." ) );
126 connect( ckbComp, SIGNAL( clicked() ), this, SLOT( slotCompChecked() ) ); 126 connect( ckbComp, SIGNAL( clicked() ), this, SLOT( slotCompChecked() ) );
127 btnComp = new QPushButton( curDateStr, container ); 127 btnComp = new QPushButton( curDateStr, container );
128 btnComp->setEnabled( FALSE ); 128 btnComp->setEnabled( FALSE );
129 layout->addMultiCellWidget( btnComp, 4, 4, 1, 2 ); 129 layout->addMultiCellWidget( btnComp, 4, 4, 1, 2 );
130 QWhatsThis::add( btnComp, tr( "Click here to set the date this task was completed." ) ); 130 QWhatsThis::add( btnComp, tr( "Click here to set the date this task was completed." ) );
131 popup = new QPopupMenu( this ); 131 popup = new QPopupMenu( this );
132 m_compBook = new DateBookMonth( popup, 0, TRUE ); 132 m_compBook = new DateBookMonth( popup, 0, TRUE );
133 popup->insertItem( m_compBook ); 133 popup->insertItem( m_compBook );
134 btnComp->setPopup( popup ); 134 btnComp->setPopup( popup );
135 connect( m_compBook, SIGNAL( dateClicked( int, int, int ) ), 135 connect( m_compBook, SIGNAL( dateClicked(int,int,int) ),
136 this, SLOT( slotCompChanged( int, int, int ) ) ); 136 this, SLOT( slotCompChanged(int,int,int) ) );
137 137
138 QSpacerItem *spacer = new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); 138 QSpacerItem *spacer = new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding );
139 layout->addItem( spacer, 5, 0 ); 139 layout->addItem( spacer, 5, 0 );
140 140
141 // Maintainer mode 141 // Maintainer mode
142#if 0 142#if 0
143 label = new QLabel( tr( "Maintainer Mode:" ), container ); 143 label = new QLabel( tr( "Maintainer Mode:" ), container );
144 layout->addWidget( label, 6, 0 ); 144 layout->addWidget( label, 6, 0 );
145 QWhatsThis::add( label, tr( "Click here to set the maintainer's role." ) ); 145 QWhatsThis::add( label, tr( "Click here to set the maintainer's role." ) );
146 cmbMaintMode = new QComboBox( FALSE, container ); 146 cmbMaintMode = new QComboBox( FALSE, container );
147 cmbMaintMode->insertItem( tr( "Nothing" ) ); 147 cmbMaintMode->insertItem( tr( "Nothing" ) );
148 cmbMaintMode->insertItem( tr( "Responsible" ) ); 148 cmbMaintMode->insertItem( tr( "Responsible" ) );
149 cmbMaintMode->insertItem( tr( "Done By" ) ); 149 cmbMaintMode->insertItem( tr( "Done By" ) );
150 cmbMaintMode->insertItem( tr( "Coordinating" ) ); 150 cmbMaintMode->insertItem( tr( "Coordinating" ) );
151// layout->addMultiCellWidget( cmbMaintMode, 6, 6, 1, 2 ); 151// layout->addMultiCellWidget( cmbMaintMode, 6, 6, 1, 2 );
152 QWhatsThis::add( cmbMaintMode, tr( "Click here to set the maintainer's role." ) ); 152 QWhatsThis::add( cmbMaintMode, tr( "Click here to set the maintainer's role." ) );
153 153
154 // Maintainer 154 // Maintainer
155 label = new QLabel( tr( "Maintainer:" ), container ); 155 label = new QLabel( tr( "Maintainer:" ), container );
156 layout->addWidget( label, 7, 0 ); 156 layout->addWidget( label, 7, 0 );
157 QWhatsThis::add( label, tr( "This is the name of the current task maintainer." ) ); 157 QWhatsThis::add( label, tr( "This is the name of the current task maintainer." ) );
158 txtMaintainer = new QLabel( tr( "test" ), container ); 158 txtMaintainer = new QLabel( tr( "test" ), container );
159 txtMaintainer->setTextFormat( QLabel::RichText ); 159 txtMaintainer->setTextFormat( QLabel::RichText );
160 layout->addWidget( txtMaintainer, 7, 1 ); 160 layout->addWidget( txtMaintainer, 7, 1 );
161 QWhatsThis::add( txtMaintainer, tr( "This is the name of the current task maintainer." ) ); 161 QWhatsThis::add( txtMaintainer, tr( "This is the name of the current task maintainer." ) );
162 tbtMaintainer = new QToolButton( container ); 162 tbtMaintainer = new QToolButton( container );
163 tbtMaintainer->setPixmap( Resource::loadPixmap( "todo/more" ) ); 163 tbtMaintainer->setPixmap( Resource::loadPixmap( "todo/more" ) );
164// layout->addWidget( tbtMaintainer, 7, 2 ); 164// layout->addWidget( tbtMaintainer, 7, 2 );
165 QWhatsThis::add( tbtMaintainer, tr( "Click here to select the task maintainer." ) ); 165 QWhatsThis::add( tbtMaintainer, tr( "Click here to select the task maintainer." ) );
166#endif 166#endif
167} 167}
168 168
169TaskEditorStatus::~TaskEditorStatus() 169TaskEditorStatus::~TaskEditorStatus()
170{ 170{
171} 171}
172 172
173void TaskEditorStatus::load( const OPimTodo &todo ) 173void TaskEditorStatus::load( const OPimTodo &todo )
174{ 174{
175 QDate date = QDate::currentDate(); 175 QDate date = QDate::currentDate();
176 QString str = TimeString::longDateString( date ); 176 QString str = TimeString::longDateString( date );
177 177
178 // Status 178 // Status
179 int state = todo.hasState()? todo.state().state() : OPimState::NotStarted; 179 int state = todo.hasState()? todo.state().state() : OPimState::NotStarted;
180 if ( state == OPimState::Undefined ) 180 if ( state == OPimState::Undefined )
181 state = OPimState::NotStarted; 181 state = OPimState::NotStarted;
182 cmbStatus->setCurrentItem( state ); 182 cmbStatus->setCurrentItem( state );
183 183
184 // Progress 184 // Progress
diff --git a/core/qws/qcopbridge.cpp b/core/qws/qcopbridge.cpp
index c0c52e8..4fd0807 100644
--- a/core/qws/qcopbridge.cpp
+++ b/core/qws/qcopbridge.cpp
@@ -9,118 +9,118 @@
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 "qcopbridge.h" 21#include "qcopbridge.h"
22#include "transferserver.h" 22#include "transferserver.h"
23 23
24#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.h>
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#include <qpe/version.h> 26#include <qpe/version.h>
27 27
28#include <qtextstream.h> 28#include <qtextstream.h>
29#ifdef QWS 29#ifdef QWS
30#include <qcopchannel_qws.h> 30#include <qcopchannel_qws.h>
31#endif 31#endif
32 32
33#define _XOPEN_SOURCE 33#define _XOPEN_SOURCE
34#include <pwd.h> 34#include <pwd.h>
35#include <sys/types.h> 35#include <sys/types.h>
36#include <unistd.h> 36#include <unistd.h>
37 37
38#if defined(_OS_LINUX_) 38#if defined(_OS_LINUX_)
39#include <shadow.h> 39#include <shadow.h>
40#endif 40#endif
41 41
42//#define INSECURE 42//#define INSECURE
43 43
44const int block_size = 51200; 44const int block_size = 51200;
45 45
46QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent , 46QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent ,
47 const char* name ) 47 const char* name )
48 : QServerSocket( port, 1, parent, name ), 48 : QServerSocket( port, 1, parent, name ),
49 desktopChannel( 0 ), 49 desktopChannel( 0 ),
50 cardChannel( 0 ) 50 cardChannel( 0 )
51{ 51{
52 if ( !ok() ) 52 if ( !ok() )
53 qWarning( "Failed to bind to port %d", port ); 53 qWarning( "Failed to bind to port %d", port );
54 else { 54 else {
55#ifndef QT_NO_COP 55#ifndef QT_NO_COP
56 desktopChannel = new QCopChannel( "QPE/Desktop", this ); 56 desktopChannel = new QCopChannel( "QPE/Desktop", this );
57 connect( desktopChannel, SIGNAL(received(const QCString &, const QByteArray &)), 57 connect( desktopChannel, SIGNAL(received(const QCString&,const QByteArray&)),
58 this, SLOT(desktopMessage( const QCString &, const QByteArray &)) ); 58 this, SLOT(desktopMessage(const QCString&,const QByteArray&)) );
59 cardChannel = new QCopChannel( "QPE/Card", this ); 59 cardChannel = new QCopChannel( "QPE/Card", this );
60 connect( cardChannel, SIGNAL(received(const QCString &, const QByteArray &)), 60 connect( cardChannel, SIGNAL(received(const QCString&,const QByteArray&)),
61 this, SLOT(desktopMessage( const QCString &, const QByteArray &)) ); 61 this, SLOT(desktopMessage(const QCString&,const QByteArray&)) );
62#endif 62#endif
63 } 63 }
64 sendSync = FALSE; 64 sendSync = FALSE;
65} 65}
66 66
67QCopBridge::~QCopBridge() 67QCopBridge::~QCopBridge()
68{ 68{
69#ifndef QT_NO_COP 69#ifndef QT_NO_COP
70 delete desktopChannel; 70 delete desktopChannel;
71#endif 71#endif
72} 72}
73 73
74void QCopBridge::newConnection( int socket ) 74void QCopBridge::newConnection( int socket )
75{ 75{
76 QCopBridgePI *pi = new QCopBridgePI( socket, this ); 76 QCopBridgePI *pi = new QCopBridgePI( socket, this );
77 openConnections.append( pi ); 77 openConnections.append( pi );
78 connect ( pi, SIGNAL( connectionClosed( QCopBridgePI *) ), this, SLOT( connectionClosed( QCopBridgePI *) ) ); 78 connect ( pi, SIGNAL( connectionClosed(QCopBridgePI*) ), this, SLOT( connectionClosed(QCopBridgePI*) ) );
79#ifndef QT_NO_COP 79#ifndef QT_NO_COP
80 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; 80 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend;
81#endif 81#endif
82 82
83 if ( sendSync ) { 83 if ( sendSync ) {
84 pi ->startSync(); 84 pi ->startSync();
85 sendSync = FALSE; 85 sendSync = FALSE;
86 } 86 }
87} 87}
88 88
89void QCopBridge::connectionClosed( QCopBridgePI *pi ) 89void QCopBridge::connectionClosed( QCopBridgePI *pi )
90{ 90{
91 openConnections.remove( pi ); 91 openConnections.remove( pi );
92 if ( openConnections.count() == 0 ) { 92 if ( openConnections.count() == 0 ) {
93#ifndef QT_NO_COP 93#ifndef QT_NO_COP
94 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 94 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
95#endif 95#endif
96 } 96 }
97} 97}
98 98
99void QCopBridge::closeOpenConnections() 99void QCopBridge::closeOpenConnections()
100{ 100{
101 QCopBridgePI *pi; 101 QCopBridgePI *pi;
102 for ( pi = openConnections.first(); pi != 0; pi = openConnections.next() ) 102 for ( pi = openConnections.first(); pi != 0; pi = openConnections.next() )
103 pi->close(); 103 pi->close();
104} 104}
105 105
106 106
107void QCopBridge::desktopMessage( const QCString &command, const QByteArray &args ) 107void QCopBridge::desktopMessage( const QCString &command, const QByteArray &args )
108{ 108{
109 command.stripWhiteSpace(); 109 command.stripWhiteSpace();
110 110
111 int paren = command.find( "(" ); 111 int paren = command.find( "(" );
112 if ( paren <= 0 ) { 112 if ( paren <= 0 ) {
113 qDebug("DesktopMessage: bad qcop syntax"); 113 qDebug("DesktopMessage: bad qcop syntax");
114 return; 114 return;
115 } 115 }
116 116
117 QString params = command.mid( paren + 1 ); 117 QString params = command.mid( paren + 1 );
118 if ( params[params.length()-1] != ')' ) { 118 if ( params[params.length()-1] != ')' ) {
119 qDebug("DesktopMessage: bad qcop syntax"); 119 qDebug("DesktopMessage: bad qcop syntax");
120 return; 120 return;
121 } 121 }
122 122
123 params.truncate( params.length()-1 ); 123 params.truncate( params.length()-1 );
124 124
125 QStringList paramList = QStringList::split( ",", params ); 125 QStringList paramList = QStringList::split( ",", params );
126 QString data; 126 QString data;
diff --git a/core/qws/transferserver.cpp b/core/qws/transferserver.cpp
index 30bf438..daf63ec 100644
--- a/core/qws/transferserver.cpp
+++ b/core/qws/transferserver.cpp
@@ -249,109 +249,109 @@ bool SyncAuthentication::checkPassword( const QString& password )
249 "<p>If you have just initiated a Sync for the first time, this is normal."), 249 "<p>If you have just initiated a Sync for the first time, this is normal."),
250 tr("Allow"), tr("Deny"), 0, 1, 1 ) == 1 ) { 250 tr("Allow"), tr("Deny"), 0, 1, 1 ) == 1 ) {
251 denials++; 251 denials++;
252 lastdenial = now; 252 lastdenial = now;
253 return FALSE; 253 return FALSE;
254 } 254 }
255 else { 255 else {
256 denials = 0; 256 denials = 0;
257 cfg.writeEntry("Passwords", pwds + " " + cpassword); 257 cfg.writeEntry("Passwords", pwds + " " + cpassword);
258 return TRUE; 258 return TRUE;
259 } 259 }
260 } 260 }
261 261
262 return FALSE; 262 return FALSE;
263} 263}
264 264
265ServerPI::ServerPI( int socket, QObject *parent , const char* name ) 265ServerPI::ServerPI( int socket, QObject *parent , const char* name )
266 : QSocket( parent, name ) , dtp( 0 ), serversocket( 0 ), waitsocket( 0 ) 266 : QSocket( parent, name ) , dtp( 0 ), serversocket( 0 ), waitsocket( 0 )
267{ 267{
268 state = Connected; 268 state = Connected;
269 269
270 setSocket( socket ); 270 setSocket( socket );
271 271
272 peerport = peerPort(); 272 peerport = peerPort();
273 peeraddress = peerAddress(); 273 peeraddress = peerAddress();
274 274
275#ifndef INSECURE 275#ifndef INSECURE
276 276
277 if ( !SyncAuthentication::isAuthorized(peeraddress) ) { 277 if ( !SyncAuthentication::isAuthorized(peeraddress) ) {
278 state = Forbidden; 278 state = Forbidden;
279 startTimer( 0 ); 279 startTimer( 0 );
280 } 280 }
281 else 281 else
282#endif 282#endif
283 { 283 {
284 connect( this, SIGNAL( readyRead() ), SLOT( read() ) ); 284 connect( this, SIGNAL( readyRead() ), SLOT( read() ) );
285 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); 285 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) );
286 286
287 passiv = FALSE; 287 passiv = FALSE;
288 for ( int i = 0; i < 4; i++ ) 288 for ( int i = 0; i < 4; i++ )
289 wait[i] = FALSE; 289 wait[i] = FALSE;
290 290
291 send( "220 Qtopia " QPE_VERSION " FTP Server" ); 291 send( "220 Qtopia " QPE_VERSION " FTP Server" );
292 state = Wait_USER; 292 state = Wait_USER;
293 293
294 dtp = new ServerDTP( this ); 294 dtp = new ServerDTP( this );
295 connect( dtp, SIGNAL( completed() ), SLOT( dtpCompleted() ) ); 295 connect( dtp, SIGNAL( completed() ), SLOT( dtpCompleted() ) );
296 connect( dtp, SIGNAL( failed() ), SLOT( dtpFailed() ) ); 296 connect( dtp, SIGNAL( failed() ), SLOT( dtpFailed() ) );
297 connect( dtp, SIGNAL( error( int ) ), SLOT( dtpError( int ) ) ); 297 connect( dtp, SIGNAL( error(int) ), SLOT( dtpError(int) ) );
298 298
299 299
300 directory = QDir::currentDirPath(); 300 directory = QDir::currentDirPath();
301 301
302 static int p = 1024; 302 static int p = 1024;
303 303
304 while ( !serversocket || !serversocket->ok() ) { 304 while ( !serversocket || !serversocket->ok() ) {
305 delete serversocket; 305 delete serversocket;
306 serversocket = new ServerSocket( ++p, this ); 306 serversocket = new ServerSocket( ++p, this );
307 } 307 }
308 connect( serversocket, SIGNAL( newIncomming( int ) ), 308 connect( serversocket, SIGNAL( newIncomming(int) ),
309 SLOT( newConnection( int ) ) ); 309 SLOT( newConnection(int) ) );
310 } 310 }
311} 311}
312 312
313ServerPI::~ServerPI() 313ServerPI::~ServerPI()
314{ 314{
315} 315}
316 316
317void ServerPI::connectionClosed() 317void ServerPI::connectionClosed()
318{ 318{
319 // qDebug( "Debug: Connection closed" ); 319 // qDebug( "Debug: Connection closed" );
320 delete this; 320 delete this;
321} 321}
322 322
323void ServerPI::send( const QString& msg ) 323void ServerPI::send( const QString& msg )
324{ 324{
325 QTextStream os( this ); 325 QTextStream os( this );
326 os << msg << endl; 326 os << msg << endl;
327 //qDebug( "Reply: %s", msg.latin1() ); 327 //qDebug( "Reply: %s", msg.latin1() );
328} 328}
329 329
330void ServerPI::read() 330void ServerPI::read()
331{ 331{
332 while ( canReadLine() ) 332 while ( canReadLine() )
333 process( readLine().stripWhiteSpace() ); 333 process( readLine().stripWhiteSpace() );
334} 334}
335 335
336bool ServerPI::checkReadFile( const QString& file ) 336bool ServerPI::checkReadFile( const QString& file )
337{ 337{
338 QString filename; 338 QString filename;
339 339
340 if ( file[0] != "/" ) 340 if ( file[0] != "/" )
341 filename = directory.path() + "/" + file; 341 filename = directory.path() + "/" + file;
342 else 342 else
343 filename = file; 343 filename = file;
344 344
345 QFileInfo fi( filename ); 345 QFileInfo fi( filename );
346 return ( fi.exists() && fi.isReadable() ); 346 return ( fi.exists() && fi.isReadable() );
347} 347}
348 348
349bool ServerPI::checkWriteFile( const QString& file ) 349bool ServerPI::checkWriteFile( const QString& file )
350{ 350{
351 QString filename; 351 QString filename;
352 352
353 if ( file[0] != "/" ) 353 if ( file[0] != "/" )
354 filename = directory.path() + "/" + file; 354 filename = directory.path() + "/" + file;
355 else 355 else
356 filename = file; 356 filename = file;
357 357
@@ -1001,112 +1001,112 @@ void ServerPI::newConnection( int socket )
1001 if ( backupRestoreGzip( waitfile ) ) 1001 if ( backupRestoreGzip( waitfile ) )
1002 dtp->retrieveGzipFile( waitfile ); 1002 dtp->retrieveGzipFile( waitfile );
1003 else 1003 else
1004 dtp->retrieveFile( waitfile ); 1004 dtp->retrieveFile( waitfile );
1005 dtp->setSocket( socket ); 1005 dtp->setSocket( socket );
1006 } 1006 }
1007 else if ( wait[SendByteArray] ) { 1007 else if ( wait[SendByteArray] ) {
1008 dtp->sendByteArray( waitarray ); 1008 dtp->sendByteArray( waitarray );
1009 dtp->setSocket( socket ); 1009 dtp->setSocket( socket );
1010 } 1010 }
1011 else if ( wait[RetrieveByteArray] ) { 1011 else if ( wait[RetrieveByteArray] ) {
1012 qDebug("retrieve byte array"); 1012 qDebug("retrieve byte array");
1013 dtp->retrieveByteArray(); 1013 dtp->retrieveByteArray();
1014 dtp->setSocket( socket ); 1014 dtp->setSocket( socket );
1015 } 1015 }
1016 else 1016 else
1017 waitsocket = socket; 1017 waitsocket = socket;
1018 1018
1019 for ( int i = 0; i < 4; i++ ) 1019 for ( int i = 0; i < 4; i++ )
1020 wait[i] = FALSE; 1020 wait[i] = FALSE;
1021} 1021}
1022 1022
1023QString ServerPI::absFilePath( const QString& file ) 1023QString ServerPI::absFilePath( const QString& file )
1024{ 1024{
1025 if ( file.isEmpty() ) 1025 if ( file.isEmpty() )
1026 return file; 1026 return file;
1027 1027
1028 QString filepath( file ); 1028 QString filepath( file );
1029 if ( file[0] != "/" ) 1029 if ( file[0] != "/" )
1030 filepath = directory.path() + "/" + file; 1030 filepath = directory.path() + "/" + file;
1031 1031
1032 return filepath; 1032 return filepath;
1033} 1033}
1034 1034
1035 1035
1036void ServerPI::timerEvent( QTimerEvent * ) 1036void ServerPI::timerEvent( QTimerEvent * )
1037{ 1037{
1038 connectionClosed(); 1038 connectionClosed();
1039} 1039}
1040 1040
1041 1041
1042ServerDTP::ServerDTP( QObject *parent, const char* name) 1042ServerDTP::ServerDTP( QObject *parent, const char* name)
1043 : QSocket( parent, name ), mode( Idle ), createTargzProc( 0 ), 1043 : QSocket( parent, name ), mode( Idle ), createTargzProc( 0 ),
1044 retrieveTargzProc( 0 ), gzipProc( 0 ) 1044 retrieveTargzProc( 0 ), gzipProc( 0 )
1045{ 1045{
1046 1046
1047 connect( this, SIGNAL( connected() ), SLOT( connected() ) ); 1047 connect( this, SIGNAL( connected() ), SLOT( connected() ) );
1048 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); 1048 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) );
1049 connect( this, SIGNAL( bytesWritten( int ) ), SLOT( bytesWritten( int ) ) ); 1049 connect( this, SIGNAL( bytesWritten(int) ), SLOT( bytesWritten(int) ) );
1050 connect( this, SIGNAL( readyRead() ), SLOT( readyRead() ) ); 1050 connect( this, SIGNAL( readyRead() ), SLOT( readyRead() ) );
1051 1051
1052 gzipProc = new OProcess( this, "gzipProc" ); 1052 gzipProc = new OProcess( this, "gzipProc" );
1053 1053
1054 createTargzProc = new OProcess( QString("tar"), this, "createTargzProc"); 1054 createTargzProc = new OProcess( QString("tar"), this, "createTargzProc");
1055 createTargzProc->setWorkingDirectory( QDir::rootDirPath() ); 1055 createTargzProc->setWorkingDirectory( QDir::rootDirPath() );
1056 connect( createTargzProc, SIGNAL( processExited(OProcess *) ), SLOT( targzDone() ) ); 1056 connect( createTargzProc, SIGNAL( processExited(OProcess*) ), SLOT( targzDone() ) );
1057 1057
1058 QStringList args = "tar"; 1058 QStringList args = "tar";
1059 args += "-xv"; 1059 args += "-xv";
1060 retrieveTargzProc = new OProcess( args, this, "retrieveTargzProc" ); 1060 retrieveTargzProc = new OProcess( args, this, "retrieveTargzProc" );
1061 retrieveTargzProc->setWorkingDirectory( QDir::rootDirPath() ); 1061 retrieveTargzProc->setWorkingDirectory( QDir::rootDirPath() );
1062 connect( retrieveTargzProc, SIGNAL( processExited(OProcess *) ), 1062 connect( retrieveTargzProc, SIGNAL( processExited(OProcess*) ),
1063 SIGNAL( completed() ) ); 1063 SIGNAL( completed() ) );
1064 connect( retrieveTargzProc, SIGNAL( processExited(OProcess *) ), 1064 connect( retrieveTargzProc, SIGNAL( processExited(OProcess*) ),
1065 SLOT( extractTarDone() ) ); 1065 SLOT( extractTarDone() ) );
1066} 1066}
1067 1067
1068ServerDTP::~ServerDTP() 1068ServerDTP::~ServerDTP()
1069{ 1069{
1070 buf.close(); 1070 buf.close();
1071 file.close(); 1071 file.close();
1072 createTargzProc->kill(); 1072 createTargzProc->kill();
1073} 1073}
1074 1074
1075void ServerDTP::extractTarDone() 1075void ServerDTP::extractTarDone()
1076{ 1076{
1077 qDebug("extract done"); 1077 qDebug("extract done");
1078#ifndef QT_NO_COP 1078#ifndef QT_NO_COP
1079 1079
1080 QCopEnvelope e( "QPE/Desktop", "restoreDone(QString)" ); 1080 QCopEnvelope e( "QPE/Desktop", "restoreDone(QString)" );
1081 e << file.name(); 1081 e << file.name();
1082#endif 1082#endif
1083} 1083}
1084 1084
1085void ServerDTP::connected() 1085void ServerDTP::connected()
1086{ 1086{
1087 // send file mode 1087 // send file mode
1088 switch ( mode ) { 1088 switch ( mode ) {
1089 case SendFile : 1089 case SendFile :
1090 if ( !file.exists() || !file.open( IO_ReadOnly) ) { 1090 if ( !file.exists() || !file.open( IO_ReadOnly) ) {
1091 emit failed(); 1091 emit failed();
1092 mode = Idle; 1092 mode = Idle;
1093 return ; 1093 return ;
1094 } 1094 }
1095 1095
1096 //qDebug( "Debug: Sending file '%s'", file.name().latin1() ); 1096 //qDebug( "Debug: Sending file '%s'", file.name().latin1() );
1097 1097
1098 bytes_written = 0; 1098 bytes_written = 0;
1099 if ( file.size() == 0 ) { 1099 if ( file.size() == 0 ) {
1100 //make sure it doesn't hang on empty files 1100 //make sure it doesn't hang on empty files
1101 file.close(); 1101 file.close();
1102 emit completed(); 1102 emit completed();
1103 mode = Idle; 1103 mode = Idle;
1104 } 1104 }
1105 else { 1105 else {
1106 1106
1107 if ( !file.atEnd() ) { 1107 if ( !file.atEnd() ) {
1108 QCString s; 1108 QCString s;
1109 s.resize( block_size ); 1109 s.resize( block_size );
1110 int bytes = file.readBlock( s.data(), block_size ); 1110 int bytes = file.readBlock( s.data(), block_size );
1111 writeBlock( s.data(), bytes ); 1111 writeBlock( s.data(), bytes );
1112 } 1112 }
@@ -1236,169 +1236,169 @@ void ServerDTP::bytesWritten( int bytes )
1236 1236
1237 // send buffer mode 1237 // send buffer mode
1238 if ( SendBuffer == mode ) { 1238 if ( SendBuffer == mode ) {
1239 1239
1240 if ( bytes_written == buf.size() ) { 1240 if ( bytes_written == buf.size() ) {
1241 // qDebug( "Debug: Sending complete: %d bytes", buf.size() ); 1241 // qDebug( "Debug: Sending complete: %d bytes", buf.size() );
1242 emit completed(); 1242 emit completed();
1243 mode = Idle; 1243 mode = Idle;
1244 } 1244 }
1245 } 1245 }
1246} 1246}
1247 1247
1248void ServerDTP::readyRead() 1248void ServerDTP::readyRead()
1249{ 1249{
1250 // retrieve file mode 1250 // retrieve file mode
1251 if ( RetrieveFile == mode ) { 1251 if ( RetrieveFile == mode ) {
1252 QCString s; 1252 QCString s;
1253 s.resize( bytesAvailable() ); 1253 s.resize( bytesAvailable() );
1254 readBlock( s.data(), bytesAvailable() ); 1254 readBlock( s.data(), bytesAvailable() );
1255 file.writeBlock( s.data(), s.size() ); 1255 file.writeBlock( s.data(), s.size() );
1256 } 1256 }
1257 else if ( RetrieveGzipFile == mode ) { 1257 else if ( RetrieveGzipFile == mode ) {
1258 if ( !gzipProc->isRunning() ) 1258 if ( !gzipProc->isRunning() )
1259 gzipProc->start(OProcess::NotifyOnExit, (OProcess::Communication) ( OProcess::Stdin | OProcess::Stdout )); 1259 gzipProc->start(OProcess::NotifyOnExit, (OProcess::Communication) ( OProcess::Stdin | OProcess::Stdout ));
1260 1260
1261 QByteArray s; 1261 QByteArray s;
1262 s.resize( bytesAvailable() ); 1262 s.resize( bytesAvailable() );
1263 readBlock( s.data(), bytesAvailable() ); 1263 readBlock( s.data(), bytesAvailable() );
1264 gzipProc->writeStdin( s.data(), s.size() ); 1264 gzipProc->writeStdin( s.data(), s.size() );
1265 qDebug("wrote %d bytes to ungzip ", s.size() ); 1265 qDebug("wrote %d bytes to ungzip ", s.size() );
1266 } 1266 }
1267 // retrieve buffer mode 1267 // retrieve buffer mode
1268 else if ( RetrieveBuffer == mode ) { 1268 else if ( RetrieveBuffer == mode ) {
1269 QCString s; 1269 QCString s;
1270 s.resize( bytesAvailable() ); 1270 s.resize( bytesAvailable() );
1271 readBlock( s.data(), bytesAvailable() ); 1271 readBlock( s.data(), bytesAvailable() );
1272 buf.writeBlock( s.data(), s.size() ); 1272 buf.writeBlock( s.data(), s.size() );
1273 } 1273 }
1274} 1274}
1275 1275
1276void ServerDTP::writeTargzBlock(OProcess *, char *buffer, int buflen) 1276void ServerDTP::writeTargzBlock(OProcess *, char *buffer, int buflen)
1277{ 1277{
1278 writeBlock( buffer, buflen ); 1278 writeBlock( buffer, buflen );
1279 qDebug("writeTargzBlock %d", buflen); 1279 qDebug("writeTargzBlock %d", buflen);
1280 if ( !createTargzProc->isRunning() ) { 1280 if ( !createTargzProc->isRunning() ) {
1281 qDebug("tar and gzip done"); 1281 qDebug("tar and gzip done");
1282 emit completed(); 1282 emit completed();
1283 mode = Idle; 1283 mode = Idle;
1284 disconnect( gzipProc, SIGNAL( receivedStdout(OProcess *, char *, int ) ), 1284 disconnect( gzipProc, SIGNAL( receivedStdout(OProcess*,char*,int) ),
1285 this, SLOT( writeTargzBlock(OProcess *, char *, int) ) ); 1285 this, SLOT( writeTargzBlock(OProcess*,char*,int) ) );
1286 } 1286 }
1287} 1287}
1288 1288
1289void ServerDTP::targzDone() 1289void ServerDTP::targzDone()
1290{ 1290{
1291 //qDebug("targz done"); 1291 //qDebug("targz done");
1292 disconnect( createTargzProc, SIGNAL( receivedStdout(OProcess *, char *, int) ), 1292 disconnect( createTargzProc, SIGNAL( receivedStdout(OProcess*,char*,int) ),
1293 this, SLOT( gzipTarBlock(OProcess *, char *, int) ) ); 1293 this, SLOT( gzipTarBlock(OProcess*,char*,int) ) );
1294 gzipProc->closeStdin(); 1294 gzipProc->closeStdin();
1295} 1295}
1296 1296
1297void ServerDTP::gzipTarBlock(OProcess *, char *buffer, int buflen) 1297void ServerDTP::gzipTarBlock(OProcess *, char *buffer, int buflen)
1298{ 1298{
1299 //qDebug("gzipTarBlock"); 1299 //qDebug("gzipTarBlock");
1300 if ( !gzipProc->isRunning() ) { 1300 if ( !gzipProc->isRunning() ) {
1301 //qDebug("auto start gzip proc"); 1301 //qDebug("auto start gzip proc");
1302 gzipProc->start(OProcess::NotifyOnExit, (OProcess::Communication) ( OProcess::Stdin | OProcess::Stdout )); 1302 gzipProc->start(OProcess::NotifyOnExit, (OProcess::Communication) ( OProcess::Stdin | OProcess::Stdout ));
1303 } 1303 }
1304 gzipProc->writeStdin( buffer, buflen ); 1304 gzipProc->writeStdin( buffer, buflen );
1305} 1305}
1306 1306
1307void ServerDTP::sendFile( const QString fn, const QHostAddress& host, Q_UINT16 port ) 1307void ServerDTP::sendFile( const QString fn, const QHostAddress& host, Q_UINT16 port )
1308{ 1308{
1309 file.setName( fn ); 1309 file.setName( fn );
1310 mode = SendFile; 1310 mode = SendFile;
1311 connectToHost( host.toString(), port ); 1311 connectToHost( host.toString(), port );
1312} 1312}
1313 1313
1314void ServerDTP::sendFile( const QString fn ) 1314void ServerDTP::sendFile( const QString fn )
1315{ 1315{
1316 file.setName( fn ); 1316 file.setName( fn );
1317 mode = SendFile; 1317 mode = SendFile;
1318} 1318}
1319 1319
1320void ServerDTP::sendGzipFile( const QString &fn, 1320void ServerDTP::sendGzipFile( const QString &fn,
1321 const QStringList &archiveTargets, 1321 const QStringList &archiveTargets,
1322 const QHostAddress& host, Q_UINT16 port ) 1322 const QHostAddress& host, Q_UINT16 port )
1323{ 1323{
1324 sendGzipFile( fn, archiveTargets ); 1324 sendGzipFile( fn, archiveTargets );
1325 connectToHost( host.toString(), port ); 1325 connectToHost( host.toString(), port );
1326} 1326}
1327 1327
1328void ServerDTP::sendGzipFile( const QString &fn, 1328void ServerDTP::sendGzipFile( const QString &fn,
1329 const QStringList &archiveTargets ) 1329 const QStringList &archiveTargets )
1330{ 1330{
1331 mode = SendGzipFile; 1331 mode = SendGzipFile;
1332 file.setName( fn ); 1332 file.setName( fn );
1333 1333
1334 QStringList args = "tar"; 1334 QStringList args = "tar";
1335 args += "-cv"; 1335 args += "-cv";
1336 args += archiveTargets; 1336 args += archiveTargets;
1337 qDebug("sendGzipFile %s", args.join(" ").latin1() ); 1337 qDebug("sendGzipFile %s", args.join(" ").latin1() );
1338 createTargzProc->clearArguments( ); 1338 createTargzProc->clearArguments( );
1339 *createTargzProc << args; 1339 *createTargzProc << args;
1340 connect( createTargzProc, 1340 connect( createTargzProc,
1341 SIGNAL( receivedStdout(OProcess *, char *, int) ), SLOT( gzipTarBlock(OProcess *, char *, int) ) ); 1341 SIGNAL( receivedStdout(OProcess*,char*,int) ), SLOT( gzipTarBlock(OProcess*,char*,int) ) );
1342 1342
1343 gzipProc->clearArguments( ); 1343 gzipProc->clearArguments( );
1344 *gzipProc << "gzip"; 1344 *gzipProc << "gzip";
1345 connect( gzipProc, SIGNAL( receivedStdout(OProcess *, char *, int) ), 1345 connect( gzipProc, SIGNAL( receivedStdout(OProcess*,char*,int) ),
1346 SLOT( writeTargzBlock(OProcess *, char *, int) ) ); 1346 SLOT( writeTargzBlock(OProcess*,char*,int) ) );
1347} 1347}
1348 1348
1349void ServerDTP::gunzipDone() 1349void ServerDTP::gunzipDone()
1350{ 1350{
1351 qDebug("gunzipDone"); 1351 qDebug("gunzipDone");
1352 disconnect( gzipProc, SIGNAL( processExited() ), 1352 disconnect( gzipProc, SIGNAL( processExited() ),
1353 this, SLOT( gunzipDone() ) ); 1353 this, SLOT( gunzipDone() ) );
1354 retrieveTargzProc->closeStdin(); 1354 retrieveTargzProc->closeStdin();
1355 disconnect( gzipProc, SIGNAL( receivedStdout(OProcess *, char *, int) ), 1355 disconnect( gzipProc, SIGNAL( receivedStdout(OProcess*,char*,int) ),
1356 this, SLOT( tarExtractBlock(OProcess *, char *, int) ) ); 1356 this, SLOT( tarExtractBlock(OProcess*,char*,int) ) );
1357} 1357}
1358 1358
1359void ServerDTP::tarExtractBlock(OProcess *, char *buffer, int buflen) 1359void ServerDTP::tarExtractBlock(OProcess *, char *buffer, int buflen)
1360{ 1360{
1361 qDebug("tarExtractBlock"); 1361 qDebug("tarExtractBlock");
1362 if ( !retrieveTargzProc->isRunning() ) { 1362 if ( !retrieveTargzProc->isRunning() ) {
1363 qDebug("auto start ungzip proc"); 1363 qDebug("auto start ungzip proc");
1364 if ( !retrieveTargzProc->start(OProcess::NotifyOnExit, OProcess::Stdin) ) 1364 if ( !retrieveTargzProc->start(OProcess::NotifyOnExit, OProcess::Stdin) )
1365 qWarning(" failed to start tar -x process"); 1365 qWarning(" failed to start tar -x process");
1366 } 1366 }
1367 retrieveTargzProc->writeStdin( buffer, buflen ); 1367 retrieveTargzProc->writeStdin( buffer, buflen );
1368} 1368}
1369 1369
1370 1370
1371void ServerDTP::retrieveFile( const QString fn, const QHostAddress& host, Q_UINT16 port ) 1371void ServerDTP::retrieveFile( const QString fn, const QHostAddress& host, Q_UINT16 port )
1372{ 1372{
1373 file.setName( fn ); 1373 file.setName( fn );
1374 mode = RetrieveFile; 1374 mode = RetrieveFile;
1375 connectToHost( host.toString(), port ); 1375 connectToHost( host.toString(), port );
1376} 1376}
1377 1377
1378void ServerDTP::retrieveFile( const QString fn ) 1378void ServerDTP::retrieveFile( const QString fn )
1379{ 1379{
1380 file.setName( fn ); 1380 file.setName( fn );
1381 mode = RetrieveFile; 1381 mode = RetrieveFile;
1382} 1382}
1383 1383
1384void ServerDTP::retrieveGzipFile( const QString &fn ) 1384void ServerDTP::retrieveGzipFile( const QString &fn )
1385{ 1385{
1386 qDebug("retrieveGzipFile %s", fn.latin1()); 1386 qDebug("retrieveGzipFile %s", fn.latin1());
1387 file.setName( fn ); 1387 file.setName( fn );
1388 mode = RetrieveGzipFile; 1388 mode = RetrieveGzipFile;
1389 1389
1390 gzipProc->clearArguments(); 1390 gzipProc->clearArguments();
1391 *gzipProc << "gunzip"; 1391 *gzipProc << "gunzip";
1392 connect( gzipProc, SIGNAL( readyReadStdout() ), 1392 connect( gzipProc, SIGNAL( readyReadStdout() ),
1393 SLOT( tarExtractBlock() ) ); 1393 SLOT( tarExtractBlock() ) );
1394 connect( gzipProc, SIGNAL( processExited() ), 1394 connect( gzipProc, SIGNAL( processExited() ),
1395 SLOT( gunzipDone() ) ); 1395 SLOT( gunzipDone() ) );
1396} 1396}
1397 1397
1398void ServerDTP::retrieveGzipFile( const QString &fn, const QHostAddress& host, Q_UINT16 port ) 1398void ServerDTP::retrieveGzipFile( const QString &fn, const QHostAddress& host, Q_UINT16 port )
1399{ 1399{
1400 retrieveGzipFile( fn ); 1400 retrieveGzipFile( fn );
1401 connectToHost( host.toString(), port ); 1401 connectToHost( host.toString(), port );
1402} 1402}
1403 1403
1404void ServerDTP::sendByteArray( const QByteArray& array, const QHostAddress& host, Q_UINT16 port ) 1404void ServerDTP::sendByteArray( const QByteArray& array, const QHostAddress& host, Q_UINT16 port )
diff --git a/core/settings/button/buttonsettings.cpp b/core/settings/button/buttonsettings.cpp
index 141e0f6..d80e496 100644
--- a/core/settings/button/buttonsettings.cpp
+++ b/core/settings/button/buttonsettings.cpp
@@ -91,97 +91,97 @@ ButtonSettings::ButtonSettings ( QWidget *parent , const char *name, bool modal
91 bi-> m_button = &(*it); 91 bi-> m_button = &(*it);
92 bi-> m_index = index++; 92 bi-> m_index = index++;
93 bi-> m_pmsg = (*it). pressedAction ( ); 93 bi-> m_pmsg = (*it). pressedAction ( );
94 bi-> m_hmsg = (*it). heldAction ( ); 94 bi-> m_hmsg = (*it). heldAction ( );
95 bi-> m_pdirty = false; 95 bi-> m_pdirty = false;
96 bi-> m_hdirty = false; 96 bi-> m_hdirty = false;
97 97
98 l = new QLabel ( this ); 98 l = new QLabel ( this );
99 l-> setPixmap (( *it ). pixmap ( )); 99 l-> setPixmap (( *it ). pixmap ( ));
100 100
101 lay-> addMultiCellWidget ( l, i, i + 1, 0, 0 ); 101 lay-> addMultiCellWidget ( l, i, i + 1, 0, 0 );
102 102
103 l = new QLabel ( tr( "Press:" ), this ); 103 l = new QLabel ( tr( "Press:" ), this );
104 lay-> addWidget ( l, i, 1, AlignLeft | AlignBottom ); 104 lay-> addWidget ( l, i, 1, AlignLeft | AlignBottom );
105 l = new QLabel ( tr( "Hold:" ), this ); 105 l = new QLabel ( tr( "Hold:" ), this );
106 lay-> addWidget ( l, i + 1, 1, AlignLeft | AlignTop ); 106 lay-> addWidget ( l, i + 1, 1, AlignLeft | AlignTop );
107 107
108 l = new QLabel ( this ); 108 l = new QLabel ( this );
109 l-> setFixedSize ( 16, 16 ); 109 l-> setFixedSize ( 16, 16 );
110 lay-> addWidget ( l, i, 2, AlignLeft | AlignBottom ); 110 lay-> addWidget ( l, i, 2, AlignLeft | AlignBottom );
111 bi-> m_picon = l; 111 bi-> m_picon = l;
112 112
113 l = new QLabel ( this ); 113 l = new QLabel ( this );
114 l-> setAlignment ( AlignLeft | AlignVCenter | SingleLine ); 114 l-> setAlignment ( AlignLeft | AlignVCenter | SingleLine );
115 lay-> addWidget ( l, i, 3, AlignLeft | AlignBottom ); 115 lay-> addWidget ( l, i, 3, AlignLeft | AlignBottom );
116 bi-> m_plabel = l; 116 bi-> m_plabel = l;
117 117
118 l = new QLabel ( this ); 118 l = new QLabel ( this );
119 l-> setFixedSize ( 16, 16 ); 119 l-> setFixedSize ( 16, 16 );
120 lay-> addWidget ( l, i + 1, 2, AlignLeft | AlignTop ); 120 lay-> addWidget ( l, i + 1, 2, AlignLeft | AlignTop );
121 bi-> m_hicon = l; 121 bi-> m_hicon = l;
122 122
123 l = new QLabel ( this ); 123 l = new QLabel ( this );
124 l-> setAlignment ( AlignLeft | AlignVCenter | SingleLine ); 124 l-> setAlignment ( AlignLeft | AlignVCenter | SingleLine );
125 lay-> addWidget ( l, i + 1, 3, AlignLeft | AlignTop ); 125 lay-> addWidget ( l, i + 1, 3, AlignLeft | AlignTop );
126 bi-> m_hlabel = l; 126 bi-> m_hlabel = l;
127 127
128 i += 2; 128 i += 2;
129 129
130 m_infos. append ( bi ); 130 m_infos. append ( bi );
131 } 131 }
132 132
133 toplay-> addStretch ( 10 ); 133 toplay-> addStretch ( 10 );
134 134
135 m_last_button = 0; 135 m_last_button = 0;
136 m_lock = false; 136 m_lock = false;
137 137
138 m_timer = new QTimer ( this ); 138 m_timer = new QTimer ( this );
139 connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( keyTimeout ( ))); 139 connect ( m_timer, SIGNAL( timeout()), this, SLOT( keyTimeout()));
140 140
141 updateLabels ( ); 141 updateLabels ( );
142 142
143 QPEApplication::grabKeyboard ( ); 143 QPEApplication::grabKeyboard ( );
144} 144}
145 145
146ButtonSettings::~ButtonSettings ( ) 146ButtonSettings::~ButtonSettings ( )
147{ 147{
148 QPEApplication::ungrabKeyboard ( ); 148 QPEApplication::ungrabKeyboard ( );
149} 149}
150 150
151void ButtonSettings::updateLabels ( ) 151void ButtonSettings::updateLabels ( )
152{ 152{
153 for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { 153 for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) {
154 qCopInfo cip = ButtonUtils::inst ( )-> messageToInfo ((*it)-> m_pmsg ); 154 qCopInfo cip = ButtonUtils::inst ( )-> messageToInfo ((*it)-> m_pmsg );
155 155
156 (*it)-> m_picon-> setPixmap ( cip. m_icon ); 156 (*it)-> m_picon-> setPixmap ( cip. m_icon );
157 (*it)-> m_plabel-> setText ( cip. m_name ); 157 (*it)-> m_plabel-> setText ( cip. m_name );
158 158
159 qCopInfo cih = ButtonUtils::inst ( )-> messageToInfo ((*it)-> m_hmsg ); 159 qCopInfo cih = ButtonUtils::inst ( )-> messageToInfo ((*it)-> m_hmsg );
160 160
161 (*it)-> m_hicon-> setPixmap ( cih. m_icon ); 161 (*it)-> m_hicon-> setPixmap ( cih. m_icon );
162 (*it)-> m_hlabel-> setText ( cih. m_name ); 162 (*it)-> m_hlabel-> setText ( cih. m_name );
163 } 163 }
164} 164}
165 165
166buttoninfo *ButtonSettings::buttonInfoForKeycode ( ushort key ) 166buttoninfo *ButtonSettings::buttonInfoForKeycode ( ushort key )
167{ 167{
168 for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { 168 for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) {
169 if ((*it)-> m_button-> keycode ( ) == key ) 169 if ((*it)-> m_button-> keycode ( ) == key )
170 return *it; 170 return *it;
171 } 171 }
172 return 0; 172 return 0;
173} 173}
174 174
175void ButtonSettings::keyPressEvent ( QKeyEvent *e ) 175void ButtonSettings::keyPressEvent ( QKeyEvent *e )
176{ 176{
177 buttoninfo *bi = buttonInfoForKeycode ( e-> key ( )); 177 buttoninfo *bi = buttonInfoForKeycode ( e-> key ( ));
178 178
179 if ( bi && !e-> isAutoRepeat ( )) { 179 if ( bi && !e-> isAutoRepeat ( )) {
180 m_timer-> stop ( ); 180 m_timer-> stop ( );
181 m_last_button = bi; 181 m_last_button = bi;
182 m_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); 182 m_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true );
183 } 183 }
184 else 184 else
185 QDialog::keyPressEvent ( e ); 185 QDialog::keyPressEvent ( e );
186} 186}
187 187
diff --git a/core/settings/button/remapdlg.cpp b/core/settings/button/remapdlg.cpp
index 7dabe68..121173a 100644
--- a/core/settings/button/remapdlg.cpp
+++ b/core/settings/button/remapdlg.cpp
@@ -34,97 +34,97 @@ public:
34 p-> setFont ( f ); 34 p-> setFont ( f );
35 } 35 }
36 QListViewItem::paintCell ( p, cg, column, width, align ); 36 QListViewItem::paintCell ( p, cg, column, width, align );
37 } 37 }
38 38
39private: 39private:
40 QString m_key; 40 QString m_key;
41 bool m_def; 41 bool m_def;
42}; 42};
43 43
44 44
45RemapDlg::RemapDlg ( const Opie::ODeviceButton *b, bool hold, QWidget *parent, const char *name ) 45RemapDlg::RemapDlg ( const Opie::ODeviceButton *b, bool hold, QWidget *parent, const char *name )
46 : RemapDlgBase ( parent, name, true, WStyle_ContextHelp ) 46 : RemapDlgBase ( parent, name, true, WStyle_ContextHelp )
47{ 47{
48 setCaption ( tr( "%1 %2", "(hold|press) buttoname" ). arg( hold ? tr( "Held" ) : tr( "Pressed" )). arg ( b-> userText ( ))); 48 setCaption ( tr( "%1 %2", "(hold|press) buttoname" ). arg( hold ? tr( "Held" ) : tr( "Pressed" )). arg ( b-> userText ( )));
49 49
50 m_current = 0; 50 m_current = 0;
51 51
52 static const char * const def_channels [] = { "QPE/Application/", "QPE/Launcher", "QPE/System", "QPE/TaskBar", "QPE/", 0 }; 52 static const char * const def_channels [] = { "QPE/Application/", "QPE/Launcher", "QPE/System", "QPE/TaskBar", "QPE/", 0 };
53 w_channel-> insertStrList ((const char **) def_channels ); 53 w_channel-> insertStrList ((const char **) def_channels );
54 54
55 m_msg = hold ? b-> heldAction ( ) : b-> pressedAction ( ); 55 m_msg = hold ? b-> heldAction ( ) : b-> pressedAction ( );
56 m_msg_preset = hold ? b-> factoryPresetHeldAction ( ) : b-> factoryPresetPressedAction ( ); 56 m_msg_preset = hold ? b-> factoryPresetHeldAction ( ) : b-> factoryPresetPressedAction ( );
57 57
58 m_map_none = new NoSortItem ( w_list, 0, tr( "No mapping" )); 58 m_map_none = new NoSortItem ( w_list, 0, tr( "No mapping" ));
59 m_map_preset = new NoSortItem ( w_list, 1, tr( "Default" ), m_msg_preset. channel ( ), m_msg_preset. message ( )); 59 m_map_preset = new NoSortItem ( w_list, 1, tr( "Default" ), m_msg_preset. channel ( ), m_msg_preset. message ( ));
60 ((NoSortItem *) m_map_preset )-> setDefault ( true ); 60 ((NoSortItem *) m_map_preset )-> setDefault ( true );
61 61
62 if (m_msg. channel ( ) == "ignore") 62 if (m_msg. channel ( ) == "ignore")
63 { 63 {
64 m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg_preset. channel ( ), m_msg_preset. message ( )); 64 m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg_preset. channel ( ), m_msg_preset. message ( ));
65 65
66 m_current = m_map_none; 66 m_current = m_map_none;
67 } 67 }
68 else 68 else
69 { 69 {
70 m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg. channel ( ), m_msg. message ( )); 70 m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg. channel ( ), m_msg. message ( ));
71 m_current = m_map_custom; 71 m_current = m_map_custom;
72 } 72 }
73 73
74 QListViewItem *it = new NoSortItem ( w_list, 3, tr( "Actions" )); 74 QListViewItem *it = new NoSortItem ( w_list, 3, tr( "Actions" ));
75 ButtonUtils::inst ( )-> insertActions ( it ); 75 ButtonUtils::inst ( )-> insertActions ( it );
76 it-> setOpen ( true ); 76 it-> setOpen ( true );
77 77
78 m_map_show = new NoSortItem ( w_list, 4, tr( "Show" )); 78 m_map_show = new NoSortItem ( w_list, 4, tr( "Show" ));
79 79
80 w_list-> setCurrentItem ( m_current ); 80 w_list-> setCurrentItem ( m_current );
81 81
82 QTimer::singleShot ( 0, this, SLOT( delayedInit ( ))); 82 QTimer::singleShot ( 0, this, SLOT( delayedInit()));
83} 83}
84 84
85RemapDlg::~RemapDlg ( ) 85RemapDlg::~RemapDlg ( )
86{ 86{
87} 87}
88 88
89void RemapDlg::delayedInit ( ) 89void RemapDlg::delayedInit ( )
90{ 90{
91 bool b = w_list-> viewport ( )-> isUpdatesEnabled ( ); 91 bool b = w_list-> viewport ( )-> isUpdatesEnabled ( );
92 w_list-> viewport ( )-> setUpdatesEnabled ( false ); 92 w_list-> viewport ( )-> setUpdatesEnabled ( false );
93 93
94 ButtonUtils::inst ( )-> insertAppLnks ( m_map_show ); 94 ButtonUtils::inst ( )-> insertAppLnks ( m_map_show );
95 95
96 w_list-> viewport ( )-> setUpdatesEnabled ( b ); 96 w_list-> viewport ( )-> setUpdatesEnabled ( b );
97 97
98 m_map_show-> repaint ( ); 98 m_map_show-> repaint ( );
99} 99}
100 100
101void RemapDlg::itemChanged ( QListViewItem *it ) 101void RemapDlg::itemChanged ( QListViewItem *it )
102{ 102{
103 bool enabled = false; 103 bool enabled = false;
104 OQCopMessage m; 104 OQCopMessage m;
105 105
106 m_current = it; 106 m_current = it;
107 107
108 if ( it == m_map_none ) 108 if ( it == m_map_none )
109 { 109 {
110 m_msg = m = OQCopMessage ( "ignore", 0 ); 110 m_msg = m = OQCopMessage ( "ignore", 0 );
111 qDebug ("***ignoring"); 111 qDebug ("***ignoring");
112 } 112 }
113 else if ( it == m_map_preset ) 113 else if ( it == m_map_preset )
114 { 114 {
115 m_msg = m = m_msg_preset; 115 m_msg = m = m_msg_preset;
116 qDebug ("***Preset"); 116 qDebug ("***Preset");
117 } 117 }
118 else if ( it && !it-> childCount ( ) ) 118 else if ( it && !it-> childCount ( ) )
119 { 119 {
120 qDebug ("***Custom: %s %s ",it-> text ( 1 ). latin1 ( ), it-> text ( 2 ). latin1 ( )); 120 qDebug ("***Custom: %s %s ",it-> text ( 1 ). latin1 ( ), it-> text ( 2 ). latin1 ( ));
121 enabled = ( it == m_map_custom ); 121 enabled = ( it == m_map_custom );
122 m_msg = m = OQCopMessage ( it-> text ( 1 ). latin1 ( ), it-> text ( 2 ). latin1 ( )); 122 m_msg = m = OQCopMessage ( it-> text ( 1 ). latin1 ( ), it-> text ( 2 ). latin1 ( ));
123 } 123 }
124 124
125 w_channel-> setEnabled ( enabled ); 125 w_channel-> setEnabled ( enabled );
126 w_message-> setEnabled ( enabled ); 126 w_message-> setEnabled ( enabled );
127 127
128 w_channel-> setEditText ( m. channel ( )); 128 w_channel-> setEditText ( m. channel ( ));
129//hack for if user has typed in a message, such as 'suspend()' 129//hack for if user has typed in a message, such as 'suspend()'
130//so raise() is always present 130//so raise() is always present
diff --git a/core/settings/citytime/citytime.cpp b/core/settings/citytime/citytime.cpp
index e7f0c46..721285d 100644
--- a/core/settings/citytime/citytime.cpp
+++ b/core/settings/citytime/citytime.cpp
@@ -64,98 +64,98 @@ CityTime::CityTime( QWidget *parent, const char* name,
64 64
65 listCities.append( cmdCity1 ); 65 listCities.append( cmdCity1 );
66 listCities.append( cmdCity2 ); 66 listCities.append( cmdCity2 );
67 listCities.append( cmdCity3 ); 67 listCities.append( cmdCity3 );
68 68
69 listTimes.append( lblCTime1 ); 69 listTimes.append( lblCTime1 );
70 listTimes.append( lblCTime2 ); 70 listTimes.append( lblCTime2 );
71 listTimes.append( lblCTime3 ); 71 listTimes.append( lblCTime3 );
72 72
73 73
74 // kludgy way of getting the screen size so we don't have to depend 74 // kludgy way of getting the screen size so we don't have to depend
75 // on a resize event... 75 // on a resize event...
76 QWidget *d = QApplication::desktop(); 76 QWidget *d = QApplication::desktop();
77 if ( d->width() < d->height() ) { 77 if ( d->width() < d->height() ) {
78 // append for that 4 down look 78 // append for that 4 down look
79 listCities.append( cmdCity4 ); 79 listCities.append( cmdCity4 );
80 listCities.append( cmdCity5 ); 80 listCities.append( cmdCity5 );
81 listCities.append( cmdCity6 ); 81 listCities.append( cmdCity6 );
82 listTimes.append( lblCTime4 ); 82 listTimes.append( lblCTime4 );
83 listTimes.append( lblCTime5 ); 83 listTimes.append( lblCTime5 );
84 listTimes.append( lblCTime6 ); 84 listTimes.append( lblCTime6 );
85 lblCTime7->hide(); 85 lblCTime7->hide();
86 lblCTime8->hide(); 86 lblCTime8->hide();
87 lblCTime9->hide(); 87 lblCTime9->hide();
88 cmdCity7->hide(); 88 cmdCity7->hide();
89 cmdCity8->hide(); 89 cmdCity8->hide();
90 cmdCity9->hide(); 90 cmdCity9->hide();
91 } else { 91 } else {
92 listCities.append( cmdCity7 ); 92 listCities.append( cmdCity7 );
93 listCities.append( cmdCity8 ); 93 listCities.append( cmdCity8 );
94 listCities.append( cmdCity9 ); 94 listCities.append( cmdCity9 );
95 listTimes.append( lblCTime7 ); 95 listTimes.append( lblCTime7 );
96 listTimes.append( lblCTime8 ); 96 listTimes.append( lblCTime8 );
97 listTimes.append( lblCTime9 ); 97 listTimes.append( lblCTime9 );
98 lblCTime4->hide(); 98 lblCTime4->hide();
99 lblCTime5->hide(); 99 lblCTime5->hide();
100 lblCTime6->hide(); 100 lblCTime6->hide();
101 cmdCity4->hide(); 101 cmdCity4->hide();
102 cmdCity5->hide(); 102 cmdCity5->hide();
103 cmdCity6->hide(); 103 cmdCity6->hide();
104 } 104 }
105 105
106 selWidget = frmMap->selectionWidget( this ); 106 selWidget = frmMap->selectionWidget( this );
107 selWidget->hide(); 107 selWidget->hide();
108 CityTimeBaseLayout->addWidget( selWidget ); 108 CityTimeBaseLayout->addWidget( selWidget );
109 bAdded = true; 109 bAdded = true;
110 readInTimes(); 110 readInTimes();
111 changed = FALSE; 111 changed = FALSE;
112 QObject::connect( qApp, SIGNAL( clockChanged( bool ) ), 112 QObject::connect( qApp, SIGNAL( clockChanged(bool) ),
113 this, SLOT( changeClock( bool ) ) ); 113 this, SLOT( changeClock(bool) ) );
114 // now start the timer so we can update the time quickly every second 114 // now start the timer so we can update the time quickly every second
115 timerEvent( 0 ); 115 timerEvent( 0 );
116} 116}
117 117
118CityTime::~CityTime() 118CityTime::~CityTime()
119{ 119{
120 if ( changed ) { 120 if ( changed ) {
121 Config cfg("CityTime"); 121 Config cfg("CityTime");
122 cfg.setGroup("TimeZones"); 122 cfg.setGroup("TimeZones");
123 QListIterator<QToolButton> itCity( listCities ); 123 QListIterator<QToolButton> itCity( listCities );
124 int i; 124 int i;
125 bool realTzWritten = FALSE; 125 bool realTzWritten = FALSE;
126 for ( i = 0, itCity.toFirst(); i < CITIES; i++, ++itCity ) { 126 for ( i = 0, itCity.toFirst(); i < CITIES; i++, ++itCity ) {
127 if ( !strCityTz[i].isNull() ) { 127 if ( !strCityTz[i].isNull() ) {
128 cfg.writeEntry("Zone"+QString::number(i), strCityTz[i]); 128 cfg.writeEntry("Zone"+QString::number(i), strCityTz[i]);
129 cfg.writeEntry("ZoneName"+QString::number(i), itCity.current()->text()); 129 cfg.writeEntry("ZoneName"+QString::number(i), itCity.current()->text());
130 if ( strCityTz[i] == strRealTz ) 130 if ( strCityTz[i] == strRealTz )
131 realTzWritten = TRUE; 131 realTzWritten = TRUE;
132 } 132 }
133 } 133 }
134 if ( realTzWritten ) { 134 if ( realTzWritten ) {
135 cfg.removeEntry("Zone"+QString::number(CITIES)); 135 cfg.removeEntry("Zone"+QString::number(CITIES));
136 cfg.removeEntry("ZoneName"+QString::number(CITIES)); 136 cfg.removeEntry("ZoneName"+QString::number(CITIES));
137 } else { 137 } else {
138 cfg.writeEntry("Zone"+QString::number(CITIES), strRealTz); 138 cfg.writeEntry("Zone"+QString::number(CITIES), strRealTz);
139 if ( nameRealTz.isEmpty() ) { 139 if ( nameRealTz.isEmpty() ) {
140 int i = strRealTz.find( '/' ); 140 int i = strRealTz.find( '/' );
141 nameRealTz = strRealTz.mid( i+1 ); 141 nameRealTz = strRealTz.mid( i+1 );
142 } 142 }
143 cfg.writeEntry("ZoneName"+QString::number(CITIES), nameRealTz); 143 cfg.writeEntry("ZoneName"+QString::number(CITIES), nameRealTz);
144 } 144 }
145 QCopEnvelope ( "QPE/System", "timeZoneListChange()" ); 145 QCopEnvelope ( "QPE/System", "timeZoneListChange()" );
146 146
147 changed = FALSE; 147 changed = FALSE;
148 } 148 }
149 // restore the timezone, just in case we messed with it and 149 // restore the timezone, just in case we messed with it and
150 // are destroyed at an inoppurtune moment 150 // are destroyed at an inoppurtune moment
151 if ( !strRealTz.isNull() ) { 151 if ( !strRealTz.isNull() ) {
152 // this should be checked, but there is not much that can done at this 152 // this should be checked, but there is not much that can done at this
153 //point if it fails 153 //point if it fails
154 setenv( "TZ", strRealTz, true ); 154 setenv( "TZ", strRealTz, true );
155 } 155 }
156} 156}
157 157
158void CityTime::timerEvent( QTimerEvent *e ) 158void CityTime::timerEvent( QTimerEvent *e )
159{ 159{
160 if ( e ) 160 if ( e )
161 killTimer( timerId ); 161 killTimer( timerId );
diff --git a/core/settings/citytime/citytimebase.cpp b/core/settings/citytime/citytimebase.cpp
index a3483cc..323929b 100644
--- a/core/settings/citytime/citytimebase.cpp
+++ b/core/settings/citytime/citytimebase.cpp
@@ -185,97 +185,97 @@ CityTimeBase::CityTimeBase( QWidget* parent, const char* name, WFlags )
185 lblCTime7->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 185 lblCTime7->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
186 186
187 Layout2->addWidget( lblCTime7, 0, 3 ); 187 Layout2->addWidget( lblCTime7, 0, 3 );
188 188
189 lblCTime4 = new QLabel( buttonWidget, "lblCTime4" ); 189 lblCTime4 = new QLabel( buttonWidget, "lblCTime4" );
190 QFont lblCTime4_font( lblCTime4->font() ); 190 QFont lblCTime4_font( lblCTime4->font() );
191 lblCTime4_font.setPointSize( 10 ); 191 lblCTime4_font.setPointSize( 10 );
192 lblCTime4->setFont( lblCTime4_font ); 192 lblCTime4->setFont( lblCTime4_font );
193 lblCTime4->setText( tr( "" ) ); 193 lblCTime4->setText( tr( "" ) );
194 lblCTime4->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 194 lblCTime4->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
195 195
196 Layout2->addWidget( lblCTime4, 3, 1 ); 196 Layout2->addWidget( lblCTime4, 3, 1 );
197 197
198 cmdCity5 = new QToolButton( buttonWidget, "cmdCity5" ); 198 cmdCity5 = new QToolButton( buttonWidget, "cmdCity5" );
199 cmdCity5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity5->sizePolicy().hasHeightForWidth() ) ); 199 cmdCity5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity5->sizePolicy().hasHeightForWidth() ) );
200 QFont cmdCity5_font( cmdCity5->font() ); 200 QFont cmdCity5_font( cmdCity5->font() );
201 cmdCity5_font.setBold( TRUE ); 201 cmdCity5_font.setBold( TRUE );
202 cmdCity5->setFont( cmdCity5_font ); 202 cmdCity5->setFont( cmdCity5_font );
203 cmdCity5->setFocusPolicy( QToolButton::TabFocus ); 203 cmdCity5->setFocusPolicy( QToolButton::TabFocus );
204 cmdCity5->setText( tr( "" ) ); 204 cmdCity5->setText( tr( "" ) );
205 cmdCity5->setToggleButton( TRUE ); 205 cmdCity5->setToggleButton( TRUE );
206 cmdCity5->setToggleButton( TRUE ); 206 cmdCity5->setToggleButton( TRUE );
207 207
208 Layout2->addWidget( cmdCity5, 4, 0 ); 208 Layout2->addWidget( cmdCity5, 4, 0 );
209 209
210 lblCTime3 = new QLabel( buttonWidget, "lblCTime3" ); 210 lblCTime3 = new QLabel( buttonWidget, "lblCTime3" );
211 QFont lblCTime3_font( lblCTime3->font() ); 211 QFont lblCTime3_font( lblCTime3->font() );
212 lblCTime3_font.setPointSize( 10 ); 212 lblCTime3_font.setPointSize( 10 );
213 lblCTime3->setFont( lblCTime3_font ); 213 lblCTime3->setFont( lblCTime3_font );
214 lblCTime3->setText( tr( "" ) ); 214 lblCTime3->setText( tr( "" ) );
215 lblCTime3->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 215 lblCTime3->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
216 216
217 Layout2->addWidget( lblCTime3, 2, 1 ); 217 Layout2->addWidget( lblCTime3, 2, 1 );
218 218
219 cmdCity9 = new QToolButton( buttonWidget, "cmdCity9" ); 219 cmdCity9 = new QToolButton( buttonWidget, "cmdCity9" );
220 cmdCity9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity9->sizePolicy().hasHeightForWidth() ) ); 220 cmdCity9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity9->sizePolicy().hasHeightForWidth() ) );
221 QFont cmdCity9_font( cmdCity9->font() ); 221 QFont cmdCity9_font( cmdCity9->font() );
222 cmdCity9_font.setBold( TRUE ); 222 cmdCity9_font.setBold( TRUE );
223 cmdCity9->setFont( cmdCity9_font ); 223 cmdCity9->setFont( cmdCity9_font );
224 cmdCity9->setFocusPolicy( QToolButton::TabFocus ); 224 cmdCity9->setFocusPolicy( QToolButton::TabFocus );
225 cmdCity9->setText( tr( "" ) ); 225 cmdCity9->setText( tr( "" ) );
226 cmdCity9->setToggleButton( TRUE ); 226 cmdCity9->setToggleButton( TRUE );
227 cmdCity9->setToggleButton( TRUE ); 227 cmdCity9->setToggleButton( TRUE );
228 228
229 Layout2->addWidget( cmdCity9, 2, 2 ); 229 Layout2->addWidget( cmdCity9, 2, 2 );
230 CityTimeBaseLayout->addWidget( buttonWidget ); 230 CityTimeBaseLayout->addWidget( buttonWidget );
231 231
232 // signals and slots connections 232 // signals and slots connections
233 connect( frmMap, SIGNAL( signalTz(const QString &, const QString &) ), this, SLOT( slotNewTz(const QString &, const QString &) ) ); 233 connect( frmMap, SIGNAL( signalTz(const QString&,const QString&) ), this, SLOT( slotNewTz(const QString&,const QString&) ) );
234 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 234 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
235 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 235 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
236 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 236 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
237 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 237 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
238 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 238 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
239 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 239 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
240 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 240 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
241 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 241 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
242 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 242 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
243 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 243 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
244 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 244 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
245 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 245 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
246 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 246 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
247 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 247 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
248 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 248 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
249 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 249 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
250 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 250 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
251 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 251 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
252 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 252 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
253 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 253 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
254 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 254 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
255 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 255 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
256 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 256 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
257 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 257 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
258 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 258 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
259 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 259 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
260 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 260 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
261 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 261 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
262 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 262 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
263 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 263 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
264 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 264 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
265 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 265 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
266 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 266 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
267 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 267 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
268 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 268 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
269 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 269 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
270 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 270 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
271 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 271 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
272 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 272 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
273 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 273 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
274 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 274 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
275 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 275 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
276 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 276 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
277 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 277 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
278 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 278 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
279 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 279 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
280 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 280 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
281 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 281 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
diff --git a/core/settings/citytime/zonemap.cpp b/core/settings/citytime/zonemap.cpp
index b83da59..b6843d2 100644
--- a/core/settings/citytime/zonemap.cpp
+++ b/core/settings/citytime/zonemap.cpp
@@ -142,102 +142,102 @@ ZoneMap::ZoneMap( QWidget *parent, const char* name )
142 pRepaint( 0 ), 142 pRepaint( 0 ),
143 ox( 0 ), 143 ox( 0 ),
144 oy( 0 ), 144 oy( 0 ),
145 drawableW( -1 ), 145 drawableW( -1 ),
146 drawableH( -1 ), 146 drawableH( -1 ),
147 bZoom( FALSE ), 147 bZoom( FALSE ),
148 bIllum( TRUE ), 148 bIllum( TRUE ),
149 cursor( 0 ) 149 cursor( 0 )
150{ 150{
151 viewport()->setFocusPolicy( StrongFocus ); 151 viewport()->setFocusPolicy( StrongFocus );
152 152
153 // set mouse tracking so we can use the mouse move event 153 // set mouse tracking so we can use the mouse move event
154 zones.setAutoDelete( true ); 154 zones.setAutoDelete( true );
155 // get the map loaded 155 // get the map loaded
156 // just set the current image to point 156 // just set the current image to point
157 pixCurr = new QPixmap(); 157 pixCurr = new QPixmap();
158 158
159 QPixmap pixZoom = Resource::loadPixmap( "mag" ); 159 QPixmap pixZoom = Resource::loadPixmap( "mag" );
160 160
161 cmdZoom = new QToolButton( this, "Zoom command" ); 161 cmdZoom = new QToolButton( this, "Zoom command" );
162 cmdZoom->setPixmap( pixZoom ); 162 cmdZoom->setPixmap( pixZoom );
163 cmdZoom->setToggleButton( true ); 163 cmdZoom->setToggleButton( true );
164 164
165 cmdZoom->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, 165 cmdZoom->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0,
166 (QSizePolicy::SizeType)0, 166 (QSizePolicy::SizeType)0,
167 cmdZoom->sizePolicy().hasHeightForWidth() ) ); 167 cmdZoom->sizePolicy().hasHeightForWidth() ) );
168 cmdZoom->setMaximumSize( cmdZoom->sizeHint() ); 168 cmdZoom->setMaximumSize( cmdZoom->sizeHint() );
169 // probably don't need this, but just in case... 169 // probably don't need this, but just in case...
170 cmdZoom->move( width() - cmdZoom->width(), height() - cmdZoom->height() ); 170 cmdZoom->move( width() - cmdZoom->width(), height() - cmdZoom->height() );
171 171
172 172
173 lblCity = new QLabel( tr( "CITY" ), this, "City Label" ); 173 lblCity = new QLabel( tr( "CITY" ), this, "City Label" );
174 lblCity->setMinimumSize( lblCity->sizeHint() ); 174 lblCity->setMinimumSize( lblCity->sizeHint() );
175 lblCity->setFrameStyle( QFrame::Plain | QFrame::Box ); 175 lblCity->setFrameStyle( QFrame::Plain | QFrame::Box );
176 lblCity->setBackgroundColor( yellow ); 176 lblCity->setBackgroundColor( yellow );
177 lblCity->hide(); 177 lblCity->hide();
178 178
179 // A timer to make sure the label gets hidden 179 // A timer to make sure the label gets hidden
180 tHide = new QTimer( this, "Label Timer" ); 180 tHide = new QTimer( this, "Label Timer" );
181 QObject::connect( tHide, SIGNAL( timeout() ), 181 QObject::connect( tHide, SIGNAL( timeout() ),
182 lblCity, SLOT( hide() ) ); 182 lblCity, SLOT( hide() ) );
183 QObject::connect( tHide, SIGNAL( timeout() ), 183 QObject::connect( tHide, SIGNAL( timeout() ),
184 this, SLOT( slotRedraw() ) ); 184 this, SLOT( slotRedraw() ) );
185 QTimer *tUpdate = new QTimer( this, "Update Timer" ); 185 QTimer *tUpdate = new QTimer( this, "Update Timer" );
186 QObject::connect( tUpdate, SIGNAL( timeout() ), 186 QObject::connect( tUpdate, SIGNAL( timeout() ),
187 this, SLOT( slotUpdate() ) ); 187 this, SLOT( slotUpdate() ) );
188 QObject::connect( qApp, SIGNAL( timeChanged() ), 188 QObject::connect( qApp, SIGNAL( timeChanged() ),
189 this, SLOT( slotUpdate() ) ); 189 this, SLOT( slotUpdate() ) );
190 QObject::connect( cmdZoom, SIGNAL( toggled( bool ) ), 190 QObject::connect( cmdZoom, SIGNAL( toggled(bool) ),
191 this, SLOT( slotZoom( bool ) ) ); 191 this, SLOT( slotZoom(bool) ) );
192 QObject::connect( &norm, SIGNAL( signalNewPoint( const QPoint& ) ), 192 QObject::connect( &norm, SIGNAL( signalNewPoint(const QPoint&) ),
193 this, SLOT( slotFindCity( const QPoint& ) ) ); 193 this, SLOT( slotFindCity(const QPoint&) ) );
194 QObject::connect( qApp, SIGNAL( clockChanged( bool ) ), 194 QObject::connect( qApp, SIGNAL( clockChanged(bool) ),
195 this, SLOT( changeClock( bool ) ) ); 195 this, SLOT( changeClock(bool) ) );
196 // update the sun's movement every 5 minutes 196 // update the sun's movement every 5 minutes
197 tUpdate->start( 5 * 60 * 1000 ); 197 tUpdate->start( 5 * 60 * 1000 );
198 // May as well read in the timezone information too... 198 // May as well read in the timezone information too...
199 readZones(); 199 readZones();
200} 200}
201 201
202ZoneMap::~ZoneMap() 202ZoneMap::~ZoneMap()
203{ 203{
204} 204}
205 205
206void ZoneMap::readZones( void ) 206void ZoneMap::readZones( void )
207{ 207{
208 QFile fZone( strZONEINFO ); 208 QFile fZone( strZONEINFO );
209 if ( !fZone.open( IO_ReadOnly ) ) { 209 if ( !fZone.open( IO_ReadOnly ) ) {
210 QMessageBox::warning (this, 210 QMessageBox::warning (this,
211 tr( "Unable to Find Timezone Info" ), 211 tr( "Unable to Find Timezone Info" ),
212 tr( "<p>Unable to find any timezone information in %1" ) 212 tr( "<p>Unable to find any timezone information in %1" )
213 .arg( strZONEINFO )); 213 .arg( strZONEINFO ));
214 exit(-1); 214 exit(-1);
215 } else { 215 } else {
216 QTextStream tZone( &fZone ); 216 QTextStream tZone( &fZone );
217 while ( !tZone.atEnd() ) { 217 while ( !tZone.atEnd() ) {
218 QString strLine = tZone.readLine(); 218 QString strLine = tZone.readLine();
219 // only pass on lines that aren't comments 219 // only pass on lines that aren't comments
220 if ( strLine[0] != '#' ) { 220 if ( strLine[0] != '#' ) {
221 zones.append( new ZoneField( strLine ) ); 221 zones.append( new ZoneField( strLine ) );
222 } 222 }
223 } 223 }
224 fZone.close(); 224 fZone.close();
225 } 225 }
226} 226}
227 227
228void ZoneMap::viewportMousePressEvent( QMouseEvent* event ) 228void ZoneMap::viewportMousePressEvent( QMouseEvent* event )
229{ 229{
230 // add the mouse event into the normalizer, and get the average, 230 // add the mouse event into the normalizer, and get the average,
231 // pass it along 231 // pass it along
232 slotRedraw(); 232 slotRedraw();
233 norm.start(); 233 norm.start();
234 norm.addEvent( event->pos() ); 234 norm.addEvent( event->pos() );
235} 235}
236 236
237void ZoneMap::viewportMouseMoveEvent( QMouseEvent* event ) 237void ZoneMap::viewportMouseMoveEvent( QMouseEvent* event )
238{ 238{
239 norm.addEvent( event->pos() ); 239 norm.addEvent( event->pos() );
240} 240}
241 241
242void ZoneMap::viewportMouseReleaseEvent( QMouseEvent* ) 242void ZoneMap::viewportMouseReleaseEvent( QMouseEvent* )
243{ 243{
@@ -421,133 +421,133 @@ void ZoneMap::showCity( ZoneField *city )
421 int repx, 421 int repx,
422 repy; 422 repy;
423 zoneToWin( pRepaint->x(), pRepaint->y(), repx, repy ); 423 zoneToWin( pRepaint->x(), pRepaint->y(), repx, repy );
424 updateContents( repx - iCITYOFFSET, repy - iCITYOFFSET, 424 updateContents( repx - iCITYOFFSET, repy - iCITYOFFSET,
425 iCITYSIZE, iCITYSIZE ); 425 iCITYSIZE, iCITYSIZE );
426 } 426 }
427 updateContents( tmpx - iCITYOFFSET, tmpy - iCITYOFFSET, iCITYSIZE, 427 updateContents( tmpx - iCITYOFFSET, tmpy - iCITYOFFSET, iCITYSIZE,
428 iCITYSIZE ); 428 iCITYSIZE );
429 pRepaint = pLast; 429 pRepaint = pLast;
430 430
431 lblCity->move( x, y ); 431 lblCity->move( x, y );
432 lblCity->show(); 432 lblCity->show();
433} 433}
434 434
435void ZoneMap::resizeEvent( QResizeEvent *e ) 435void ZoneMap::resizeEvent( QResizeEvent *e )
436{ 436{
437 // keep the zoom button down in the corner 437 // keep the zoom button down in the corner
438 QSize _size = e->size(); 438 QSize _size = e->size();
439 cmdZoom->move( _size.width() - cmdZoom->width(), 439 cmdZoom->move( _size.width() - cmdZoom->width(),
440 _size.height() - cmdZoom->height() ); 440 _size.height() - cmdZoom->height() );
441 if ( !bZoom ) { 441 if ( !bZoom ) {
442 drawableW = width() - 2 * frameWidth(); 442 drawableW = width() - 2 * frameWidth();
443 drawableH = height() - 2 * frameWidth(); 443 drawableH = height() - 2 * frameWidth();
444 makeMap( drawableW, drawableH ); 444 makeMap( drawableW, drawableH );
445 resizeContents( drawableW, drawableH ); 445 resizeContents( drawableW, drawableH );
446 } 446 }
447} 447}
448 448
449void ZoneMap::showZones( void ) const 449void ZoneMap::showZones( void ) const
450{ 450{
451 // go through the zones in the list and just display the values... 451 // go through the zones in the list and just display the values...
452 QListIterator<ZoneField> itZone( zones ); 452 QListIterator<ZoneField> itZone( zones );
453 for ( itZone.toFirst(); itZone.current(); ++itZone ) { 453 for ( itZone.toFirst(); itZone.current(); ++itZone ) {
454 ZoneField *pZone = itZone.current(); 454 ZoneField *pZone = itZone.current();
455 pZone->showStructure(); 455 pZone->showStructure();
456 } 456 }
457} 457}
458 458
459 459
460QWidget* ZoneMap::selectionWidget( QWidget *parent) { 460QWidget* ZoneMap::selectionWidget( QWidget *parent) {
461 461
462 QWidget *returnWidget = new QWidget( parent ); 462 QWidget *returnWidget = new QWidget( parent );
463 463
464 QVBoxLayout *layout = new QVBoxLayout( returnWidget ); 464 QVBoxLayout *layout = new QVBoxLayout( returnWidget );
465 QHBox *hBox = new QHBox( returnWidget ); 465 QHBox *hBox = new QHBox( returnWidget );
466 QListView *continentView = new QListView( hBox ); 466 QListView *continentView = new QListView( hBox );
467 continentView->addColumn( tr("Continent") ); 467 continentView->addColumn( tr("Continent") );
468 QWhatsThis::add( continentView, tr("Select a continent/country here, then select a city") ); 468 QWhatsThis::add( continentView, tr("Select a continent/country here, then select a city") );
469 connect ( continentView, SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( slotGetCities( QListViewItem * ) ) ); 469 connect ( continentView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( slotGetCities(QListViewItem*) ) );
470 470
471 QStringList continentList; 471 QStringList continentList;
472 QListIterator<ZoneField> itZone( zones ); 472 QListIterator<ZoneField> itZone( zones );
473 for ( itZone.toFirst(); itZone.current(); ++itZone ) { 473 for ( itZone.toFirst(); itZone.current(); ++itZone ) {
474 ZoneField *pZone = itZone.current(); 474 ZoneField *pZone = itZone.current();
475 if ( continentList.contains( pZone->country() ) == 0 ) { 475 if ( continentList.contains( pZone->country() ) == 0 ) {
476 QString name; 476 QString name;
477 QListViewItem *item; 477 QListViewItem *item;
478 if ( !(pZone->country().length() > 24) ) { 478 if ( !(pZone->country().length() > 24) ) {
479 name = pZone->country().left(pZone->country().length()-1 ); 479 name = pZone->country().left(pZone->country().length()-1 );
480 } else { 480 } else {
481 name = pZone->country().left( 24 ); 481 name = pZone->country().left( 24 );
482 } 482 }
483 item = new QListViewItem( continentView, name, pZone->country() ); 483 item = new QListViewItem( continentView, name, pZone->country() );
484 continentList.append( pZone->country() ); 484 continentList.append( pZone->country() );
485 } 485 }
486 } 486 }
487 487
488 cityView = new QListView( hBox ); 488 cityView = new QListView( hBox );
489 cityView->addColumn( tr("City") ); 489 cityView->addColumn( tr("City") );
490 490
491 layout->addWidget( hBox ); 491 layout->addWidget( hBox );
492 return returnWidget; 492 return returnWidget;
493} 493}
494 494
495void ZoneMap::slotGetCities( QListViewItem * contItem) { 495void ZoneMap::slotGetCities( QListViewItem * contItem) {
496 496
497 cityView->clear(); 497 cityView->clear();
498 selectedCont = contItem->text( 1 ); 498 selectedCont = contItem->text( 1 );
499 QListIterator<ZoneField> itZone( zones ); 499 QListIterator<ZoneField> itZone( zones );
500 for ( itZone.toFirst(); itZone.current(); ++itZone ) { 500 for ( itZone.toFirst(); itZone.current(); ++itZone ) {
501 ZoneField *pZone = itZone.current(); 501 ZoneField *pZone = itZone.current();
502 if ( pZone->country() == contItem->text( 1 ) ) { 502 if ( pZone->country() == contItem->text( 1 ) ) {
503 QListViewItem *item; 503 QListViewItem *item;
504 item = new QListViewItem( cityView, pZone->city() ); 504 item = new QListViewItem( cityView, pZone->city() );
505 connect ( cityView, SIGNAL( clicked ( QListViewItem* ) ), this, SLOT( slotCitySelected( QListViewItem* ) ) ); 505 connect ( cityView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( slotCitySelected(QListViewItem*) ) );
506 } 506 }
507 } 507 }
508} 508}
509 509
510void ZoneMap::slotCitySelected( QListViewItem *cityItem ) { 510void ZoneMap::slotCitySelected( QListViewItem *cityItem ) {
511 if ( cityItem ) { 511 if ( cityItem ) {
512 emit signalTz( selectedCont, cityItem->text( 0 ) ); 512 emit signalTz( selectedCont, cityItem->text( 0 ) );
513 } 513 }
514} 514}
515 515
516void ZoneMap::drawCities( QPainter *p ) 516void ZoneMap::drawCities( QPainter *p )
517{ 517{
518 int x, y, j; 518 int x, y, j;
519 // draw in the cities 519 // draw in the cities
520 // for testing only as when you put it 520 // for testing only as when you put it
521 // on the small screen it looks awful and not to mention useless 521 // on the small screen it looks awful and not to mention useless
522 p->setPen( red ); 522 p->setPen( red );
523 QListIterator<ZoneField> itZone( zones ); 523 QListIterator<ZoneField> itZone( zones );
524 for ( itZone.toFirst(), j = 0; itZone.current(); ++itZone, j++ ) { 524 for ( itZone.toFirst(), j = 0; itZone.current(); ++itZone, j++ ) {
525 ZoneField *pZone = itZone.current(); 525 ZoneField *pZone = itZone.current();
526 zoneToWin( pZone->x(), pZone->y(), x, y ); 526 zoneToWin( pZone->x(), pZone->y(), x, y );
527 if ( x > wImg ) 527 if ( x > wImg )
528 x = x - wImg; 528 x = x - wImg;
529 p->drawRect( x - iCITYOFFSET, y - iCITYOFFSET, iCITYSIZE, iCITYSIZE); 529 p->drawRect( x - iCITYOFFSET, y - iCITYOFFSET, iCITYSIZE, iCITYSIZE);
530 } 530 }
531} 531}
532 532
533static void dayNight(QImage *pImage) 533static void dayNight(QImage *pImage)
534{ 534{
535 // create a mask the functions from sun.h 535 // create a mask the functions from sun.h
536 double dJulian, 536 double dJulian,
537 dSunRad, 537 dSunRad,
538 dSunDecl, 538 dSunDecl,
539 dSunRadius, 539 dSunRadius,
540 dSunLong; 540 dSunLong;
541 int wImage = pImage->width(), 541 int wImage = pImage->width(),
542 hImage = pImage->height(), 542 hImage = pImage->height(),
543 iStart, 543 iStart,
544 iStop, 544 iStop,
545 iMid, 545 iMid,
546 relw, 546 relw,
547 i; 547 i;
548 short wtab[ wImage ]; 548 short wtab[ wImage ];
549 time_t tCurrent; 549 time_t tCurrent;
550 struct tm *pTm; 550 struct tm *pTm;
551 551
552 // get the position of the sun bassed on our current time... 552 // get the position of the sun bassed on our current time...
553 tCurrent = time( NULL ); 553 tCurrent = time( NULL );
diff --git a/core/settings/launcher/menusettings.cpp b/core/settings/launcher/menusettings.cpp
index dc8e993..2b64c47 100644
--- a/core/settings/launcher/menusettings.cpp
+++ b/core/settings/launcher/menusettings.cpp
@@ -25,151 +25,151 @@
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "menusettings.h" 29#include "menusettings.h"
30 30
31#include <qpe/config.h> 31#include <qpe/config.h>
32#include <qpe/qlibrary.h> 32#include <qpe/qlibrary.h>
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#include <qpe/menuappletinterface.h> 34#include <qpe/menuappletinterface.h>
35#include <qpe/qcopenvelope_qws.h> 35#include <qpe/qcopenvelope_qws.h>
36 36
37#include <qdir.h> 37#include <qdir.h>
38#include <qlistview.h> 38#include <qlistview.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qheader.h> 40#include <qheader.h>
41#include <qlayout.h> 41#include <qlayout.h>
42#include <qlabel.h> 42#include <qlabel.h>
43#include <qwhatsthis.h> 43#include <qwhatsthis.h>
44 44
45#include <stdlib.h> 45#include <stdlib.h>
46 46
47 47
48MenuSettings::MenuSettings ( QWidget *parent, const char *name ) 48MenuSettings::MenuSettings ( QWidget *parent, const char *name )
49 : QWidget ( parent, name ) 49 : QWidget ( parent, name )
50{ 50{
51 m_applets_changed = false; 51 m_applets_changed = false;
52 52
53 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); 53 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
54 54
55 QLabel *l = new QLabel ( tr( "Load applets in O-Menu:" ), this ); 55 QLabel *l = new QLabel ( tr( "Load applets in O-Menu:" ), this );
56 lay-> addWidget ( l ); 56 lay-> addWidget ( l );
57 57
58 m_list = new QListView ( this ); 58 m_list = new QListView ( this );
59 m_list-> addColumn ( "foobar" ); 59 m_list-> addColumn ( "foobar" );
60 m_list-> header ( )-> hide ( ); 60 m_list-> header ( )-> hide ( );
61 61
62 lay-> addWidget ( m_list ); 62 lay-> addWidget ( m_list );
63 63
64 m_menutabs = new QCheckBox ( tr( "Show Launcher tabs in O-Menu" ), this ); 64 m_menutabs = new QCheckBox ( tr( "Show Launcher tabs in O-Menu" ), this );
65 lay-> addWidget ( m_menutabs ); 65 lay-> addWidget ( m_menutabs );
66 66
67 m_menusubpopup = new QCheckBox ( tr( "Show Applications in Subpopups" ), this ); 67 m_menusubpopup = new QCheckBox ( tr( "Show Applications in Subpopups" ), this );
68 lay-> addWidget ( m_menusubpopup ); 68 lay-> addWidget ( m_menusubpopup );
69 69
70 QWhatsThis::add ( m_list, tr( "Check the applets that you want to have included in the O-Menu." )); 70 QWhatsThis::add ( m_list, tr( "Check the applets that you want to have included in the O-Menu." ));
71 QWhatsThis::add ( m_menutabs, tr( "Adds the contents of the Launcher Tabs as menus in the O-Menu." )); 71 QWhatsThis::add ( m_menutabs, tr( "Adds the contents of the Launcher Tabs as menus in the O-Menu." ));
72 72
73 connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( ))); 73 connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged()));
74 74
75 init ( ); 75 init ( );
76} 76}
77 77
78void MenuSettings::init ( ) 78void MenuSettings::init ( )
79{ 79{
80 Config cfg ( "StartMenu" ); 80 Config cfg ( "StartMenu" );
81 cfg. setGroup ( "Applets" ); 81 cfg. setGroup ( "Applets" );
82 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); 82 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' );
83 83
84 QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; 84 QString path = QPEApplication::qpeDir ( ) + "/plugins/applets";
85#ifdef Q_OS_MACX 85#ifdef Q_OS_MACX
86 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); 86 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( );
87#else 87#else
88 QStringList list = QDir ( path, "lib*.so" ). entryList ( ); 88 QStringList list = QDir ( path, "lib*.so" ). entryList ( );
89#endif /* Q_OS_MACX */ 89#endif /* Q_OS_MACX */
90 90
91 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { 91 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
92 QString name; 92 QString name;
93 QPixmap icon; 93 QPixmap icon;
94 MenuAppletInterface *iface = 0; 94 MenuAppletInterface *iface = 0;
95 95
96 QLibrary *lib = new QLibrary ( path + "/" + *it ); 96 QLibrary *lib = new QLibrary ( path + "/" + *it );
97 lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface ); 97 lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface );
98 if ( iface ) { 98 if ( iface ) {
99 QString lang = getenv( "LANG" ); 99 QString lang = getenv( "LANG" );
100 QTranslator *trans = new QTranslator ( qApp ); 100 QTranslator *trans = new QTranslator ( qApp );
101 QString type = (*it). left ((*it). find (".")); 101 QString type = (*it). left ((*it). find ("."));
102 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; 102 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm";
103 if ( trans-> load ( tfn )) 103 if ( trans-> load ( tfn ))
104 qApp-> installTranslator ( trans ); 104 qApp-> installTranslator ( trans );
105 else 105 else
106 delete trans; 106 delete trans;
107 name = iface-> name ( ); 107 name = iface-> name ( );
108 icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal ); 108 icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal );
109 iface-> release ( ); 109 iface-> release ( );
110 lib-> unload ( ); 110 lib-> unload ( );
111 111
112 QCheckListItem *item; 112 QCheckListItem *item;
113 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); 113 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
114 if ( !icon. isNull ( )) 114 if ( !icon. isNull ( ))
115 item-> setPixmap ( 0, icon ); 115 item-> setPixmap ( 0, icon );
116 item-> setOn ( exclude. find ( *it ) == exclude. end ( )); 116 item-> setOn ( exclude. find ( *it ) == exclude. end ( ));
117 m_applets [*it] = item; 117 m_applets [*it] = item;
118 } else { 118 } else {
119 delete lib; 119 delete lib;
120 } 120 }
121 } 121 }
122 122
123 cfg. setGroup ( "Menu" ); 123 cfg. setGroup ( "Menu" );
124 m_menutabs->setChecked( cfg.readBoolEntry( "LauncherTabs", true ) ); 124 m_menutabs->setChecked( cfg.readBoolEntry( "LauncherTabs", true ) );
125 m_menusubpopup->setChecked( cfg.readBoolEntry( "LauncherSubPopup", true ) ); 125 m_menusubpopup->setChecked( cfg.readBoolEntry( "LauncherSubPopup", true ) );
126 m_menusubpopup->setEnabled( m_menutabs->isChecked() ); 126 m_menusubpopup->setEnabled( m_menutabs->isChecked() );
127 connect( m_menutabs, SIGNAL( stateChanged( int ) ), m_menusubpopup, SLOT( setEnabled( bool ) ) ); 127 connect( m_menutabs, SIGNAL( stateChanged(int) ), m_menusubpopup, SLOT( setEnabled(bool) ) );
128 128
129} 129}
130 130
131void MenuSettings::appletChanged() 131void MenuSettings::appletChanged()
132{ 132{
133 m_applets_changed = true; 133 m_applets_changed = true;
134} 134}
135 135
136void MenuSettings::accept ( ) 136void MenuSettings::accept ( )
137{ 137{
138 bool apps_changed = false; 138 bool apps_changed = false;
139 139
140 Config cfg ( "StartMenu" ); 140 Config cfg ( "StartMenu" );
141 cfg. setGroup ( "Applets" ); 141 cfg. setGroup ( "Applets" );
142 if ( m_applets_changed ) { 142 if ( m_applets_changed ) {
143 QStringList exclude; 143 QStringList exclude;
144 QMap <QString, QCheckListItem *>::Iterator it; 144 QMap <QString, QCheckListItem *>::Iterator it;
145 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { 145 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) {
146 if ( !(*it)-> isOn ( )) 146 if ( !(*it)-> isOn ( ))
147 exclude << it. key ( ); 147 exclude << it. key ( );
148 } 148 }
149 cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); 149 cfg. writeEntry ( "ExcludeApplets", exclude, ',' );
150 } 150 }
151 cfg. writeEntry ( "SafeMode", false ); 151 cfg. writeEntry ( "SafeMode", false );
152 152
153 cfg. setGroup ( "Menu" ); 153 cfg. setGroup ( "Menu" );
154 154
155 if ( m_menutabs-> isChecked ( ) != cfg. readBoolEntry ( "LauncherTabs", true )) { 155 if ( m_menutabs-> isChecked ( ) != cfg. readBoolEntry ( "LauncherTabs", true )) {
156 apps_changed = true; 156 apps_changed = true;
157 cfg. writeEntry ( "LauncherTabs", m_menutabs-> isChecked ( )); 157 cfg. writeEntry ( "LauncherTabs", m_menutabs-> isChecked ( ));
158 } 158 }
159 159
160 if ( m_menusubpopup-> isChecked ( ) != cfg. readBoolEntry ( "LauncherSubPopup", true )) { 160 if ( m_menusubpopup-> isChecked ( ) != cfg. readBoolEntry ( "LauncherSubPopup", true )) {
161 apps_changed = true; 161 apps_changed = true;
162 cfg. writeEntry ( "LauncherSubPopup", m_menusubpopup-> isChecked ( )); 162 cfg. writeEntry ( "LauncherSubPopup", m_menusubpopup-> isChecked ( ));
163 } 163 }
164 164
165 cfg. write ( ); 165 cfg. write ( );
166 166
167 if ( m_applets_changed ) { 167 if ( m_applets_changed ) {
168 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" ); 168 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" );
169 m_applets_changed = false; 169 m_applets_changed = false;
170 } 170 }
171 if ( apps_changed ) { 171 if ( apps_changed ) {
172 // currently use reloadApplets() since reloadApps is now used exclusive for server 172 // currently use reloadApplets() since reloadApps is now used exclusive for server
173 // to refresh the tabs. But what we want here is also a refresh of the startmenu entries 173 // to refresh the tabs. But what we want here is also a refresh of the startmenu entries
174 QCopEnvelope ( "QPE/TaskBar", "reloadApps()" ); 174 QCopEnvelope ( "QPE/TaskBar", "reloadApps()" );
175 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" ); 175 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" );
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp
index f79ad40..c0d1cf2 100644
--- a/core/settings/launcher/tabdialog.cpp
+++ b/core/settings/launcher/tabdialog.cpp
@@ -274,198 +274,198 @@ TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig
274 tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" )); 274 tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" ));
275 tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) ); 275 tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) );
276 276
277 tw-> setCurrentTab ( bgtab ); 277 tw-> setCurrentTab ( bgtab );
278 278
279 QWidget *sample = new QVBox ( this ); 279 QWidget *sample = new QVBox ( this );
280 QTabBar *tb = new QTabBar ( sample ); 280 QTabBar *tb = new QTabBar ( sample );
281 QString name ( tr( "Previewing %1" ). arg ( tabname )); 281 QString name ( tr( "Previewing %1" ). arg ( tabname ));
282 282
283 tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); 283 tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name ));
284 284
285 m_sample = new SampleView ( sample ); 285 m_sample = new SampleView ( sample );
286 286
287 lay-> addWidget ( tw, 10 ); 287 lay-> addWidget ( tw, 10 );
288 lay-> addWidget ( sample, 1 ); 288 lay-> addWidget ( sample, 1 );
289 289
290 m_iconsize-> setButton ( tc. m_view ); 290 m_iconsize-> setButton ( tc. m_view );
291 iconSizeClicked ( tc. m_view ); 291 iconSizeClicked ( tc. m_view );
292 //m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); 292 //m_iconcolor-> setColor ( QColor ( m_tc. m_text_color ));
293 iconColorClicked ( m_iconcolor-> color ( )); 293 iconColorClicked ( m_iconcolor-> color ( ));
294 m_bgtype-> setButton ( tc. m_bg_type ); 294 m_bgtype-> setButton ( tc. m_bg_type );
295 //m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); 295 //m_solidcolor-> setColor ( QColor ( tc. m_bg_color ));
296 m_bgimage = tc. m_bg_image; 296 m_bgimage = tc. m_bg_image;
297 bgTypeClicked ( tc. m_bg_type ); 297 bgTypeClicked ( tc. m_bg_type );
298 m_fontuse-> setChecked ( tc. m_font_use ); 298 m_fontuse-> setChecked ( tc. m_font_use );
299 m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); 299 m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic ));
300 m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); 300 m_fontselect-> setEnabled ( m_fontuse-> isChecked ( ));
301 fontClicked ( m_fontselect-> selectedFont ( )); 301 fontClicked ( m_fontselect-> selectedFont ( ));
302 302
303 QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); 303 QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." ));
304} 304}
305 305
306 306
307TabDialog::~TabDialog ( ) 307TabDialog::~TabDialog ( )
308{ 308{
309} 309}
310 310
311QWidget *TabDialog::createFontTab ( QWidget *parent ) 311QWidget *TabDialog::createFontTab ( QWidget *parent )
312{ 312{
313 QWidget *tab = new QWidget ( parent, "FontTab" ); 313 QWidget *tab = new QWidget ( parent, "FontTab" );
314 QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 ); 314 QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 );
315 315
316 m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab ); 316 m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab );
317 vertLayout-> addWidget ( m_fontuse ); 317 vertLayout-> addWidget ( m_fontuse );
318 318
319 m_fontselect = new OFontSelector ( false, tab, "fontsel" ); 319 m_fontselect = new OFontSelector ( false, tab, "fontsel" );
320 vertLayout-> addWidget ( m_fontselect ); 320 vertLayout-> addWidget ( m_fontselect );
321 321
322 connect ( m_fontuse, SIGNAL( toggled ( bool )), m_fontselect, SLOT( setEnabled ( bool ))); 322 connect ( m_fontuse, SIGNAL( toggled(bool)), m_fontselect, SLOT( setEnabled(bool)));
323 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), 323 connect( m_fontselect, SIGNAL( fontSelected(const QFont&)),
324 this, SLOT( fontClicked ( const QFont & ))); 324 this, SLOT( fontClicked(const QFont&)));
325 325
326 return tab; 326 return tab;
327} 327}
328 328
329QWidget *TabDialog::createBgTab ( QWidget *parent ) 329QWidget *TabDialog::createBgTab ( QWidget *parent )
330{ 330{
331 QWidget *tab = new QWidget( parent, "BgTab" ); 331 QWidget *tab = new QWidget( parent, "BgTab" );
332 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); 332 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 );
333 333
334 QGridLayout* gridLayout = new QGridLayout ( vertLayout ); 334 QGridLayout* gridLayout = new QGridLayout ( vertLayout );
335 gridLayout-> setColStretch ( 1, 10 ); 335 gridLayout-> setColStretch ( 1, 10 );
336 336
337 QLabel* label = new QLabel( tr( "Type:" ), tab ); 337 QLabel* label = new QLabel( tr( "Type:" ), tab );
338 gridLayout-> addWidget ( label, 0, 0 ); 338 gridLayout-> addWidget ( label, 0, 0 );
339 m_bgtype = new QButtonGroup( tab, "buttongroup" ); 339 m_bgtype = new QButtonGroup( tab, "buttongroup" );
340 m_bgtype-> hide ( ); 340 m_bgtype-> hide ( );
341 m_bgtype-> setExclusive ( true ); 341 m_bgtype-> setExclusive ( true );
342 342
343 QRadioButton *rb; 343 QRadioButton *rb;
344 rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); 344 rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" );
345 m_bgtype-> insert ( rb, TabConfig::Ruled ); 345 m_bgtype-> insert ( rb, TabConfig::Ruled );
346 gridLayout-> addWidget( rb, 0, 1 ); 346 gridLayout-> addWidget( rb, 0, 1 );
347 347
348 QHBoxLayout *hb = new QHBoxLayout ( ); 348 QHBoxLayout *hb = new QHBoxLayout ( );
349 hb-> setSpacing ( 3 ); 349 hb-> setSpacing ( 3 );
350 350
351 rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); 351 rb = new QRadioButton( tr( "Solid color" ), tab, "solid" );
352 m_bgtype-> insert ( rb, TabConfig::SolidColor ); 352 m_bgtype-> insert ( rb, TabConfig::SolidColor );
353 hb-> addWidget ( rb ); 353 hb-> addWidget ( rb );
354 hb-> addSpacing ( 10 ); 354 hb-> addSpacing ( 10 );
355 355
356 m_solidcolor = new OColorButton ( tab, QColor ( m_tc. m_bg_color ) ); 356 m_solidcolor = new OColorButton ( tab, QColor ( m_tc. m_bg_color ) );
357 connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( bgColorClicked ( const QColor & ))); 357 connect ( m_solidcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( bgColorClicked(const QColor&)));
358 hb-> addWidget ( m_solidcolor ); 358 hb-> addWidget ( m_solidcolor );
359 hb-> addStretch ( 10 ); 359 hb-> addStretch ( 10 );
360 360
361 gridLayout-> addLayout ( hb, 1, 1 ); 361 gridLayout-> addLayout ( hb, 1, 1 );
362 362
363 hb = new QHBoxLayout ( ); 363 hb = new QHBoxLayout ( );
364 hb-> setSpacing ( 3 ); 364 hb-> setSpacing ( 3 );
365 365
366 rb = new QRadioButton( tr( "Image" ), tab, "image" ); 366 rb = new QRadioButton( tr( "Image" ), tab, "image" );
367 m_bgtype-> insert ( rb, TabConfig::Image ); 367 m_bgtype-> insert ( rb, TabConfig::Image );
368 hb-> addWidget( rb ); 368 hb-> addWidget( rb );
369 hb-> addSpacing ( 10 ); 369 hb-> addSpacing ( 10 );
370 370
371 m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); 371 m_imagebrowse = new QPushButton ( tr( "Select..." ), tab );
372 connect ( m_imagebrowse, SIGNAL( clicked ( )), this, SLOT( bgImageClicked ( ))); 372 connect ( m_imagebrowse, SIGNAL( clicked()), this, SLOT( bgImageClicked()));
373 hb-> addWidget ( m_imagebrowse ); 373 hb-> addWidget ( m_imagebrowse );
374 hb-> addStretch ( 10 ); 374 hb-> addStretch ( 10 );
375 375
376 gridLayout-> addLayout ( hb, 2, 1 ); 376 gridLayout-> addLayout ( hb, 2, 1 );
377 377
378 QPushButton *p = new QPushButton ( tr( "Default" ), tab ); 378 QPushButton *p = new QPushButton ( tr( "Default" ), tab );
379 connect ( p, SIGNAL( clicked ( )), this, SLOT( bgDefaultClicked ( ))); 379 connect ( p, SIGNAL( clicked()), this, SLOT( bgDefaultClicked()));
380 gridLayout-> addWidget ( p, 3, 1 ); 380 gridLayout-> addWidget ( p, 3, 1 );
381 381
382 connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int ))); 382 connect ( m_bgtype, SIGNAL( clicked(int)), this, SLOT( bgTypeClicked(int)));
383 383
384 vertLayout-> addStretch ( 10 ); 384 vertLayout-> addStretch ( 10 );
385 385
386 return tab; 386 return tab;
387} 387}
388 388
389QWidget *TabDialog::createIconTab ( QWidget *parent ) 389QWidget *TabDialog::createIconTab ( QWidget *parent )
390{ 390{
391 QWidget *tab = new QWidget( parent, "IconTab" ); 391 QWidget *tab = new QWidget( parent, "IconTab" );
392 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); 392 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 );
393 393
394 QGridLayout* gridLayout = new QGridLayout ( vertLayout ); 394 QGridLayout* gridLayout = new QGridLayout ( vertLayout );
395 gridLayout-> setColStretch ( 1, 10 ); 395 gridLayout-> setColStretch ( 1, 10 );
396 396
397 QLabel* label = new QLabel( tr( "Size:" ), tab ); 397 QLabel* label = new QLabel( tr( "Size:" ), tab );
398 gridLayout-> addWidget ( label, 0, 0 ); 398 gridLayout-> addWidget ( label, 0, 0 );
399 m_iconsize = new QButtonGroup( tab, "buttongroup" ); 399 m_iconsize = new QButtonGroup( tab, "buttongroup" );
400 m_iconsize-> hide ( ); 400 m_iconsize-> hide ( );
401 m_iconsize-> setExclusive ( true ); 401 m_iconsize-> setExclusive ( true );
402 402
403 QRadioButton *rb; 403 QRadioButton *rb;
404 rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); 404 rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" );
405 m_iconsize-> insert ( rb, TabConfig::List ); 405 m_iconsize-> insert ( rb, TabConfig::List );
406 gridLayout-> addWidget( rb, 0, 1 ); 406 gridLayout-> addWidget( rb, 0, 1 );
407 407
408 rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); 408 rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" );
409 m_iconsize-> insert ( rb, TabConfig::Icon ); 409 m_iconsize-> insert ( rb, TabConfig::Icon );
410 gridLayout-> addWidget( rb, 1, 1 ); 410 gridLayout-> addWidget( rb, 1, 1 );
411 411
412 connect ( m_iconsize, SIGNAL( clicked ( int )), this, SLOT( iconSizeClicked ( int ))); 412 connect ( m_iconsize, SIGNAL( clicked(int)), this, SLOT( iconSizeClicked(int)));
413 413
414 //vertLayout-> addSpacing ( 8 ); 414 //vertLayout-> addSpacing ( 8 );
415 415
416 //gridLayout = new QGridLayout ( vertLayout ); 416 //gridLayout = new QGridLayout ( vertLayout );
417 gridLayout-> addRowSpacing ( 2, 8 ); 417 gridLayout-> addRowSpacing ( 2, 8 );
418 418
419 label = new QLabel ( tr( "Color:" ), tab ); 419 label = new QLabel ( tr( "Color:" ), tab );
420 gridLayout-> addWidget ( label, 3, 0 ); 420 gridLayout-> addWidget ( label, 3, 0 );
421 421
422 m_iconcolor = new OColorButton ( tab, QColor ( m_tc. m_text_color ) ); 422 m_iconcolor = new OColorButton ( tab, QColor ( m_tc. m_text_color ) );
423 connect ( m_iconcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( iconColorClicked ( const QColor & ))); 423 connect ( m_iconcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( iconColorClicked(const QColor&)));
424 gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); 424 gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft );
425 425
426 vertLayout-> addStretch ( 10 ); 426 vertLayout-> addStretch ( 10 );
427 427
428 return tab; 428 return tab;
429} 429}
430 430
431 431
432void TabDialog::iconSizeClicked ( int s ) 432void TabDialog::iconSizeClicked ( int s )
433{ 433{
434 m_sample-> setViewMode ((TabConfig::ViewMode) s ); 434 m_sample-> setViewMode ((TabConfig::ViewMode) s );
435} 435}
436 436
437void TabDialog::fontClicked ( const QFont &f ) 437void TabDialog::fontClicked ( const QFont &f )
438{ 438{
439 m_sample-> setViewFont ( f ); 439 m_sample-> setViewFont ( f );
440} 440}
441 441
442void TabDialog::bgTypeClicked ( int t ) 442void TabDialog::bgTypeClicked ( int t )
443{ 443{
444 QString s; 444 QString s;
445 445
446 if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) 446 if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t )
447 m_bgtype-> setButton ( t ); 447 m_bgtype-> setButton ( t );
448 448
449 m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); 449 m_solidcolor-> setEnabled ( t == TabConfig::SolidColor );
450 m_imagebrowse-> setEnabled ( t == TabConfig::Image ); 450 m_imagebrowse-> setEnabled ( t == TabConfig::Image );
451 451
452 if ( t == TabConfig::SolidColor ) 452 if ( t == TabConfig::SolidColor )
453 s = m_solidcolor-> color ( ). name ( ); 453 s = m_solidcolor-> color ( ). name ( );
454 else if ( t == TabConfig::Image ) 454 else if ( t == TabConfig::Image )
455 s = Resource::findPixmap ( m_bgimage ); 455 s = Resource::findPixmap ( m_bgimage );
456 456
457 m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); 457 m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s );
458} 458}
459 459
460void TabDialog::bgColorClicked ( const QColor & ) 460void TabDialog::bgColorClicked ( const QColor & )
461{ 461{
462 bgTypeClicked ( TabConfig::SolidColor ); 462 bgTypeClicked ( TabConfig::SolidColor );
463} 463}
464 464
465void TabDialog::iconColorClicked ( const QColor &col ) 465void TabDialog::iconColorClicked ( const QColor &col )
466{ 466{
467 m_sample-> setTextColor ( col ); 467 m_sample-> setTextColor ( col );
468} 468}
469 469
470void TabDialog::bgImageClicked ( ) 470void TabDialog::bgImageClicked ( )
471{ 471{
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp
index 17a1609..e5a7087 100644
--- a/core/settings/launcher/tabssettings.cpp
+++ b/core/settings/launcher/tabssettings.cpp
@@ -21,105 +21,105 @@
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27 27
28#include "tabssettings.h" 28#include "tabssettings.h"
29 29
30#include <qpe/resource.h> 30#include <qpe/resource.h>
31#include <qpe/applnk.h> 31#include <qpe/applnk.h>
32#include <qpe/mimetype.h> 32#include <qpe/mimetype.h>
33#include <qpe/qcopenvelope_qws.h> 33#include <qpe/qcopenvelope_qws.h>
34#include <qpe/config.h> 34#include <qpe/config.h>
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36 36
37#include <qlistbox.h> 37#include <qlistbox.h>
38#include <qpushbutton.h> 38#include <qpushbutton.h>
39#include <qlayout.h> 39#include <qlayout.h>
40#include <qlabel.h> 40#include <qlabel.h>
41#include <qwhatsthis.h> 41#include <qwhatsthis.h>
42#include <qcheckbox.h> 42#include <qcheckbox.h>
43 43
44#include "tabdialog.h" 44#include "tabdialog.h"
45 45
46#include <stdlib.h> 46#include <stdlib.h>
47#include <qmessagebox.h> 47#include <qmessagebox.h>
48 48
49 49
50 #define GLOBALID ".global." 50 #define GLOBALID ".global."
51 51
52 52
53TabsSettings::TabsSettings ( QWidget *parent, const char *name ) 53TabsSettings::TabsSettings ( QWidget *parent, const char *name )
54 : QWidget ( parent, name ) 54 : QWidget ( parent, name )
55{ 55{
56 QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); 56 QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 );
57 57
58 QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); 58 QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this );
59 lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); 59 lay-> addMultiCellWidget ( l, 0, 0, 0, 1 );
60 60
61 m_list = new QListBox ( this ); 61 m_list = new QListBox ( this );
62 lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); 62 lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 );
63 63
64 QWhatsThis::add ( m_list, tr( "foobar" )); 64 QWhatsThis::add ( m_list, tr( "foobar" ));
65 65
66 QPushButton *p1, *p2, *p3; 66 QPushButton *p1, *p2, *p3;
67 p1 = new QPushButton ( tr( "New" ), this ); 67 p1 = new QPushButton ( tr( "New" ), this );
68 lay-> addWidget ( p1, 1, 1 ); 68 lay-> addWidget ( p1, 1, 1 );
69 connect ( p1, SIGNAL( clicked ( )), this, SLOT( newClicked ( ))); 69 connect ( p1, SIGNAL( clicked()), this, SLOT( newClicked()));
70 70
71 p2 = new QPushButton ( tr( "Edit" ), this ); 71 p2 = new QPushButton ( tr( "Edit" ), this );
72 lay-> addWidget ( p2, 2, 1 ); 72 lay-> addWidget ( p2, 2, 1 );
73 connect ( p2, SIGNAL( clicked ( )), this, SLOT( editClicked ( ))); 73 connect ( p2, SIGNAL( clicked()), this, SLOT( editClicked()));
74 74
75 p3 = new QPushButton ( tr( "Delete" ), this ); 75 p3 = new QPushButton ( tr( "Delete" ), this );
76 lay-> addWidget ( p3, 3, 1 ); 76 lay-> addWidget ( p3, 3, 1 );
77 connect ( p3, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( ))); 77 connect ( p3, SIGNAL( clicked()), this, SLOT( deleteClicked()));
78 78
79 lay-> setRowStretch ( 4, 10 ); 79 lay-> setRowStretch ( 4, 10 );
80 80
81 m_bigbusy = new QCheckBox( tr( "Enable big busy indicator" ), this ); 81 m_bigbusy = new QCheckBox( tr( "Enable big busy indicator" ), this );
82 lay-> addMultiCellWidget ( m_bigbusy, 5, 5, 0, 1 ); 82 lay-> addMultiCellWidget ( m_bigbusy, 5, 5, 0, 1 );
83 83
84 m_busyani = new QCheckBox ( tr( "Enable animated busy indicator" ), this ); 84 m_busyani = new QCheckBox ( tr( "Enable animated busy indicator" ), this );
85 lay-> addMultiCellWidget ( m_busyani, 6, 6, 0, 1 ); 85 lay-> addMultiCellWidget ( m_busyani, 6, 6, 0, 1 );
86 86
87 p1-> setEnabled ( false ); 87 p1-> setEnabled ( false );
88 p3-> setEnabled ( false ); 88 p3-> setEnabled ( false );
89 89
90 init ( ); 90 init ( );
91 91
92 QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." )); 92 QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." ));
93 QWhatsThis::add ( p1, tr( "Adds a new Tab to the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); 93 QWhatsThis::add ( p1, tr( "Adds a new Tab to the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." ));
94 QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." )); 94 QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." ));
95 QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); 95 QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." ));
96 QWhatsThis::add ( m_bigbusy, tr( "Activate this, if you want a big busy indicator in the middle of the screen instead of the one in taskbar." )); 96 QWhatsThis::add ( m_bigbusy, tr( "Activate this, if you want a big busy indicator in the middle of the screen instead of the one in taskbar." ));
97 QWhatsThis::add ( m_busyani, tr( "Activate this, if you want an animatedbusy indicator for starting applications in the Launcher." )); 97 QWhatsThis::add ( m_busyani, tr( "Activate this, if you want an animatedbusy indicator for starting applications in the Launcher." ));
98} 98}
99 99
100void TabsSettings::init ( ) 100void TabsSettings::init ( )
101{ 101{
102 AppLnkSet rootFolder( MimeType::appsFolderName ( )); 102 AppLnkSet rootFolder( MimeType::appsFolderName ( ));
103 QStringList types = rootFolder. types ( ); 103 QStringList types = rootFolder. types ( );
104 104
105 m_list-> insertItem ( tr( "All Tabs" )); 105 m_list-> insertItem ( tr( "All Tabs" ));
106 m_ids << GLOBALID; 106 m_ids << GLOBALID;
107 107
108 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { 108 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) {
109 m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); 109 m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it ));
110 m_ids << *it; 110 m_ids << *it;
111 } 111 }
112 QImage img ( Resource::loadImage ( "DocsIcon" )); 112 QImage img ( Resource::loadImage ( "DocsIcon" ));
113 QPixmap pix; 113 QPixmap pix;
114 pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); 114 pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( ));
115 m_list-> insertItem ( pix, tr( "Documents" )); 115 m_list-> insertItem ( pix, tr( "Documents" ));
116 m_ids += "Documents"; // No tr 116 m_ids += "Documents"; // No tr
117 117
118 Config cfg ( "Launcher" ); 118 Config cfg ( "Launcher" );
119 119
120 readTabSettings ( cfg ); 120 readTabSettings ( cfg );
121 121
122 cfg. setGroup ( "GUI" ); 122 cfg. setGroup ( "GUI" );
123 m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" ); 123 m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" );
124 m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) ); 124 m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) );
125} 125}
diff --git a/core/settings/launcher/taskbarsettings.cpp b/core/settings/launcher/taskbarsettings.cpp
index badb98f..43886c9 100644
--- a/core/settings/launcher/taskbarsettings.cpp
+++ b/core/settings/launcher/taskbarsettings.cpp
@@ -17,97 +17,97 @@
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 "taskbarsettings.h" 29#include "taskbarsettings.h"
30 30
31#include <qpe/config.h> 31#include <qpe/config.h>
32#include <qpe/qlibrary.h> 32#include <qpe/qlibrary.h>
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#include <qpe/taskbarappletinterface.h> 34#include <qpe/taskbarappletinterface.h>
35#include <qpe/qcopenvelope_qws.h> 35#include <qpe/qcopenvelope_qws.h>
36 36
37#include <qdir.h> 37#include <qdir.h>
38#include <qlistview.h> 38#include <qlistview.h>
39#include <qheader.h> 39#include <qheader.h>
40#include <qlayout.h> 40#include <qlayout.h>
41#include <qlabel.h> 41#include <qlabel.h>
42#include <qwhatsthis.h> 42#include <qwhatsthis.h>
43 43
44#include <stdlib.h> 44#include <stdlib.h>
45 45
46 46
47TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name ) 47TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name )
48 : QWidget ( parent, name ) 48 : QWidget ( parent, name )
49{ 49{
50 m_applets_changed = false; 50 m_applets_changed = false;
51 51
52 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); 52 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
53 53
54 QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this ); 54 QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this );
55 lay-> addWidget ( l ); 55 lay-> addWidget ( l );
56 56
57 m_list = new QListView ( this ); 57 m_list = new QListView ( this );
58 m_list-> addColumn ( "foobar" ); 58 m_list-> addColumn ( "foobar" );
59 m_list-> header ( )-> hide ( ); 59 m_list-> header ( )-> hide ( );
60 60
61 lay-> addWidget ( m_list ); 61 lay-> addWidget ( m_list );
62 62
63 QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." )); 63 QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." ));
64 64
65 connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( ))); 65 connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged()));
66 66
67 init ( ); 67 init ( );
68} 68}
69 69
70void TaskbarSettings::init ( ) 70void TaskbarSettings::init ( )
71{ 71{
72 Config cfg ( "Taskbar" ); 72 Config cfg ( "Taskbar" );
73 cfg. setGroup ( "Applets" ); 73 cfg. setGroup ( "Applets" );
74 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); 74 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' );
75 75
76 QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; 76 QString path = QPEApplication::qpeDir ( ) + "/plugins/applets";
77#ifdef Q_OS_MACX 77#ifdef Q_OS_MACX
78 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); 78 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( );
79#else 79#else
80 QStringList list = QDir ( path, "lib*.so" ). entryList ( ); 80 QStringList list = QDir ( path, "lib*.so" ). entryList ( );
81#endif /* Q_OS_MACX */ 81#endif /* Q_OS_MACX */
82 82
83 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { 83 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
84 QString name; 84 QString name;
85 QPixmap icon; 85 QPixmap icon;
86 TaskbarNamedAppletInterface *iface = 0; 86 TaskbarNamedAppletInterface *iface = 0;
87 87
88 qWarning("Load applet: %s", (*it).latin1() ); 88 qWarning("Load applet: %s", (*it).latin1() );
89 QLibrary *lib = new QLibrary ( path + "/" + *it ); 89 QLibrary *lib = new QLibrary ( path + "/" + *it );
90 lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); 90 lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface );
91 qWarning("<1>"); 91 qWarning("<1>");
92 if ( iface ) { 92 if ( iface ) {
93 qWarning("<2>"); 93 qWarning("<2>");
94 QString lang = getenv( "LANG" ); 94 QString lang = getenv( "LANG" );
95 QTranslator *trans = new QTranslator ( qApp ); 95 QTranslator *trans = new QTranslator ( qApp );
96 QString type = (*it). left ((*it). find (".")); 96 QString type = (*it). left ((*it). find ("."));
97 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; 97 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm";
98 if ( trans-> load ( tfn )) 98 if ( trans-> load ( tfn ))
99 qApp-> installTranslator ( trans ); 99 qApp-> installTranslator ( trans );
100 else 100 else
101 delete trans; 101 delete trans;
102 name = iface-> name ( ); 102 name = iface-> name ( );
103 icon = iface-> icon ( ); 103 icon = iface-> icon ( );
104 iface-> release ( ); 104 iface-> release ( );
105 } 105 }
106 qWarning("<3>"); 106 qWarning("<3>");
107 if ( !iface ) { 107 if ( !iface ) {
108 qWarning("<4>"); 108 qWarning("<4>");
109 lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); 109 lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface );
110 110
111 if ( iface ) { 111 if ( iface ) {
112 qWarning("<5>"); 112 qWarning("<5>");
113 name = (*it). mid ( 3 ); 113 name = (*it). mid ( 3 );
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp
index 4baff8e..ce45836 100644
--- a/core/settings/light-and-power/light.cpp
+++ b/core/settings/light-and-power/light.cpp
@@ -127,133 +127,133 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
127 contrast-> setValue ( contr ); 127 contrast-> setValue ( contr );
128 } 128 }
129 129
130 // light sensor 130 // light sensor
131 auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); 131 auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false ));
132 m_sensordata = config. readListEntry ( "LightSensorData", ';' ); 132 m_sensordata = config. readListEntry ( "LightSensorData", ';' );
133 133
134 config. setGroup ( "AC" ); 134 config. setGroup ( "AC" );
135 135
136 // ac spinboxes 136 // ac spinboxes
137 interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 )); 137 interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 ));
138 interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 )); 138 interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 ));
139 interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 )); 139 interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 ));
140 140
141 // ac check and slider 141 // ac check and slider
142 LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); 142 LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false ));
143 143
144 // CPU frequency 144 // CPU frequency
145 frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); 145 frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) );
146 146
147 // hinge action 147 // hinge action
148 closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); 148 closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) );
149 149
150 bright = config. readNumEntry ( "Brightness", 255 ); 150 bright = config. readNumEntry ( "Brightness", 255 );
151 brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); 151 brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres ));
152 brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); 152 brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres ));
153 brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres )); 153 brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres ));
154 brightness_ac-> setValue ( bright ); 154 brightness_ac-> setValue ( bright );
155 155
156 if (m_cres) { 156 if (m_cres) {
157 contr = config. readNumEntry ( "Contrast", 127); 157 contr = config. readNumEntry ( "Contrast", 127);
158 contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres )); 158 contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres ));
159 contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres )); 159 contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres ));
160 contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres )); 160 contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres ));
161 contrast_ac-> setValue ( contr ); 161 contrast_ac-> setValue ( contr );
162 } 162 }
163 163
164 // light sensor 164 // light sensor
165 auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); 165 auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false ));
166 m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); 166 m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' );
167 167
168 // warnings 168 // warnings
169 config. setGroup ( "Warnings" ); 169 config. setGroup ( "Warnings" );
170 warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); 170 warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 );
171 lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); 171 lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) );
172 criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) ); 172 criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) );
173 173
174 m_resettimer = new QTimer ( this ); 174 m_resettimer = new QTimer ( this );
175 connect ( m_resettimer, SIGNAL( timeout ( )), this, SLOT( resetBacklight ( ))); 175 connect ( m_resettimer, SIGNAL( timeout()), this, SLOT( resetBacklight()));
176 176
177 if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { 177 if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) {
178 tabs-> setCurrentPage ( 0 ); 178 tabs-> setCurrentPage ( 0 );
179 } 179 }
180 else { 180 else {
181 tabs-> setCurrentPage ( 1 ); 181 tabs-> setCurrentPage ( 1 );
182 } 182 }
183 183
184 connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); 184 connect ( brightness, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int)));
185 connect ( brightness_ac, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); 185 connect ( brightness_ac, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int)));
186 if (m_cres) { 186 if (m_cres) {
187 connect ( contrast, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int ))); 187 connect ( contrast, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int)));
188 connect ( contrast_ac, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int ))); 188 connect ( contrast_ac, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int)));
189 } 189 }
190 connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); 190 connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) );
191 connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); 191 connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) );
192 connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); 192 connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) );
193 connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); 193 connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) );
194} 194}
195 195
196LightSettings::~LightSettings ( ) 196LightSettings::~LightSettings ( )
197{ 197{
198} 198}
199 199
200void LightSettings::calibrateSensor ( ) 200void LightSettings::calibrateSensor ( )
201{ 201{
202 Sensor *s = new Sensor ( m_sensordata, this ); 202 Sensor *s = new Sensor ( m_sensordata, this );
203 connect ( s, SIGNAL( viewBacklight ( int )), this, SLOT( setBacklight ( int ))); 203 connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int)));
204 QPEApplication::execDialog( s ); 204 QPEApplication::execDialog( s );
205 delete s; 205 delete s;
206} 206}
207 207
208void LightSettings::calibrateSensorAC ( ) 208void LightSettings::calibrateSensorAC ( )
209{ 209{
210 Sensor *s = new Sensor ( m_sensordata_ac, this ); 210 Sensor *s = new Sensor ( m_sensordata_ac, this );
211 connect ( s, SIGNAL( viewBacklight ( int )), this, SLOT( setBacklight ( int ))); 211 connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int)));
212 QPEApplication::execDialog ( s ); 212 QPEApplication::execDialog ( s );
213 delete s; 213 delete s;
214} 214}
215 215
216void LightSettings::setBacklight ( int bright ) 216void LightSettings::setBacklight ( int bright )
217{ 217{
218 QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); 218 QCopEnvelope e ( "QPE/System", "setBacklight(int)" );
219 e << bright; 219 e << bright;
220 220
221 if ( bright != -1 ) { 221 if ( bright != -1 ) {
222 m_resettimer-> stop ( ); 222 m_resettimer-> stop ( );
223 m_resettimer-> start ( 4000, true ); 223 m_resettimer-> start ( 4000, true );
224 } 224 }
225} 225}
226 226
227void LightSettings::setContrast ( int contr ) 227void LightSettings::setContrast ( int contr )
228{ 228{
229 if (contr == -1) contr = m_oldcontrast; 229 if (contr == -1) contr = m_oldcontrast;
230 ODevice::inst ( )-> setDisplayContrast(contr); 230 ODevice::inst ( )-> setDisplayContrast(contr);
231} 231}
232 232
233void LightSettings::setFrequency ( int index ) 233void LightSettings::setFrequency ( int index )
234{ 234{
235 qWarning("LightSettings::setFrequency(%d)", index); 235 qWarning("LightSettings::setFrequency(%d)", index);
236 ODevice::inst ( )-> setCurrentCpuFrequency(index); 236 ODevice::inst ( )-> setCurrentCpuFrequency(index);
237} 237}
238 238
239void LightSettings::resetBacklight ( ) 239void LightSettings::resetBacklight ( )
240{ 240{
241 setBacklight ( -1 ); 241 setBacklight ( -1 );
242 setContrast ( -1 ); 242 setContrast ( -1 );
243} 243}
244 244
245void LightSettings::setCloseHingeAction ( int index ) 245void LightSettings::setCloseHingeAction ( int index )
246{ 246{
247 qWarning("LightSettings::setCloseHingeStatus(%d)", index); 247 qWarning("LightSettings::setCloseHingeStatus(%d)", index);
248} 248}
249 249
250void LightSettings::accept ( ) 250void LightSettings::accept ( )
251{ 251{
252 Config config ( "apm" ); 252 Config config ( "apm" );
253 253
254 // bat 254 // bat
255 config. setGroup ( "Battery" ); 255 config. setGroup ( "Battery" );
256 config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( )); 256 config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( ));
257 config. writeEntry ( "Dim", interval_dim-> value ( )); 257 config. writeEntry ( "Dim", interval_dim-> value ( ));
258 config. writeEntry ( "LightOff", interval_lightoff-> value ( )); 258 config. writeEntry ( "LightOff", interval_lightoff-> value ( ));
259 config. writeEntry ( "Suspend", interval_suspend-> value ( )); 259 config. writeEntry ( "Suspend", interval_suspend-> value ( ));
diff --git a/core/settings/light-and-power/sensor.cpp b/core/settings/light-and-power/sensor.cpp
index 41de851..013e655 100644
--- a/core/settings/light-and-power/sensor.cpp
+++ b/core/settings/light-and-power/sensor.cpp
@@ -28,75 +28,75 @@
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qslider.h> 29#include <qslider.h>
30#include <qspinbox.h> 30#include <qspinbox.h>
31 31
32#include <opie/odevice.h> 32#include <opie/odevice.h>
33 33
34using namespace Opie; 34using namespace Opie;
35 35
36#include "calibration.h" 36#include "calibration.h"
37#include "sensor.h" 37#include "sensor.h"
38 38
39Sensor::Sensor ( QStringList &params, QWidget *parent, const char *name ) 39Sensor::Sensor ( QStringList &params, QWidget *parent, const char *name )
40 : SensorBase ( parent, name, true, WStyle_ContextHelp ), m_params ( params ) 40 : SensorBase ( parent, name, true, WStyle_ContextHelp ), m_params ( params )
41{ 41{
42 int steps = 12; 42 int steps = 12;
43 int inter = 2; 43 int inter = 2;
44 44
45 int smin = 40; 45 int smin = 40;
46 int smax = 215; 46 int smax = 215;
47 int lmin = 1; 47 int lmin = 1;
48 int lmax = 255; 48 int lmax = 255;
49 49
50 switch ( params. count ( )) { 50 switch ( params. count ( )) {
51 case 6: lmax = params [5]. toInt ( ); 51 case 6: lmax = params [5]. toInt ( );
52 case 5: lmin = params [4]. toInt ( ); 52 case 5: lmin = params [4]. toInt ( );
53 case 4: smax = params [3]. toInt ( ); 53 case 4: smax = params [3]. toInt ( );
54 case 3: smin = params [2]. toInt ( ); 54 case 3: smin = params [2]. toInt ( );
55 case 2: steps = params [1]. toInt ( ); 55 case 2: steps = params [1]. toInt ( );
56 case 1: inter = params [0]. toInt ( ) / 1000; 56 case 1: inter = params [0]. toInt ( ) / 1000;
57 } 57 }
58 58
59 int xscale = ODevice::inst ( )-> lightSensorResolution ( ); 59 int xscale = ODevice::inst ( )-> lightSensorResolution ( );
60 int yscale = ODevice::inst ( )-> displayBrightnessResolution ( ); 60 int yscale = ODevice::inst ( )-> displayBrightnessResolution ( );
61 61
62 QVBoxLayout *lay = new QVBoxLayout ( frame ); 62 QVBoxLayout *lay = new QVBoxLayout ( frame );
63 lay-> setMargin ( 2 ); 63 lay-> setMargin ( 2 );
64 m_calib = new Calibration ( frame ); 64 m_calib = new Calibration ( frame );
65 lay-> add ( m_calib ); 65 lay-> add ( m_calib );
66 66
67 m_calib-> setScale ( QSize ( xscale, yscale )); 67 m_calib-> setScale ( QSize ( xscale, yscale ));
68 m_calib-> setLineSteps ( steps ); 68 m_calib-> setLineSteps ( steps );
69 m_calib-> setInterval ( inter ); 69 m_calib-> setInterval ( inter );
70 m_calib-> setStartPoint ( QPoint ( smin * xscale / 256, lmax * yscale / 256 )); 70 m_calib-> setStartPoint ( QPoint ( smin * xscale / 256, lmax * yscale / 256 ));
71 m_calib-> setEndPoint ( QPoint ( smax * xscale / 256, lmin * yscale / 256 )); 71 m_calib-> setEndPoint ( QPoint ( smax * xscale / 256, lmin * yscale / 256 ));
72 72
73 interval-> setValue ( inter ); 73 interval-> setValue ( inter );
74 linesteps-> setValue ( steps ); 74 linesteps-> setValue ( steps );
75 75
76 connect ( interval, SIGNAL( valueChanged ( int )), m_calib, SLOT( setInterval ( int ))); 76 connect ( interval, SIGNAL( valueChanged(int)), m_calib, SLOT( setInterval(int)));
77 connect ( linesteps, SIGNAL( valueChanged ( int )), m_calib, SLOT( setLineSteps ( int ))); 77 connect ( linesteps, SIGNAL( valueChanged(int)), m_calib, SLOT( setLineSteps(int)));
78 78
79 connect ( m_calib, SIGNAL( startPointChanged ( const QPoint & )), this, SLOT( pointDrag ( const QPoint & ))); 79 connect ( m_calib, SIGNAL( startPointChanged(const QPoint&)), this, SLOT( pointDrag(const QPoint&)));
80 connect ( m_calib, SIGNAL( endPointChanged ( const QPoint & )), this, SLOT( pointDrag ( const QPoint & ))); 80 connect ( m_calib, SIGNAL( endPointChanged(const QPoint&)), this, SLOT( pointDrag(const QPoint&)));
81} 81}
82 82
83void Sensor::accept ( ) 83void Sensor::accept ( )
84{ 84{
85 int xscale = ODevice::inst ( )-> lightSensorResolution ( ); 85 int xscale = ODevice::inst ( )-> lightSensorResolution ( );
86 int yscale = ODevice::inst ( )-> displayBrightnessResolution ( ); 86 int yscale = ODevice::inst ( )-> displayBrightnessResolution ( );
87 87
88 m_params. clear ( ); 88 m_params. clear ( );
89 m_params << QString::number ( m_calib-> interval ( ) * 1000 ) 89 m_params << QString::number ( m_calib-> interval ( ) * 1000 )
90 << QString::number ( m_calib-> lineSteps ( )) 90 << QString::number ( m_calib-> lineSteps ( ))
91 << QString::number ( m_calib-> startPoint ( ). x ( ) * 256 / xscale ) 91 << QString::number ( m_calib-> startPoint ( ). x ( ) * 256 / xscale )
92 << QString::number ( m_calib-> endPoint ( ). x ( ) * 256 / xscale ) 92 << QString::number ( m_calib-> endPoint ( ). x ( ) * 256 / xscale )
93 << QString::number ( m_calib-> endPoint ( ). y ( ) * 256 / yscale ) 93 << QString::number ( m_calib-> endPoint ( ). y ( ) * 256 / yscale )
94 << QString::number ( m_calib-> startPoint ( ). y ( ) * 256 / yscale ); 94 << QString::number ( m_calib-> startPoint ( ). y ( ) * 256 / yscale );
95 95
96 QDialog::accept ( ); 96 QDialog::accept ( );
97} 97}
98 98
99void Sensor::pointDrag ( const QPoint &p ) 99void Sensor::pointDrag ( const QPoint &p )
100{ 100{
101 emit viewBacklight ( p. y ( )); 101 emit viewBacklight ( p. y ( ));
102} 102}
diff --git a/core/tools/quicklauncher/main.cpp b/core/tools/quicklauncher/main.cpp
index cc411fd..1d6774c 100644
--- a/core/tools/quicklauncher/main.cpp
+++ b/core/tools/quicklauncher/main.cpp
@@ -41,98 +41,98 @@
41 41
42static QPEApplication *app = 0; 42static QPEApplication *app = 0;
43static PluginLoader *loader = 0; 43static PluginLoader *loader = 0;
44static ApplicationInterface *appIface = 0; 44static ApplicationInterface *appIface = 0;
45static QGuardedPtr<QWidget> mainWindow; 45static QGuardedPtr<QWidget> mainWindow;
46 46
47#ifdef _OS_LINUX_ 47#ifdef _OS_LINUX_
48static char **argv0 = 0; 48static char **argv0 = 0;
49static int argv_lth; 49static int argv_lth;
50extern char **environ; 50extern char **environ;
51#ifndef SPT_BUFSIZE 51#ifndef SPT_BUFSIZE
52#define SPT_BUFSIZE 2048 52#define SPT_BUFSIZE 2048
53#endif 53#endif
54#include <stdarg.h> 54#include <stdarg.h>
55void setproctitle (const char *fmt,...) { 55void setproctitle (const char *fmt,...) {
56 int i; 56 int i;
57 char buf[SPT_BUFSIZE]; 57 char buf[SPT_BUFSIZE];
58 va_list ap; 58 va_list ap;
59 59
60 if (!argv0) 60 if (!argv0)
61 return; 61 return;
62 62
63 va_start(ap, fmt); 63 va_start(ap, fmt);
64 (void) vsnprintf(buf, SPT_BUFSIZE, fmt, ap); 64 (void) vsnprintf(buf, SPT_BUFSIZE, fmt, ap);
65 va_end(ap); 65 va_end(ap);
66 66
67 i = strlen (buf); 67 i = strlen (buf);
68 if (i > argv_lth - 2) { 68 if (i > argv_lth - 2) {
69 i = argv_lth - 2; 69 i = argv_lth - 2;
70 buf[i] = '\0'; 70 buf[i] = '\0';
71 } 71 }
72 memset(argv0[0], '\0', argv_lth); /* clear the memory area */ 72 memset(argv0[0], '\0', argv_lth); /* clear the memory area */
73 (void) strcpy (argv0[0], buf); 73 (void) strcpy (argv0[0], buf);
74 74
75 argv0[1] = NULL; 75 argv0[1] = NULL;
76} 76}
77#endif 77#endif
78 78
79 79
80class QuickLauncher : public QObject 80class QuickLauncher : public QObject
81{ 81{
82 Q_OBJECT 82 Q_OBJECT
83public: 83public:
84 QuickLauncher() : QObject() 84 QuickLauncher() : QObject()
85 { 85 {
86 QCString ch("QPE/QuickLauncher-"); 86 QCString ch("QPE/QuickLauncher-");
87 ch += QString::number(getpid()); 87 ch += QString::number(getpid());
88 qlChannel = new QCopChannel( ch, this); 88 qlChannel = new QCopChannel( ch, this);
89 connect( qlChannel, SIGNAL(received(const QCString&, const QByteArray&)), 89 connect( qlChannel, SIGNAL(received(const QCString&,const QByteArray&)),
90 this, SLOT(message(const QCString&, const QByteArray&)) ); 90 this, SLOT(message(const QCString&,const QByteArray&)) );
91 } 91 }
92 92
93 static void exec( int /*argc*/, char **argv ) 93 static void exec( int /*argc*/, char **argv )
94 { 94 {
95 QString appName = argv[0]; 95 QString appName = argv[0];
96 int sep = appName.findRev( '/' ); 96 int sep = appName.findRev( '/' );
97 if ( sep > 0 ) 97 if ( sep > 0 )
98 appName = appName.mid( sep+1 ); 98 appName = appName.mid( sep+1 );
99 99
100 appIface = 0; 100 appIface = 0;
101 if ( loader->queryInterface(appName, IID_QtopiaApplication, (QUnknownInterface**)&appIface) == QS_OK ) { 101 if ( loader->queryInterface(appName, IID_QtopiaApplication, (QUnknownInterface**)&appIface) == QS_OK ) {
102 mainWindow = appIface->createMainWindow( appName ); 102 mainWindow = appIface->createMainWindow( appName );
103 } 103 }
104 if ( mainWindow ) { 104 if ( mainWindow ) {
105 if ( mainWindow->metaObject()->slotNames().contains("setDocument(const QString&)") ) { 105 if ( mainWindow->metaObject()->slotNames().contains("setDocument(const QString&)") ) {
106 app->showMainDocumentWidget( mainWindow ); 106 app->showMainDocumentWidget( mainWindow );
107 } else { 107 } else {
108 app->showMainWidget( mainWindow ); 108 app->showMainWidget( mainWindow );
109 } 109 }
110 } else { 110 } else {
111 qWarning( "Could not create application main window" ); 111 qWarning( "Could not create application main window" );
112 exit(-1); 112 exit(-1);
113 } 113 }
114 } 114 }
115 115
116private slots: 116private slots:
117 void message(const QCString &msg, const QByteArray & data) 117 void message(const QCString &msg, const QByteArray & data)
118 { 118 {
119 QStrList argList; 119 QStrList argList;
120 120
121 if ( msg == "execute(QStrList)" ) { 121 if ( msg == "execute(QStrList)" ) {
122 delete qlChannel; 122 delete qlChannel;
123 QDataStream stream( data, IO_ReadOnly ); 123 QDataStream stream( data, IO_ReadOnly );
124 QStrList argList; 124 QStrList argList;
125 stream >> argList; 125 stream >> argList;
126 qDebug( "QuickLauncher execute: %s", argList.at(0) ); 126 qDebug( "QuickLauncher execute: %s", argList.at(0) );
127 doQuickLaunch( argList ); 127 doQuickLaunch( argList );
128 delete this; 128 delete this;
129 } else if ( msg == "execute(QString)" ) { 129 } else if ( msg == "execute(QString)" ) {
130 delete qlChannel; 130 delete qlChannel;
131 QDataStream stream( data, IO_ReadOnly ); 131 QDataStream stream( data, IO_ReadOnly );
132 QString arg; 132 QString arg;
133 stream >> arg; 133 stream >> arg;
134 qDebug( "QuickLauncher execute: %s", arg.latin1() ); 134 qDebug( "QuickLauncher execute: %s", arg.latin1() );
135 QStrList argList; 135 QStrList argList;
136 argList.append( arg.utf8() ); 136 argList.append( arg.utf8() );
137 doQuickLaunch( argList ); 137 doQuickLaunch( argList );
138 delete this; 138 delete this;
diff --git a/development/keyview/keyview.cpp b/development/keyview/keyview.cpp
index 21bbb93..93c84d9 100644
--- a/development/keyview/keyview.cpp
+++ b/development/keyview/keyview.cpp
@@ -1,69 +1,69 @@
1#include "keyview.h" 1#include "keyview.h"
2#include <qgrid.h> 2#include <qgrid.h>
3//#include <iostream.h> 3//#include <iostream.h>
4#include <qlineedit.h> 4#include <qlineedit.h>
5#include <qlabel.h> 5#include <qlabel.h>
6 6
7Keyview::Keyview( QWidget* parent, const char* name, WFlags fl ) 7Keyview::Keyview( QWidget* parent, const char* name, WFlags fl )
8 : QGrid ( 2, parent, name, fl ) 8 : QGrid ( 2, parent, name, fl )
9{ 9{
10 setCaption( tr("Keyview") ); 10 setCaption( tr("Keyview") );
11 setSpacing(3); 11 setSpacing(3);
12 setMargin(4); 12 setMargin(4);
13 13
14 QLabel *l; 14 QLabel *l;
15 15
16 l = new QLabel(QString("unicode:"), this); 16 l = new QLabel(QString("unicode:"), this);
17 unicode = new QLineEdit(this); 17 unicode = new QLineEdit(this);
18 unicode->setReadOnly(1); 18 unicode->setReadOnly(1);
19 19
20 l = new QLabel(QString("keycode:"), this); 20 l = new QLabel(QString("keycode:"), this);
21 keycode = new QLineEdit(this); 21 keycode = new QLineEdit(this);
22 keycode->setReadOnly(1); 22 keycode->setReadOnly(1);
23 23
24 l = new QLabel(QString("modifiers:"), this); 24 l = new QLabel(QString("modifiers:"), this);
25 modifiers = new QLineEdit(this); 25 modifiers = new QLineEdit(this);
26 modifiers->setReadOnly(1); 26 modifiers->setReadOnly(1);
27 27
28 l = new QLabel(QString("isPress:"), this); 28 l = new QLabel(QString("isPress:"), this);
29 isPress = new QLineEdit(this); 29 isPress = new QLineEdit(this);
30 isPress->setReadOnly(1); 30 isPress->setReadOnly(1);
31 31
32 l = new QLabel(QString("autoRepeat:"), this); 32 l = new QLabel(QString("autoRepeat:"), this);
33 autoRepeat = new QLineEdit(this); 33 autoRepeat = new QLineEdit(this);
34 autoRepeat->setReadOnly(1); 34 autoRepeat->setReadOnly(1);
35 35
36 // spacer 36 // spacer
37 l = new QLabel(QString(""), this); 37 l = new QLabel(QString(""), this);
38 l->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); 38 l->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
39 39
40 40
41 KeyFilter *filter = new KeyFilter(this); 41 KeyFilter *filter = new KeyFilter(this);
42 QWSServer::setKeyboardFilter(filter); 42 QWSServer::setKeyboardFilter(filter);
43 43
44 connect(filter, SIGNAL(keyPressed(int, int, int, bool, bool)), 44 connect(filter, SIGNAL(keyPressed(int,int,int,bool,bool)),
45 this, SLOT(updateItems(int, int, int, bool, bool))); 45 this, SLOT(updateItems(int,int,int,bool,bool)));
46} 46}
47 47
48Keyview::~Keyview() { } 48Keyview::~Keyview() { }
49 49
50void Keyview::updateItems(int u, int k, int m, bool p, bool a) { 50void Keyview::updateItems(int u, int k, int m, bool p, bool a) {
51 51
52 unicode->setText("0x" + QString::number(u, 16)); 52 unicode->setText("0x" + QString::number(u, 16));
53 keycode->setText("0x" + QString::number(k, 16)); 53 keycode->setText("0x" + QString::number(k, 16));
54 modifiers->setText("0x" + QString::number(m, 16)); 54 modifiers->setText("0x" + QString::number(m, 16));
55 isPress->setText("0x" + QString::number(p, 16)); 55 isPress->setText("0x" + QString::number(p, 16));
56 autoRepeat->setText("0x" + QString::number(a, 16)); 56 autoRepeat->setText("0x" + QString::number(a, 16));
57} 57}
58 58
59KeyFilter::KeyFilter(QObject * parent, const char *name) : QObject( parent, name ) { 59KeyFilter::KeyFilter(QObject * parent, const char *name) : QObject( parent, name ) {
60 60
61} 61}
62 62
63bool KeyFilter::filter(int unicode, int keycode, int modifiers, bool isPress, 63bool KeyFilter::filter(int unicode, int keycode, int modifiers, bool isPress,
64 bool autoRepeat) { 64 bool autoRepeat) {
65 65
66 emit keyPressed(unicode, keycode, modifiers, isPress, autoRepeat); 66 emit keyPressed(unicode, keycode, modifiers, isPress, autoRepeat);
67 return 0; // return 1 to stop key emiting 67 return 0; // return 1 to stop key emiting
68 68
69} 69}
diff --git a/examples/main-tab/simple.cpp b/examples/main-tab/simple.cpp
index 69dd00f..c5a6d5a 100644
--- a/examples/main-tab/simple.cpp
+++ b/examples/main-tab/simple.cpp
@@ -1,91 +1,91 @@
1#include <qaction.h> // action 1#include <qaction.h> // action
2#include <qmenubar.h> // menubar 2#include <qmenubar.h> // menubar
3#include <qtoolbar.h> // toolbar 3#include <qtoolbar.h> // toolbar
4#include <qlabel.h> // a label 4#include <qlabel.h> // a label
5#include <qpushbutton.h> // the header file for the QPushButton 5#include <qpushbutton.h> // the header file for the QPushButton
6#include <qlayout.h> 6#include <qlayout.h>
7 7
8#include <qpe/qpeapplication.h> // the QPEApplication 8#include <qpe/qpeapplication.h> // the QPEApplication
9#include <qpe/resource.h> 9#include <qpe/resource.h>
10#include <qpe/sound.h> 10#include <qpe/sound.h>
11 11
12#include <opie/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching 12#include <opie/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching
13#include <opie/otabwidget.h> 13#include <opie/otabwidget.h>
14 14
15#include "simple.h" 15#include "simple.h"
16 16
17/* 17/*
18 * implementation of simple 18 * implementation of simple
19 */ 19 */
20 20
21/* 21/*
22 * The factory is used for quicklaunching 22 * The factory is used for quicklaunching
23 * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro 23 * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro
24 * 24 *
25 * Depending on the global quick launch setting this will create 25 * Depending on the global quick launch setting this will create
26 * either a main method or one for our component plugin system 26 * either a main method or one for our component plugin system
27 */ 27 */
28 28
29OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) 29OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
30 30
31MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl ) 31MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl )
32 : QMainWindow( parent, name, fl ) { 32 : QMainWindow( parent, name, fl ) {
33 setCaption(tr("My MainWindow") ); 33 setCaption(tr("My MainWindow") );
34 34
35 initUI(); 35 initUI();
36 36
37 37
38 /* 38 /*
39 * Tab widget as central 39 * Tab widget as central
40 */ 40 */
41 OTabWidget *tab = new OTabWidget(this); 41 OTabWidget *tab = new OTabWidget(this);
42 connect(tab, SIGNAL(currentChanged(QWidget*) ), 42 connect(tab, SIGNAL(currentChanged(QWidget*) ),
43 this, SLOT( slotCurrentChanged( QWidget* ) ) ); 43 this, SLOT( slotCurrentChanged(QWidget*) ) );
44 setCentralWidget( tab ); 44 setCentralWidget( tab );
45 45
46 Simple1 *simple1 = new Simple1( this ); 46 Simple1 *simple1 = new Simple1( this );
47 tab->addTab( simple1, "new", tr("Simple1") ); 47 tab->addTab( simple1, "new", tr("Simple1") );
48 tab->setCurrentTab( tr("Simple1") ); 48 tab->setCurrentTab( tr("Simple1") );
49 49
50 Simple2 *simple2 = new Simple2( this ); 50 Simple2 *simple2 = new Simple2( this );
51 tab->addTab( simple2, "trash", tr("Simple2") ); 51 tab->addTab( simple2, "trash", tr("Simple2") );
52 52
53 m_oldCurrent = simple1; 53 m_oldCurrent = simple1;
54 54
55 connect(m_fire, SIGNAL(activated() ), 55 connect(m_fire, SIGNAL(activated() ),
56 simple1, SLOT(slotFire() ) ); 56 simple1, SLOT(slotFire() ) );
57} 57}
58 58
59MainWindow::~MainWindow() { 59MainWindow::~MainWindow() {
60 // again nothing to delete because Qt takes care 60 // again nothing to delete because Qt takes care
61} 61}
62 62
63 63
64void MainWindow::setDocument( const QString& /*str*/ ) { 64void MainWindow::setDocument( const QString& /*str*/ ) {
65} 65}
66void MainWindow::slotCurrentChanged( QWidget *wid) { 66void MainWindow::slotCurrentChanged( QWidget *wid) {
67 disconnect(m_fire, SIGNAL(activated() ), 67 disconnect(m_fire, SIGNAL(activated() ),
68 m_oldCurrent, SLOT(slotFire() ) ); 68 m_oldCurrent, SLOT(slotFire() ) );
69 connect(m_fire, SIGNAL(activated() ), 69 connect(m_fire, SIGNAL(activated() ),
70 wid, SLOT(slotFire() ) ); 70 wid, SLOT(slotFire() ) );
71 71
72 m_oldCurrent = wid; 72 m_oldCurrent = wid;
73} 73}
74 74
75void MainWindow::initUI() { 75void MainWindow::initUI() {
76 76
77 setToolBarsMovable( false ); 77 setToolBarsMovable( false );
78 78
79 QToolBar *menuBarHolder = new QToolBar( this ); 79 QToolBar *menuBarHolder = new QToolBar( this );
80 80
81 menuBarHolder->setHorizontalStretchable( true ); 81 menuBarHolder->setHorizontalStretchable( true );
82 QMenuBar *mb = new QMenuBar( menuBarHolder ); 82 QMenuBar *mb = new QMenuBar( menuBarHolder );
83 QToolBar *tb = new QToolBar( this ); 83 QToolBar *tb = new QToolBar( this );
84 84
85 QPopupMenu *fileMenu = new QPopupMenu( this ); 85 QPopupMenu *fileMenu = new QPopupMenu( this );
86 86
87 87
88 QAction *a = new QAction( tr("Quit"), Resource::loadIconSet("quit_icon"), 88 QAction *a = new QAction( tr("Quit"), Resource::loadIconSet("quit_icon"),
89 QString::null, 0, this, "quit_action" ); 89 QString::null, 0, this, "quit_action" );
90 /* 90 /*
91 * Connect quit to the QApplication quit slot 91 * Connect quit to the QApplication quit slot
diff --git a/examples/simple-pim/simple.cpp b/examples/simple-pim/simple.cpp
index 3e9fcd3..029e71b 100644
--- a/examples/simple-pim/simple.cpp
+++ b/examples/simple-pim/simple.cpp
@@ -34,100 +34,100 @@
34 * Depending on the global quick launch setting this will create 34 * Depending on the global quick launch setting this will create
35 * either a main method or one for our component plugin system 35 * either a main method or one for our component plugin system
36 */ 36 */
37 37
38OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) 38OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
39 39
40MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl ) 40MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl )
41 : QMainWindow( parent, name, fl ) { 41 : QMainWindow( parent, name, fl ) {
42 setCaption(tr("My MainWindow") ); 42 setCaption(tr("My MainWindow") );
43 43
44 m_desktopChannel = 0; 44 m_desktopChannel = 0;
45 m_loading = 0; 45 m_loading = 0;
46 46
47 initUI(); 47 initUI();
48 48
49 49
50 /* 50 /*
51 * Tab widget as central 51 * Tab widget as central
52 */ 52 */
53 m_tab = new OTabWidget(this); 53 m_tab = new OTabWidget(this);
54 54
55 setCentralWidget( m_tab ); 55 setCentralWidget( m_tab );
56 56
57 m_todoView = new PIMListView(m_tab, "Todo view" ); 57 m_todoView = new PIMListView(m_tab, "Todo view" );
58 m_tab->addTab( m_todoView,"todo/TodoList", tr("Todos") ); 58 m_tab->addTab( m_todoView,"todo/TodoList", tr("Todos") );
59 59
60 m_dateView = new PIMListView(m_tab, "Datebook view" ); 60 m_dateView = new PIMListView(m_tab, "Datebook view" );
61 m_tab->addTab( m_dateView, "datebook/DateBook", tr("Events") ); 61 m_tab->addTab( m_dateView, "datebook/DateBook", tr("Events") );
62 62
63 /* now connect the actions */ 63 /* now connect the actions */
64 /* 64 /*
65 * we connect the activated to our show 65 * we connect the activated to our show
66 * and on activation we will show a detailed 66 * and on activation we will show a detailed
67 * summary of the record 67 * summary of the record
68 */ 68 */
69 connect(m_fire, SIGNAL(activated() ), 69 connect(m_fire, SIGNAL(activated() ),
70 this, SLOT(slotShow() ) ); 70 this, SLOT(slotShow() ) );
71 71
72 /* 72 /*
73 * We will change the date 73 * We will change the date
74 */ 74 */
75 connect(m_dateAction, SIGNAL(activated() ), 75 connect(m_dateAction, SIGNAL(activated() ),
76 this, SLOT(slotDate() ) ); 76 this, SLOT(slotDate() ) );
77 77
78 /* 78 /*
79 * connect the show signal of the PIMListView 79 * connect the show signal of the PIMListView
80 * to a slot to show a dialog 80 * to a slot to show a dialog
81 */ 81 */
82 connect(m_todoView, SIGNAL(showRecord(const OPimRecord& ) ), 82 connect(m_todoView, SIGNAL(showRecord(const OPimRecord&) ),
83 this, SLOT(slotShowRecord(const OPimRecord& ) ) ); 83 this, SLOT(slotShowRecord(const OPimRecord&) ) );
84 connect(m_dateView, SIGNAL(showRecord(const OPimRecord& ) ), 84 connect(m_dateView, SIGNAL(showRecord(const OPimRecord&) ),
85 this, SLOT(slotShowRecord(const OPimRecord& ) ) ); 85 this, SLOT(slotShowRecord(const OPimRecord&) ) );
86 86
87 /* 87 /*
88 * Now comes the important lines of code for this example 88 * Now comes the important lines of code for this example
89 * We do not directly call load but delay loading until 89 * We do not directly call load but delay loading until
90 * all Events are dispatches and handled. 90 * all Events are dispatches and handled.
91 * SO we will load once our window is mapped to screen 91 * SO we will load once our window is mapped to screen
92 * to achieve that we use a QTimer::singleShot 92 * to achieve that we use a QTimer::singleShot
93 * After 10 milli seconds the timer fires and on TimerEvent 93 * After 10 milli seconds the timer fires and on TimerEvent
94 * out slot slotLoad will be called 94 * out slot slotLoad will be called
95 * Remember this a Constructor to construct your object and not 95 * Remember this a Constructor to construct your object and not
96 * to load 96 * to load
97 */ 97 */
98 QTimer::singleShot( 10, this, SLOT(slotLoad() ) ); 98 QTimer::singleShot( 10, this, SLOT(slotLoad() ) );
99} 99}
100 100
101MainWindow::~MainWindow() { 101MainWindow::~MainWindow() {
102 // again nothing to delete because Qt takes care 102 // again nothing to delete because Qt takes care
103} 103}
104 104
105 105
106void MainWindow::setDocument( const QString& /*str*/ ) { 106void MainWindow::setDocument( const QString& /*str*/ ) {
107} 107}
108 108
109 109
110void MainWindow::initUI() { 110void MainWindow::initUI() {
111 111
112 setToolBarsMovable( false ); 112 setToolBarsMovable( false );
113 113
114 QToolBar *menuBarHolder = new QToolBar( this ); 114 QToolBar *menuBarHolder = new QToolBar( this );
115 115
116 menuBarHolder->setHorizontalStretchable( true ); 116 menuBarHolder->setHorizontalStretchable( true );
117 QMenuBar *mb = new QMenuBar( menuBarHolder ); 117 QMenuBar *mb = new QMenuBar( menuBarHolder );
118 QToolBar *tb = new QToolBar( this ); 118 QToolBar *tb = new QToolBar( this );
119 119
120 QPopupMenu *fileMenu = new QPopupMenu( this ); 120 QPopupMenu *fileMenu = new QPopupMenu( this );
121 121
122 122
123 QAction *a = new QAction( tr("Quit"), Resource::loadIconSet("quit_icon"), 123 QAction *a = new QAction( tr("Quit"), Resource::loadIconSet("quit_icon"),
124 QString::null, 0, this, "quit_action" ); 124 QString::null, 0, this, "quit_action" );
125 /* 125 /*
126 * Connect quit to the QApplication quit slot 126 * Connect quit to the QApplication quit slot
127 */ 127 */
128 connect(a, SIGNAL(activated() ), 128 connect(a, SIGNAL(activated() ),
129 qApp, SLOT(quit() ) ); 129 qApp, SLOT(quit() ) );
130 a->addTo( fileMenu ); 130 a->addTo( fileMenu );
131 131
132 a = new QAction(tr("View Current"), 132 a = new QAction(tr("View Current"),
133 Resource::loadIconSet("zoom"), 133 Resource::loadIconSet("zoom"),
@@ -144,98 +144,98 @@ void MainWindow::initUI() {
144 a = new QAction(tr("Choose Date"), 144 a = new QAction(tr("Choose Date"),
145 Resource::loadIconSet("day"), 145 Resource::loadIconSet("day"),
146 QString::null, 0, this, "choose date" ); 146 QString::null, 0, this, "choose date" );
147 a->addTo( fileMenu ); 147 a->addTo( fileMenu );
148 a->addTo( tb ); 148 a->addTo( tb );
149 m_dateAction = a; 149 m_dateAction = a;
150 150
151 mb->insertItem(tr("File"), fileMenu ); 151 mb->insertItem(tr("File"), fileMenu );
152 152
153} 153}
154 154
155void MainWindow::slotLoad() { 155void MainWindow::slotLoad() {
156 /* 156 /*
157 * There is no real shared access in the PIM API 157 * There is no real shared access in the PIM API
158 * It wasn't finish cause of health problems of one 158 * It wasn't finish cause of health problems of one
159 * of the authors so we do something fancy and use QCOP 159 * of the authors so we do something fancy and use QCOP
160 * the IPC system to get a current copy 160 * the IPC system to get a current copy
161 */ 161 */
162 /* NOTES to QCOP: QCOP operates over channels and use QDataStream 162 /* NOTES to QCOP: QCOP operates over channels and use QDataStream
163 * to send data. You can check if a channel isRegistered or hook 163 * to send data. You can check if a channel isRegistered or hook
164 * yourself to that channel. A Channel is QCString and normally 164 * yourself to that channel. A Channel is QCString and normally
165 * prefix with QPE/ and then the system in example QPE/System, 165 * prefix with QPE/ and then the system in example QPE/System,
166 * QPE/Desktop a special channel is the application channel 166 * QPE/Desktop a special channel is the application channel
167 * it QPE/Application/appname this channel gets created on app 167 * it QPE/Application/appname this channel gets created on app
168 * startup by QPEApplication. QCOP is asynchronous 168 * startup by QPEApplication. QCOP is asynchronous
169 * 169 *
170 * To send you'll use QCopEnevelope 170 * To send you'll use QCopEnevelope
171 * 171 *
172 */ 172 */
173 /* 173 /*
174 * What we will do is first is get to know if either 174 * What we will do is first is get to know if either
175 * datebook or todolist are running if so we will kindly 175 * datebook or todolist are running if so we will kindly
176 * asked to save the data for us. 176 * asked to save the data for us.
177 * If neither are running we can load directly 177 * If neither are running we can load directly
178 */ 178 */
179 if (!QCopChannel::isRegistered("QPE/Application/todolist") && 179 if (!QCopChannel::isRegistered("QPE/Application/todolist") &&
180 !QCopChannel::isRegistered("QPE/Application/datebook") ) { 180 !QCopChannel::isRegistered("QPE/Application/datebook") ) {
181 m_db.load(); 181 m_db.load();
182 m_tb.load(); 182 m_tb.load();
183 return slotLoadForDay( QDate::currentDate() ); 183 return slotLoadForDay( QDate::currentDate() );
184 } 184 }
185 185
186 /* 186 /*
187 * prepare our answer machine the QCopChannel 187 * prepare our answer machine the QCopChannel
188 * QPE/Desktop will send "flushDone(QString)" when 188 * QPE/Desktop will send "flushDone(QString)" when
189 * the flush is done it emits a signal on receive 189 * the flush is done it emits a signal on receive
190 */ 190 */
191 m_desktopChannel = new QCopChannel("QPE/Desktop"); 191 m_desktopChannel = new QCopChannel("QPE/Desktop");
192 connect(m_desktopChannel, SIGNAL(received(const QCString&, const QByteArray& ) ), 192 connect(m_desktopChannel, SIGNAL(received(const QCString&,const QByteArray&) ),
193 this, SLOT(slotDesktopReceive(const QCString&, const QByteArray& ) ) ); 193 this, SLOT(slotDesktopReceive(const QCString&,const QByteArray&) ) );
194 /* the numberof synced channels will be set to zero */ 194 /* the numberof synced channels will be set to zero */
195 m_synced = 0; 195 m_synced = 0;
196 196
197 /* 197 /*
198 * We use {} around the QCopEnvelope because it sends its 198 * We use {} around the QCopEnvelope because it sends its
199 * data on destruction of QCopEnvelope with 199 * data on destruction of QCopEnvelope with
200 */ 200 */
201 /* check again if not present increment synced*/ 201 /* check again if not present increment synced*/
202 if ( QCopChannel::isRegistered("QPE/Application/todolist") ) { 202 if ( QCopChannel::isRegistered("QPE/Application/todolist") ) {
203 QCopEnvelope env("QPE/Application/todolist", "flush()" ); 203 QCopEnvelope env("QPE/Application/todolist", "flush()" );
204 // env << data; but we do not have any parameters here 204 // env << data; but we do not have any parameters here
205 }else 205 }else
206 m_synced++; 206 m_synced++;
207 207
208 if ( QCopChannel::isRegistered("QPE/Application/datebook") ) { 208 if ( QCopChannel::isRegistered("QPE/Application/datebook") ) {
209 QCopEnvelope env("QPE/Application/datebook", "flush()" ); 209 QCopEnvelope env("QPE/Application/datebook", "flush()" );
210 }else 210 }else
211 m_synced++; 211 m_synced++;
212 212
213 /* we will provide a wait scrren */ 213 /* we will provide a wait scrren */
214 m_loading = new OWait(this, "wait screen" ); 214 m_loading = new OWait(this, "wait screen" );
215} 215}
216 216
217void MainWindow::slotDesktopReceive(const QCString& cmd, const QByteArray& data ) { 217void MainWindow::slotDesktopReceive(const QCString& cmd, const QByteArray& data ) {
218 /* the bytearray was filled with the QDataStream now 218 /* the bytearray was filled with the QDataStream now
219 * we open it read only to get the value(s) 219 * we open it read only to get the value(s)
220 */ 220 */
221 QDataStream stream(data, IO_ReadOnly ); 221 QDataStream stream(data, IO_ReadOnly );
222 /* 222 /*
223 * we're only interested in the flushDone 223 * we're only interested in the flushDone
224 */ 224 */
225 if ( cmd == "flushDone(QString)" ) { 225 if ( cmd == "flushDone(QString)" ) {
226 QString appname; 226 QString appname;
227 stream >> appname; // get the first argument out of stream 227 stream >> appname; // get the first argument out of stream
228 if (appname == QString::fromLatin1("datebook") || 228 if (appname == QString::fromLatin1("datebook") ||
229 appname == QString::fromLatin1("todolist") ) 229 appname == QString::fromLatin1("todolist") )
230 m_synced++; 230 m_synced++;
231 } 231 }
232 232
233 /* 233 /*
234 * If we synced both we can go ahead 234 * If we synced both we can go ahead
235 * In future this is not needed anymore when we finally 235 * In future this is not needed anymore when we finally
236 * implemented X-Ref and other PIM features 236 * implemented X-Ref and other PIM features
237 */ 237 */
238 if (m_synced >= 2 ) { 238 if (m_synced >= 2 ) {
239 delete m_loading; 239 delete m_loading;
240 delete m_desktopChannel; 240 delete m_desktopChannel;
241 /* now we finally can start doing the actual loading */ 241 /* now we finally can start doing the actual loading */
@@ -262,98 +262,98 @@ void MainWindow::slotLoadForDay(const QDate& date) {
262 262
263 /* all todos for today including the ones without dueDate */ 263 /* all todos for today including the ones without dueDate */
264 m_todoView->set( m_tb.effectiveToDos(date, date ) ); 264 m_todoView->set( m_tb.effectiveToDos(date, date ) );
265 m_dateView->set( m_db.effectiveEvents( date, date ) ); 265 m_dateView->set( m_db.effectiveEvents( date, date ) );
266} 266}
267 267
268/* we want to show the current record */ 268/* we want to show the current record */
269void MainWindow::slotShow() { 269void MainWindow::slotShow() {
270 /* we only added PIMListViews so we can safely cast */ 270 /* we only added PIMListViews so we can safely cast */
271 PIMListView *view = static_cast<PIMListView*>(m_tab->currentWidget() ); 271 PIMListView *view = static_cast<PIMListView*>(m_tab->currentWidget() );
272 272
273 /* ask the view to send a signal */ 273 /* ask the view to send a signal */
274 view->showCurrentRecord(); 274 view->showCurrentRecord();
275 275
276} 276}
277 277
278/* as answer this slot will be called */ 278/* as answer this slot will be called */
279void MainWindow::slotShowRecord( const OPimRecord& rec) { 279void MainWindow::slotShowRecord( const OPimRecord& rec) {
280 /* got a parent but still is a toplevel MODAL dialog */ 280 /* got a parent but still is a toplevel MODAL dialog */
281 QDialog* dia = new QDialog(this,"dialog",TRUE ); 281 QDialog* dia = new QDialog(this,"dialog",TRUE );
282 QVBoxLayout *box = new QVBoxLayout( dia ); 282 QVBoxLayout *box = new QVBoxLayout( dia );
283 dia->setCaption( tr("View Record") ); 283 dia->setCaption( tr("View Record") );
284 284
285 285
286 QTextView *view = new QTextView(dia ); 286 QTextView *view = new QTextView(dia );
287 view->setText( rec.toRichText() ); 287 view->setText( rec.toRichText() );
288 box->addWidget( view ); 288 box->addWidget( view );
289 /* 289 /*
290 * execute via QPEApplication 290 * execute via QPEApplication
291 * this allows QPEApplication to make a sane decision 291 * this allows QPEApplication to make a sane decision
292 * on the size 292 * on the size
293 */ 293 */
294 dia->showMaximized(); 294 dia->showMaximized();
295 QPEApplication::execDialog( dia ); 295 QPEApplication::execDialog( dia );
296 delete dia; 296 delete dia;
297} 297}
298 298
299 299
300void MainWindow::slotDate() { 300void MainWindow::slotDate() {
301 /* 301 /*
302 * called by the action we will show a Popup 302 * called by the action we will show a Popup
303 * at the current mouse position with a DateChooser 303 * at the current mouse position with a DateChooser
304 * to select the day 304 * to select the day
305 */ 305 */
306 qWarning("slot Date"); 306 qWarning("slot Date");
307 QPopupMenu *menu = new QPopupMenu(); 307 QPopupMenu *menu = new QPopupMenu();
308 /* A Month to select a date from TRUE for auto close */ 308 /* A Month to select a date from TRUE for auto close */
309 DateBookMonth *month = new DateBookMonth(menu, 0, true ); 309 DateBookMonth *month = new DateBookMonth(menu, 0, true );
310 connect(month, SIGNAL(dateClicked(int, int, int) ), 310 connect(month, SIGNAL(dateClicked(int,int,int) ),
311 this, SLOT(slotLoadForDay(int, int, int) ) ); 311 this, SLOT(slotLoadForDay(int,int,int) ) );
312 312
313 menu->insertItem( month ); 313 menu->insertItem( month );
314 314
315 menu->exec( QCursor::pos() ); 315 menu->exec( QCursor::pos() );
316 316
317 /* 317 /*
318 * we do not need to delete month because 318 * we do not need to delete month because
319 * we delete its parent menu 319 * we delete its parent menu
320 */ 320 */
321 321
322 delete menu; 322 delete menu;
323} 323}
324 324
325/* 325/*
326 * An anonymous namespace this symbol is only available here 326 * An anonymous namespace this symbol is only available here
327 * so truely private 327 * so truely private
328 */ 328 */
329namespace { 329namespace {
330 /* not static cause namespace does that what static would do */ 330 /* not static cause namespace does that what static would do */
331 const int RTTI = 5050; 331 const int RTTI = 5050;
332 /* 332 /*
333 * every ListView got Items. we've special pim items 333 * every ListView got Items. we've special pim items
334 * holding ownership and the pointer to a pim record 334 * holding ownership and the pointer to a pim record
335 * it can't hold a pimrecord directly because this 335 * it can't hold a pimrecord directly because this
336 * would introduce slicing... any break 336 * would introduce slicing... any break
337 */ 337 */
338 /* 338 /*
339 * A struct is a special class. Everything is public by 339 * A struct is a special class. Everything is public by
340 * default. 340 * default.
341 */ 341 */
342 struct PIMListViewItem : public QListViewItem { 342 struct PIMListViewItem : public QListViewItem {
343 /* 343 /*
344 *currently no hierachies are planed for the example 344 *currently no hierachies are planed for the example
345 * so only one constructor with a QListView as parent 345 * so only one constructor with a QListView as parent
346 */ 346 */
347 PIMListViewItem( QListView*, OPimRecord* record ); 347 PIMListViewItem( QListView*, OPimRecord* record );
348 ~PIMListViewItem(); 348 ~PIMListViewItem();
349 349
350 /* used by the QListViewItem to easily allow identifiying of different 350 /* used by the QListViewItem to easily allow identifiying of different
351 * items. Values greater than 1000 should be used */ 351 * items. Values greater than 1000 should be used */
352 int rtti()const; 352 int rtti()const;
353 OPimRecord* record()const; 353 OPimRecord* record()const;
354 354
355 private: 355 private:
356 OPimRecord* m_record; 356 OPimRecord* m_record;
357 }; 357 };
358 358
359 PIMListViewItem::PIMListViewItem( QListView *p, OPimRecord* rec ) 359 PIMListViewItem::PIMListViewItem( QListView *p, OPimRecord* rec )
diff --git a/inputmethods/handwriting/qimpenhelp.cpp b/inputmethods/handwriting/qimpenhelp.cpp
index a294301..0727931 100644
--- a/inputmethods/handwriting/qimpenhelp.cpp
+++ b/inputmethods/handwriting/qimpenhelp.cpp
@@ -118,125 +118,125 @@ HandwritingHelp::HandwritingHelp( QIMPenProfile *p, QWidget *parent, const char
118 118
119 HandwritingTrainer *trainer = new HandwritingTrainer( p, this ); 119 HandwritingTrainer *trainer = new HandwritingTrainer( p, this );
120 addTab( trainer, tr("Trainer") ); 120 addTab( trainer, tr("Trainer") );
121} 121}
122 122
123void HandwritingHelp::showEvent( QShowEvent * ) 123void HandwritingHelp::showEvent( QShowEvent * )
124{ 124{
125 Global::hideInputMethod(); 125 Global::hideInputMethod();
126} 126}
127 127
128void HandwritingHelp::hideEvent( QHideEvent * ) 128void HandwritingHelp::hideEvent( QHideEvent * )
129{ 129{
130 Global::showInputMethod(); 130 Global::showInputMethod();
131} 131}
132 132
133//--------------------------------------------------------------------------- 133//---------------------------------------------------------------------------
134 134
135HandwritingTrainer::HandwritingTrainer( QIMPenProfile *p, QWidget *parent, const char *name ) 135HandwritingTrainer::HandwritingTrainer( QIMPenProfile *p, QWidget *parent, const char *name )
136 : QWidget( parent, name ), profile(p) 136 : QWidget( parent, name ), profile(p)
137{ 137{
138 QGridLayout *gl = new QGridLayout( this, 4, 2, 0, 4 ); 138 QGridLayout *gl = new QGridLayout( this, 4, 2, 0, 4 );
139 gl->setColStretch( 1, 1 ); 139 gl->setColStretch( 1, 1 );
140 gl->setRowStretch(3, 1); 140 gl->setRowStretch(3, 1);
141 141
142 charSetCombo = new QComboBox( this ); 142 charSetCombo = new QComboBox( this );
143 gl->addMultiCellWidget( charSetCombo, 0, 0, 0, 1 ); 143 gl->addMultiCellWidget( charSetCombo, 0, 0, 0, 1 );
144 connect( charSetCombo, SIGNAL(activated(int)), SLOT(selectCharSet(int))); 144 connect( charSetCombo, SIGNAL(activated(int)), SLOT(selectCharSet(int)));
145 QIMPenCharSetIterator it( profile->charSets() ); 145 QIMPenCharSetIterator it( profile->charSets() );
146 for ( ; it.current(); ++it ) { 146 for ( ; it.current(); ++it ) {
147 charSetCombo->insertItem( it.current()->description() ); 147 charSetCombo->insertItem( it.current()->description() );
148 } 148 }
149 149
150 charList = new QListBox( this ); 150 charList = new QListBox( this );
151 charList->setHScrollBarMode( QListBox::AlwaysOff ); 151 charList->setHScrollBarMode( QListBox::AlwaysOff );
152 charList->setFixedWidth(80); 152 charList->setFixedWidth(80);
153 connect( charList, SIGNAL(highlighted(int)), this, SLOT(selectChar(int)) ); 153 connect( charList, SIGNAL(highlighted(int)), this, SLOT(selectChar(int)) );
154 gl->addWidget(charList, 1, 0); 154 gl->addWidget(charList, 1, 0);
155 155
156 result = new QLabel( this ); 156 result = new QLabel( this );
157 result->setAlignment(AlignLeft | AlignVCenter | WordBreak); 157 result->setAlignment(AlignLeft | AlignVCenter | WordBreak);
158 result->setText( 158 result->setText(
159 tr( "Select a reference character from the list. Practice writing in " 159 tr( "Select a reference character from the list. Practice writing in "
160 "the area on the right.")); 160 "the area on the right."));
161 gl->addMultiCellWidget(result, 1, 2, 1, 1); 161 gl->addMultiCellWidget(result, 1, 2, 1, 1);
162 162
163 matcher = new QIMPenMatch( this ); 163 matcher = new QIMPenMatch( this );
164 matcher->setCharSet( currentSet ); 164 matcher->setCharSet( currentSet );
165 connect( matcher, SIGNAL(noMatch()), this, SLOT(noMatch()) ); 165 connect( matcher, SIGNAL(noMatch()), this, SLOT(noMatch()) );
166 connect( matcher, SIGNAL(matchedCharacters(const QIMPenCharMatchList &)), 166 connect( matcher, SIGNAL(matchedCharacters(const QIMPenCharMatchList&)),
167 this, SLOT(matched(const QIMPenCharMatchList &)) ); 167 this, SLOT(matched(const QIMPenCharMatchList&)) );
168 168
169 QHBoxLayout *hb = new QHBoxLayout(); 169 QHBoxLayout *hb = new QHBoxLayout();
170 gl->addLayout( hb, 2, 0 ); 170 gl->addLayout( hb, 2, 0 );
171 prevBtn = new QPushButton( this ); 171 prevBtn = new QPushButton( this );
172 prevBtn->setPixmap( QPixmap( (const char **)left_xpm ) ); 172 prevBtn->setPixmap( QPixmap( (const char **)left_xpm ) );
173 connect( prevBtn, SIGNAL(clicked()), SLOT(prevChar())); 173 connect( prevBtn, SIGNAL(clicked()), SLOT(prevChar()));
174 hb->addWidget( prevBtn ); 174 hb->addWidget( prevBtn );
175 175
176 nextBtn = new QPushButton( this ); 176 nextBtn = new QPushButton( this );
177 nextBtn->setPixmap( QPixmap( (const char **)right_xpm ) ); 177 nextBtn->setPixmap( QPixmap( (const char **)right_xpm ) );
178 connect( nextBtn, SIGNAL(clicked()), SLOT(nextChar())); 178 connect( nextBtn, SIGNAL(clicked()), SLOT(nextChar()));
179 hb->addWidget( nextBtn ); 179 hb->addWidget( nextBtn );
180 180
181 refPw = new QIMPenWidget( this ); 181 refPw = new QIMPenWidget( this );
182 refPw->setReadOnly( TRUE ); 182 refPw->setReadOnly( TRUE );
183 gl->addWidget( refPw, 3, 0 ); 183 gl->addWidget( refPw, 3, 0 );
184 184
185 pracPw = new QIMPenWidget( this ); 185 pracPw = new QIMPenWidget( this );
186 connect( matcher, SIGNAL(removeStroke()), pracPw, SLOT(removeStroke()) ); 186 connect( matcher, SIGNAL(removeStroke()), pracPw, SLOT(removeStroke()) );
187 connect( pracPw, SIGNAL(beginStroke()), 187 connect( pracPw, SIGNAL(beginStroke()),
188 this, SLOT(beginStroke()) ); 188 this, SLOT(beginStroke()) );
189 connect( pracPw, SIGNAL(stroke( QIMPenStroke * )), 189 connect( pracPw, SIGNAL(stroke(QIMPenStroke*)),
190 this, SLOT(strokeEntered( QIMPenStroke * )) ); 190 this, SLOT(strokeEntered(QIMPenStroke*)) );
191 connect( pracPw, SIGNAL(beginStroke()), 191 connect( pracPw, SIGNAL(beginStroke()),
192 matcher, SLOT(beginStroke()) ); 192 matcher, SLOT(beginStroke()) );
193 connect( pracPw, SIGNAL(stroke( QIMPenStroke * )), 193 connect( pracPw, SIGNAL(stroke(QIMPenStroke*)),
194 matcher, SLOT(strokeEntered( QIMPenStroke * )) ); 194 matcher, SLOT(strokeEntered(QIMPenStroke*)) );
195 gl->addWidget( pracPw, 3, 1 ); 195 gl->addWidget( pracPw, 3, 1 );
196 196
197 redrawTimer = new QTimer( this ); 197 redrawTimer = new QTimer( this );
198 connect( redrawTimer, SIGNAL(timeout()), this, SLOT(redrawChar()) ); 198 connect( redrawTimer, SIGNAL(timeout()), this, SLOT(redrawChar()) );
199 redrawTimer->start( 5000 ); 199 redrawTimer->start( 5000 );
200 200
201 currentSet = 0; 201 currentSet = 0;
202 charSetCombo->setCurrentItem( 1 ); 202 charSetCombo->setCurrentItem( 1 );
203 selectCharSet( 1 ); 203 selectCharSet( 1 );
204} 204}
205 205
206HandwritingTrainer::~HandwritingTrainer() 206HandwritingTrainer::~HandwritingTrainer()
207{ 207{
208} 208}
209 209
210void HandwritingTrainer::showEvent( QShowEvent * ) 210void HandwritingTrainer::showEvent( QShowEvent * )
211{ 211{
212 redrawChar(); 212 redrawChar();
213 redrawTimer->start( 5000 ); 213 redrawTimer->start( 5000 );
214} 214}
215 215
216void HandwritingTrainer::setCurrentChar( QIMPenChar *c ) 216void HandwritingTrainer::setCurrentChar( QIMPenChar *c )
217{ 217{
218 currentChar = c; 218 currentChar = c;
219 refPw->showCharacter( currentChar ); 219 refPw->showCharacter( currentChar );
220 pracPw->clear(); 220 pracPw->clear();
221 if ( currentChar ) { 221 if ( currentChar ) {
222 prevBtn->setEnabled( findPrev() != 0 ); 222 prevBtn->setEnabled( findPrev() != 0 );
223 nextBtn->setEnabled( findNext() != 0 ); 223 nextBtn->setEnabled( findNext() != 0 );
224 } 224 }
225 redrawTimer->start( 5000 ); 225 redrawTimer->start( 5000 );
226} 226}
227 227
228void HandwritingTrainer::selectChar( int i ) 228void HandwritingTrainer::selectChar( int i )
229{ 229{
230 static int last_char = 0; 230 static int last_char = 0;
231 231
232 if (last_char != i) { 232 if (last_char != i) {
233 result->setText(""); 233 result->setText("");
234 } 234 }
235 235
236 currentChar = 0; 236 currentChar = 0;
237 currentCode = ((CharListItem *)charList->item(i))->code(); 237 currentCode = ((CharListItem *)charList->item(i))->code();
238 QIMPenCharIterator it(currentSet->characters() ); 238 QIMPenCharIterator it(currentSet->characters() );
239 for ( ; it.current(); ++it ) { 239 for ( ; it.current(); ++it ) {
240 if ( it.current()->character() == currentCode && 240 if ( it.current()->character() == currentCode &&
241 !it.current()->testFlag( QIMPenChar::Deleted ) ) { 241 !it.current()->testFlag( QIMPenChar::Deleted ) ) {
242 setCurrentChar( it.current() ); 242 setCurrentChar( it.current() );
diff --git a/inputmethods/handwriting/qimpeninput.cpp b/inputmethods/handwriting/qimpeninput.cpp
index db33c9b..d073cdf 100644
--- a/inputmethods/handwriting/qimpeninput.cpp
+++ b/inputmethods/handwriting/qimpeninput.cpp
@@ -104,157 +104,157 @@ static char * enter_xpm[] = {
104" . ", 104" . ",
105" ", 105" ",
106" "}; 106" "};
107 107
108 108
109 109
110/* XPM */ 110/* XPM */
111static char * help_xpm[] = { 111static char * help_xpm[] = {
112"12 12 5 1", 112"12 12 5 1",
113 " c None", 113 " c None",
114 ".c #000000", 114 ".c #000000",
115 "+c #FFFFFF", 115 "+c #FFFFFF",
116 "@c #666666", 116 "@c #666666",
117 "#c #333333", 117 "#c #333333",
118" ", 118" ",
119" ... ", 119" ... ",
120" .+++. ", 120" .+++. ",
121" .+..@+. ", 121" .+..@+. ",
122" #.# .+. ", 122" #.# .+. ",
123" .+. ", 123" .+. ",
124" .+. ", 124" .+. ",
125" .+. ", 125" .+. ",
126" .+. ", 126" .+. ",
127" #.# ", 127" #.# ",
128" .+. ", 128" .+. ",
129" #.# "}; 129" #.# "};
130 130
131 131
132/*! 132/*!
133 \class QIMPenInput qimpeninput.h 133 \class QIMPenInput qimpeninput.h
134 134
135 Pen input widget. 135 Pen input widget.
136*/ 136*/
137QIMPenInput::QIMPenInput( QWidget *parent, const char *name, WFlags wf ) 137QIMPenInput::QIMPenInput( QWidget *parent, const char *name, WFlags wf )
138 : QFrame( parent, name, wf ), helpDlg(0), profile(0) 138 : QFrame( parent, name, wf ), helpDlg(0), profile(0)
139{ 139{
140 setFrameStyle( Box | Plain ); 140 setFrameStyle( Box | Plain );
141 141
142 profileList.setAutoDelete( true ); 142 profileList.setAutoDelete( true );
143 143
144 matcher = new QIMPenMatch( this ); 144 matcher = new QIMPenMatch( this );
145 connect( matcher, SIGNAL(keypress(uint)), this, SLOT(keypress(uint)) ); 145 connect( matcher, SIGNAL(keypress(uint)), this, SLOT(keypress(uint)) );
146 connect( matcher, SIGNAL(erase()), this, SLOT(erase()) ); 146 connect( matcher, SIGNAL(erase()), this, SLOT(erase()) );
147 147
148 QGridLayout *gl = new QGridLayout( this, 5, 2, 1, 0 ); 148 QGridLayout *gl = new QGridLayout( this, 5, 2, 1, 0 );
149 gl->setColStretch( 0, 1 ); 149 gl->setColStretch( 0, 1 );
150 150
151 wordPicker = new QIMPenWordPick( this ); 151 wordPicker = new QIMPenWordPick( this );
152 connect( wordPicker, SIGNAL(wordClicked(const QString &)), 152 connect( wordPicker, SIGNAL(wordClicked(const QString&)),
153 this, SLOT(wordPicked(const QString &)) ); 153 this, SLOT(wordPicked(const QString&)) );
154 connect( matcher, SIGNAL(matchedCharacters(const QIMPenCharMatchList &)), 154 connect( matcher, SIGNAL(matchedCharacters(const QIMPenCharMatchList&)),
155 this, SLOT(matchedCharacters(const QIMPenCharMatchList &)) ); 155 this, SLOT(matchedCharacters(const QIMPenCharMatchList&)) );
156 connect( matcher, SIGNAL(matchedWords(const QIMPenMatch::MatchWordList&)), 156 connect( matcher, SIGNAL(matchedWords(const QIMPenMatch::MatchWordList&)),
157 wordPicker, SLOT(setWords(const QIMPenMatch::MatchWordList&)) ); 157 wordPicker, SLOT(setWords(const QIMPenMatch::MatchWordList&)) );
158 QFont f("smallsmooth",9); 158 QFont f("smallsmooth",9);
159 QFontInfo fi( f ); 159 QFontInfo fi( f );
160 wordPicker->setFont( f ); 160 wordPicker->setFont( f );
161 wordPicker->setBackgroundColor( white ); 161 wordPicker->setBackgroundColor( white );
162 gl->addMultiCellWidget( wordPicker, 0, 0, 0, 1 ); 162 gl->addMultiCellWidget( wordPicker, 0, 0, 0, 1 );
163 if ( !Global::fixedDawg().root() || !matcher->isWordMatchingEnabled() ) 163 if ( !Global::fixedDawg().root() || !matcher->isWordMatchingEnabled() )
164 wordPicker->hide(); 164 wordPicker->hide();
165 165
166 pw = new QIMPenWidget( this ); 166 pw = new QIMPenWidget( this );
167 gl->addMultiCellWidget( pw, 1, 4, 0, 0 ); 167 gl->addMultiCellWidget( pw, 1, 4, 0, 0 );
168 168
169 int bh = pw->sizeHint().height()/4; 169 int bh = pw->sizeHint().height()/4;
170 170
171 QPushButton *b = new QPushButton( this ); 171 QPushButton *b = new QPushButton( this );
172 b->setFocusPolicy( NoFocus ); 172 b->setFocusPolicy( NoFocus );
173 b->setPixmap( QPixmap( (const char **)bs_xpm ) ); 173 b->setPixmap( QPixmap( (const char **)bs_xpm ) );
174 b->setFixedHeight(pw->sizeHint().height()-3*bh); // left-over space goes here 174 b->setFixedHeight(pw->sizeHint().height()-3*bh); // left-over space goes here
175 b->setAutoRepeat( TRUE ); 175 b->setAutoRepeat( TRUE );
176 gl->addWidget( b, 1, 1 ); 176 gl->addWidget( b, 1, 1 );
177 connect( b, SIGNAL(clicked()), SLOT(backspace())); 177 connect( b, SIGNAL(clicked()), SLOT(backspace()));
178 178
179 b = new QPushButton( this ); 179 b = new QPushButton( this );
180 b->setFocusPolicy( NoFocus ); 180 b->setFocusPolicy( NoFocus );
181 b->setPixmap( QPixmap( (const char **)enter_xpm ) ); 181 b->setPixmap( QPixmap( (const char **)enter_xpm ) );
182 b->setFixedHeight(bh); 182 b->setFixedHeight(bh);
183 b->setAutoRepeat( TRUE ); 183 b->setAutoRepeat( TRUE );
184 gl->addWidget( b, 2, 1 ); 184 gl->addWidget( b, 2, 1 );
185 connect( b, SIGNAL(clicked()), SLOT(enter())); 185 connect( b, SIGNAL(clicked()), SLOT(enter()));
186 186
187 helpBtn = new QPushButton( this ); 187 helpBtn = new QPushButton( this );
188 helpBtn->setFocusPolicy( NoFocus ); 188 helpBtn->setFocusPolicy( NoFocus );
189 helpBtn->setPixmap( QPixmap( (const char **)help_xpm ) ); 189 helpBtn->setPixmap( QPixmap( (const char **)help_xpm ) );
190 helpBtn->setFixedHeight(bh); 190 helpBtn->setFixedHeight(bh);
191 gl->addWidget( helpBtn, 3, 1 ); 191 gl->addWidget( helpBtn, 3, 1 );
192 connect( helpBtn, SIGNAL(clicked()), SLOT(help())); 192 connect( helpBtn, SIGNAL(clicked()), SLOT(help()));
193 193
194 QPixmap pm( (const char **)pen_xpm ); 194 QPixmap pm( (const char **)pen_xpm );
195 setupBtn = new QPushButton( this ); 195 setupBtn = new QPushButton( this );
196 setupBtn->setFocusPolicy( NoFocus ); 196 setupBtn->setFocusPolicy( NoFocus );
197 setupBtn->setPixmap( pm ); 197 setupBtn->setPixmap( pm );
198 setupBtn->setFixedHeight(bh); 198 setupBtn->setFixedHeight(bh);
199 gl->addWidget( setupBtn, 4, 1 ); 199 gl->addWidget( setupBtn, 4, 1 );
200 connect( setupBtn, SIGNAL(clicked()), SLOT(setup())); 200 connect( setupBtn, SIGNAL(clicked()), SLOT(setup()));
201 201
202 connect( matcher, SIGNAL(removeStroke()), pw, SLOT(removeStroke()) ); 202 connect( matcher, SIGNAL(removeStroke()), pw, SLOT(removeStroke()) );
203 connect( pw, SIGNAL(changeCharSet( QIMPenCharSet * )), 203 connect( pw, SIGNAL(changeCharSet(QIMPenCharSet*)),
204 matcher, SLOT(setCharSet( QIMPenCharSet * )) ); 204 matcher, SLOT(setCharSet(QIMPenCharSet*)) );
205 connect( pw, SIGNAL(changeCharSet( int )), 205 connect( pw, SIGNAL(changeCharSet(int)),
206 this, SLOT(selectCharSet( int )) ); 206 this, SLOT(selectCharSet(int)) );
207 connect( pw, SIGNAL(beginStroke()), 207 connect( pw, SIGNAL(beginStroke()),
208 matcher, SLOT(beginStroke()) ); 208 matcher, SLOT(beginStroke()) );
209 connect( pw, SIGNAL(stroke( QIMPenStroke * )), 209 connect( pw, SIGNAL(stroke(QIMPenStroke*)),
210 this, SLOT(strokeEntered( QIMPenStroke * )) ); 210 this, SLOT(strokeEntered(QIMPenStroke*)) );
211 connect( pw, SIGNAL(stroke( QIMPenStroke * )), 211 connect( pw, SIGNAL(stroke(QIMPenStroke*)),
212 matcher, SLOT(strokeEntered( QIMPenStroke * )) ); 212 matcher, SLOT(strokeEntered(QIMPenStroke*)) );
213 213
214 shortcutCharSet = 0; 214 shortcutCharSet = 0;
215 currCharSet = 0; 215 currCharSet = 0;
216 setupDlg = 0; 216 setupDlg = 0;
217 profile = 0; 217 profile = 0;
218 mode = Normal; 218 mode = Normal;
219 219
220 loadProfiles(); 220 loadProfiles();
221} 221}
222 222
223QIMPenInput::~QIMPenInput() 223QIMPenInput::~QIMPenInput()
224{ 224{
225 delete (HandwritingHelp*) helpDlg; 225 delete (HandwritingHelp*) helpDlg;
226} 226}
227 227
228QSize QIMPenInput::sizeHint() const 228QSize QIMPenInput::sizeHint() const
229{ 229{
230 int fw = frameWidth(); 230 int fw = frameWidth();
231 int ps = wordPicker->isHidden() ? 0 : wordPicker->sizeHint().height(); 231 int ps = wordPicker->isHidden() ? 0 : wordPicker->sizeHint().height();
232 return pw->sizeHint() + QSize( fw*2, fw*2+ps ); 232 return pw->sizeHint() + QSize( fw*2, fw*2+ps );
233} 233}
234 234
235void QIMPenInput::loadProfiles() 235void QIMPenInput::loadProfiles()
236{ 236{
237 profileList.clear(); 237 profileList.clear();
238 profile = 0; 238 profile = 0;
239 delete shortcutCharSet; 239 delete shortcutCharSet;
240 shortcutCharSet = new QIMPenCharSet(); 240 shortcutCharSet = new QIMPenCharSet();
241 shortcutCharSet->setTitle( tr("Shortcut") ); 241 shortcutCharSet->setTitle( tr("Shortcut") );
242 QString path = QPEApplication::qpeDir() + "etc/qimpen"; 242 QString path = QPEApplication::qpeDir() + "etc/qimpen";
243 QDir dir( path, "*.conf" ); 243 QDir dir( path, "*.conf" );
244 QStringList list = dir.entryList(); 244 QStringList list = dir.entryList();
245 QStringList::Iterator it; 245 QStringList::Iterator it;
246 for ( it = list.begin(); it != list.end(); ++it ) { 246 for ( it = list.begin(); it != list.end(); ++it ) {
247 QIMPenProfile *p = new QIMPenProfile( path + "/" + *it ); 247 QIMPenProfile *p = new QIMPenProfile( path + "/" + *it );
248 profileList.append( p ); 248 profileList.append( p );
249 if ( p->shortcut() ) { 249 if ( p->shortcut() ) {
250 QIMPenCharIterator it( p->shortcut()->characters() ); 250 QIMPenCharIterator it( p->shortcut()->characters() );
251 for ( ; it.current(); ++it ) { 251 for ( ; it.current(); ++it ) {
252 shortcutCharSet->addChar( new QIMPenChar(*it.current()) ); 252 shortcutCharSet->addChar( new QIMPenChar(*it.current()) );
253 } 253 }
254 } 254 }
255 } 255 }
256 256
257 Config config( "handwriting" ); 257 Config config( "handwriting" );
258 config.setGroup( "Settings" ); 258 config.setGroup( "Settings" );
259 QString prof = config.readEntry( "Profile", "Default" ); 259 QString prof = config.readEntry( "Profile", "Default" );
260 selectProfile( prof ); 260 selectProfile( prof );
diff --git a/inputmethods/handwriting/qimpensetup.cpp b/inputmethods/handwriting/qimpensetup.cpp
index d0f9ffd..d1297a9 100644
--- a/inputmethods/handwriting/qimpensetup.cpp
+++ b/inputmethods/handwriting/qimpensetup.cpp
@@ -56,98 +56,98 @@ static const char * const left_xpm[] = {
56" .... ", 56" .... ",
57" ... ", 57" ... ",
58" .. ", 58" .. ",
59" . ", 59" . ",
60" ", 60" ",
61" "}; 61" "};
62 62
63 63
64/* XPM */ 64/* XPM */
65static const char * const right_xpm[] = { 65static const char * const right_xpm[] = {
66"16 16 2 1", 66"16 16 2 1",
67 " c None", 67 " c None",
68 ".c #000000", 68 ".c #000000",
69" ", 69" ",
70" ", 70" ",
71" ", 71" ",
72" . ", 72" . ",
73" .. ", 73" .. ",
74" ... ", 74" ... ",
75" .... ", 75" .... ",
76" ..... ", 76" ..... ",
77" ...... ", 77" ...... ",
78" ..... ", 78" ..... ",
79" .... ", 79" .... ",
80" ... ", 80" ... ",
81" .. ", 81" .. ",
82" . ", 82" . ",
83" ", 83" ",
84" "}; 84" "};
85 85
86 86
87 87
88QIMPenSetup::QIMPenSetup( QIMPenProfile *p, QWidget *parent, 88QIMPenSetup::QIMPenSetup( QIMPenProfile *p, QWidget *parent,
89 const char *name, bool modal, int WFlags ) 89 const char *name, bool modal, int WFlags )
90 : QDialog( parent, name, modal, WFlags ), profileCombo(0), profile(p) 90 : QDialog( parent, name, modal, WFlags ), profileCombo(0), profile(p)
91{ 91{
92 setCaption( tr("Setup Handwriting Input") ); 92 setCaption( tr("Setup Handwriting Input") );
93 93
94 QVBoxLayout *vb = new QVBoxLayout( this ); 94 QVBoxLayout *vb = new QVBoxLayout( this );
95 95
96#define MULTIPROFILE 96#define MULTIPROFILE
97#ifdef MULTIPROFILE 97#ifdef MULTIPROFILE
98 profileList.setAutoDelete( true ); 98 profileList.setAutoDelete( true );
99 QHBoxLayout *hb = new QHBoxLayout( vb ); 99 QHBoxLayout *hb = new QHBoxLayout( vb );
100 hb->setMargin( 6 ); 100 hb->setMargin( 6 );
101 QLabel *l = new QLabel( tr("Character Profile:"), this ); 101 QLabel *l = new QLabel( tr("Character Profile:"), this );
102 hb->addWidget( l ); 102 hb->addWidget( l );
103 profileCombo = new QComboBox( this ); 103 profileCombo = new QComboBox( this );
104 connect( profileCombo, SIGNAL(activated(const QString &)), 104 connect( profileCombo, SIGNAL(activated(const QString&)),
105 this, SLOT(selectProfile(const QString &)) ); 105 this, SLOT(selectProfile(const QString&)) );
106 hb->addWidget( profileCombo ); 106 hb->addWidget( profileCombo );
107#else 107#else
108 profileList.append( profile ); 108 profileList.append( profile );
109#endif 109#endif
110 110
111 qWarning("profiles: %d", profileList.count()); 111 qWarning("profiles: %d", profileList.count());
112 112
113 QTabWidget *tw = new QTabWidget( this ); 113 QTabWidget *tw = new QTabWidget( this );
114 vb->addWidget( tw ); 114 vb->addWidget( tw );
115 115
116 pref = new QIMPenPrefBase( this ); 116 pref = new QIMPenPrefBase( this );
117 tw->addTab( pref, tr("Preferences") ); 117 tw->addTab( pref, tr("Preferences") );
118 118
119 pref->inputStyle->setExclusive( TRUE ); 119 pref->inputStyle->setExclusive( TRUE );
120 120
121 style = profile->style() == QIMPenProfile::ToggleCases ? 1 : 0; 121 style = profile->style() == QIMPenProfile::ToggleCases ? 1 : 0;
122 pref->inputStyle->setButton( style ); 122 pref->inputStyle->setButton( style );
123 connect( pref->inputStyle, SIGNAL(clicked(int)), 123 connect( pref->inputStyle, SIGNAL(clicked(int)),
124 this, SLOT(styleClicked(int)) ); 124 this, SLOT(styleClicked(int)) );
125 pref->inputStyle->setEnabled( profile->canSelectStyle() ); 125 pref->inputStyle->setEnabled( profile->canSelectStyle() );
126 126
127 multiTimeout = profile->multiStrokeTimeout(); 127 multiTimeout = profile->multiStrokeTimeout();
128 pref->multiStrokeSlider->setValue( multiTimeout ); 128 pref->multiStrokeSlider->setValue( multiTimeout );
129 multiTimeoutChanged( multiTimeout ); 129 multiTimeoutChanged( multiTimeout );
130 connect( pref->multiStrokeSlider, SIGNAL(valueChanged(int)), 130 connect( pref->multiStrokeSlider, SIGNAL(valueChanged(int)),
131 this, SLOT(multiTimeoutChanged(int)) ); 131 this, SLOT(multiTimeoutChanged(int)) );
132 132
133 edit = new QIMPenEdit( p, tw ); 133 edit = new QIMPenEdit( p, tw );
134 tw->addTab( edit, tr("Customize") ); 134 tw->addTab( edit, tr("Customize") );
135#ifdef MULTIPROFILE 135#ifdef MULTIPROFILE
136 loadProfiles(); 136 loadProfiles();
137#endif 137#endif
138 138
139} 139}
140 140
141void QIMPenSetup::loadProfiles() 141void QIMPenSetup::loadProfiles()
142{ 142{
143 QString path = QPEApplication::qpeDir() + "etc/qimpen"; 143 QString path = QPEApplication::qpeDir() + "etc/qimpen";
144 QDir dir( path, "*.conf" ); 144 QDir dir( path, "*.conf" );
145 QStringList list = dir.entryList(); 145 QStringList list = dir.entryList();
146 QStringList::Iterator it; 146 QStringList::Iterator it;
147 for ( it = list.begin(); it != list.end(); ++it ) { 147 for ( it = list.begin(); it != list.end(); ++it ) {
148 QIMPenProfile *p = new QIMPenProfile( path + "/" + *it ); 148 QIMPenProfile *p = new QIMPenProfile( path + "/" + *it );
149 profileList.append( p ); 149 profileList.append( p );
150 profileCombo->insertItem( p->name() ); 150 profileCombo->insertItem( p->name() );
151 if ( p->name() == profile->name() ) { 151 if ( p->name() == profile->name() ) {
152 profileCombo->setCurrentItem( profileCombo->count()-1 ); 152 profileCombo->setCurrentItem( profileCombo->count()-1 );
153 profile = p; 153 profile = p;
@@ -202,191 +202,191 @@ void QIMPenSetup::accept()
202 } 202 }
203 // Save charsets 203 // Save charsets
204 bool ok = TRUE; 204 bool ok = TRUE;
205 for ( int i = 0; i < (int)profileList.count(); i++ ) { 205 for ( int i = 0; i < (int)profileList.count(); i++ ) {
206 QIMPenProfile *prof = profileList.at(i); 206 QIMPenProfile *prof = profileList.at(i);
207 QIMPenCharSetIterator it(prof->charSets()); 207 QIMPenCharSetIterator it(prof->charSets());
208 for ( ; it.current(); ++it ) { 208 for ( ; it.current(); ++it ) {
209 if ( !(it.current()->save( QIMPenCharSet::User )) ) { 209 if ( !(it.current()->save( QIMPenCharSet::User )) ) {
210 ok = FALSE; 210 ok = FALSE;
211 break; 211 break;
212 } 212 }
213 } 213 }
214 } 214 }
215 if ( !ok ) { 215 if ( !ok ) {
216 if ( QMessageBox::critical( 0, tr( "Out of space" ), 216 if ( QMessageBox::critical( 0, tr( "Out of space" ),
217 tr("Unable to save information.\n" 217 tr("Unable to save information.\n"
218 "Free up some space\n" 218 "Free up some space\n"
219 "and try again.\n" 219 "and try again.\n"
220 "\nQuit anyway?"), 220 "\nQuit anyway?"),
221 QMessageBox::Yes|QMessageBox::Escape, 221 QMessageBox::Yes|QMessageBox::Escape,
222 QMessageBox::No|QMessageBox::Default ) 222 QMessageBox::No|QMessageBox::Default )
223 != QMessageBox::No ) { 223 != QMessageBox::No ) {
224 QDialog::accept(); 224 QDialog::accept();
225 } 225 }
226 } else { 226 } else {
227 QDialog::accept(); 227 QDialog::accept();
228 } 228 }
229} 229}
230 230
231//--------------------------------------------------------------------------- 231//---------------------------------------------------------------------------
232 232
233QIMPenInputCharDlg::QIMPenInputCharDlg( QWidget *parent, const char *name, 233QIMPenInputCharDlg::QIMPenInputCharDlg( QWidget *parent, const char *name,
234 bool modal, int WFlags) 234 bool modal, int WFlags)
235 : QDialog( parent, name, modal, WFlags ) 235 : QDialog( parent, name, modal, WFlags )
236{ 236{
237 setCaption( tr("Enter new character") ); 237 setCaption( tr("Enter new character") );
238 uni = 0; 238 uni = 0;
239 239
240 QVBoxLayout *vb = new QVBoxLayout( this, 10 ); 240 QVBoxLayout *vb = new QVBoxLayout( this, 10 );
241 241
242 QHBoxLayout *hb = new QHBoxLayout(); 242 QHBoxLayout *hb = new QHBoxLayout();
243 vb->addLayout( hb ); 243 vb->addLayout( hb );
244 244
245 QLabel *label = new QLabel( tr("Character:"), this ); 245 QLabel *label = new QLabel( tr("Character:"), this );
246 hb->addWidget( label ); 246 hb->addWidget( label );
247 247
248 QComboBox *cb = new QComboBox( TRUE, this ); 248 QComboBox *cb = new QComboBox( TRUE, this );
249 connect( cb, SIGNAL(activated(int)), SLOT(setSpecial(int)) ); 249 connect( cb, SIGNAL(activated(int)), SLOT(setSpecial(int)) );
250 connect( cb, SIGNAL(textChanged(const QString &)), 250 connect( cb, SIGNAL(textChanged(const QString&)),
251 SLOT(setCharacter(const QString &)) ); 251 SLOT(setCharacter(const QString&)) );
252 addSpecial( cb ); 252 addSpecial( cb );
253 cb->setEditText( "" ); 253 cb->setEditText( "" );
254 hb->addWidget( cb ); 254 hb->addWidget( cb );
255 255
256 hb = new QHBoxLayout(); 256 hb = new QHBoxLayout();
257 vb->addLayout( hb ); 257 vb->addLayout( hb );
258 258
259 QPushButton *pb = new QPushButton( "OK", this ); 259 QPushButton *pb = new QPushButton( "OK", this );
260 connect( pb, SIGNAL(clicked()), SLOT(accept())); 260 connect( pb, SIGNAL(clicked()), SLOT(accept()));
261 hb->addWidget( pb ); 261 hb->addWidget( pb );
262 pb = new QPushButton( "Cancel", this ); 262 pb = new QPushButton( "Cancel", this );
263 connect( pb, SIGNAL(clicked()), SLOT(reject())); 263 connect( pb, SIGNAL(clicked()), SLOT(reject()));
264 hb->addWidget( pb ); 264 hb->addWidget( pb );
265 265
266 cb->setFocus(); 266 cb->setFocus();
267} 267}
268 268
269void QIMPenInputCharDlg::addSpecial( QComboBox *cb ) 269void QIMPenInputCharDlg::addSpecial( QComboBox *cb )
270{ 270{
271 int i = 0; 271 int i = 0;
272 while ( qimpen_specialKeys[i].code != Key_unknown ) { 272 while ( qimpen_specialKeys[i].code != Key_unknown ) {
273 cb->insertItem( qimpen_specialKeys[i].name ); 273 cb->insertItem( qimpen_specialKeys[i].name );
274 i++; 274 i++;
275 } 275 }
276} 276}
277 277
278void QIMPenInputCharDlg::setSpecial( int sp ) 278void QIMPenInputCharDlg::setSpecial( int sp )
279{ 279{
280 uni = qimpen_specialKeys[sp].code << 16; 280 uni = qimpen_specialKeys[sp].code << 16;
281} 281}
282 282
283void QIMPenInputCharDlg::setCharacter( const QString &string ) 283void QIMPenInputCharDlg::setCharacter( const QString &string )
284{ 284{
285 uni = string[0].unicode(); 285 uni = string[0].unicode();
286} 286}
287 287
288//--------------------------------------------------------------------------- 288//---------------------------------------------------------------------------
289 289
290class CharListItem : public QListBoxText 290class CharListItem : public QListBoxText
291{ 291{
292public: 292public:
293 CharListItem( const QString &text, uint c ) 293 CharListItem( const QString &text, uint c )
294 : QListBoxText( text ) 294 : QListBoxText( text )
295 { 295 {
296 _code = c; 296 _code = c;
297 } 297 }
298 298
299 uint code() const { return _code; } 299 uint code() const { return _code; }
300 300
301protected: 301protected:
302 uint _code; 302 uint _code;
303}; 303};
304 304
305/*! 305/*!
306 \class QIMPenEdit qimpensetup.h 306 \class QIMPenEdit qimpensetup.h
307 307
308 Class to allow users to input totally useless character definitions 308 Class to allow users to input totally useless character definitions
309 which could match any number of the default set. 309 which could match any number of the default set.
310*/ 310*/
311 311
312QIMPenEdit::QIMPenEdit( QIMPenProfile *p, QWidget *parent, 312QIMPenEdit::QIMPenEdit( QIMPenProfile *p, QWidget *parent,
313 const char *name ) 313 const char *name )
314 : QWidget( parent, name ), profile(p) 314 : QWidget( parent, name ), profile(p)
315{ 315{
316 currentChar = 0; 316 currentChar = 0;
317 currentCode = 0; 317 currentCode = 0;
318 inputChar = new QIMPenChar(); 318 inputChar = new QIMPenChar();
319 319
320 QVBoxLayout *tvb = new QVBoxLayout( this, 5 ); 320 QVBoxLayout *tvb = new QVBoxLayout( this, 5 );
321 321
322 QGridLayout *gl = new QGridLayout( tvb, 4, 2 ); 322 QGridLayout *gl = new QGridLayout( tvb, 4, 2 );
323 gl->setRowStretch( 1, 1 ); 323 gl->setRowStretch( 1, 1 );
324 gl->addRowSpacing( 2, 35 ); 324 gl->addRowSpacing( 2, 35 );
325 gl->addRowSpacing( 3, 35 ); 325 gl->addRowSpacing( 3, 35 );
326 326
327 charSetCombo = new QComboBox( this ); 327 charSetCombo = new QComboBox( this );
328 gl->addMultiCellWidget( charSetCombo, 0, 0, 0, 1 ); 328 gl->addMultiCellWidget( charSetCombo, 0, 0, 0, 1 );
329 connect( charSetCombo, SIGNAL(activated(int)), SLOT(selectCharSet(int))); 329 connect( charSetCombo, SIGNAL(activated(int)), SLOT(selectCharSet(int)));
330 QIMPenCharSetIterator it( profile->charSets() ); 330 QIMPenCharSetIterator it( profile->charSets() );
331 for ( ; it.current(); ++it ) { 331 for ( ; it.current(); ++it ) {
332 charSetCombo->insertItem( it.current()->description() ); 332 charSetCombo->insertItem( it.current()->description() );
333 } 333 }
334 334
335 charList = new QListBox( this ); 335 charList = new QListBox( this );
336 charList->setMinimumHeight( charList->sizeHint().height() ); 336 charList->setMinimumHeight( charList->sizeHint().height() );
337 connect( charList, SIGNAL(highlighted(int)), SLOT(selectChar(int)) ); 337 connect( charList, SIGNAL(highlighted(int)), SLOT(selectChar(int)) );
338 gl->addWidget( charList, 1, 0 ); 338 gl->addWidget( charList, 1, 0 );
339 339
340 pw = new QIMPenWidget( this ); 340 pw = new QIMPenWidget( this );
341 pw->setFixedHeight( 75 ); 341 pw->setFixedHeight( 75 );
342 gl->addMultiCellWidget( pw, 2, 3, 0, 0 ); 342 gl->addMultiCellWidget( pw, 2, 3, 0, 0 );
343 connect( pw, SIGNAL(stroke(QIMPenStroke *)), 343 connect( pw, SIGNAL(stroke(QIMPenStroke*)),
344 SLOT(newStroke(QIMPenStroke *)) ); 344 SLOT(newStroke(QIMPenStroke*)) );
345 345
346 QVBoxLayout *vb = new QVBoxLayout(); 346 QVBoxLayout *vb = new QVBoxLayout();
347 gl->addLayout( vb, 1, 1 ); 347 gl->addLayout( vb, 1, 1 );
348 newBtn = new QPushButton( tr("New..."), this ); 348 newBtn = new QPushButton( tr("New..."), this );
349 connect( newBtn, SIGNAL(clicked()), SLOT(addNewChar()) ); 349 connect( newBtn, SIGNAL(clicked()), SLOT(addNewChar()) );
350 vb->addWidget( newBtn ); 350 vb->addWidget( newBtn );
351 351
352 addBtn = new QPushButton( tr("Add"), this ); 352 addBtn = new QPushButton( tr("Add"), this );
353 connect( addBtn, SIGNAL(clicked()), SLOT(addChar()) ); 353 connect( addBtn, SIGNAL(clicked()), SLOT(addChar()) );
354 vb->addWidget( addBtn ); 354 vb->addWidget( addBtn );
355 355
356 removeBtn = new QPushButton( tr("Remove"), this ); 356 removeBtn = new QPushButton( tr("Remove"), this );
357 connect( removeBtn, SIGNAL(clicked()), SLOT(removeChar()) ); 357 connect( removeBtn, SIGNAL(clicked()), SLOT(removeChar()) );
358 vb->addWidget( removeBtn ); 358 vb->addWidget( removeBtn );
359 359
360 QPushButton *pb = new QPushButton( tr("Default"), this ); 360 QPushButton *pb = new QPushButton( tr("Default"), this );
361 connect( pb, SIGNAL(clicked()), SLOT(defaultChars()) ); 361 connect( pb, SIGNAL(clicked()), SLOT(defaultChars()) );
362 vb->addWidget( pb ); 362 vb->addWidget( pb );
363 363
364 QHBoxLayout *hb = new QHBoxLayout(); 364 QHBoxLayout *hb = new QHBoxLayout();
365 gl->addLayout( hb, 2, 1 ); 365 gl->addLayout( hb, 2, 1 );
366 prevBtn = new QPushButton( this ); 366 prevBtn = new QPushButton( this );
367 prevBtn->setPixmap( QPixmap( (const char **)left_xpm ) ); 367 prevBtn->setPixmap( QPixmap( (const char **)left_xpm ) );
368 connect( prevBtn, SIGNAL(clicked()), SLOT(prevChar())); 368 connect( prevBtn, SIGNAL(clicked()), SLOT(prevChar()));
369 hb->addWidget( prevBtn ); 369 hb->addWidget( prevBtn );
370 370
371 nextBtn = new QPushButton( this ); 371 nextBtn = new QPushButton( this );
372 nextBtn->setPixmap( QPixmap( (const char **)right_xpm ) ); 372 nextBtn->setPixmap( QPixmap( (const char **)right_xpm ) );
373 connect( nextBtn, SIGNAL(clicked()), SLOT(nextChar())); 373 connect( nextBtn, SIGNAL(clicked()), SLOT(nextChar()));
374 hb->addWidget( nextBtn ); 374 hb->addWidget( nextBtn );
375 375
376 pb = new QPushButton( tr("Clear"), this ); 376 pb = new QPushButton( tr("Clear"), this );
377 connect( pb, SIGNAL(clicked()), SLOT(clearChar()) ); 377 connect( pb, SIGNAL(clicked()), SLOT(clearChar()) );
378 gl->addWidget( pb, 3, 1 ); 378 gl->addWidget( pb, 3, 1 );
379 379
380 //-- 380 //--
381#if !defined(Q_WS_QWS) 381#if !defined(Q_WS_QWS)
382 hb = new QHBoxLayout( tvb ); 382 hb = new QHBoxLayout( tvb );
383 pb = new QPushButton( tr("OK"), this ); 383 pb = new QPushButton( tr("OK"), this );
384 connect( pb, SIGNAL(clicked()), SLOT(accept()) ); 384 connect( pb, SIGNAL(clicked()), SLOT(accept()) );
385 hb->addWidget( pb ); 385 hb->addWidget( pb );
386 386
387 pb = new QPushButton( tr("Cancel"), this ); 387 pb = new QPushButton( tr("Cancel"), this );
388 connect( pb, SIGNAL(clicked()), SLOT(reject()) ); 388 connect( pb, SIGNAL(clicked()), SLOT(reject()) );
389 hb->addWidget( pb ); 389 hb->addWidget( pb );
390#endif 390#endif
391 selectCharSet( 0 ); 391 selectCharSet( 0 );
392 charList->setFocus(); 392 charList->setFocus();
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index aec0ad3..4f4f25f 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -50,98 +50,98 @@ static const char * const kb_config_xpm[] = {
50" . ", 50" . ",
51" . ", 51" . ",
52" "}; 52" "};
53 53
54/* Keyboard::Keyboard {{{1 */ 54/* Keyboard::Keyboard {{{1 */
55Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : 55Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) :
56 QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), 56 QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0),
57 meta(0), circumflex(0), diaeresis(0), baccent(0), accent(0), 57 meta(0), circumflex(0), diaeresis(0), baccent(0), accent(0),
58 useLargeKeys(TRUE), usePicks(0), useRepeat(0), 58 useLargeKeys(TRUE), usePicks(0), useRepeat(0),
59 pressedKeyRow(-1), pressedKeyCol(-1), 59 pressedKeyRow(-1), pressedKeyCol(-1),
60 unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), 60 unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0),
61 configdlg(0) 61 configdlg(0)
62 62
63{ 63{
64 64
65 // get the default font 65 // get the default font
66 Config *config = new Config( "qpe" ); 66 Config *config = new Config( "qpe" );
67 config->setGroup( "Appearance" ); 67 config->setGroup( "Appearance" );
68 QString familyStr = config->readEntry( "FontFamily", "smallsmooth" ); 68 QString familyStr = config->readEntry( "FontFamily", "smallsmooth" );
69 delete config; 69 delete config;
70 70
71 config = new Config("multikey"); 71 config = new Config("multikey");
72 config->setGroup ("general"); 72 config->setGroup ("general");
73 usePicks = config->readBoolEntry ("usePickboard", 0); // default closed 73 usePicks = config->readBoolEntry ("usePickboard", 0); // default closed
74 useRepeat = config->readBoolEntry ("useRepeat", 1); 74 useRepeat = config->readBoolEntry ("useRepeat", 1);
75 delete config; 75 delete config;
76 76
77 77
78 setFont( QFont( familyStr, 10 ) ); 78 setFont( QFont( familyStr, 10 ) );
79 79
80 picks = new KeyboardPicks( this ); 80 picks = new KeyboardPicks( this );
81 picks->setFont( QFont( familyStr, 10 ) ); 81 picks->setFont( QFont( familyStr, 10 ) );
82 picks->initialise(); 82 picks->initialise();
83 if (usePicks) { 83 if (usePicks) {
84 84
85 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), 85 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
86 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); 86 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
87 87
88 } else picks->hide(); 88 } else picks->hide();
89 89
90 loadKeyboardColors(); 90 loadKeyboardColors();
91 91
92 keys = new Keys(); 92 keys = new Keys();
93 93
94 repeatTimer = new QTimer( this ); 94 repeatTimer = new QTimer( this );
95 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); 95 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) );
96 96
97 QCopChannel* kbdChannel = new QCopChannel("MultiKey/Keyboard", this); 97 QCopChannel* kbdChannel = new QCopChannel("MultiKey/Keyboard", this);
98 connect(kbdChannel, SIGNAL(received(const QCString &, const QByteArray &)), 98 connect(kbdChannel, SIGNAL(received(const QCString&,const QByteArray&)),
99 this, SLOT(receive(const QCString &, const QByteArray &))); 99 this, SLOT(receive(const QCString&,const QByteArray&)));
100} 100}
101 101
102Keyboard::~Keyboard() { 102Keyboard::~Keyboard() {
103 103
104 if ( configdlg ) { 104 if ( configdlg ) {
105 delete configdlg; 105 delete configdlg;
106 configdlg = 0; 106 configdlg = 0;
107 } 107 }
108 108
109} 109}
110 110
111/* Keyboard::resizeEvent {{{1 */ 111/* Keyboard::resizeEvent {{{1 */
112void Keyboard::resizeEvent(QResizeEvent*) 112void Keyboard::resizeEvent(QResizeEvent*)
113{ 113{
114 int ph = picks->sizeHint().height(); 114 int ph = picks->sizeHint().height();
115 picks->setGeometry( 0, 0, width(), ph ); 115 picks->setGeometry( 0, 0, width(), ph );
116 keyHeight = (height()-(usePicks ? ph : 0))/(keys->rows()?keys->rows():1); 116 keyHeight = (height()-(usePicks ? ph : 0))/(keys->rows()?keys->rows():1);
117 117
118 int nk; // number of keys? 118 int nk; // number of keys?
119 if ( useLargeKeys ) { 119 if ( useLargeKeys ) {
120 nk = 15; 120 nk = 15;
121 } else { 121 } else {
122 nk = 19; 122 nk = 19;
123 } 123 }
124 defaultKeyWidth = (width()/nk)/2; 124 defaultKeyWidth = (width()/nk)/2;
125 xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? 125 xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces?
126 126
127} 127}
128 128
129/* KeyboardPicks::initialize {{{1 */ 129/* KeyboardPicks::initialize {{{1 */
130void KeyboardPicks::initialise() 130void KeyboardPicks::initialise()
131{ 131{
132 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); 132 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
133 mode = 0; 133 mode = 0;
134 dc = new KeyboardConfig(this); 134 dc = new KeyboardConfig(this);
135 configs.append(dc); 135 configs.append(dc);
136} 136}
137 137
138/* KeyboardPicks::sizeHint {{{1 */ 138/* KeyboardPicks::sizeHint {{{1 */
139QSize KeyboardPicks::sizeHint() const 139QSize KeyboardPicks::sizeHint() const
140{ 140{
141 return QSize(240,fontMetrics().lineSpacing()); 141 return QSize(240,fontMetrics().lineSpacing());
142} 142}
143 143
144 144
145/* KeyboardConfig::generateText {{{1 */ 145/* KeyboardConfig::generateText {{{1 */
146void KeyboardConfig::generateText(const QString &s) 146void KeyboardConfig::generateText(const QString &s)
147{ 147{
diff --git a/libopie/big-screen/example/osplitter_mail.cpp b/libopie/big-screen/example/osplitter_mail.cpp
index 4eaf3a9..4356baa 100644
--- a/libopie/big-screen/example/osplitter_mail.cpp
+++ b/libopie/big-screen/example/osplitter_mail.cpp
@@ -1,80 +1,80 @@
1 1
2#include <qstring.h> 2#include <qstring.h>
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qheader.h> 4#include <qheader.h>
5#include <qlayout.h> 5#include <qlayout.h>
6 6
7#include <qpe/qpeapplication.h> 7#include <qpe/qpeapplication.h>
8#include <opie/oapplicationfactory.h> 8#include <opie/oapplicationfactory.h>
9 9
10#include "../osplitter.h" 10#include "../osplitter.h"
11 11
12#include "osplitter_mail.h" 12#include "osplitter_mail.h"
13 13
14 14
15OPIE_EXPORT_APP( OApplicationFactory<ListViews> ) 15OPIE_EXPORT_APP( OApplicationFactory<ListViews> )
16 16
17class Folder { 17class Folder {
18 int dummy; 18 int dummy;
19}; 19};
20 20
21// ----------------------------------------------------------------- 21// -----------------------------------------------------------------
22 22
23ListViews::ListViews( QWidget* p, const char* name, WFlags fl ) 23ListViews::ListViews( QWidget* p, const char* name, WFlags fl )
24 : QWidget( p, name, fl ) { 24 : QWidget( p, name, fl ) {
25 qApp->installEventFilter( this ); 25 qApp->installEventFilter( this );
26 m_lstFolders.setAutoDelete( true ); 26 m_lstFolders.setAutoDelete( true );
27 QHBoxLayout *lay = new QHBoxLayout(this); 27 QHBoxLayout *lay = new QHBoxLayout(this);
28 28
29 m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" ); 29 m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" );
30 lay->addWidget( m_splitter ); 30 lay->addWidget( m_splitter );
31 connect(m_splitter, SIGNAL(sizeChange(bool, const QSize& ) ), 31 connect(m_splitter, SIGNAL(sizeChange(bool,const QSize&) ),
32 this, SLOT(slotSizeChange(bool, const QSize& ) ) ); 32 this, SLOT(slotSizeChange(bool,const QSize&) ) );
33 33
34 m_overview = new QListView( m_splitter ); 34 m_overview = new QListView( m_splitter );
35 m_overview->header()->setClickEnabled( FALSE ); 35 m_overview->header()->setClickEnabled( FALSE );
36 m_overview->addColumn( tr("Folder") ); 36 m_overview->addColumn( tr("Folder") );
37 m_overview->setMaximumWidth( 200 ); 37 m_overview->setMaximumWidth( 200 );
38 m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") ); 38 m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") );
39 m_splitter->setSizeChange( 300 ); 39 m_splitter->setSizeChange( 300 );
40 40
41 /* OSplitter starts with the small mode */ 41 /* OSplitter starts with the small mode */
42 m_messages = 0; 42 m_messages = 0;
43 m_message = m_attach = 0; 43 m_message = m_attach = 0;
44 44
45 splitti = new OSplitter( Vertical, m_splitter, "Splitti2" ); 45 splitti = new OSplitter( Vertical, m_splitter, "Splitti2" );
46 splitti->setSizeChange( 300 ); 46 splitti->setSizeChange( 300 );
47 splitti->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); 47 splitti->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) );
48 48
49 QLabel *lbl = new QLabel(splitti); 49 QLabel *lbl = new QLabel(splitti);
50 lbl->setTextFormat ( Qt::RichText ); 50 lbl->setTextFormat ( Qt::RichText );
51 lbl->setText("<br><br><b>Test Test Test</b><br><br><p>Fooooo hjhh</p>"); 51 lbl->setText("<br><br><b>Test Test Test</b><br><br><p>Fooooo hjhh</p>");
52 52
53 m_messages = new QListView( splitti ); 53 m_messages = new QListView( splitti );
54 m_messages->addColumn(" Messages "); 54 m_messages->addColumn(" Messages ");
55 55
56 folder1 = new QListView( splitti ); 56 folder1 = new QListView( splitti );
57 folder1->addColumn( "Messages 2 " ); 57 folder1->addColumn( "Messages 2 " );
58 58
59 splitti->addWidget(m_messages, "mail", tr("Mails") ); 59 splitti->addWidget(m_messages, "mail", tr("Mails") );
60 splitti->addWidget(folder1, "folder", tr("Folder") ); 60 splitti->addWidget(folder1, "folder", tr("Folder") );
61 splitti->addWidget( lbl, "logo", tr("Label") ); 61 splitti->addWidget( lbl, "logo", tr("Label") );
62 m_message = lbl; 62 m_message = lbl;
63 63
64 m_splitter->addWidget( splitti ); 64 m_splitter->addWidget( splitti );
65 65
66} 66}
67 67
68 68
69ListViews::~ListViews() { 69ListViews::~ListViews() {
70 70
71} 71}
72 72
73 73
74bool ListViews::eventFilter( QObject* obj, QEvent* ev ) { 74bool ListViews::eventFilter( QObject* obj, QEvent* ev ) {
75 if (!obj->isWidgetType() ) 75 if (!obj->isWidgetType() )
76 return false; 76 return false;
77 if ( ev->type() == QEvent::MouseButtonRelease ) { 77 if ( ev->type() == QEvent::MouseButtonRelease ) {
78 qWarning(" name %s, class %s", obj->name(), obj->className() ); 78 qWarning(" name %s, class %s", obj->name(), obj->className() );
79 } 79 }
80 80
diff --git a/libopie/colordialog.cpp b/libopie/colordialog.cpp
index d46da41..b2854a6 100644
--- a/libopie/colordialog.cpp
+++ b/libopie/colordialog.cpp
@@ -427,100 +427,100 @@ protected:
427private: 427private:
428 QColor col; 428 QColor col;
429 bool mousePressed; 429 bool mousePressed;
430 QPoint pressPos; 430 QPoint pressPos;
431 431
432}; 432};
433 433
434void QColorShowLabel::drawContents( QPainter *p ) 434void QColorShowLabel::drawContents( QPainter *p )
435{ 435{
436 p->fillRect( contentsRect(), col ); 436 p->fillRect( contentsRect(), col );
437} 437}
438 438
439void QColorShower::showAlpha( bool b ) 439void QColorShower::showAlpha( bool b )
440{ 440{
441 if ( b ) { 441 if ( b ) {
442 alphaLab->show(); 442 alphaLab->show();
443 alphaEd->show(); 443 alphaEd->show();
444 } else { 444 } else {
445 alphaLab->hide(); 445 alphaLab->hide();
446 alphaEd->hide(); 446 alphaEd->hide();
447 } 447 }
448} 448}
449 449
450void QColorShowLabel::mousePressEvent( QMouseEvent *e ) 450void QColorShowLabel::mousePressEvent( QMouseEvent *e )
451{ 451{
452 mousePressed = TRUE; 452 mousePressed = TRUE;
453 pressPos = e->pos(); 453 pressPos = e->pos();
454} 454}
455 455
456void QColorShowLabel::mouseReleaseEvent( QMouseEvent * ) 456void QColorShowLabel::mouseReleaseEvent( QMouseEvent * )
457{ 457{
458 if ( !mousePressed ) 458 if ( !mousePressed )
459 return; 459 return;
460 mousePressed = FALSE; 460 mousePressed = FALSE;
461} 461}
462 462
463QColorShower::QColorShower( QWidget *parent, const char *name ) 463QColorShower::QColorShower( QWidget *parent, const char *name )
464 :QWidget( parent, name) 464 :QWidget( parent, name)
465{ 465{
466 curCol = qRgb( -1, -1, -1 ); 466 curCol = qRgb( -1, -1, -1 );
467 QColIntValidator *val256 = new QColIntValidator( 0, 255, this ); 467 QColIntValidator *val256 = new QColIntValidator( 0, 255, this );
468 QColIntValidator *val360 = new QColIntValidator( 0, 360, this ); 468 QColIntValidator *val360 = new QColIntValidator( 0, 360, this );
469 469
470 QGridLayout *gl = new QGridLayout( this, 1, 1, 2 ); 470 QGridLayout *gl = new QGridLayout( this, 1, 1, 2 );
471 gl->setMargin( 0 ); 471 gl->setMargin( 0 );
472 lab = new QColorShowLabel( this ); 472 lab = new QColorShowLabel( this );
473 lab->setMinimumWidth( 60 ); //### 473 lab->setMinimumWidth( 60 ); //###
474 gl->addMultiCellWidget(lab, 0,-1,0,0); 474 gl->addMultiCellWidget(lab, 0,-1,0,0);
475 connect( lab, SIGNAL( colorDropped( QRgb ) ), 475 connect( lab, SIGNAL( colorDropped(QRgb) ),
476 this, SIGNAL( newCol( QRgb ) ) ); 476 this, SIGNAL( newCol(QRgb) ) );
477 connect( lab, SIGNAL( colorDropped( QRgb ) ), 477 connect( lab, SIGNAL( colorDropped(QRgb) ),
478 this, SLOT( setRgb( QRgb ) ) ); 478 this, SLOT( setRgb(QRgb) ) );
479 479
480 hEd = new QColNumLineEdit( this ); 480 hEd = new QColNumLineEdit( this );
481 hEd->setValidator( val360 ); 481 hEd->setValidator( val360 );
482 QLabel *l = new QLabel( hEd, OColorDialog::tr("Hue:"), this ); 482 QLabel *l = new QLabel( hEd, OColorDialog::tr("Hue:"), this );
483 l->setAlignment( AlignRight|AlignVCenter ); 483 l->setAlignment( AlignRight|AlignVCenter );
484 gl->addWidget( l, 0, 1 ); 484 gl->addWidget( l, 0, 1 );
485 gl->addWidget( hEd, 0, 2 ); 485 gl->addWidget( hEd, 0, 2 );
486 486
487 sEd = new QColNumLineEdit( this ); 487 sEd = new QColNumLineEdit( this );
488 sEd->setValidator( val256 ); 488 sEd->setValidator( val256 );
489 l = new QLabel( sEd, OColorDialog::tr("Sat:"), this ); 489 l = new QLabel( sEd, OColorDialog::tr("Sat:"), this );
490 l->setAlignment( AlignRight|AlignVCenter ); 490 l->setAlignment( AlignRight|AlignVCenter );
491 gl->addWidget( l, 1, 1 ); 491 gl->addWidget( l, 1, 1 );
492 gl->addWidget( sEd, 1, 2 ); 492 gl->addWidget( sEd, 1, 2 );
493 493
494 vEd = new QColNumLineEdit( this ); 494 vEd = new QColNumLineEdit( this );
495 vEd->setValidator( val256 ); 495 vEd->setValidator( val256 );
496 l = new QLabel( vEd, OColorDialog::tr("Val:"), this ); 496 l = new QLabel( vEd, OColorDialog::tr("Val:"), this );
497 l->setAlignment( AlignRight|AlignVCenter ); 497 l->setAlignment( AlignRight|AlignVCenter );
498 gl->addWidget( l, 2, 1 ); 498 gl->addWidget( l, 2, 1 );
499 gl->addWidget( vEd, 2, 2 ); 499 gl->addWidget( vEd, 2, 2 );
500 500
501 rEd = new QColNumLineEdit( this ); 501 rEd = new QColNumLineEdit( this );
502 rEd->setValidator( val256 ); 502 rEd->setValidator( val256 );
503 l = new QLabel( rEd, OColorDialog::tr("Red:"), this ); 503 l = new QLabel( rEd, OColorDialog::tr("Red:"), this );
504 l->setAlignment( AlignRight|AlignVCenter ); 504 l->setAlignment( AlignRight|AlignVCenter );
505 gl->addWidget( l, 0, 3 ); 505 gl->addWidget( l, 0, 3 );
506 gl->addWidget( rEd, 0, 4 ); 506 gl->addWidget( rEd, 0, 4 );
507 507
508 gEd = new QColNumLineEdit( this ); 508 gEd = new QColNumLineEdit( this );
509 gEd->setValidator( val256 ); 509 gEd->setValidator( val256 );
510 l = new QLabel( gEd, OColorDialog::tr("Green:"), this ); 510 l = new QLabel( gEd, OColorDialog::tr("Green:"), this );
511 l->setAlignment( AlignRight|AlignVCenter ); 511 l->setAlignment( AlignRight|AlignVCenter );
512 gl->addWidget( l, 1, 3 ); 512 gl->addWidget( l, 1, 3 );
513 gl->addWidget( gEd, 1, 4 ); 513 gl->addWidget( gEd, 1, 4 );
514 514
515 bEd = new QColNumLineEdit( this ); 515 bEd = new QColNumLineEdit( this );
516 bEd->setValidator( val256 ); 516 bEd->setValidator( val256 );
517 l = new QLabel( bEd, OColorDialog::tr("Blue:"), this ); 517 l = new QLabel( bEd, OColorDialog::tr("Blue:"), this );
518 l->setAlignment( AlignRight|AlignVCenter ); 518 l->setAlignment( AlignRight|AlignVCenter );
519 gl->addWidget( l, 2, 3 ); 519 gl->addWidget( l, 2, 3 );
520 gl->addWidget( bEd, 2, 4 ); 520 gl->addWidget( bEd, 2, 4 );
521 521
522 alphaEd = new QColNumLineEdit( this ); 522 alphaEd = new QColNumLineEdit( this );
523 alphaEd->setValidator( val256 ); 523 alphaEd->setValidator( val256 );
524 alphaLab = new QLabel( alphaEd, OColorDialog::tr("Alpha channel:"), this ); 524 alphaLab = new QLabel( alphaEd, OColorDialog::tr("Alpha channel:"), this );
525 alphaLab->setAlignment( AlignRight|AlignVCenter ); 525 alphaLab->setAlignment( AlignRight|AlignVCenter );
526 gl->addMultiCellWidget( alphaLab, 3, 3, 1, 3 ); 526 gl->addMultiCellWidget( alphaLab, 3, 3, 1, 3 );
diff --git a/libopie/colorpopupmenu.cpp b/libopie/colorpopupmenu.cpp
index 0d66fba..03ad233 100644
--- a/libopie/colorpopupmenu.cpp
+++ b/libopie/colorpopupmenu.cpp
@@ -107,66 +107,66 @@ OColorPopupMenu::OColorPopupMenu( const QColor& color, QWidget* parent, const ch
107 addColor(QColor(0, 0, 0), 0, 5); 107 addColor(QColor(0, 0, 0), 0, 5);
108 108
109 addColor(QColor(255, 0, 0), 1, 0); 109 addColor(QColor(255, 0, 0), 1, 0);
110 addColor(QColor(255, 128, 0), 1, 1); 110 addColor(QColor(255, 128, 0), 1, 1);
111 addColor(QColor(255, 255, 0), 1, 2); 111 addColor(QColor(255, 255, 0), 1, 2);
112 addColor(QColor(128, 255, 0), 1, 3); 112 addColor(QColor(128, 255, 0), 1, 3);
113 addColor(QColor(0, 255, 0), 1, 4); 113 addColor(QColor(0, 255, 0), 1, 4);
114 addColor(QColor(0, 255, 128), 1, 5); 114 addColor(QColor(0, 255, 128), 1, 5);
115 115
116 addColor(QColor(128, 0, 0), 2, 0); 116 addColor(QColor(128, 0, 0), 2, 0);
117 addColor(QColor(128, 64, 0), 2, 1); 117 addColor(QColor(128, 64, 0), 2, 1);
118 addColor(QColor(128, 128, 0), 2, 2); 118 addColor(QColor(128, 128, 0), 2, 2);
119 addColor(QColor(64, 128, 0), 2, 3); 119 addColor(QColor(64, 128, 0), 2, 3);
120 addColor(QColor(0, 128, 0), 2, 4); 120 addColor(QColor(0, 128, 0), 2, 4);
121 addColor(QColor(0, 128, 64), 2, 5); 121 addColor(QColor(0, 128, 64), 2, 5);
122 122
123 addColor(QColor(0, 255, 255), 3, 0); 123 addColor(QColor(0, 255, 255), 3, 0);
124 addColor(QColor(0, 128, 255), 3, 1); 124 addColor(QColor(0, 128, 255), 3, 1);
125 addColor(QColor(0, 0, 255), 3, 2); 125 addColor(QColor(0, 0, 255), 3, 2);
126 addColor(QColor(128, 0, 255), 3, 3); 126 addColor(QColor(128, 0, 255), 3, 3);
127 addColor(QColor(255, 0, 255), 3, 4); 127 addColor(QColor(255, 0, 255), 3, 4);
128 addColor(QColor(255, 0, 128), 3, 5); 128 addColor(QColor(255, 0, 128), 3, 5);
129 129
130 addColor(QColor(0, 128, 128), 4, 0); 130 addColor(QColor(0, 128, 128), 4, 0);
131 addColor(QColor(0, 64, 128), 4, 1); 131 addColor(QColor(0, 64, 128), 4, 1);
132 addColor(QColor(0, 0, 128), 4, 2); 132 addColor(QColor(0, 0, 128), 4, 2);
133 addColor(QColor(64, 0, 128), 4, 3); 133 addColor(QColor(64, 0, 128), 4, 3);
134 addColor(QColor(128, 0, 128), 4, 4); 134 addColor(QColor(128, 0, 128), 4, 4);
135 addColor(QColor(128, 0, 64), 4, 5); 135 addColor(QColor(128, 0, 64), 4, 5);
136 136
137 insertItem( colorPanel ); 137 insertItem( colorPanel );
138 insertSeparator(); 138 insertSeparator();
139 insertItem(tr("More"),this,SLOT( moreColorClicked())); 139 insertItem(tr("More"),this,SLOT( moreColorClicked()));
140 /* 140 /*
141 QAction* chooseColorAction = new QAction( tr( "More" ), tr( "More..." ), 0, colorPanel, "More" ); 141 QAction* chooseColorAction = new QAction( tr( "More" ), tr( "More..." ), 0, colorPanel, "More" );
142 connect( chooseColorAction, SIGNAL( activated() ), this, SLOT( moreColorClicked() ) ); 142 connect( chooseColorAction, SIGNAL( activated() ), this, SLOT( moreColorClicked() ) );
143 chooseColorAction->addTo( this ); 143 chooseColorAction->addTo( this );
144 */ 144 */
145 activateItemAt( 0 ); 145 activateItemAt( 0 );
146} 146}
147 147
148OColorPopupMenu::~OColorPopupMenu() 148OColorPopupMenu::~OColorPopupMenu()
149{ 149{
150} 150}
151 151
152void OColorPopupMenu::addColor( const QColor& color, int row, int col ) 152void OColorPopupMenu::addColor( const QColor& color, int row, int col )
153{ 153{
154 OColorPanelButton* panelButton = new OColorPanelButton( color, colorPanel ); 154 OColorPanelButton* panelButton = new OColorPanelButton( color, colorPanel );
155 connect( panelButton, SIGNAL( selected( const QColor& ) ), this, SLOT( buttonSelected( const QColor& ) ) ); 155 connect( panelButton, SIGNAL( selected(const QColor&) ), this, SLOT( buttonSelected(const QColor&) ) );
156 colorLayout->addWidget( panelButton, row, col ); 156 colorLayout->addWidget( panelButton, row, col );
157} 157}
158 158
159void OColorPopupMenu::buttonSelected( const QColor& color ) 159void OColorPopupMenu::buttonSelected( const QColor& color )
160{ 160{
161 m_color = color; 161 m_color = color;
162 emit colorSelected( color ); 162 emit colorSelected( color );
163 hide(); 163 hide();
164} 164}
165 165
166void OColorPopupMenu::moreColorClicked() 166void OColorPopupMenu::moreColorClicked()
167{ 167{
168 QColor color = OColorDialog::getColor( m_color ); 168 QColor color = OColorDialog::getColor( m_color );
169 m_color = color; 169 m_color = color;
170 emit colorSelected( color ); 170 emit colorSelected( color );
171 hide(); 171 hide();
172} 172}
diff --git a/libopie/ocolorbutton.cpp b/libopie/ocolorbutton.cpp
index 93fe5d0..298dba2 100644
--- a/libopie/ocolorbutton.cpp
+++ b/libopie/ocolorbutton.cpp
@@ -8,97 +8,97 @@
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that 12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 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 <opie/colorpopupmenu.h> 29#include <opie/colorpopupmenu.h>
30#include <opie/ocolorbutton.h> 30#include <opie/ocolorbutton.h>
31 31
32#include <qpe/resource.h> 32#include <qpe/resource.h>
33 33
34struct OColorButtonPrivate { 34struct OColorButtonPrivate {
35 QPopupMenu *m_menu; 35 QPopupMenu *m_menu;
36 QColor m_color; 36 QColor m_color;
37}; 37};
38 38
39 39
40/** 40/**
41 * This concstructs a Color Button with @param color as the start color 41 * This concstructs a Color Button with @param color as the start color
42 * It'll use a OColorPopupMenu internally 42 * It'll use a OColorPopupMenu internally
43 * 43 *
44 * @param parent The parent of the Color Button 44 * @param parent The parent of the Color Button
45 * @param color The color from where to start on 45 * @param color The color from where to start on
46 * @param name @see QObject 46 * @param name @see QObject
47 */ 47 */
48OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name ) 48OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name )
49 : QPushButton ( parent, name ) 49 : QPushButton ( parent, name )
50{ 50{
51 d = new OColorButtonPrivate; 51 d = new OColorButtonPrivate;
52 52
53 d-> m_menu = new OColorPopupMenu ( color, 0, 0 ); 53 d-> m_menu = new OColorPopupMenu ( color, 0, 0 );
54 setPopup ( d-> m_menu ); 54 setPopup ( d-> m_menu );
55 //setPopupDelay ( 0 ); 55 //setPopupDelay ( 0 );
56 connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & ))); 56 connect ( d-> m_menu, SIGNAL( colorSelected(const QColor&)), this, SLOT( updateColor(const QColor&)));
57 57
58 updateColor ( color ); 58 updateColor ( color );
59 59
60 QSize s = sizeHint ( ) + QSize ( 12, 0 ); 60 QSize s = sizeHint ( ) + QSize ( 12, 0 );
61 setMinimumSize ( s ); 61 setMinimumSize ( s );
62 setMaximumSize ( s. width ( ) * 2, s. height ( )); 62 setMaximumSize ( s. width ( ) * 2, s. height ( ));
63} 63}
64 64
65/** 65/**
66 * This destructs the object 66 * This destructs the object
67 */ 67 */
68OColorButton::~OColorButton ( ) 68OColorButton::~OColorButton ( )
69{ 69{
70 delete d; 70 delete d;
71} 71}
72 72
73/** 73/**
74 * @return Returns the current color of the button 74 * @return Returns the current color of the button
75 */ 75 */
76QColor OColorButton::color ( ) const 76QColor OColorButton::color ( ) const
77{ 77{
78 return d-> m_color; 78 return d-> m_color;
79} 79}
80 80
81/** 81/**
82 * This method sets the color of the button 82 * This method sets the color of the button
83 * @param c The color to be set. 83 * @param c The color to be set.
84 */ 84 */
85void OColorButton::setColor ( const QColor &c ) 85void OColorButton::setColor ( const QColor &c )
86{ 86{
87 updateColor ( c ); 87 updateColor ( c );
88} 88}
89 89
90/** 90/**
91 * @internal 91 * @internal
92 */ 92 */
93void OColorButton::updateColor ( const QColor &c ) 93void OColorButton::updateColor ( const QColor &c )
94{ 94{
95 d-> m_color = c; 95 d-> m_color = c;
96 96
97 QImage img ( 16, 16, 32 ); 97 QImage img ( 16, 16, 32 );
98 img. fill ( 0 ); 98 img. fill ( 0 );
99 99
100 int r, g, b; 100 int r, g, b;
101 c. rgb ( &r, &g, &b ); 101 c. rgb ( &r, &g, &b );
102 102
103 int w = img. width ( ); 103 int w = img. width ( );
104 int h = img. height ( ); 104 int h = img. height ( );
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index c0b6efa..4258d60 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -487,97 +487,97 @@ ODevice::ODevice ( )
487 d-> m_rotation = Rot0; 487 d-> m_rotation = Rot0;
488 d-> m_direction = CW; 488 d-> m_direction = CW;
489 489
490 d-> m_holdtime = 1000; // 1000ms 490 d-> m_holdtime = 1000; // 1000ms
491 d-> m_buttons = 0; 491 d-> m_buttons = 0;
492 d-> m_cpu_frequencies = new QStrList; 492 d-> m_cpu_frequencies = new QStrList;
493} 493}
494 494
495void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) 495void ODevice::systemMessage ( const QCString &msg, const QByteArray & )
496{ 496{
497 if ( msg == "deviceButtonMappingChanged()" ) { 497 if ( msg == "deviceButtonMappingChanged()" ) {
498 reloadButtonMapping ( ); 498 reloadButtonMapping ( );
499 } 499 }
500} 500}
501 501
502void ODevice::init ( ) 502void ODevice::init ( )
503{ 503{
504} 504}
505 505
506/** 506/**
507 * This method initialises the button mapping 507 * This method initialises the button mapping
508 */ 508 */
509void ODevice::initButtons ( ) 509void ODevice::initButtons ( )
510{ 510{
511 if ( d-> m_buttons ) 511 if ( d-> m_buttons )
512 return; 512 return;
513 513
514 // Simulation uses iPAQ 3660 device buttons 514 // Simulation uses iPAQ 3660 device buttons
515 515
516 qDebug ( "init Buttons" ); 516 qDebug ( "init Buttons" );
517 d-> m_buttons = new QValueList <ODeviceButton>; 517 d-> m_buttons = new QValueList <ODeviceButton>;
518 518
519 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 519 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
520 i_button *ib = ipaq_buttons + i; 520 i_button *ib = ipaq_buttons + i;
521 ODeviceButton b; 521 ODeviceButton b;
522 522
523 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { 523 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) {
524 b. setKeycode ( ib-> code ); 524 b. setKeycode ( ib-> code );
525 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 525 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
526 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 526 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
527 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 527 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
528 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 528 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
529 d-> m_buttons-> append ( b ); 529 d-> m_buttons-> append ( b );
530 } 530 }
531 } 531 }
532 reloadButtonMapping ( ); 532 reloadButtonMapping ( );
533 533
534 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 534 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
535 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 535 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
536} 536}
537 537
538ODevice::~ODevice ( ) 538ODevice::~ODevice ( )
539{ 539{
540// we leak m_devicebuttons and m_cpu_frequency 540// we leak m_devicebuttons and m_cpu_frequency
541// but it's a singleton and it is not so importantant 541// but it's a singleton and it is not so importantant
542// -zecke 542// -zecke
543 delete d; 543 delete d;
544} 544}
545 545
546bool ODevice::setSoftSuspend ( bool /*soft*/ ) 546bool ODevice::setSoftSuspend ( bool /*soft*/ )
547{ 547{
548 return false; 548 return false;
549} 549}
550 550
551//#include <linux/apm_bios.h> 551//#include <linux/apm_bios.h>
552 552
553#define APM_IOC_SUSPEND OD_IO( 'A', 2 ) 553#define APM_IOC_SUSPEND OD_IO( 'A', 2 )
554 554
555/** 555/**
556 * This method will try to suspend the device 556 * This method will try to suspend the device
557 * It only works if the user is the QWS Server and the apm application 557 * It only works if the user is the QWS Server and the apm application
558 * is installed. 558 * is installed.
559 * It tries to suspend and then waits some time cause some distributions 559 * It tries to suspend and then waits some time cause some distributions
560 * do have asynchronus apm implementations. 560 * do have asynchronus apm implementations.
561 * This method will either fail and return false or it'll suspend the 561 * This method will either fail and return false or it'll suspend the
562 * device and return once the device got woken up 562 * device and return once the device got woken up
563 * 563 *
564 * @return if the device got suspended 564 * @return if the device got suspended
565 */ 565 */
566bool ODevice::suspend ( ) 566bool ODevice::suspend ( )
567{ 567{
568 qDebug("ODevice::suspend"); 568 qDebug("ODevice::suspend");
569 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 569 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
570 return false; 570 return false;
571 571
572 if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices 572 if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
573 return false; 573 return false;
574 574
575 bool res = false; 575 bool res = false;
576 576
577 struct timeval tvs, tvn; 577 struct timeval tvs, tvn;
578 ::gettimeofday ( &tvs, 0 ); 578 ::gettimeofday ( &tvs, 0 );
579 579
580 ::sync ( ); // flush fs caches 580 ::sync ( ); // flush fs caches
581 res = ( ::system ( "apm --suspend" ) == 0 ); 581 res = ( ::system ( "apm --suspend" ) == 0 );
582 582
583 // This is needed because the iPAQ apm implementation is asynchronous and we 583 // This is needed because the iPAQ apm implementation is asynchronous and we
@@ -1067,98 +1067,98 @@ bool Yopy::isYopy ( )
1067} 1067}
1068 1068
1069void Yopy::init ( ) 1069void Yopy::init ( )
1070{ 1070{
1071 d-> m_vendorstr = "G.Mate"; 1071 d-> m_vendorstr = "G.Mate";
1072 d-> m_vendor = Vendor_GMate; 1072 d-> m_vendor = Vendor_GMate;
1073 d-> m_modelstr = "Yopy3700"; 1073 d-> m_modelstr = "Yopy3700";
1074 d-> m_model = Model_Yopy_3700; 1074 d-> m_model = Model_Yopy_3700;
1075 d-> m_rotation = Rot0; 1075 d-> m_rotation = Rot0;
1076 1076
1077 d-> m_systemstr = "Linupy"; 1077 d-> m_systemstr = "Linupy";
1078 d-> m_system = System_Linupy; 1078 d-> m_system = System_Linupy;
1079 1079
1080 QFile f ( "/etc/issue" ); 1080 QFile f ( "/etc/issue" );
1081 if ( f. open ( IO_ReadOnly )) { 1081 if ( f. open ( IO_ReadOnly )) {
1082 QTextStream ts ( &f ); 1082 QTextStream ts ( &f );
1083 ts.readLine(); 1083 ts.readLine();
1084 d-> m_sysverstr = ts. readLine ( ); 1084 d-> m_sysverstr = ts. readLine ( );
1085 f. close ( ); 1085 f. close ( );
1086 } 1086 }
1087} 1087}
1088 1088
1089void Yopy::initButtons ( ) 1089void Yopy::initButtons ( )
1090{ 1090{
1091 if ( d-> m_buttons ) 1091 if ( d-> m_buttons )
1092 return; 1092 return;
1093 1093
1094 d-> m_buttons = new QValueList <ODeviceButton>; 1094 d-> m_buttons = new QValueList <ODeviceButton>;
1095 1095
1096 for (uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof(yopy_button)); i++) { 1096 for (uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof(yopy_button)); i++) {
1097 1097
1098 yopy_button *ib = yopy_buttons + i; 1098 yopy_button *ib = yopy_buttons + i;
1099 1099
1100 ODeviceButton b; 1100 ODeviceButton b;
1101 1101
1102 b. setKeycode ( ib-> code ); 1102 b. setKeycode ( ib-> code );
1103 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 1103 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
1104 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 1104 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
1105 b. setFactoryPresetPressedAction 1105 b. setFactoryPresetPressedAction
1106 (OQCopMessage(makeChannel(ib->fpressedservice), ib->fpressedaction)); 1106 (OQCopMessage(makeChannel(ib->fpressedservice), ib->fpressedaction));
1107 b. setFactoryPresetHeldAction 1107 b. setFactoryPresetHeldAction
1108 (OQCopMessage(makeChannel(ib->fheldservice), ib->fheldaction)); 1108 (OQCopMessage(makeChannel(ib->fheldservice), ib->fheldaction));
1109 1109
1110 d-> m_buttons-> append ( b ); 1110 d-> m_buttons-> append ( b );
1111 } 1111 }
1112 reloadButtonMapping ( ); 1112 reloadButtonMapping ( );
1113 1113
1114 QCopChannel *sysch = new QCopChannel("QPE/System", this); 1114 QCopChannel *sysch = new QCopChannel("QPE/System", this);
1115 connect(sysch, SIGNAL(received(const QCString &, const QByteArray & )), 1115 connect(sysch, SIGNAL(received(const QCString&,const QByteArray&)),
1116 this, SLOT(systemMessage(const QCString &, const QByteArray & ))); 1116 this, SLOT(systemMessage(const QCString&,const QByteArray&)));
1117} 1117}
1118 1118
1119bool Yopy::suspend() 1119bool Yopy::suspend()
1120{ 1120{
1121 /* Opie for Yopy does not implement its own power management at the 1121 /* Opie for Yopy does not implement its own power management at the
1122 moment. The public version runs parallel to X, and relies on the 1122 moment. The public version runs parallel to X, and relies on the
1123 existing power management features. */ 1123 existing power management features. */
1124 return false; 1124 return false;
1125} 1125}
1126 1126
1127bool Yopy::setDisplayBrightness(int bright) 1127bool Yopy::setDisplayBrightness(int bright)
1128{ 1128{
1129 /* The code here works, but is disabled as the current version runs 1129 /* The code here works, but is disabled as the current version runs
1130 parallel to X, and relies on the existing backlight demon. */ 1130 parallel to X, and relies on the existing backlight demon. */
1131#if 0 1131#if 0
1132 if ( QFile::exists("/proc/sys/pm/light") ) { 1132 if ( QFile::exists("/proc/sys/pm/light") ) {
1133 int fd = ::open("/proc/sys/pm/light", O_WRONLY); 1133 int fd = ::open("/proc/sys/pm/light", O_WRONLY);
1134 if (fd >= 0 ) { 1134 if (fd >= 0 ) {
1135 if (bright) 1135 if (bright)
1136 ::write(fd, "1\n", 2); 1136 ::write(fd, "1\n", 2);
1137 else 1137 else
1138 ::write(fd, "0\n", 2); 1138 ::write(fd, "0\n", 2);
1139 ::close(fd); 1139 ::close(fd);
1140 return true; 1140 return true;
1141 } 1141 }
1142 } 1142 }
1143#endif 1143#endif
1144 return false; 1144 return false;
1145} 1145}
1146 1146
1147int Yopy::displayBrightnessResolution() const 1147int Yopy::displayBrightnessResolution() const
1148{ 1148{
1149 return 2; 1149 return 2;
1150} 1150}
1151 1151
1152/************************************************** 1152/**************************************************
1153 * 1153 *
1154 * iPAQ 1154 * iPAQ
1155 * 1155 *
1156 **************************************************/ 1156 **************************************************/
1157 1157
1158void iPAQ::init ( ) 1158void iPAQ::init ( )
1159{ 1159{
1160 d-> m_vendorstr = "HP"; 1160 d-> m_vendorstr = "HP";
1161 d-> m_vendor = Vendor_HP; 1161 d-> m_vendor = Vendor_HP;
1162 1162
1163 QFile f ( "/proc/hal/model" ); 1163 QFile f ( "/proc/hal/model" );
1164 1164
@@ -1216,97 +1216,97 @@ void iPAQ::init ( )
1216 if ( f. open ( IO_ReadOnly )) { 1216 if ( f. open ( IO_ReadOnly )) {
1217 d-> m_systemstr = "OpenEmbedded/iPaq"; 1217 d-> m_systemstr = "OpenEmbedded/iPaq";
1218 d-> m_system = System_Familiar; 1218 d-> m_system = System_Familiar;
1219 1219
1220 QTextStream ts ( &f ); 1220 QTextStream ts ( &f );
1221 ts.setDevice ( &f ); 1221 ts.setDevice ( &f );
1222 d-> m_sysverstr = ts. readLine ( ); 1222 d-> m_sysverstr = ts. readLine ( );
1223 f. close ( ); 1223 f. close ( );
1224 } 1224 }
1225 } 1225 }
1226 1226
1227 1227
1228 1228
1229 1229
1230 1230
1231 m_leds [0] = m_leds [1] = Led_Off; 1231 m_leds [0] = m_leds [1] = Led_Off;
1232 1232
1233 m_power_timer = 0; 1233 m_power_timer = 0;
1234 1234
1235} 1235}
1236 1236
1237void iPAQ::initButtons ( ) 1237void iPAQ::initButtons ( )
1238{ 1238{
1239 if ( d-> m_buttons ) 1239 if ( d-> m_buttons )
1240 return; 1240 return;
1241 1241
1242 if ( isQWS( ) ) 1242 if ( isQWS( ) )
1243 QWSServer::setKeyboardFilter ( this ); 1243 QWSServer::setKeyboardFilter ( this );
1244 1244
1245 d-> m_buttons = new QValueList <ODeviceButton>; 1245 d-> m_buttons = new QValueList <ODeviceButton>;
1246 1246
1247 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 1247 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
1248 i_button *ib = ipaq_buttons + i; 1248 i_button *ib = ipaq_buttons + i;
1249 ODeviceButton b; 1249 ODeviceButton b;
1250 1250
1251 if (( ib-> model & d-> m_model ) == d-> m_model ) { 1251 if (( ib-> model & d-> m_model ) == d-> m_model ) {
1252 b. setKeycode ( ib-> code ); 1252 b. setKeycode ( ib-> code );
1253 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 1253 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
1254 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 1254 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
1255 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 1255 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
1256 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 1256 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
1257 1257
1258 d-> m_buttons-> append ( b ); 1258 d-> m_buttons-> append ( b );
1259 } 1259 }
1260 } 1260 }
1261 reloadButtonMapping ( ); 1261 reloadButtonMapping ( );
1262 1262
1263 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 1263 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
1264 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 1264 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
1265} 1265}
1266 1266
1267 1267
1268//#include <linux/h3600_ts.h> // including kernel headers is evil ... 1268//#include <linux/h3600_ts.h> // including kernel headers is evil ...
1269 1269
1270typedef struct { 1270typedef struct {
1271 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ 1271 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */
1272 unsigned char TotalTime; /* Units of 5 seconds */ 1272 unsigned char TotalTime; /* Units of 5 seconds */
1273 unsigned char OnTime; /* units of 100m/s */ 1273 unsigned char OnTime; /* units of 100m/s */
1274 unsigned char OffTime; /* units of 100m/s */ 1274 unsigned char OffTime; /* units of 100m/s */
1275} LED_IN; 1275} LED_IN;
1276 1276
1277typedef struct { 1277typedef struct {
1278 unsigned char mode; 1278 unsigned char mode;
1279 unsigned char pwr; 1279 unsigned char pwr;
1280 unsigned char brightness; 1280 unsigned char brightness;
1281} FLITE_IN; 1281} FLITE_IN;
1282 1282
1283#define LED_ON OD_IOW( 'f', 5, LED_IN ) 1283#define LED_ON OD_IOW( 'f', 5, LED_IN )
1284#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) 1284#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
1285 1285
1286 1286
1287QValueList <OLed> iPAQ::ledList ( ) const 1287QValueList <OLed> iPAQ::ledList ( ) const
1288{ 1288{
1289 QValueList <OLed> vl; 1289 QValueList <OLed> vl;
1290 vl << Led_Power; 1290 vl << Led_Power;
1291 1291
1292 if ( d-> m_model == Model_iPAQ_H38xx ) 1292 if ( d-> m_model == Model_iPAQ_H38xx )
1293 vl << Led_BlueTooth; 1293 vl << Led_BlueTooth;
1294 return vl; 1294 return vl;
1295} 1295}
1296 1296
1297QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const 1297QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const
1298{ 1298{
1299 QValueList <OLedState> vl; 1299 QValueList <OLedState> vl;
1300 1300
1301 if ( l == Led_Power ) 1301 if ( l == Led_Power )
1302 vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; 1302 vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast;
1303 else if ( l == Led_BlueTooth && d-> m_model == Model_iPAQ_H38xx ) 1303 else if ( l == Led_BlueTooth && d-> m_model == Model_iPAQ_H38xx )
1304 vl << Led_Off; // << Led_On << ??? 1304 vl << Led_Off; // << Led_On << ???
1305 1305
1306 return vl; 1306 return vl;
1307} 1307}
1308 1308
1309OLedState iPAQ::ledState ( OLed l ) const 1309OLedState iPAQ::ledState ( OLed l ) const
1310{ 1310{
1311 switch ( l ) { 1311 switch ( l ) {
1312 case Led_Power: 1312 case Led_Power:
@@ -1702,98 +1702,98 @@ void Zaurus::init ( )
1702 case Model_Zaurus_SLB600: 1702 case Model_Zaurus_SLB600:
1703 case Model_Zaurus_SL5500: 1703 case Model_Zaurus_SL5500:
1704 case Model_Zaurus_SL5000: 1704 case Model_Zaurus_SL5000:
1705 default: 1705 default:
1706 d-> m_rotation = Rot270; 1706 d-> m_rotation = Rot270;
1707 break; 1707 break;
1708 } 1708 }
1709 m_leds [0] = Led_Off; 1709 m_leds [0] = Led_Off;
1710} 1710}
1711 1711
1712void Zaurus::initButtons ( ) 1712void Zaurus::initButtons ( )
1713{ 1713{
1714 if ( d-> m_buttons ) 1714 if ( d-> m_buttons )
1715 return; 1715 return;
1716 1716
1717 d-> m_buttons = new QValueList <ODeviceButton>; 1717 d-> m_buttons = new QValueList <ODeviceButton>;
1718 1718
1719 struct z_button * pz_buttons; 1719 struct z_button * pz_buttons;
1720 int buttoncount; 1720 int buttoncount;
1721 switch ( d-> m_model ) { 1721 switch ( d-> m_model ) {
1722 case Model_Zaurus_SLC7x0: 1722 case Model_Zaurus_SLC7x0:
1723 pz_buttons = z_buttons_c700; 1723 pz_buttons = z_buttons_c700;
1724 buttoncount = ARRAY_SIZE(z_buttons_c700); 1724 buttoncount = ARRAY_SIZE(z_buttons_c700);
1725 break; 1725 break;
1726 default: 1726 default:
1727 pz_buttons = z_buttons; 1727 pz_buttons = z_buttons;
1728 buttoncount = ARRAY_SIZE(z_buttons); 1728 buttoncount = ARRAY_SIZE(z_buttons);
1729 break; 1729 break;
1730 } 1730 }
1731 1731
1732 for ( int i = 0; i < buttoncount; i++ ) { 1732 for ( int i = 0; i < buttoncount; i++ ) {
1733 struct z_button *zb = pz_buttons + i; 1733 struct z_button *zb = pz_buttons + i;
1734 ODeviceButton b; 1734 ODeviceButton b;
1735 1735
1736 b. setKeycode ( zb-> code ); 1736 b. setKeycode ( zb-> code );
1737 b. setUserText ( QObject::tr ( "Button", zb-> utext )); 1737 b. setUserText ( QObject::tr ( "Button", zb-> utext ));
1738 b. setPixmap ( Resource::loadPixmap ( zb-> pix )); 1738 b. setPixmap ( Resource::loadPixmap ( zb-> pix ));
1739 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), 1739 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ),
1740 zb-> fpressedaction )); 1740 zb-> fpressedaction ));
1741 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), 1741 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ),
1742 zb-> fheldaction )); 1742 zb-> fheldaction ));
1743 1743
1744 d-> m_buttons-> append ( b ); 1744 d-> m_buttons-> append ( b );
1745 } 1745 }
1746 1746
1747 reloadButtonMapping ( ); 1747 reloadButtonMapping ( );
1748 1748
1749 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 1749 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
1750 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), 1750 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)),
1751 this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 1751 this, SLOT( systemMessage(const QCString&,const QByteArray&)));
1752} 1752}
1753 1753
1754#include <unistd.h> 1754#include <unistd.h>
1755#include <fcntl.h> 1755#include <fcntl.h>
1756#include <sys/ioctl.h> 1756#include <sys/ioctl.h>
1757 1757
1758//#include <asm/sharp_char.h> // including kernel headers is evil ... 1758//#include <asm/sharp_char.h> // including kernel headers is evil ...
1759 1759
1760#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 1760#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
1761 1761
1762 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1762 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1763#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1763#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1764 1764
1765#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1765#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1766#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1766#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1767#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 1767#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
1768 1768
1769/* --- for SHARP_BUZZER device --- */ 1769/* --- for SHARP_BUZZER device --- */
1770 1770
1771 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1771 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1772//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1772//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1773 1773
1774#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) 1774#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
1775#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) 1775#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
1776#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) 1776#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
1777#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) 1777#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
1778#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) 1778#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
1779 1779
1780//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1780//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1781//#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1781//#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1782 1782
1783//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ 1783//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */
1784//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ 1784//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */
1785//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ 1785//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */
1786//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ 1786//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */
1787//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ 1787//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */
1788//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ 1788//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */
1789//#define SHARP_PDA_APPSTART 9 /* application start */ 1789//#define SHARP_PDA_APPSTART 9 /* application start */
1790//#define SHARP_PDA_APPQUIT 10 /* application ends */ 1790//#define SHARP_PDA_APPQUIT 10 /* application ends */
1791 1791
1792//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 1792//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
1793//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ 1793//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */
1794//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ 1794//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */
1795//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ 1795//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */
1796// 1796//
1797 1797
1798 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1798 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1799#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) 1799#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1)
@@ -2253,97 +2253,97 @@ void SIMpad::init ( )
2253 f. close ( ); 2253 f. close ( );
2254 } else { 2254 } else {
2255 f. setName ( "/etc/oz_version" ); 2255 f. setName ( "/etc/oz_version" );
2256 2256
2257 if ( f. open ( IO_ReadOnly )) { 2257 if ( f. open ( IO_ReadOnly )) {
2258 d-> m_systemstr = "OpenEmbedded/SIMpad"; 2258 d-> m_systemstr = "OpenEmbedded/SIMpad";
2259 d-> m_system = System_OpenZaurus; 2259 d-> m_system = System_OpenZaurus;
2260 2260
2261 QTextStream ts ( &f ); 2261 QTextStream ts ( &f );
2262 ts.setDevice ( &f ); 2262 ts.setDevice ( &f );
2263 d-> m_sysverstr = ts. readLine ( ); 2263 d-> m_sysverstr = ts. readLine ( );
2264 f. close ( ); 2264 f. close ( );
2265 } 2265 }
2266 } 2266 }
2267 2267
2268 m_leds [0] = m_leds [1] = Led_Off; 2268 m_leds [0] = m_leds [1] = Led_Off;
2269 2269
2270 m_power_timer = 0; 2270 m_power_timer = 0;
2271 2271
2272} 2272}
2273 2273
2274void SIMpad::initButtons ( ) 2274void SIMpad::initButtons ( )
2275{ 2275{
2276 if ( d-> m_buttons ) 2276 if ( d-> m_buttons )
2277 return; 2277 return;
2278 2278
2279 if ( isQWS( ) ) 2279 if ( isQWS( ) )
2280 QWSServer::setKeyboardFilter ( this ); 2280 QWSServer::setKeyboardFilter ( this );
2281 2281
2282 d-> m_buttons = new QValueList <ODeviceButton>; 2282 d-> m_buttons = new QValueList <ODeviceButton>;
2283 2283
2284 for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { 2284 for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) {
2285 s_button *sb = simpad_buttons + i; 2285 s_button *sb = simpad_buttons + i;
2286 ODeviceButton b; 2286 ODeviceButton b;
2287 2287
2288 if (( sb-> model & d-> m_model ) == d-> m_model ) { 2288 if (( sb-> model & d-> m_model ) == d-> m_model ) {
2289 b. setKeycode ( sb-> code ); 2289 b. setKeycode ( sb-> code );
2290 b. setUserText ( QObject::tr ( "Button", sb-> utext )); 2290 b. setUserText ( QObject::tr ( "Button", sb-> utext ));
2291 b. setPixmap ( Resource::loadPixmap ( sb-> pix )); 2291 b. setPixmap ( Resource::loadPixmap ( sb-> pix ));
2292 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb-> fpressedservice ), sb-> fpressedaction )); 2292 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb-> fpressedservice ), sb-> fpressedaction ));
2293 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb-> fheldservice ), sb-> fheldaction )); 2293 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb-> fheldservice ), sb-> fheldaction ));
2294 2294
2295 d-> m_buttons-> append ( b ); 2295 d-> m_buttons-> append ( b );
2296 } 2296 }
2297 } 2297 }
2298 reloadButtonMapping ( ); 2298 reloadButtonMapping ( );
2299 2299
2300 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 2300 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
2301 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 2301 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
2302} 2302}
2303 2303
2304// SIMpad boardcontrol register CS3 2304// SIMpad boardcontrol register CS3
2305#define SIMPAD_BOARDCONTROL "/proc/cs3" 2305#define SIMPAD_BOARDCONTROL "/proc/cs3"
2306#define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA 2306#define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA
2307#define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA 2307#define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA
2308#define SIMPAD_EN1 0x0004 // This is only for EPROM's 2308#define SIMPAD_EN1 0x0004 // This is only for EPROM's
2309#define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V 2309#define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V
2310#define SIMPAD_DISPLAY_ON 0x0010 2310#define SIMPAD_DISPLAY_ON 0x0010
2311#define SIMPAD_PCMCIA_BUFF_DIS 0x0020 2311#define SIMPAD_PCMCIA_BUFF_DIS 0x0020
2312#define SIMPAD_MQ_RESET 0x0040 2312#define SIMPAD_MQ_RESET 0x0040
2313#define SIMPAD_PCMCIA_RESET 0x0080 2313#define SIMPAD_PCMCIA_RESET 0x0080
2314#define SIMPAD_DECT_POWER_ON 0x0100 2314#define SIMPAD_DECT_POWER_ON 0x0100
2315#define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave 2315#define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave
2316#define SIMPAD_RS232_ON 0x0400 2316#define SIMPAD_RS232_ON 0x0400
2317#define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave 2317#define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave
2318#define SIMPAD_LED2_ON 0x1000 2318#define SIMPAD_LED2_ON 0x1000
2319#define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode 2319#define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode
2320#define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit 2320#define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit
2321#define SIMPAD_RESET_SIMCARD 0x8000 2321#define SIMPAD_RESET_SIMCARD 0x8000
2322 2322
2323//SIMpad touchscreen backlight strength control 2323//SIMpad touchscreen backlight strength control
2324#define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" 2324#define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL"
2325#define SIMPAD_BACKLIGHT_MASK 0x00a10044 2325#define SIMPAD_BACKLIGHT_MASK 0x00a10044
2326 2326
2327QValueList <OLed> SIMpad::ledList ( ) const 2327QValueList <OLed> SIMpad::ledList ( ) const
2328{ 2328{
2329 QValueList <OLed> vl; 2329 QValueList <OLed> vl;
2330 vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one? 2330 vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one?
2331 //vl << Led_Mail; //TODO find out if LED1 is accessible anyway 2331 //vl << Led_Mail; //TODO find out if LED1 is accessible anyway
2332 return vl; 2332 return vl;
2333} 2333}
2334 2334
2335QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const 2335QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const
2336{ 2336{
2337 QValueList <OLedState> vl; 2337 QValueList <OLedState> vl;
2338 2338
2339 if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one? 2339 if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one?
2340 vl << Led_Off << Led_On; 2340 vl << Led_Off << Led_On;
2341 //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway 2341 //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway
2342 //vl << Led_Off; 2342 //vl << Led_Off;
2343 return vl; 2343 return vl;
2344} 2344}
2345 2345
2346OLedState SIMpad::ledState ( OLed l ) const 2346OLedState SIMpad::ledState ( OLed l ) const
2347{ 2347{
2348 switch ( l ) { 2348 switch ( l ) {
2349 case Led_Power: 2349 case Led_Power:
@@ -2753,94 +2753,94 @@ bool Jornada::isJornada ( )
2753void Jornada::init ( ) 2753void Jornada::init ( )
2754{ 2754{
2755 d-> m_vendorstr = "HP"; 2755 d-> m_vendorstr = "HP";
2756 d-> m_vendor = Vendor_HP; 2756 d-> m_vendor = Vendor_HP;
2757 d-> m_modelstr = "Jornada 56x"; 2757 d-> m_modelstr = "Jornada 56x";
2758 d-> m_model = Model_Jornada_56x; 2758 d-> m_model = Model_Jornada_56x;
2759 d-> m_systemstr = "Familiar"; 2759 d-> m_systemstr = "Familiar";
2760 d-> m_system = System_Familiar; 2760 d-> m_system = System_Familiar;
2761 d-> m_rotation = Rot0; 2761 d-> m_rotation = Rot0;
2762 2762
2763 QFile f ( "/etc/familiar-version" ); 2763 QFile f ( "/etc/familiar-version" );
2764 f. setName ( "/etc/familiar-version" ); 2764 f. setName ( "/etc/familiar-version" );
2765 if ( f. open ( IO_ReadOnly )) { 2765 if ( f. open ( IO_ReadOnly )) {
2766 2766
2767 QTextStream ts ( &f ); 2767 QTextStream ts ( &f );
2768 d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); 2768 d-> m_sysverstr = ts. readLine ( ). mid ( 10 );
2769 2769
2770 f. close ( ); 2770 f. close ( );
2771 } 2771 }
2772} 2772}
2773 2773
2774#if 0 2774#if 0
2775void Jornada::initButtons ( ) 2775void Jornada::initButtons ( )
2776{ 2776{
2777 if ( d-> m_buttons ) 2777 if ( d-> m_buttons )
2778 return; 2778 return;
2779 2779
2780 // Simulation uses iPAQ 3660 device buttons 2780 // Simulation uses iPAQ 3660 device buttons
2781 2781
2782 qDebug ( "init Buttons" ); 2782 qDebug ( "init Buttons" );
2783 d-> m_buttons = new QValueList <ODeviceButton>; 2783 d-> m_buttons = new QValueList <ODeviceButton>;
2784 2784
2785 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 2785 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
2786 i_button *ib = ipaq_buttons + i; 2786 i_button *ib = ipaq_buttons + i;
2787 ODeviceButton b; 2787 ODeviceButton b;
2788 2788
2789 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { 2789 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) {
2790 b. setKeycode ( ib-> code ); 2790 b. setKeycode ( ib-> code );
2791 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 2791 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
2792 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 2792 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
2793 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 2793 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
2794 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 2794 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
2795 d-> m_buttons-> append ( b ); 2795 d-> m_buttons-> append ( b );
2796 } 2796 }
2797 } 2797 }
2798 reloadButtonMapping ( ); 2798 reloadButtonMapping ( );
2799 2799
2800 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 2800 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
2801 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 2801 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
2802} 2802}
2803#endif 2803#endif
2804int Jornada::displayBrightnessResolution ( ) const 2804int Jornada::displayBrightnessResolution ( ) const
2805{ 2805{
2806} 2806}
2807 2807
2808bool Jornada::setDisplayBrightness ( int bright ) 2808bool Jornada::setDisplayBrightness ( int bright )
2809{ 2809{
2810 bool res = false; 2810 bool res = false;
2811 int fd; 2811 int fd;
2812 2812
2813 if ( bright > 255 ) 2813 if ( bright > 255 )
2814 bright = 255; 2814 bright = 255;
2815 if ( bright < 0 ) 2815 if ( bright < 0 )
2816 bright = 0; 2816 bright = 0;
2817 2817
2818 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { 2818 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) {
2819 FLITE_IN bl; 2819 FLITE_IN bl;
2820 bl. mode = 1; 2820 bl. mode = 1;
2821 bl. pwr = bright ? 1 : 0; 2821 bl. pwr = bright ? 1 : 0;
2822 bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; 2822 bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255;
2823 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 2823 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
2824 ::close ( fd ); 2824 ::close ( fd );
2825 } 2825 }
2826 return res; 2826 return res;
2827} 2827}
2828 2828
2829bool Jornada::setSoftSuspend ( bool soft ) 2829bool Jornada::setSoftSuspend ( bool soft )
2830{ 2830{
2831 bool res = false; 2831 bool res = false;
2832 int fd; 2832 int fd;
2833 2833
2834 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { 2834 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) {
2835 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) 2835 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 )
2836 res = true; 2836 res = true;
2837 else 2837 else
2838 ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); 2838 ::perror ( "write to /proc/sys/ts/suspend_button_mode" );
2839 2839
2840 ::close ( fd ); 2840 ::close ( fd );
2841 } 2841 }
2842 else 2842 else
2843 ::perror ( "/proc/sys/ts/suspend_button_mode" ); 2843 ::perror ( "/proc/sys/ts/suspend_button_mode" );
2844 2844
2845 return res; 2845 return res;
2846} 2846}
diff --git a/libopie/ofileselector.cpp b/libopie/ofileselector.cpp
index 1ba94ae..2a6aed0 100644
--- a/libopie/ofileselector.cpp
+++ b/libopie/ofileselector.cpp
@@ -78,102 +78,102 @@ QString OFileViewInterface::startDirectory()const{
78 return selector()->m_startDir; 78 return selector()->m_startDir;
79} 79}
80 80
81 81
82ODocumentFileView::ODocumentFileView( OFileSelector* selector ) 82ODocumentFileView::ODocumentFileView( OFileSelector* selector )
83 : OFileViewInterface( selector ) { 83 : OFileViewInterface( selector ) {
84 m_selector = 0; 84 m_selector = 0;
85 setName( QObject::tr("Documents") ); 85 setName( QObject::tr("Documents") );
86} 86}
87ODocumentFileView::~ODocumentFileView() { 87ODocumentFileView::~ODocumentFileView() {
88 88
89} 89}
90QString ODocumentFileView::selectedName()const { 90QString ODocumentFileView::selectedName()const {
91 if (!m_selector) 91 if (!m_selector)
92 return QString::null; 92 return QString::null;
93 93
94 return m_selector->selectedDocument().file(); 94 return m_selector->selectedDocument().file();
95} 95}
96QString ODocumentFileView::selectedPath()const { 96QString ODocumentFileView::selectedPath()const {
97 return QPEApplication::documentDir(); 97 return QPEApplication::documentDir();
98} 98}
99QString ODocumentFileView::directory()const { 99QString ODocumentFileView::directory()const {
100 return selectedPath(); 100 return selectedPath();
101} 101}
102void ODocumentFileView::reread() { 102void ODocumentFileView::reread() {
103 if (!m_selector) 103 if (!m_selector)
104 return; 104 return;
105 105
106 m_selector->setNewVisible( showNew() ); 106 m_selector->setNewVisible( showNew() );
107 m_selector->setCloseVisible( showClose() ); 107 m_selector->setCloseVisible( showClose() );
108 m_selector->filter = currentMimeType().join(";"); 108 m_selector->filter = currentMimeType().join(";");
109 m_selector->reread(); 109 m_selector->reread();
110} 110}
111int ODocumentFileView::fileCount()const { 111int ODocumentFileView::fileCount()const {
112 if (!m_selector) 112 if (!m_selector)
113 return -1; 113 return -1;
114 114
115 return m_selector->fileCount(); 115 return m_selector->fileCount();
116} 116}
117DocLnk ODocumentFileView::selectedDocument()const { 117DocLnk ODocumentFileView::selectedDocument()const {
118 if (!m_selector) 118 if (!m_selector)
119 return DocLnk(); 119 return DocLnk();
120 120
121 return m_selector->selectedDocument(); 121 return m_selector->selectedDocument();
122} 122}
123QWidget* ODocumentFileView::widget( QWidget* parent ) { 123QWidget* ODocumentFileView::widget( QWidget* parent ) {
124 if (!m_selector ) { 124 if (!m_selector ) {
125 m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); 125 m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() );
126 QObject::connect(m_selector, SIGNAL(fileSelected( const DocLnk& ) ), 126 QObject::connect(m_selector, SIGNAL(fileSelected(const DocLnk&) ),
127 selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); 127 selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) );
128 QObject::connect(m_selector, SIGNAL(closeMe() ), 128 QObject::connect(m_selector, SIGNAL(closeMe() ),
129 selector(), SIGNAL(closeMe() ) ); 129 selector(), SIGNAL(closeMe() ) );
130 QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk& ) ), 130 QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk&) ),
131 selector(), SIGNAL(newSelected(const DocLnk& ) ) ); 131 selector(), SIGNAL(newSelected(const DocLnk&) ) );
132 } 132 }
133 133
134 return m_selector; 134 return m_selector;
135} 135}
136 136
137/* 137/*
138 * This is the file system view used 138 * This is the file system view used
139 * we use a QListView + QListViewItems for it 139 * we use a QListView + QListViewItems for it
140 */ 140 */
141 141
142OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, 142OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap,
143 const QString& path, const QString& date, 143 const QString& path, const QString& date,
144 const QString& size, const QString& dir, 144 const QString& size, const QString& dir,
145 bool isLocked, bool isDir ) 145 bool isLocked, bool isDir )
146 : QListViewItem( view ) 146 : QListViewItem( view )
147{ 147{
148 setPixmap(0, pixmap ); 148 setPixmap(0, pixmap );
149 setText(1, path ); 149 setText(1, path );
150 setText(2, size ); 150 setText(2, size );
151 setText(3, date ); 151 setText(3, date );
152 m_isDir = isDir; 152 m_isDir = isDir;
153 m_dir = dir; 153 m_dir = dir;
154 m_locked = isLocked; 154 m_locked = isLocked;
155} 155}
156OFileSelectorItem::~OFileSelectorItem() { 156OFileSelectorItem::~OFileSelectorItem() {
157 157
158} 158}
159bool OFileSelectorItem::isLocked()const { 159bool OFileSelectorItem::isLocked()const {
160 return m_locked; 160 return m_locked;
161} 161}
162QString OFileSelectorItem::directory()const { 162QString OFileSelectorItem::directory()const {
163 return m_dir; 163 return m_dir;
164} 164}
165bool OFileSelectorItem::isDir()const { 165bool OFileSelectorItem::isDir()const {
166 return m_isDir; 166 return m_isDir;
167} 167}
168QString OFileSelectorItem::path()const { 168QString OFileSelectorItem::path()const {
169 return text( 1 ); 169 return text( 1 );
170} 170}
171QString OFileSelectorItem::key( int id, bool )const { 171QString OFileSelectorItem::key( int id, bool )const {
172 QString ke; 172 QString ke;
173 if( id == 0 || id == 1 ){ // name 173 if( id == 0 || id == 1 ){ // name
174 if( m_isDir ){ 174 if( m_isDir ){
175 ke.append("0" ); 175 ke.append("0" );
176 ke.append( text(1) ); 176 ke.append( text(1) );
177 }else{ 177 }else{
178 ke.append("1" ); 178 ke.append("1" );
179 ke.append( text(1) ); 179 ke.append( text(1) );
@@ -343,98 +343,98 @@ void OFileViewFileListView::reread( bool all ) {
343 }else if( info.isDir() ){ 343 }else if( info.isDir() ){
344 addDir( fi, TRUE ); 344 addDir( fi, TRUE );
345 break; 345 break;
346 }else if( info.isFile() ){ 346 }else if( info.isFile() ){
347 addFile( fi, TRUE ); 347 addFile( fi, TRUE );
348 break; 348 break;
349 }else if( info.isSymLink() ){ 349 }else if( info.isSymLink() ){
350 file = info.dirPath(true ) + "/" + info.readLink() ; 350 file = info.dirPath(true ) + "/" + info.readLink() ;
351 break; 351 break;
352 }else if( i == 4){ // couldn't resolve symlink add it as symlink 352 }else if( i == 4){ // couldn't resolve symlink add it as symlink
353 addSymlink( fi ); 353 addSymlink( fi );
354 } 354 }
355 } // off for loop for symlink resolving 355 } // off for loop for symlink resolving
356 }else if( fi->isDir() ) 356 }else if( fi->isDir() )
357 addDir( fi ); 357 addDir( fi );
358 else if( fi->isFile() ) 358 else if( fi->isFile() )
359 addFile( fi ); 359 addFile( fi );
360 360
361 ++it; 361 ++it;
362 } // of while loop 362 } // of while loop
363 m_view->sort(); 363 m_view->sort();
364 364
365} 365}
366int OFileViewFileListView::fileCount()const{ 366int OFileViewFileListView::fileCount()const{
367 return m_view->childCount(); 367 return m_view->childCount();
368} 368}
369QString OFileViewFileListView::currentDir()const{ 369QString OFileViewFileListView::currentDir()const{
370 return m_currentDir; 370 return m_currentDir;
371} 371}
372OFileSelector* OFileViewFileListView::selector() { 372OFileSelector* OFileViewFileListView::selector() {
373 return m_sel; 373 return m_sel;
374} 374}
375 375
376bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) { 376bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) {
377 if ( e->type() == QEvent::KeyPress ) { 377 if ( e->type() == QEvent::KeyPress ) {
378 QKeyEvent *k = (QKeyEvent *)e; 378 QKeyEvent *k = (QKeyEvent *)e;
379 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) { 379 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) {
380 slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); 380 slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0);
381 return true; 381 return true;
382 } 382 }
383 } 383 }
384 return false; 384 return false;
385} 385}
386 386
387 387
388void OFileViewFileListView::connectSlots() { 388void OFileViewFileListView::connectSlots() {
389 connect(m_view, SIGNAL(clicked(QListViewItem*) ), 389 connect(m_view, SIGNAL(clicked(QListViewItem*) ),
390 this, SLOT(slotCurrentChanged(QListViewItem*) ) ); 390 this, SLOT(slotCurrentChanged(QListViewItem*) ) );
391 connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ), 391 connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),
392 this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) ); 392 this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) );
393} 393}
394void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) { 394void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) {
395 if (!item) 395 if (!item)
396 return; 396 return;
397#if 0 397#if 0
398 398
399 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 399 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
400 400
401 if (!sel->isDir() ) { 401 if (!sel->isDir() ) {
402 selector()->m_lneEdit->setText( sel->text(1) ); 402 selector()->m_lneEdit->setText( sel->text(1) );
403 // if in fileselector mode we will emit selected 403 // if in fileselector mode we will emit selected
404 if ( selector()->mode() == OFileSelector::FileSelector ) { 404 if ( selector()->mode() == OFileSelector::FileSelector ) {
405 qWarning("slot Current Changed"); 405 qWarning("slot Current Changed");
406 QStringList str = QStringList::split("->", sel->text(1) ); 406 QStringList str = QStringList::split("->", sel->text(1) );
407 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 407 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
408 emit selector()->fileSelected( path ); 408 emit selector()->fileSelected( path );
409 DocLnk lnk( path ); 409 DocLnk lnk( path );
410 emit selector()->fileSelected( lnk ); 410 emit selector()->fileSelected( lnk );
411 } 411 }
412 } 412 }
413#endif 413#endif
414} 414}
415void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) { 415void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) {
416 if (!item || ( button != Qt::LeftButton) ) 416 if (!item || ( button != Qt::LeftButton) )
417 return; 417 return;
418 418
419 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 419 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
420 if (!sel->isLocked() ) { 420 if (!sel->isLocked() ) {
421 QStringList str = QStringList::split("->", sel->text(1) ); 421 QStringList str = QStringList::split("->", sel->text(1) );
422 if (sel->isDir() ) { 422 if (sel->isDir() ) {
423 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); 423 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace();
424 emit selector()->dirSelected( m_currentDir ); 424 emit selector()->dirSelected( m_currentDir );
425 reread( m_all ); 425 reread( m_all );
426 }else { // file 426 }else { // file
427 qWarning("slot Clicked"); 427 qWarning("slot Clicked");
428 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); 428 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() );
429 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 429 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
430 emit selector()->fileSelected( path ); 430 emit selector()->fileSelected( path );
431 DocLnk lnk( path ); 431 DocLnk lnk( path );
432 emit selector()->fileSelected( lnk ); 432 emit selector()->fileSelected( lnk );
433 } 433 }
434 } // not locked 434 } // not locked
435} 435}
436void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) { 436void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) {
437 MimeType type( info->absFilePath() ); 437 MimeType type( info->absFilePath() );
438 if (!compliesMime( type.id() ) ) 438 if (!compliesMime( type.id() ) )
439 return; 439 return;
440 440
@@ -735,98 +735,98 @@ void OFileSelector::initUI() {
735 m_nameBox = new QHBox( this ); 735 m_nameBox = new QHBox( this );
736 (void)new QLabel( tr("Name:"), m_nameBox ); 736 (void)new QLabel( tr("Name:"), m_nameBox );
737 m_lneEdit = new QLineEdit( m_nameBox ); 737 m_lneEdit = new QLineEdit( m_nameBox );
738 m_lneEdit ->installEventFilter(this); 738 m_lneEdit ->installEventFilter(this);
739 lay->addWidget( m_nameBox ); 739 lay->addWidget( m_nameBox );
740 740
741 m_cmbBox = new QHBox( this ); 741 m_cmbBox = new QHBox( this );
742 m_cmbView = new QComboBox( m_cmbBox ); 742 m_cmbView = new QComboBox( m_cmbBox );
743 m_cmbMime = new QComboBox( m_cmbBox ); 743 m_cmbMime = new QComboBox( m_cmbBox );
744 lay->addWidget( m_cmbBox ); 744 lay->addWidget( m_cmbBox );
745} 745}
746 746
747/* 747/*
748 * This will make sure that the return key in the name edit causes dialogs to close 748 * This will make sure that the return key in the name edit causes dialogs to close
749 */ 749 */
750 750
751bool OFileSelector::eventFilter (QObject *o, QEvent *e) { 751bool OFileSelector::eventFilter (QObject *o, QEvent *e) {
752 if ( e->type() == QEvent::KeyPress ) { 752 if ( e->type() == QEvent::KeyPress ) {
753 QKeyEvent *k = (QKeyEvent *)e; 753 QKeyEvent *k = (QKeyEvent *)e;
754 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) { 754 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) {
755 emit ok(); 755 emit ok();
756 return true; 756 return true;
757 } 757 }
758 } 758 }
759 return false; 759 return false;
760} 760}
761 761
762/* 762/*
763 * This will insert the MimeTypes into the Combo Box 763 * This will insert the MimeTypes into the Combo Box
764 * And also connect the changed signal 764 * And also connect the changed signal
765 * 765 *
766 * AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes 766 * AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes
767 */ 767 */
768void OFileSelector::initMime() { 768void OFileSelector::initMime() {
769 MimeTypes::Iterator it; 769 MimeTypes::Iterator it;
770 for ( it = m_mimeType.begin(); it != m_mimeType.end(); ++it ) { 770 for ( it = m_mimeType.begin(); it != m_mimeType.end(); ++it ) {
771 m_cmbMime->insertItem( it.key() ); 771 m_cmbMime->insertItem( it.key() );
772 } 772 }
773 m_cmbMime->setCurrentItem( 0 ); 773 m_cmbMime->setCurrentItem( 0 );
774 774
775 connect( m_cmbMime, SIGNAL(activated(int) ), 775 connect( m_cmbMime, SIGNAL(activated(int) ),
776 this, SLOT(slotMimeTypeChanged() ) ); 776 this, SLOT(slotMimeTypeChanged() ) );
777 777
778} 778}
779void OFileSelector::initViews() { 779void OFileSelector::initViews() {
780 m_cmbView->insertItem( QObject::tr("Documents") ); 780 m_cmbView->insertItem( QObject::tr("Documents") );
781 m_cmbView->insertItem( QObject::tr("Files") ); 781 m_cmbView->insertItem( QObject::tr("Files") );
782 m_cmbView->insertItem( QObject::tr("All Files") ); 782 m_cmbView->insertItem( QObject::tr("All Files") );
783 connect(m_cmbView, SIGNAL(activated( const QString& ) ), 783 connect(m_cmbView, SIGNAL(activated(const QString&) ),
784 this, SLOT(slotViewChange( const QString& ) ) ); 784 this, SLOT(slotViewChange(const QString&) ) );
785 785
786 786
787 m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); 787 m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) );
788 788
789 /* see above why add both */ 789 /* see above why add both */
790 OFileViewInterface* in = new OFileViewFileSystem( this ); 790 OFileViewInterface* in = new OFileViewFileSystem( this );
791 m_views.insert( QObject::tr("Files"), in ); 791 m_views.insert( QObject::tr("Files"), in );
792 m_views.insert( QObject::tr("All Files"), in ); 792 m_views.insert( QObject::tr("All Files"), in );
793} 793}
794 794
795/** 795/**
796 * d'tor 796 * d'tor
797 */ 797 */
798OFileSelector::~OFileSelector() { 798OFileSelector::~OFileSelector() {
799 799
800} 800}
801 801
802/** 802/**
803 * Convience function for the fileselector 803 * Convience function for the fileselector
804 * make sure to delete the DocLnk 804 * make sure to delete the DocLnk
805 * 805 *
806 * @see DocLnk 806 * @see DocLnk
807 * @todo remove in ODP 807 * @todo remove in ODP
808 */ 808 */
809const DocLnk* OFileSelector::selected() { 809const DocLnk* OFileSelector::selected() {
810 DocLnk* lnk = new DocLnk( currentView()->selectedDocument() ); 810 DocLnk* lnk = new DocLnk( currentView()->selectedDocument() );
811 return lnk; 811 return lnk;
812} 812}
813 813
814/** 814/**
815 * 815 *
816 * @return the name of the selected file 816 * @return the name of the selected file
817 */ 817 */
818QString OFileSelector::selectedName()const{ 818QString OFileSelector::selectedName()const{
819 return currentView()->selectedName(); 819 return currentView()->selectedName();
820} 820}
821 821
822/** 822/**
823 * @return the selected path 823 * @return the selected path
824 */ 824 */
825QString OFileSelector::selectedPath()const { 825QString OFileSelector::selectedPath()const {
826 return currentView()->selectedPath(); 826 return currentView()->selectedPath();
827} 827}
828 828
829/** 829/**
830 * @return the directory name 830 * @return the directory name
831 */ 831 */
832QString OFileSelector::directory()const { 832QString OFileSelector::directory()const {
diff --git a/libopie/ofontselector.cpp b/libopie/ofontselector.cpp
index 7e07008..87b7869 100644
--- a/libopie/ofontselector.cpp
+++ b/libopie/ofontselector.cpp
@@ -74,111 +74,111 @@ public:
74 } 74 }
75 75
76 const QValueList<int> &sizes ( ) const 76 const QValueList<int> &sizes ( ) const
77 { 77 {
78 return m_sizes; 78 return m_sizes;
79 } 79 }
80 80
81private: 81private:
82 QStringList m_styles; 82 QStringList m_styles;
83 QValueList<int> m_sizes; 83 QValueList<int> m_sizes;
84 QString m_name; 84 QString m_name;
85}; 85};
86 86
87 87
88static int findItemCB ( QComboBox *box, const QString &str ) 88static int findItemCB ( QComboBox *box, const QString &str )
89{ 89{
90 for ( int i = 0; i < box-> count ( ); i++ ) { 90 for ( int i = 0; i < box-> count ( ); i++ ) {
91 if ( box-> text ( i ) == str ) 91 if ( box-> text ( i ) == str )
92 return i; 92 return i;
93 } 93 }
94 return -1; 94 return -1;
95} 95}
96 96
97} 97}
98/* static same as anon. namespace */ 98/* static same as anon. namespace */
99static int qt_version ( ) 99static int qt_version ( )
100{ 100{
101 const char *qver = qVersion ( ); 101 const char *qver = qVersion ( );
102 102
103 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); 103 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' );
104} 104}
105 105
106/** 106/**
107 * Constructs the Selector object 107 * Constructs the Selector object
108 * @param withpreview If a font preview should be given 108 * @param withpreview If a font preview should be given
109 * @param parent The parent of the Font Selector 109 * @param parent The parent of the Font Selector
110 * @param name The name of the object 110 * @param name The name of the object
111 * @param fl WidgetFlags 111 * @param fl WidgetFlags
112 */ 112 */
113OFontSelector::OFontSelector ( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) 113OFontSelector::OFontSelector ( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl )
114{ 114{
115 d = new OFontSelectorPrivate ( ); 115 d = new OFontSelectorPrivate ( );
116 116
117 QGridLayout *gridLayout = new QGridLayout ( this, 0, 0, 4, 4 ); 117 QGridLayout *gridLayout = new QGridLayout ( this, 0, 0, 4, 4 );
118 gridLayout->setRowStretch ( 4, 10 ); 118 gridLayout->setRowStretch ( 4, 10 );
119 119
120 d-> m_font_family_list = new QListBox( this, "FontListBox" ); 120 d-> m_font_family_list = new QListBox( this, "FontListBox" );
121 gridLayout->addMultiCellWidget( d-> m_font_family_list, 0, 4, 0, 0 ); 121 gridLayout->addMultiCellWidget( d-> m_font_family_list, 0, 4, 0, 0 );
122 connect( d-> m_font_family_list, SIGNAL( highlighted( int ) ), this, SLOT( fontFamilyClicked( int ) ) ); 122 connect( d-> m_font_family_list, SIGNAL( highlighted(int) ), this, SLOT( fontFamilyClicked(int) ) );
123 123
124 QLabel *label = new QLabel( tr( "Style" ), this ); 124 QLabel *label = new QLabel( tr( "Style" ), this );
125 gridLayout->addWidget( label, 0, 1 ); 125 gridLayout->addWidget( label, 0, 1 );
126 126
127 d-> m_font_style_list = new QComboBox( this, "StyleListBox" ); 127 d-> m_font_style_list = new QComboBox( this, "StyleListBox" );
128 connect( d-> m_font_style_list, SIGNAL( activated( int ) ), this, SLOT( fontStyleClicked( int ) ) ); 128 connect( d-> m_font_style_list, SIGNAL( activated(int) ), this, SLOT( fontStyleClicked(int) ) );
129 gridLayout->addWidget( d-> m_font_style_list, 1, 1 ); 129 gridLayout->addWidget( d-> m_font_style_list, 1, 1 );
130 130
131 label = new QLabel( tr( "Size" ), this ); 131 label = new QLabel( tr( "Size" ), this );
132 gridLayout->addWidget( label, 2, 1 ); 132 gridLayout->addWidget( label, 2, 1 );
133 133
134 d-> m_font_size_list = new QComboBox( this, "SizeListBox" ); 134 d-> m_font_size_list = new QComboBox( this, "SizeListBox" );
135 connect( d-> m_font_size_list, SIGNAL( activated( int ) ), 135 connect( d-> m_font_size_list, SIGNAL( activated(int) ),
136 this, SLOT( fontSizeClicked( int ) ) ); 136 this, SLOT( fontSizeClicked(int) ) );
137 gridLayout->addWidget( d-> m_font_size_list, 3, 1 ); 137 gridLayout->addWidget( d-> m_font_size_list, 3, 1 );
138 138
139 d-> m_pointbug = ( qt_version ( ) <= 233 ); 139 d-> m_pointbug = ( qt_version ( ) <= 233 );
140 140
141 if ( withpreview ) { 141 if ( withpreview ) {
142 d-> m_preview = new QMultiLineEdit ( this, "Preview" ); 142 d-> m_preview = new QMultiLineEdit ( this, "Preview" );
143 d-> m_preview-> setAlignment ( AlignCenter ); 143 d-> m_preview-> setAlignment ( AlignCenter );
144 d-> m_preview-> setWordWrap ( QMultiLineEdit::WidgetWidth ); 144 d-> m_preview-> setWordWrap ( QMultiLineEdit::WidgetWidth );
145 d-> m_preview-> setMargin ( 3 ); 145 d-> m_preview-> setMargin ( 3 );
146 d-> m_preview-> setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); 146 d-> m_preview-> setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" ));
147 gridLayout-> addRowSpacing ( 5, 4 ); 147 gridLayout-> addRowSpacing ( 5, 4 );
148 gridLayout-> addMultiCellWidget ( d-> m_preview, 6, 6, 0, 1 ); 148 gridLayout-> addMultiCellWidget ( d-> m_preview, 6, 6, 0, 1 );
149 gridLayout-> setRowStretch ( 6, 5 ); 149 gridLayout-> setRowStretch ( 6, 5 );
150 } 150 }
151 else 151 else
152 d-> m_preview = 0; 152 d-> m_preview = 0;
153 153
154 loadFonts ( d-> m_font_family_list ); 154 loadFonts ( d-> m_font_family_list );
155} 155}
156 156
157OFontSelector::~OFontSelector ( ) 157OFontSelector::~OFontSelector ( )
158{ 158{
159 delete d; 159 delete d;
160} 160}
161 161
162/** 162/**
163 * This methods tries to set the font 163 * This methods tries to set the font
164 * @param f The wishes font 164 * @param f The wishes font
165 * @return success or failure 165 * @return success or failure
166 */ 166 */
167bool OFontSelector::setSelectedFont ( const QFont &f ) 167bool OFontSelector::setSelectedFont ( const QFont &f )
168{ 168{
169 return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( ))); 169 return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( )));
170} 170}
171 171
172 172
173/** 173/**
174 * This is an overloaded method @see setSelectedFont 174 * This is an overloaded method @see setSelectedFont
175 * @param familyStr The family of the font 175 * @param familyStr The family of the font
176 * @param styleStr The style of the font 176 * @param styleStr The style of the font
177 * @param sizeVal The size of font 177 * @param sizeVal The size of font
178 * @param charset The charset to be used. Will be deprecated by QT3 178 * @param charset The charset to be used. Will be deprecated by QT3
179 */ 179 */
180bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) 180bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset )
181{ 181{
182 QString sizeStr = QString::number ( sizeVal ); 182 QString sizeStr = QString::number ( sizeVal );
183 183
184 QListBoxItem *family = d-> m_font_family_list-> findItem ( familyStr ); 184 QListBoxItem *family = d-> m_font_family_list-> findItem ( familyStr );
diff --git a/libopie/orecurrancewidget.cpp b/libopie/orecurrancewidget.cpp
index d81851e..33be269 100644
--- a/libopie/orecurrancewidget.cpp
+++ b/libopie/orecurrancewidget.cpp
@@ -505,98 +505,98 @@ void ORecurranceWidget::setupWeekly() {
505 // might as well set the day too... 505 // might as well set the day too...
506 if ( startWeekOnMonday ) { 506 if ( startWeekOnMonday ) {
507 fraExtra->setButton( start.dayOfWeek() - 1 ); 507 fraExtra->setButton( start.dayOfWeek() - 1 );
508 } else { 508 } else {
509 fraExtra->setButton( start.dayOfWeek() % 7 ); 509 fraExtra->setButton( start.dayOfWeek() % 7 );
510 } 510 }
511 lblFreq->setText( tr("week(s)") ); 511 lblFreq->setText( tr("week(s)") );
512 lblVar2->show(); 512 lblVar2->show();
513 showRepeatStuff(); 513 showRepeatStuff();
514 setupRepeatLabel( 1 ); 514 setupRepeatLabel( 1 );
515} 515}
516void ORecurranceWidget::setupMonthly() { 516void ORecurranceWidget::setupMonthly() {
517 hideExtras(); 517 hideExtras();
518 lblWeekVar->hide(); 518 lblWeekVar->hide();
519 fraExtra->setTitle( tr("Repeat By") ); 519 fraExtra->setTitle( tr("Repeat By") );
520 fraExtra->setExclusive( TRUE ); 520 fraExtra->setExclusive( TRUE );
521 fraExtra->show(); 521 fraExtra->show();
522 cmdExtra1->setText( tr("Day") ); 522 cmdExtra1->setText( tr("Day") );
523 cmdExtra1->show(); 523 cmdExtra1->show();
524 cmdExtra2->setText( tr("Date") ); 524 cmdExtra2->setText( tr("Date") );
525 cmdExtra2->show(); 525 cmdExtra2->show();
526 spinFreq->setValue( 1 ); 526 spinFreq->setValue( 1 );
527 lblFreq->setText( tr("month(s)") ); 527 lblFreq->setText( tr("month(s)") );
528 lblVar2->show(); 528 lblVar2->show();
529 showRepeatStuff(); 529 showRepeatStuff();
530 setupRepeatLabel( 1 ); 530 setupRepeatLabel( 1 );
531} 531}
532void ORecurranceWidget::setupYearly() { 532void ORecurranceWidget::setupYearly() {
533hideExtras(); 533hideExtras();
534 lblWeekVar->hide(); 534 lblWeekVar->hide();
535 spinFreq->setValue( 1 ); 535 spinFreq->setValue( 1 );
536 lblFreq->setText( tr("year(s)") ); 536 lblFreq->setText( tr("year(s)") );
537 lblFreq->show(); 537 lblFreq->show();
538 lblFreq->show(); 538 lblFreq->show();
539 showRepeatStuff(); 539 showRepeatStuff();
540 lblVar2->show(); 540 lblVar2->show();
541 QString strEvery = strYearTemplate.arg( start.monthName(start.month()) ).arg( numberPlacing(start.day()) ); 541 QString strEvery = strYearTemplate.arg( start.monthName(start.month()) ).arg( numberPlacing(start.day()) );
542 lblRepeat->setText( strEvery ); 542 lblRepeat->setText( strEvery );
543 setupRepeatLabel( 1 ); 543 setupRepeatLabel( 1 );
544 544
545} 545}
546void ORecurranceWidget::init() { 546void ORecurranceWidget::init() {
547 QPopupMenu *m1 = new QPopupMenu( this ); 547 QPopupMenu *m1 = new QPopupMenu( this );
548 repeatPicker = new DateBookMonth( m1, 0, TRUE ); 548 repeatPicker = new DateBookMonth( m1, 0, TRUE );
549 m1->insertItem( repeatPicker ); 549 m1->insertItem( repeatPicker );
550 cmdEnd->setPopup( m1 ); 550 cmdEnd->setPopup( m1 );
551 cmdEnd->setPopupDelay( 0 ); 551 cmdEnd->setPopupDelay( 0 );
552 552
553 QObject::connect( repeatPicker, SIGNAL(dateClicked(int, int, int)), 553 QObject::connect( repeatPicker, SIGNAL(dateClicked(int,int,int)),
554 this, SLOT(endDateChanged(int, int, int)) ); 554 this, SLOT(endDateChanged(int,int,int)) );
555 QObject::connect( qApp, SIGNAL(weekChanged(bool)), 555 QObject::connect( qApp, SIGNAL(weekChanged(bool)),
556 this, SLOT(slotChangeStartOfWeek(bool)) ); 556 this, SLOT(slotChangeStartOfWeek(bool)) );
557 557
558 listRTypeButtons.setAutoDelete( TRUE ); 558 listRTypeButtons.setAutoDelete( TRUE );
559 listRTypeButtons.append( cmdNone ); 559 listRTypeButtons.append( cmdNone );
560 listRTypeButtons.append( cmdDay ); 560 listRTypeButtons.append( cmdDay );
561 listRTypeButtons.append( cmdWeek ); 561 listRTypeButtons.append( cmdWeek );
562 listRTypeButtons.append( cmdMonth ); 562 listRTypeButtons.append( cmdMonth );
563 listRTypeButtons.append( cmdYear ); 563 listRTypeButtons.append( cmdYear );
564 564
565 listExtra.setAutoDelete( TRUE ); 565 listExtra.setAutoDelete( TRUE );
566 listExtra.append( cmdExtra1 ); 566 listExtra.append( cmdExtra1 );
567 listExtra.append( cmdExtra2 ); 567 listExtra.append( cmdExtra2 );
568 listExtra.append( cmdExtra3 ); 568 listExtra.append( cmdExtra3 );
569 listExtra.append( cmdExtra4 ); 569 listExtra.append( cmdExtra4 );
570 listExtra.append( cmdExtra5 ); 570 listExtra.append( cmdExtra5 );
571 listExtra.append( cmdExtra6 ); 571 listExtra.append( cmdExtra6 );
572 listExtra.append( cmdExtra7 ); 572 listExtra.append( cmdExtra7 );
573} 573}
574void ORecurranceWidget::hideExtras() { 574void ORecurranceWidget::hideExtras() {
575 // hide the extra buttons... 575 // hide the extra buttons...
576 fraExtra->hide(); 576 fraExtra->hide();
577 chkNoEnd->hide(); 577 chkNoEnd->hide();
578 QListIterator<QToolButton> it( listExtra ); 578 QListIterator<QToolButton> it( listExtra );
579 for ( ; *it; ++it ) { 579 for ( ; *it; ++it ) {
580 (*it)->hide(); 580 (*it)->hide();
581 (*it)->setOn( FALSE ); 581 (*it)->setOn( FALSE );
582 } 582 }
583} 583}
584void ORecurranceWidget::showRepeatStuff() { 584void ORecurranceWidget::showRepeatStuff() {
585 cmdEnd->show(); 585 cmdEnd->show();
586 chkNoEnd->show(); 586 chkNoEnd->show();
587 lblFreq->show(); 587 lblFreq->show();
588 lblEvery->show(); 588 lblEvery->show();
589 lblFreq->show(); 589 lblFreq->show();
590 spinFreq->show(); 590 spinFreq->show();
591 lblEnd->show(); 591 lblEnd->show();
592 lblRepeat->setText( tr("Every") ); 592 lblRepeat->setText( tr("Every") );
593} 593}
594 594
595 595
596static int week( const QDate &start ) 596static int week( const QDate &start )
597{ 597{
598 // figure out the week... 598 // figure out the week...
599 int stop = start.day(), 599 int stop = start.day(),
600 sentinel = start.dayOfWeek(), 600 sentinel = start.dayOfWeek(),
601 dayOfWeek = QDate( start.year(), start.month(), 1 ).dayOfWeek(), 601 dayOfWeek = QDate( start.year(), start.month(), 1 ).dayOfWeek(),
602 week = 1, 602 week = 1,
diff --git a/libopie/otabwidget.cpp b/libopie/otabwidget.cpp
index 3a9a5ec..52190b2 100644
--- a/libopie/otabwidget.cpp
+++ b/libopie/otabwidget.cpp
@@ -25,101 +25,101 @@
25    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#include "otabwidget.h" 32#include "otabwidget.h"
33 33
34#include <qpe/applnk.h> 34#include <qpe/applnk.h>
35#include <qpe/config.h> 35#include <qpe/config.h>
36#include <qpe/resource.h> 36#include <qpe/resource.h>
37#include <opie/otabbar.h> 37#include <opie/otabbar.h>
38 38
39#include <qcombobox.h> 39#include <qcombobox.h>
40#include <qwidgetstack.h> 40#include <qwidgetstack.h>
41 41
42OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) 42OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p )
43 : QWidget( parent, name ) 43 : QWidget( parent, name )
44{ 44{
45 if ( s == Global ) 45 if ( s == Global )
46 { 46 {
47 Config config( "qpe" ); 47 Config config( "qpe" );
48 config.setGroup( "Appearance" ); 48 config.setGroup( "Appearance" );
49 s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); 49 s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab );
50 if ( s <= Global || s > IconList) 50 if ( s <= Global || s > IconList)
51 { 51 {
52 s = IconTab; 52 s = IconTab;
53 } 53 }
54 QString pos = config.readEntry( "TabPosition", "Top"); 54 QString pos = config.readEntry( "TabPosition", "Top");
55 if ( pos == "Bottom" ) 55 if ( pos == "Bottom" )
56 { 56 {
57 p = Bottom; 57 p = Bottom;
58 } 58 }
59 else 59 else
60 { 60 {
61 p = Top; 61 p = Top;
62 } 62 }
63 } 63 }
64 64
65 widgetStack = new QWidgetStack( this, "widgetstack" ); 65 widgetStack = new QWidgetStack( this, "widgetstack" );
66 widgetStack->setFrameStyle( QFrame::NoFrame ); 66 widgetStack->setFrameStyle( QFrame::NoFrame );
67 widgetStack->setLineWidth( style().defaultFrameWidth() ); 67 widgetStack->setLineWidth( style().defaultFrameWidth() );
68 68
69 tabBarStack = new QWidgetStack( this, "tabbarstack" ); 69 tabBarStack = new QWidgetStack( this, "tabbarstack" );
70 70
71 tabBar = new OTabBar( tabBarStack, "tabbar" ); 71 tabBar = new OTabBar( tabBarStack, "tabbar" );
72 tabBarStack->addWidget( tabBar, 0 ); 72 tabBarStack->addWidget( tabBar, 0 );
73 connect( tabBar, SIGNAL( selected( int ) ), this, SLOT( slotTabBarSelected( int ) ) ); 73 connect( tabBar, SIGNAL( selected(int) ), this, SLOT( slotTabBarSelected(int) ) );
74 74
75 tabList = new QComboBox( false, tabBarStack, "tablist" ); 75 tabList = new QComboBox( false, tabBarStack, "tablist" );
76 tabBarStack->addWidget( tabList, 1 ); 76 tabBarStack->addWidget( tabList, 1 );
77 connect( tabList, SIGNAL( activated( int ) ), this, SLOT( slotTabListSelected( int ) ) ); 77 connect( tabList, SIGNAL( activated(int) ), this, SLOT( slotTabListSelected(int) ) );
78 78
79 tabBarPosition = p; 79 tabBarPosition = p;
80 setTabStyle( s ); 80 setTabStyle( s );
81 setTabPosition( p ); 81 setTabPosition( p );
82 82
83 currTab= 0x0; 83 currTab= 0x0;
84} 84}
85 85
86OTabWidget::~OTabWidget() 86OTabWidget::~OTabWidget()
87{ 87{
88} 88}
89 89
90void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) 90void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label )
91{ 91{
92 QPixmap iconset = loadSmooth( icon ); 92 QPixmap iconset = loadSmooth( icon );
93 93
94 QTab *tab = new QTab(); 94 QTab *tab = new QTab();
95 if ( tabBarStyle == IconTab ) 95 if ( tabBarStyle == IconTab )
96 { 96 {
97 tab->label = QString::null; 97 tab->label = QString::null;
98 } 98 }
99 else 99 else
100 { 100 {
101 tab->label = label; 101 tab->label = label;
102 } 102 }
103 if ( tabBarStyle == IconTab || tabBarStyle == IconList ) 103 if ( tabBarStyle == IconTab || tabBarStyle == IconList )
104 { 104 {
105 tab->iconset = new QIconSet( iconset ); 105 tab->iconset = new QIconSet( iconset );
106 } 106 }
107 int tabid = tabBar->addTab( tab ); 107 int tabid = tabBar->addTab( tab );
108 108
109 if ( tabBarStyle == IconTab || tabBarStyle == IconList ) 109 if ( tabBarStyle == IconTab || tabBarStyle == IconList )
110 { 110 {
111 tabList->insertItem( iconset, label, -1 ); 111 tabList->insertItem( iconset, label, -1 );
112 } 112 }
113 else 113 else
114 { 114 {
115 tabList->insertItem( label ); 115 tabList->insertItem( label );
116 } 116 }
117 117
118 widgetStack->addWidget( child, tabid ); 118 widgetStack->addWidget( child, tabid );
119 widgetStack->raiseWidget( child ); 119 widgetStack->raiseWidget( child );
120 widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); 120 widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
121 121
122 OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label ); 122 OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label );
123 tabs.append( tabinfo ); 123 tabs.append( tabinfo );
124 selectTab( tabinfo ); 124 selectTab( tabinfo );
125} 125}
diff --git a/libopie/otimepicker.cpp b/libopie/otimepicker.cpp
index 1eca7c5..11b80ed 100644
--- a/libopie/otimepicker.cpp
+++ b/libopie/otimepicker.cpp
@@ -128,102 +128,102 @@ void OTimePicker::setTime( int h, int m ) {
128 * FIXME round minutes to the 5 minute arrangement -zecke 128 * FIXME round minutes to the 5 minute arrangement -zecke
129 */ 129 */
130/** 130/**
131 * Method to set the minutes 131 * Method to set the minutes
132 * @param m minutes 132 * @param m minutes
133 */ 133 */
134void OTimePicker::setMinute(int m) { 134void OTimePicker::setMinute(int m) {
135 135
136 QString minute; 136 QString minute;
137 minute.sprintf("%.2d",m); 137 minute.sprintf("%.2d",m);
138 138
139 QValueListIterator<OClickableLabel *> it; 139 QValueListIterator<OClickableLabel *> it;
140 for (it=minuteLst.begin(); it!=minuteLst.end(); it++) { 140 for (it=minuteLst.begin(); it!=minuteLst.end(); it++) {
141 if ((*it)->text() == minute) (*it)->setOn(true); 141 if ((*it)->text() == minute) (*it)->setOn(true);
142 else (*it)->setOn(false); 142 else (*it)->setOn(false);
143 } 143 }
144 144
145 tm.setHMS(tm.hour(),m,0); 145 tm.setHMS(tm.hour(),m,0);
146} 146}
147 147
148/** 148/**
149 * Method to set the hour 149 * Method to set the hour
150 */ 150 */
151void OTimePicker::setHour(int h) { 151void OTimePicker::setHour(int h) {
152 152
153 QString hour; 153 QString hour;
154 hour.sprintf("%.2d",h); 154 hour.sprintf("%.2d",h);
155 155
156 QValueListIterator<OClickableLabel *> it; 156 QValueListIterator<OClickableLabel *> it;
157 for (it=hourLst.begin(); it!=hourLst.end(); it++) { 157 for (it=hourLst.begin(); it!=hourLst.end(); it++) {
158 if ((*it)->text() == hour) (*it)->setOn(true); 158 if ((*it)->text() == hour) (*it)->setOn(true);
159 else (*it)->setOn(false); 159 else (*it)->setOn(false);
160 } 160 }
161 tm.setHMS(h,tm.minute(),0); 161 tm.setHMS(h,tm.minute(),0);
162} 162}
163 163
164 164
165/** 165/**
166 * This is a modal Dialog. 166 * This is a modal Dialog.
167 * 167 *
168 * @param parent The parent widget 168 * @param parent The parent widget
169 * @param name The name of the object 169 * @param name The name of the object
170 * @param fl Possible window flags 170 * @param fl Possible window flags
171 */ 171 */
172OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl ) 172OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl )
173 : OTimePickerDialogBase (parent , name, true , fl) 173 : OTimePickerDialogBase (parent , name, true , fl)
174{ 174{
175 175
176 connect ( m_timePicker, SIGNAL( timeChanged( const QTime& ) ), 176 connect ( m_timePicker, SIGNAL( timeChanged(const QTime&) ),
177 this, SLOT( setTime ( const QTime& ) ) ); 177 this, SLOT( setTime(const QTime&) ) );
178 connect ( minuteField, SIGNAL( textChanged ( const QString& ) ), 178 connect ( minuteField, SIGNAL( textChanged(const QString&) ),
179 this, SLOT ( setMinute ( const QString& ) ) ); 179 this, SLOT ( setMinute(const QString&) ) );
180 connect ( hourField, SIGNAL( textChanged ( const QString& ) ), 180 connect ( hourField, SIGNAL( textChanged(const QString&) ),
181 this, SLOT ( setHour ( const QString& ) ) ); 181 this, SLOT ( setHour(const QString&) ) );
182 182
183} 183}
184 184
185/** 185/**
186 * @return the time 186 * @return the time
187 */ 187 */
188QTime OTimePickerDialog::time()const 188QTime OTimePickerDialog::time()const
189{ 189{
190 return m_time; 190 return m_time;
191} 191}
192 192
193/** 193/**
194 * Set the time to time 194 * Set the time to time
195 * @param time The time to be set 195 * @param time The time to be set
196 */ 196 */
197void OTimePickerDialog::setTime( const QTime& time ) 197void OTimePickerDialog::setTime( const QTime& time )
198{ 198{
199 m_time = time; 199 m_time = time;
200 200
201 m_timePicker->setHour ( time.hour() ); 201 m_timePicker->setHour ( time.hour() );
202 m_timePicker->setMinute( time.minute() ); 202 m_timePicker->setMinute( time.minute() );
203 203
204 // Set Textfields 204 // Set Textfields
205 if ( time.hour() < 10 ) 205 if ( time.hour() < 10 )
206 hourField->setText( "0" + QString::number( time.hour() ) ); 206 hourField->setText( "0" + QString::number( time.hour() ) );
207 else 207 else
208 hourField->setText( QString::number( time.hour() ) ); 208 hourField->setText( QString::number( time.hour() ) );
209 209
210 if ( time.minute() < 10 ) 210 if ( time.minute() < 10 )
211 minuteField->setText( "0" + QString::number( time.minute() ) ); 211 minuteField->setText( "0" + QString::number( time.minute() ) );
212 else 212 else
213 minuteField->setText( QString::number( time.minute() ) ); 213 minuteField->setText( QString::number( time.minute() ) );
214 214
215} 215}
216 216
217/** 217/**
218 * This method takes the current minute and tries to set hour 218 * This method takes the current minute and tries to set hour
219 * to hour. This succeeds if the resulting date is valid 219 * to hour. This succeeds if the resulting date is valid
220 * @param hour The hour as a string 220 * @param hour The hour as a string
221 */ 221 */
222void OTimePickerDialog::setHour ( const QString& hour ) 222void OTimePickerDialog::setHour ( const QString& hour )
223{ 223{
224 if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) ){ 224 if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) ){
225 m_time.setHMS ( hour.toInt(), m_time.minute() , 00 ); 225 m_time.setHMS ( hour.toInt(), m_time.minute() , 00 );
226 setTime ( m_time ); 226 setTime ( m_time );
227 } 227 }
228 228
229} 229}
diff --git a/libopie/pim/ocontactaccess.cpp b/libopie/pim/ocontactaccess.cpp
index 2e3ec1f..bc359f7 100644
--- a/libopie/pim/ocontactaccess.cpp
+++ b/libopie/pim/ocontactaccess.cpp
@@ -1,147 +1,152 @@
1/* 1/*
2 * Class to manage the Contacts. 2 * Class to manage the Contacts.
3 * 3 *
4 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) 4 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
5 * 5 *
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 Library General Public 8 *modify it under the terms of the GNU Library 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 * Info: This class could just work with a change in the header-file 12 * Info: This class could just work with a change in the header-file
13 * of the Contact class ! Therefore our libopie only compiles 13 * of the Contact class ! Therefore our libopie only compiles
14 * with our version of libqpe 14 * with our version of libqpe
15 * ===================================================================== 15 * =====================================================================
16 * ToDo: XML-Backend: Automatic reload if something was changed... 16 * ToDo: XML-Backend: Automatic reload if something was changed...
17 * 17 *
18 * 18 *
19 * ===================================================================== 19 * =====================================================================
20 * Version: $Id$ 20 * Version: $Id$
21 * ===================================================================== 21 * =====================================================================
22 * History: 22 * History:
23 * $Log$ 23 * $Log$
24 * Revision 1.9 2004/03/02 12:14:22 alwin
25 * run the optimize_connect script
26 * the whole cvs is tagged with "before_optimize_connect" if there are problems you
27 * can check the diff (but it had compiled and run here)
28 *
24 * Revision 1.8 2003/05/08 13:55:09 tille 29 * Revision 1.8 2003/05/08 13:55:09 tille
25 * search stuff 30 * search stuff
26 * and match, toRichText & toShortText in oevent 31 * and match, toRichText & toShortText in oevent
27 * 32 *
28 * Revision 1.7 2002/11/13 14:14:51 eilers 33 * Revision 1.7 2002/11/13 14:14:51 eilers
29 * Added sorted for Contacts.. 34 * Added sorted for Contacts..
30 * 35 *
31 * Revision 1.6 2002/11/01 15:10:42 eilers 36 * Revision 1.6 2002/11/01 15:10:42 eilers
32 * Added regExp-search in database for all fields in a contact. 37 * Added regExp-search in database for all fields in a contact.
33 * 38 *
34 * Revision 1.5 2002/10/16 10:52:40 eilers 39 * Revision 1.5 2002/10/16 10:52:40 eilers
35 * Added some docu to the interface and now using the cache infrastucture by zecke.. :) 40 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
36 * 41 *
37 * Revision 1.4 2002/10/14 16:21:54 eilers 42 * Revision 1.4 2002/10/14 16:21:54 eilers
38 * Some minor interface updates 43 * Some minor interface updates
39 * 44 *
40 * Revision 1.3 2002/10/07 17:34:24 eilers 45 * Revision 1.3 2002/10/07 17:34:24 eilers
41 * added OBackendFactory for advanced backend access 46 * added OBackendFactory for advanced backend access
42 * 47 *
43 * Revision 1.2 2002/10/02 16:18:11 eilers 48 * Revision 1.2 2002/10/02 16:18:11 eilers
44 * debugged and seems to work almost perfectly .. 49 * debugged and seems to work almost perfectly ..
45 * 50 *
46 * Revision 1.1 2002/09/27 17:11:44 eilers 51 * Revision 1.1 2002/09/27 17:11:44 eilers
47 * Added API for accessing the Contact-Database ! It is compiling, but 52 * Added API for accessing the Contact-Database ! It is compiling, but
48 * please do not expect that anything is working ! 53 * please do not expect that anything is working !
49 * I will debug that stuff in the next time .. 54 * I will debug that stuff in the next time ..
50 * Please read README_COMPILE for compiling ! 55 * Please read README_COMPILE for compiling !
51 * 56 *
52 * 57 *
53 */ 58 */
54 59
55#include "ocontactaccess.h" 60#include "ocontactaccess.h"
56#include "obackendfactory.h" 61#include "obackendfactory.h"
57 62
58#include <qasciidict.h> 63#include <qasciidict.h>
59#include <qdatetime.h> 64#include <qdatetime.h>
60#include <qfile.h> 65#include <qfile.h>
61#include <qregexp.h> 66#include <qregexp.h>
62#include <qlist.h> 67#include <qlist.h>
63#include <qcopchannel_qws.h> 68#include <qcopchannel_qws.h>
64 69
65//#include <qpe/qcopenvelope_qws.h> 70//#include <qpe/qcopenvelope_qws.h>
66#include <qpe/global.h> 71#include <qpe/global.h>
67 72
68#include <errno.h> 73#include <errno.h>
69#include <fcntl.h> 74#include <fcntl.h>
70#include <unistd.h> 75#include <unistd.h>
71#include <stdlib.h> 76#include <stdlib.h>
72 77
73#include "ocontactaccessbackend_xml.h" 78#include "ocontactaccessbackend_xml.h"
74 79
75 80
76OContactAccess::OContactAccess ( const QString appname, const QString , 81OContactAccess::OContactAccess ( const QString appname, const QString ,
77 OContactAccessBackend* end, bool autosync ): 82 OContactAccessBackend* end, bool autosync ):
78 OPimAccessTemplate<OContact>( end ) 83 OPimAccessTemplate<OContact>( end )
79{ 84{
80 /* take care of the backend. If there is no one defined, we 85 /* take care of the backend. If there is no one defined, we
81 * will use the XML-Backend as default (until we have a cute SQL-Backend..). 86 * will use the XML-Backend as default (until we have a cute SQL-Backend..).
82 */ 87 */
83 if( end == 0 ) { 88 if( end == 0 ) {
84 qWarning ("Using BackendFactory !"); 89 qWarning ("Using BackendFactory !");
85 end = OBackendFactory<OContactAccessBackend>::Default( "contact", appname ); 90 end = OBackendFactory<OContactAccessBackend>::Default( "contact", appname );
86 } 91 }
87 // Set backend locally and in template 92 // Set backend locally and in template
88 m_backEnd = end; 93 m_backEnd = end;
89 OPimAccessTemplate<OContact>::setBackEnd (end); 94 OPimAccessTemplate<OContact>::setBackEnd (end);
90 95
91 96
92 /* Connect signal of external db change to function */ 97 /* Connect signal of external db change to function */
93 QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); 98 QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this );
94 connect( dbchannel, SIGNAL(received(const QCString &, const QByteArray &)), 99 connect( dbchannel, SIGNAL(received(const QCString&,const QByteArray&)),
95 this, SLOT(copMessage( const QCString &, const QByteArray &)) ); 100 this, SLOT(copMessage(const QCString&,const QByteArray&)) );
96 if ( autosync ){ 101 if ( autosync ){
97 QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this ); 102 QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this );
98 connect( syncchannel, SIGNAL(received(const QCString &, const QByteArray &)), 103 connect( syncchannel, SIGNAL(received(const QCString&,const QByteArray&)),
99 this, SLOT(copMessage( const QCString &, const QByteArray &)) ); 104 this, SLOT(copMessage(const QCString&,const QByteArray&)) );
100 } 105 }
101 106
102 107
103} 108}
104OContactAccess::~OContactAccess () 109OContactAccess::~OContactAccess ()
105{ 110{
106 /* The user may forget to save the changed database, therefore try to 111 /* The user may forget to save the changed database, therefore try to
107 * do it for him.. 112 * do it for him..
108 */ 113 */
109 save(); 114 save();
110 // delete m_backEnd; is done by template.. 115 // delete m_backEnd; is done by template..
111} 116}
112 117
113 118
114bool OContactAccess::save () 119bool OContactAccess::save ()
115{ 120{
116 /* If the database was changed externally, we could not save the 121 /* If the database was changed externally, we could not save the
117 * Data. This will remove added items which is unacceptable ! 122 * Data. This will remove added items which is unacceptable !
118 * Therefore: Reload database and merge the data... 123 * Therefore: Reload database and merge the data...
119 */ 124 */
120 if ( OPimAccessTemplate<OContact>::wasChangedExternally() ) 125 if ( OPimAccessTemplate<OContact>::wasChangedExternally() )
121 reload(); 126 reload();
122 127
123 bool status = OPimAccessTemplate<OContact>::save(); 128 bool status = OPimAccessTemplate<OContact>::save();
124 if ( !status ) return false; 129 if ( !status ) return false;
125 130
126 /* Now tell everyone that new data is available. 131 /* Now tell everyone that new data is available.
127 */ 132 */
128 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" ); 133 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" );
129 134
130 return true; 135 return true;
131} 136}
132 137
133const uint OContactAccess::querySettings() 138const uint OContactAccess::querySettings()
134{ 139{
135 return ( m_backEnd->querySettings() ); 140 return ( m_backEnd->querySettings() );
136} 141}
137 142
138bool OContactAccess::hasQuerySettings ( int querySettings ) const 143bool OContactAccess::hasQuerySettings ( int querySettings ) const
139{ 144{
140 return ( m_backEnd->hasQuerySettings ( querySettings ) ); 145 return ( m_backEnd->hasQuerySettings ( querySettings ) );
141} 146}
142ORecordList<OContact> OContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const 147ORecordList<OContact> OContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const
143{ 148{
144 QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat ); 149 QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat );
145 return ( ORecordList<OContact>(matchingContacts, this) ); 150 return ( ORecordList<OContact>(matchingContacts, this) );
146} 151}
147 152
diff --git a/libopie/pim/opimmainwindow.cpp b/libopie/pim/opimmainwindow.cpp
index 2739e26..99a0333 100644
--- a/libopie/pim/opimmainwindow.cpp
+++ b/libopie/pim/opimmainwindow.cpp
@@ -1,72 +1,72 @@
1#include <qapplication.h> 1#include <qapplication.h>
2#include <qdatetime.h> 2#include <qdatetime.h>
3#include <qcopchannel_qws.h> 3#include <qcopchannel_qws.h>
4 4
5#include <qpe/sound.h> 5#include <qpe/sound.h>
6#include <qpe/qcopenvelope_qws.h> 6#include <qpe/qcopenvelope_qws.h>
7#include <qpe/qpeapplication.h> 7#include <qpe/qpeapplication.h>
8 8
9#include "opimresolver.h" 9#include "opimresolver.h"
10#include "opimmainwindow.h" 10#include "opimmainwindow.h"
11 11
12OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, 12OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent,
13 const char* name, WFlags flag ) 13 const char* name, WFlags flag )
14 : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) { 14 : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) {
15 15
16 /* 16 /*
17 * let's generate our QCopChannel 17 * let's generate our QCopChannel
18 */ 18 */
19 m_str = QString("QPE/"+m_service).local8Bit(); 19 m_str = QString("QPE/"+m_service).local8Bit();
20 m_channel= new QCopChannel(m_str, this ); 20 m_channel= new QCopChannel(m_str, this );
21 connect(m_channel, SIGNAL(received(const QCString&, const QByteArray& ) ), 21 connect(m_channel, SIGNAL(received(const QCString&,const QByteArray&) ),
22 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); 22 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
23 connect(qApp, SIGNAL(appMessage(const QCString&, const QByteArray& ) ), 23 connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&) ),
24 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); 24 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
25 25
26 /* connect flush and reload */ 26 /* connect flush and reload */
27 connect(qApp, SIGNAL(flush() ), 27 connect(qApp, SIGNAL(flush() ),
28 this, SLOT(flush() ) ); 28 this, SLOT(flush() ) );
29 connect(qApp, SIGNAL(reload() ), 29 connect(qApp, SIGNAL(reload() ),
30 this, SLOT(reload() ) ); 30 this, SLOT(reload() ) );
31} 31}
32OPimMainWindow::~OPimMainWindow() { 32OPimMainWindow::~OPimMainWindow() {
33 delete m_channel; 33 delete m_channel;
34} 34}
35QCopChannel* OPimMainWindow::channel() { 35QCopChannel* OPimMainWindow::channel() {
36 return m_channel; 36 return m_channel;
37} 37}
38void OPimMainWindow::doSetDocument( const QString& ) { 38void OPimMainWindow::doSetDocument( const QString& ) {
39 39
40} 40}
41void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) { 41void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) {
42 bool needShow = false; 42 bool needShow = false;
43 /* 43 /*
44 * create demands to create 44 * create demands to create
45 * a new record... 45 * a new record...
46 */ 46 */
47 QDataStream stream(array, IO_ReadOnly); 47 QDataStream stream(array, IO_ReadOnly);
48 if ( cmd == "create()" ) { 48 if ( cmd == "create()" ) {
49 raise(); 49 raise();
50 int uid = create(); 50 int uid = create();
51 QCopEnvelope e(m_str, "created(int)" ); 51 QCopEnvelope e(m_str, "created(int)" );
52 e << uid; 52 e << uid;
53 needShow = true; 53 needShow = true;
54 }else if ( cmd == "remove(int)" ) { 54 }else if ( cmd == "remove(int)" ) {
55 int uid; 55 int uid;
56 stream >> uid; 56 stream >> uid;
57 bool rem = remove( uid ); 57 bool rem = remove( uid );
58 QCopEnvelope e(m_str, "removed(bool)" ); 58 QCopEnvelope e(m_str, "removed(bool)" );
59 e << rem; 59 e << rem;
60 needShow = true; 60 needShow = true;
61 }else if ( cmd == "beam(int)" ) { 61 }else if ( cmd == "beam(int)" ) {
62 int uid; 62 int uid;
63 stream >> uid; 63 stream >> uid;
64 beam( uid); 64 beam( uid);
65 }else if ( cmd == "show(int)" ) { 65 }else if ( cmd == "show(int)" ) {
66 raise(); 66 raise();
67 int uid; 67 int uid;
68 stream >> uid; 68 stream >> uid;
69 show( uid ); 69 show( uid );
70 needShow = true; 70 needShow = true;
71 }else if ( cmd == "edit(int)" ) { 71 }else if ( cmd == "edit(int)" ) {
72 raise(); 72 raise();
diff --git a/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp b/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp
index a75f9dc..789496c 100644
--- a/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp
+++ b/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp
@@ -1,77 +1,77 @@
1 1
2#include <qstring.h> 2#include <qstring.h>
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qheader.h> 4#include <qheader.h>
5#include <qlayout.h> 5#include <qlayout.h>
6 6
7#include <qpe/qpeapplication.h> 7#include <qpe/qpeapplication.h>
8 8
9#include <opie2/oapplicationfactory.h> 9#include <opie2/oapplicationfactory.h>
10#include "osplitter_mail.h" 10#include "osplitter_mail.h"
11 11
12OPIE_EXPORT_APP( OApplicationFactory<ListViews> ) 12OPIE_EXPORT_APP( OApplicationFactory<ListViews> )
13 13
14class Folder { 14class Folder {
15 int dummy; 15 int dummy;
16}; 16};
17 17
18// ----------------------------------------------------------------- 18// -----------------------------------------------------------------
19 19
20ListViews::ListViews( QWidget* p, const char* name, WFlags fl ) 20ListViews::ListViews( QWidget* p, const char* name, WFlags fl )
21 : QWidget( p, name, fl ) { 21 : QWidget( p, name, fl ) {
22 qApp->installEventFilter( this ); 22 qApp->installEventFilter( this );
23 m_lstFolders.setAutoDelete( true ); 23 m_lstFolders.setAutoDelete( true );
24 QHBoxLayout *lay = new QHBoxLayout(this); 24 QHBoxLayout *lay = new QHBoxLayout(this);
25 25
26 m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" ); 26 m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" );
27 lay->addWidget( m_splitter ); 27 lay->addWidget( m_splitter );
28 connect(m_splitter, SIGNAL(sizeChange(bool, const QSize& ) ), 28 connect(m_splitter, SIGNAL(sizeChange(bool,const QSize&) ),
29 this, SLOT(slotSizeChange(bool, const QSize& ) ) ); 29 this, SLOT(slotSizeChange(bool,const QSize&) ) );
30 30
31 m_overview = new QListView( m_splitter ); 31 m_overview = new QListView( m_splitter );
32 m_overview->header()->setClickEnabled( FALSE ); 32 m_overview->header()->setClickEnabled( FALSE );
33 m_overview->addColumn( tr("Folder") ); 33 m_overview->addColumn( tr("Folder") );
34 m_overview->setMaximumWidth( 200 ); 34 m_overview->setMaximumWidth( 200 );
35 m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") ); 35 m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") );
36 m_splitter->setSizeChange( 300 ); 36 m_splitter->setSizeChange( 300 );
37 37
38 /* OSplitter starts with the small mode */ 38 /* OSplitter starts with the small mode */
39 m_messages = 0; 39 m_messages = 0;
40 m_message = m_attach = 0; 40 m_message = m_attach = 0;
41 41
42 splitti = new OSplitter( Vertical, m_splitter, "Splitti2" ); 42 splitti = new OSplitter( Vertical, m_splitter, "Splitti2" );
43 splitti->setSizeChange( 300 ); 43 splitti->setSizeChange( 300 );
44 splitti->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); 44 splitti->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) );
45 45
46 QLabel *lbl = new QLabel(splitti); 46 QLabel *lbl = new QLabel(splitti);
47 lbl->setTextFormat ( Qt::RichText ); 47 lbl->setTextFormat ( Qt::RichText );
48 lbl->setText("<br><br><b>Test Test Test</b><br><br><p>Fooooo hjhh</p>"); 48 lbl->setText("<br><br><b>Test Test Test</b><br><br><p>Fooooo hjhh</p>");
49 49
50 m_messages = new QListView( splitti ); 50 m_messages = new QListView( splitti );
51 m_messages->addColumn(" Messages "); 51 m_messages->addColumn(" Messages ");
52 52
53 folder1 = new QListView( splitti ); 53 folder1 = new QListView( splitti );
54 folder1->addColumn( "Messages 2 " ); 54 folder1->addColumn( "Messages 2 " );
55 55
56 splitti->addWidget(m_messages, "mail", tr("Mails") ); 56 splitti->addWidget(m_messages, "mail", tr("Mails") );
57 splitti->addWidget(folder1, "folder", tr("Folder") ); 57 splitti->addWidget(folder1, "folder", tr("Folder") );
58 splitti->addWidget( lbl, "logo", tr("Label") ); 58 splitti->addWidget( lbl, "logo", tr("Label") );
59 m_message = lbl; 59 m_message = lbl;
60 60
61 m_splitter->addWidget( splitti ); 61 m_splitter->addWidget( splitti );
62 62
63} 63}
64 64
65 65
66ListViews::~ListViews() { 66ListViews::~ListViews() {
67 67
68} 68}
69 69
70 70
71bool ListViews::eventFilter( QObject* obj, QEvent* ev ) { 71bool ListViews::eventFilter( QObject* obj, QEvent* ev ) {
72 if (!obj->isWidgetType() ) 72 if (!obj->isWidgetType() )
73 return false; 73 return false;
74 if ( ev->type() == QEvent::MouseButtonRelease ) { 74 if ( ev->type() == QEvent::MouseButtonRelease ) {
75 qWarning(" name %s, class %s", obj->name(), obj->className() ); 75 qWarning(" name %s, class %s", obj->name(), obj->className() );
76 } 76 }
77 77
diff --git a/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp b/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp
index f62729c..0d8bc9f 100644
--- a/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp
+++ b/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp
@@ -65,97 +65,97 @@ OpieUIDemo::OpieUIDemo( QWidget* parent, const char* name, WFlags fl )
65 demo->setItemParameter( demo->insertItem( "OComboBox", this, SLOT( demo(int) ) ), ocombobox ); 65 demo->setItemParameter( demo->insertItem( "OComboBox", this, SLOT( demo(int) ) ), ocombobox );
66 demo->setItemParameter( demo->insertItem( "OEditListBox", this, SLOT( demo(int) ) ), oeditlistbox ); 66 demo->setItemParameter( demo->insertItem( "OEditListBox", this, SLOT( demo(int) ) ), oeditlistbox );
67 demo->setItemParameter( demo->insertItem( "OSelector", this, SLOT( demo(int) ) ), oselector ); 67 demo->setItemParameter( demo->insertItem( "OSelector", this, SLOT( demo(int) ) ), oselector );
68 mbar->insertItem( "Demonstrate", demo ); 68 mbar->insertItem( "Demonstrate", demo );
69 69
70 build(); 70 build();
71 71
72} 72}
73 73
74OpieUIDemo::~OpieUIDemo() 74OpieUIDemo::~OpieUIDemo()
75{ 75{
76} 76}
77 77
78void OpieUIDemo::build() 78void OpieUIDemo::build()
79{ 79{
80 main = new QTabWidget( this, "tabwidget" ); 80 main = new QTabWidget( this, "tabwidget" );
81 setCentralWidget( main ); 81 setCentralWidget( main );
82 main->show(); 82 main->show();
83 83
84 main->addTab( new OVersatileViewDemo( main ), "VersatileView" ); 84 main->addTab( new OVersatileViewDemo( main ), "VersatileView" );
85} 85}
86 86
87 87
88void OpieUIDemo::demo( int d ) 88void OpieUIDemo::demo( int d )
89{ 89{
90 switch (d) 90 switch (d)
91 { 91 {
92 case ocompletionbox: demoOCompletionBox(); break; 92 case ocompletionbox: demoOCompletionBox(); break;
93 case olineedit: demoOLineEdit(); break; 93 case olineedit: demoOLineEdit(); break;
94 case ocombobox: demoOComboBox(); break; 94 case ocombobox: demoOComboBox(); break;
95 case oeditlistbox: demoOEditListBox(); break; 95 case oeditlistbox: demoOEditListBox(); break;
96 case oselector: demoOSelector(); break; 96 case oselector: demoOSelector(); break;
97 97
98 } 98 }
99 99
100} 100}
101 101
102void OpieUIDemo::demoOCompletionBox() 102void OpieUIDemo::demoOCompletionBox()
103{ 103{
104 qDebug( "ocompletionbox" ); 104 qDebug( "ocompletionbox" );
105 105
106 OCompletionBox* box = new OCompletionBox( 0 ); 106 OCompletionBox* box = new OCompletionBox( 0 );
107 box->insertItem( "This CompletionBox" ); 107 box->insertItem( "This CompletionBox" );
108 box->insertItem( "Says 'Hello World'" ); 108 box->insertItem( "Says 'Hello World'" );
109 box->insertItem( "Here are some" ); 109 box->insertItem( "Here are some" );
110 box->insertItem( "Additional Items" ); 110 box->insertItem( "Additional Items" );
111 box->insertItem( "Complete Completion Box" ); 111 box->insertItem( "Complete Completion Box" );
112 112
113 connect( box, SIGNAL( activated( const QString& ) ), this, SLOT( messageBox( const QString& ) ) ); 113 connect( box, SIGNAL( activated(const QString&) ), this, SLOT( messageBox(const QString&) ) );
114 box->popup(); 114 box->popup();
115 115
116} 116}
117 117
118void OpieUIDemo::demoOLineEdit() 118void OpieUIDemo::demoOLineEdit()
119{ 119{
120 qDebug( "olineedit" ); 120 qDebug( "olineedit" );
121 121
122 OLineEdit *edit = new OLineEdit( 0, "lineedit" ); 122 OLineEdit *edit = new OLineEdit( 0, "lineedit" );
123 123
124 edit->setCompletionMode( OGlobalSettings::CompletionPopup ); 124 edit->setCompletionMode( OGlobalSettings::CompletionPopup );
125 OCompletion* comp = edit->completionObject(); 125 OCompletion* comp = edit->completionObject();
126 126
127 QStringList list; 127 QStringList list;
128 list << "mickeyl@handhelds.org"; 128 list << "mickeyl@handhelds.org";
129 list << "mickey@tm.informatik.uni-frankfurt.de"; 129 list << "mickey@tm.informatik.uni-frankfurt.de";
130 list << "mickey@vanille.de"; 130 list << "mickey@vanille.de";
131 131
132 comp->setItems( list ); 132 comp->setItems( list );
133 133
134 edit->show(); 134 edit->show();
135 135
136} 136}
137 137
138void OpieUIDemo::demoOComboBox() 138void OpieUIDemo::demoOComboBox()
139{ 139{
140 qDebug( "ocombobox" ); 140 qDebug( "ocombobox" );
141 141
142 OComboBox *combo = new OComboBox( true, 0, "combobox" ); 142 OComboBox *combo = new OComboBox( true, 0, "combobox" );
143 143
144 combo->setCompletionMode( OGlobalSettings::CompletionPopup ); 144 combo->setCompletionMode( OGlobalSettings::CompletionPopup );
145 OCompletion* comp = combo->completionObject(); 145 OCompletion* comp = combo->completionObject();
146 146
147 QStringList ilist; 147 QStringList ilist;
148 ilist << "kergoth@handhelds.org"; 148 ilist << "kergoth@handhelds.org";
149 ilist << "harlekin@handhelds.org"; 149 ilist << "harlekin@handhelds.org";
150 ilist << "groucho@handhelds.org"; 150 ilist << "groucho@handhelds.org";
151 combo->insertStringList( ilist ); 151 combo->insertStringList( ilist );
152 152
153 QStringList clist; 153 QStringList clist;
154 clist << "mickeyl@handhelds.org"; 154 clist << "mickeyl@handhelds.org";
155 clist << "mickey@tm.informatik.uni-frankfurt.de"; 155 clist << "mickey@tm.informatik.uni-frankfurt.de";
156 clist << "mickey@vanille.de"; 156 clist << "mickey@vanille.de";
157 comp->setItems( clist ); 157 comp->setItems( clist );
158 158
159 combo->show(); 159 combo->show();
160 160
161} 161}
diff --git a/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp b/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp
index cf1e443..9db4e62 100644
--- a/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp
+++ b/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp
@@ -29,113 +29,113 @@
29 Boston, MA 02111-1307, USA. 29 Boston, MA 02111-1307, USA.
30 30
31*/ 31*/
32 32
33#include "oversatileviewdemo.h" 33#include "oversatileviewdemo.h"
34#include <opie2/oversatileview.h> 34#include <opie2/oversatileview.h>
35#include <opie2/oversatileviewitem.h> 35#include <opie2/oversatileviewitem.h>
36 36
37#include <qstring.h> 37#include <qstring.h>
38#include <qpixmap.h> 38#include <qpixmap.h>
39#include <qlistview.h> 39#include <qlistview.h>
40 40
41OVersatileViewDemo::OVersatileViewDemo( QWidget* parent, const char* name, WFlags f ) 41OVersatileViewDemo::OVersatileViewDemo( QWidget* parent, const char* name, WFlags f )
42 :QVBox( parent, name, f ) 42 :QVBox( parent, name, f )
43{ 43{
44 vv = new OVersatileView( this ); 44 vv = new OVersatileView( this );
45 45
46 vv->addColumn( "First" ); 46 vv->addColumn( "First" );
47 vv->addColumn( "2nd" ); 47 vv->addColumn( "2nd" );
48 vv->addColumn( "IIIrd" ); 48 vv->addColumn( "IIIrd" );
49 49
50 QString counter; 50 QString counter;
51 51
52 QPixmap leaf( "leaf.png" ); 52 QPixmap leaf( "leaf.png" );
53 QPixmap opened( "folder_opened.png" ); 53 QPixmap opened( "folder_opened.png" );
54 QPixmap closed( "folder_closed.png" ); 54 QPixmap closed( "folder_closed.png" );
55 55
56 QPixmap leaf32( "leaf32.png" ); 56 QPixmap leaf32( "leaf32.png" );
57 QPixmap opened32( "folder_opened32.png" ); 57 QPixmap opened32( "folder_opened32.png" );
58 QPixmap closed32( "folder_closed32.png" ); 58 QPixmap closed32( "folder_closed32.png" );
59 59
60 vv->setDefaultPixmaps( OVersatileView::Tree, leaf, opened, closed ); 60 vv->setDefaultPixmaps( OVersatileView::Tree, leaf, opened, closed );
61 vv->setDefaultPixmaps( OVersatileView::Icons, leaf32, opened32, closed32 ); 61 vv->setDefaultPixmaps( OVersatileView::Icons, leaf32, opened32, closed32 );
62 62
63 OVersatileViewItem* item; 63 OVersatileViewItem* item;
64 OVersatileViewItem* item2; 64 OVersatileViewItem* item2;
65 65
66 for ( int i = 0; i < 5; ++i ) 66 for ( int i = 0; i < 5; ++i )
67 { 67 {
68 counter.sprintf( "%d", i ); 68 counter.sprintf( "%d", i );
69 item = new OVersatileViewItem( vv, "Item", "Text", "Some more", counter ); 69 item = new OVersatileViewItem( vv, "Item", "Text", "Some more", counter );
70 item->setRenameEnabled( true ); 70 item->setRenameEnabled( true );
71 item2 = new OVersatileViewItem( item, "OSubitem", "123", "...", counter ); 71 item2 = new OVersatileViewItem( item, "OSubitem", "123", "...", counter );
72 item2->setRenameEnabled( true ); 72 item2->setRenameEnabled( true );
73 73
74 } 74 }
75 75
76 connect( vv, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) ); 76 connect( vv, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) );
77 connect( vv, SIGNAL( selectionChanged( OVersatileViewItem * ) ), this, SLOT( selectionChanged( OVersatileViewItem * ) ) ); 77 connect( vv, SIGNAL( selectionChanged(OVersatileViewItem*) ), this, SLOT( selectionChanged(OVersatileViewItem*) ) );
78 connect( vv, SIGNAL( currentChanged( OVersatileViewItem * ) ), this, SLOT( currentChanged( OVersatileViewItem * ) ) ); 78 connect( vv, SIGNAL( currentChanged(OVersatileViewItem*) ), this, SLOT( currentChanged(OVersatileViewItem*) ) );
79 connect( vv, SIGNAL( clicked( OVersatileViewItem * ) ), this, SLOT( clicked( OVersatileViewItem * ) ) ); 79 connect( vv, SIGNAL( clicked(OVersatileViewItem*) ), this, SLOT( clicked(OVersatileViewItem*) ) );
80 connect( vv, SIGNAL( pressed( OVersatileViewItem * ) ), this, SLOT( pressed( OVersatileViewItem * ) ) ); 80 connect( vv, SIGNAL( pressed(OVersatileViewItem*) ), this, SLOT( pressed(OVersatileViewItem*) ) );
81 81
82 connect( vv, SIGNAL( doubleClicked( OVersatileViewItem * ) ), this, SLOT( doubleClicked( OVersatileViewItem * ) ) ); 82 connect( vv, SIGNAL( doubleClicked(OVersatileViewItem*) ), this, SLOT( doubleClicked(OVersatileViewItem*) ) );
83 connect( vv, SIGNAL( returnPressed( OVersatileViewItem * ) ), this, SLOT( returnPressed( OVersatileViewItem * ) ) ); 83 connect( vv, SIGNAL( returnPressed(OVersatileViewItem*) ), this, SLOT( returnPressed(OVersatileViewItem*) ) );
84 84
85 connect( vv, SIGNAL( onItem( OVersatileViewItem * ) ), this, SLOT( onItem( OVersatileViewItem * ) ) ); 85 connect( vv, SIGNAL( onItem(OVersatileViewItem*) ), this, SLOT( onItem(OVersatileViewItem*) ) );
86 connect( vv, SIGNAL( onViewport() ), this, SLOT( onViewport() ) ); 86 connect( vv, SIGNAL( onViewport() ), this, SLOT( onViewport() ) );
87 87
88 connect( vv, SIGNAL( expanded( OVersatileViewItem * ) ), this, SLOT( expanded( OVersatileViewItem * ) ) ); 88 connect( vv, SIGNAL( expanded(OVersatileViewItem*) ), this, SLOT( expanded(OVersatileViewItem*) ) );
89 connect( vv, SIGNAL( collapsed( OVersatileViewItem * ) ), this, SLOT( collapsed( OVersatileViewItem * ) ) ); 89 connect( vv, SIGNAL( collapsed(OVersatileViewItem*) ), this, SLOT( collapsed(OVersatileViewItem*) ) );
90 90
91 connect( vv, SIGNAL( moved() ), this, SLOT( moved() ) ); 91 connect( vv, SIGNAL( moved() ), this, SLOT( moved() ) );
92 92
93 connect( vv, SIGNAL( contextMenuRequested( OVersatileViewItem *, const QPoint&, int ) ), this, SLOT( contextMenuRequested( OVersatileViewItem *, const QPoint&, int ) ) ); 93 connect( vv, SIGNAL( contextMenuRequested(OVersatileViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(OVersatileViewItem*,const QPoint&,int) ) );
94 94
95} 95}
96 96
97OVersatileViewDemo::~OVersatileViewDemo() 97OVersatileViewDemo::~OVersatileViewDemo()
98{ 98{
99} 99}
100 100
101void OVersatileViewDemo::selectionChanged() 101void OVersatileViewDemo::selectionChanged()
102{ 102{
103 qDebug( "received signal selectionChanged()" ); 103 qDebug( "received signal selectionChanged()" );
104} 104}
105void OVersatileViewDemo::selectionChanged( OVersatileViewItem * item ) 105void OVersatileViewDemo::selectionChanged( OVersatileViewItem * item )
106{ 106{
107 qDebug( "received signal selectionChanged(OVersatileViewItem*)" ); 107 qDebug( "received signal selectionChanged(OVersatileViewItem*)" );
108} 108}
109void OVersatileViewDemo::currentChanged( OVersatileViewItem * item ) 109void OVersatileViewDemo::currentChanged( OVersatileViewItem * item )
110{ 110{
111 qDebug( "received signal currentChanged( OVersatileViewItem * )" ); 111 qDebug( "received signal currentChanged( OVersatileViewItem * )" );
112} 112}
113void OVersatileViewDemo::clicked( OVersatileViewItem * item ) 113void OVersatileViewDemo::clicked( OVersatileViewItem * item )
114{ 114{
115 qDebug( "received signal clicked( OVersatileViewItem * )" ); 115 qDebug( "received signal clicked( OVersatileViewItem * )" );
116} 116}
117void OVersatileViewDemo::pressed( OVersatileViewItem * item ) 117void OVersatileViewDemo::pressed( OVersatileViewItem * item )
118{ 118{
119 qDebug( "received signal pressed( OVersatileViewItem * )" ); 119 qDebug( "received signal pressed( OVersatileViewItem * )" );
120} 120}
121 121
122void OVersatileViewDemo::doubleClicked( OVersatileViewItem *item ) 122void OVersatileViewDemo::doubleClicked( OVersatileViewItem *item )
123{ 123{
124 qDebug( "received signal doubleClicked( OVersatileViewItem *item )" ); 124 qDebug( "received signal doubleClicked( OVersatileViewItem *item )" );
125} 125}
126void OVersatileViewDemo::returnPressed( OVersatileViewItem *item ) 126void OVersatileViewDemo::returnPressed( OVersatileViewItem *item )
127{ 127{
128 qDebug( "received signal returnPressed( OVersatileViewItem *item )" ); 128 qDebug( "received signal returnPressed( OVersatileViewItem *item )" );
129} 129}
130 130
131void OVersatileViewDemo::onItem( OVersatileViewItem *item ) 131void OVersatileViewDemo::onItem( OVersatileViewItem *item )
132{ 132{
133 qDebug( "received signal onItem( OVersatileViewItem *item )" ); 133 qDebug( "received signal onItem( OVersatileViewItem *item )" );
134} 134}
135void OVersatileViewDemo::onViewport() 135void OVersatileViewDemo::onViewport()
136{ 136{
137 qDebug( "received signal onViewport()" ); 137 qDebug( "received signal onViewport()" );
138} 138}
139 139
140void OVersatileViewDemo::expanded( OVersatileViewItem *item ) 140void OVersatileViewDemo::expanded( OVersatileViewItem *item )
141{ 141{
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index b8d48fe..27b0e53 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -100,97 +100,97 @@ ODevice *ODevice::inst()
100 } 100 }
101 return dev; 101 return dev;
102} 102}
103 103
104ODevice::ODevice() 104ODevice::ODevice()
105{ 105{
106 d = new ODeviceData; 106 d = new ODeviceData;
107 107
108 d->m_modelstr = "Unknown"; 108 d->m_modelstr = "Unknown";
109 d->m_model = Model_Unknown; 109 d->m_model = Model_Unknown;
110 d->m_vendorstr = "Unknown"; 110 d->m_vendorstr = "Unknown";
111 d->m_vendor = Vendor_Unknown; 111 d->m_vendor = Vendor_Unknown;
112 d->m_systemstr = "Unknown"; 112 d->m_systemstr = "Unknown";
113 d->m_system = System_Unknown; 113 d->m_system = System_Unknown;
114 d->m_sysverstr = "0.0"; 114 d->m_sysverstr = "0.0";
115 d->m_rotation = Rot0; 115 d->m_rotation = Rot0;
116 d->m_direction = CW; 116 d->m_direction = CW;
117 117
118 d->m_holdtime = 1000; // 1000ms 118 d->m_holdtime = 1000; // 1000ms
119 d->m_buttons = 0; 119 d->m_buttons = 0;
120 d->m_cpu_frequencies = new QStrList; 120 d->m_cpu_frequencies = new QStrList;
121} 121}
122 122
123void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) 123void ODevice::systemMessage ( const QCString &msg, const QByteArray & )
124{ 124{
125 if ( msg == "deviceButtonMappingChanged()" ) { 125 if ( msg == "deviceButtonMappingChanged()" ) {
126 reloadButtonMapping(); 126 reloadButtonMapping();
127 } 127 }
128} 128}
129 129
130void ODevice::init() 130void ODevice::init()
131{ 131{
132} 132}
133 133
134/** 134/**
135* This method initialises the button mapping 135* This method initialises the button mapping
136*/ 136*/
137void ODevice::initButtons() 137void ODevice::initButtons()
138{ 138{
139 if ( d->m_buttons ) 139 if ( d->m_buttons )
140 return; 140 return;
141 141
142 qDebug ( "init Buttons" ); 142 qDebug ( "init Buttons" );
143 d->m_buttons = new QValueList <ODeviceButton>; 143 d->m_buttons = new QValueList <ODeviceButton>;
144 144
145 reloadButtonMapping(); 145 reloadButtonMapping();
146 146
147 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 147 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
148 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 148 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
149} 149}
150 150
151ODevice::~ODevice() 151ODevice::~ODevice()
152{ 152{
153// we leak m_devicebuttons and m_cpu_frequency 153// we leak m_devicebuttons and m_cpu_frequency
154// but it's a singleton and it is not so importantant 154// but it's a singleton and it is not so importantant
155// -zecke 155// -zecke
156 delete d; 156 delete d;
157} 157}
158 158
159bool ODevice::setSoftSuspend ( bool /*soft*/ ) 159bool ODevice::setSoftSuspend ( bool /*soft*/ )
160{ 160{
161 return false; 161 return false;
162} 162}
163 163
164//#include <linux/apm_bios.h> 164//#include <linux/apm_bios.h>
165 165
166#define APM_IOC_SUSPEND OD_IO( 'A', 2 ) 166#define APM_IOC_SUSPEND OD_IO( 'A', 2 )
167 167
168/** 168/**
169* This method will try to suspend the device 169* This method will try to suspend the device
170* It only works if the user is the QWS Server and the apm application 170* It only works if the user is the QWS Server and the apm application
171* is installed. 171* is installed.
172* It tries to suspend and then waits some time cause some distributions 172* It tries to suspend and then waits some time cause some distributions
173* do have asynchronus apm implementations. 173* do have asynchronus apm implementations.
174* This method will either fail and return false or it'll suspend the 174* This method will either fail and return false or it'll suspend the
175* device and return once the device got woken up 175* device and return once the device got woken up
176* 176*
177* @return if the device got suspended 177* @return if the device got suspended
178*/ 178*/
179bool ODevice::suspend() 179bool ODevice::suspend()
180{ 180{
181 qDebug("ODevice::suspend"); 181 qDebug("ODevice::suspend");
182 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 182 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
183 return false; 183 return false;
184 184
185 if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices 185 if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
186 return false; 186 return false;
187 187
188 bool res = false; 188 bool res = false;
189 ODevice::sendSuspendmsg(); 189 ODevice::sendSuspendmsg();
190 190
191 struct timeval tvs, tvn; 191 struct timeval tvs, tvn;
192 ::gettimeofday ( &tvs, 0 ); 192 ::gettimeofday ( &tvs, 0 );
193 193
194 ::sync(); // flush fs caches 194 ::sync(); // flush fs caches
195 res = ( ::system ( "apm --suspend" ) == 0 ); 195 res = ( ::system ( "apm --suspend" ) == 0 );
196 196
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp
index cc4b01a..8ecea1b 100644
--- a/libopie2/opiecore/device/odevice_ipaq.cpp
+++ b/libopie2/opiecore/device/odevice_ipaq.cpp
@@ -167,97 +167,97 @@ void iPAQ::init()
167 f. close(); 167 f. close();
168 } else { 168 } else {
169 f. setName ( "/etc/oz_version" ); 169 f. setName ( "/etc/oz_version" );
170 170
171 if ( f. open ( IO_ReadOnly )) { 171 if ( f. open ( IO_ReadOnly )) {
172 d->m_systemstr = "OpenEmbedded/iPaq"; 172 d->m_systemstr = "OpenEmbedded/iPaq";
173 d->m_system = System_Familiar; 173 d->m_system = System_Familiar;
174 174
175 QTextStream ts ( &f ); 175 QTextStream ts ( &f );
176 ts.setDevice ( &f ); 176 ts.setDevice ( &f );
177 d->m_sysverstr = ts. readLine(); 177 d->m_sysverstr = ts. readLine();
178 f. close(); 178 f. close();
179 } 179 }
180 } 180 }
181 181
182 m_leds [0] = m_leds [1] = Led_Off; 182 m_leds [0] = m_leds [1] = Led_Off;
183 183
184 m_power_timer = 0; 184 m_power_timer = 0;
185 185
186} 186}
187 187
188void iPAQ::initButtons() 188void iPAQ::initButtons()
189{ 189{
190 if ( d->m_buttons ) 190 if ( d->m_buttons )
191 return; 191 return;
192 192
193 if ( isQWS( ) ) 193 if ( isQWS( ) )
194 QWSServer::setKeyboardFilter ( this ); 194 QWSServer::setKeyboardFilter ( this );
195 195
196 d->m_buttons = new QValueList <ODeviceButton>; 196 d->m_buttons = new QValueList <ODeviceButton>;
197 197
198 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 198 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
199 i_button *ib = ipaq_buttons + i; 199 i_button *ib = ipaq_buttons + i;
200 ODeviceButton b; 200 ODeviceButton b;
201 201
202 if (( ib->model & d->m_model ) == d->m_model ) { 202 if (( ib->model & d->m_model ) == d->m_model ) {
203 b. setKeycode ( ib->code ); 203 b. setKeycode ( ib->code );
204 b. setUserText ( QObject::tr ( "Button", ib->utext )); 204 b. setUserText ( QObject::tr ( "Button", ib->utext ));
205 b. setPixmap ( Resource::loadPixmap ( ib->pix )); 205 b. setPixmap ( Resource::loadPixmap ( ib->pix ));
206 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); 206 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction ));
207 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); 207 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction ));
208 208
209 d->m_buttons->append ( b ); 209 d->m_buttons->append ( b );
210 } 210 }
211 } 211 }
212 reloadButtonMapping(); 212 reloadButtonMapping();
213 213
214 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 214 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
215 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 215 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
216} 216}
217 217
218QValueList <OLed> iPAQ::ledList() const 218QValueList <OLed> iPAQ::ledList() const
219{ 219{
220 QValueList <OLed> vl; 220 QValueList <OLed> vl;
221 vl << Led_Power; 221 vl << Led_Power;
222 222
223 if ( d->m_model == Model_iPAQ_H38xx ) 223 if ( d->m_model == Model_iPAQ_H38xx )
224 vl << Led_BlueTooth; 224 vl << Led_BlueTooth;
225 return vl; 225 return vl;
226} 226}
227 227
228QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const 228QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const
229{ 229{
230 QValueList <OLedState> vl; 230 QValueList <OLedState> vl;
231 231
232 if ( l == Led_Power ) 232 if ( l == Led_Power )
233 vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; 233 vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast;
234 else if ( l == Led_BlueTooth && d->m_model == Model_iPAQ_H38xx ) 234 else if ( l == Led_BlueTooth && d->m_model == Model_iPAQ_H38xx )
235 vl << Led_Off; // << Led_On << ??? 235 vl << Led_Off; // << Led_On << ???
236 236
237 return vl; 237 return vl;
238} 238}
239 239
240OLedState iPAQ::ledState ( OLed l ) const 240OLedState iPAQ::ledState ( OLed l ) const
241{ 241{
242 switch ( l ) { 242 switch ( l ) {
243 case Led_Power: 243 case Led_Power:
244 return m_leds [0]; 244 return m_leds [0];
245 case Led_BlueTooth: 245 case Led_BlueTooth:
246 return m_leds [1]; 246 return m_leds [1];
247 default: 247 default:
248 return Led_Off; 248 return Led_Off;
249 } 249 }
250} 250}
251 251
252bool iPAQ::setLedState ( OLed l, OLedState st ) 252bool iPAQ::setLedState ( OLed l, OLedState st )
253{ 253{
254 static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK ); 254 static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK );
255 255
256 if ( l == Led_Power ) { 256 if ( l == Led_Power ) {
257 if ( fd >= 0 ) { 257 if ( fd >= 0 ) {
258 LED_IN leds; 258 LED_IN leds;
259 ::memset ( &leds, 0, sizeof( leds )); 259 ::memset ( &leds, 0, sizeof( leds ));
260 leds. TotalTime = 0; 260 leds. TotalTime = 0;
261 leds. OnTime = 0; 261 leds. OnTime = 0;
262 leds. OffTime = 1; 262 leds. OffTime = 1;
263 leds. OffOnBlink = 2; 263 leds. OffOnBlink = 2;
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp
index 31b9297..90aca2f 100644
--- a/libopie2/opiecore/device/odevice_simpad.cpp
+++ b/libopie2/opiecore/device/odevice_simpad.cpp
@@ -144,97 +144,97 @@ void SIMpad::init()
144 f. close(); 144 f. close();
145 } else { 145 } else {
146 f. setName ( "/etc/oz_version" ); 146 f. setName ( "/etc/oz_version" );
147 147
148 if ( f. open ( IO_ReadOnly )) { 148 if ( f. open ( IO_ReadOnly )) {
149 d->m_systemstr = "OpenEmbedded/SIMpad"; 149 d->m_systemstr = "OpenEmbedded/SIMpad";
150 d->m_system = System_OpenZaurus; 150 d->m_system = System_OpenZaurus;
151 151
152 QTextStream ts ( &f ); 152 QTextStream ts ( &f );
153 ts.setDevice ( &f ); 153 ts.setDevice ( &f );
154 d->m_sysverstr = ts. readLine(); 154 d->m_sysverstr = ts. readLine();
155 f. close(); 155 f. close();
156 } 156 }
157 } 157 }
158 158
159 m_leds [0] = m_leds [1] = Led_Off; 159 m_leds [0] = m_leds [1] = Led_Off;
160 160
161 m_power_timer = 0; 161 m_power_timer = 0;
162 162
163} 163}
164 164
165void SIMpad::initButtons() 165void SIMpad::initButtons()
166{ 166{
167 if ( d->m_buttons ) 167 if ( d->m_buttons )
168 return; 168 return;
169 169
170 if ( isQWS( ) ) 170 if ( isQWS( ) )
171 QWSServer::setKeyboardFilter ( this ); 171 QWSServer::setKeyboardFilter ( this );
172 172
173 d->m_buttons = new QValueList <ODeviceButton>; 173 d->m_buttons = new QValueList <ODeviceButton>;
174 174
175 for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { 175 for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) {
176 s_button *sb = simpad_buttons + i; 176 s_button *sb = simpad_buttons + i;
177 ODeviceButton b; 177 ODeviceButton b;
178 178
179 if (( sb->model & d->m_model ) == d->m_model ) { 179 if (( sb->model & d->m_model ) == d->m_model ) {
180 b. setKeycode ( sb->code ); 180 b. setKeycode ( sb->code );
181 b. setUserText ( QObject::tr ( "Button", sb->utext )); 181 b. setUserText ( QObject::tr ( "Button", sb->utext ));
182 b. setPixmap ( Resource::loadPixmap ( sb->pix )); 182 b. setPixmap ( Resource::loadPixmap ( sb->pix ));
183 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb->fpressedservice ), sb->fpressedaction )); 183 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb->fpressedservice ), sb->fpressedaction ));
184 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb->fheldservice ), sb->fheldaction )); 184 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb->fheldservice ), sb->fheldaction ));
185 185
186 d->m_buttons->append ( b ); 186 d->m_buttons->append ( b );
187 } 187 }
188 } 188 }
189 reloadButtonMapping(); 189 reloadButtonMapping();
190 190
191 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 191 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
192 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 192 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
193} 193}
194 194
195// SIMpad boardcontrol register CS3 195// SIMpad boardcontrol register CS3
196#define SIMPAD_BOARDCONTROL "/proc/cs3" 196#define SIMPAD_BOARDCONTROL "/proc/cs3"
197#define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA 197#define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA
198#define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA 198#define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA
199#define SIMPAD_EN1 0x0004 // This is only for EPROM's 199#define SIMPAD_EN1 0x0004 // This is only for EPROM's
200#define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V 200#define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V
201#define SIMPAD_DISPLAY_ON 0x0010 201#define SIMPAD_DISPLAY_ON 0x0010
202#define SIMPAD_PCMCIA_BUFF_DIS 0x0020 202#define SIMPAD_PCMCIA_BUFF_DIS 0x0020
203#define SIMPAD_MQ_RESET 0x0040 203#define SIMPAD_MQ_RESET 0x0040
204#define SIMPAD_PCMCIA_RESET 0x0080 204#define SIMPAD_PCMCIA_RESET 0x0080
205#define SIMPAD_DECT_POWER_ON 0x0100 205#define SIMPAD_DECT_POWER_ON 0x0100
206#define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave 206#define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave
207#define SIMPAD_RS232_ON 0x0400 207#define SIMPAD_RS232_ON 0x0400
208#define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave 208#define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave
209#define SIMPAD_LED2_ON 0x1000 209#define SIMPAD_LED2_ON 0x1000
210#define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode 210#define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode
211#define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit 211#define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit
212#define SIMPAD_RESET_SIMCARD 0x8000 212#define SIMPAD_RESET_SIMCARD 0x8000
213 213
214//SIMpad touchscreen backlight strength control 214//SIMpad touchscreen backlight strength control
215#define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" 215#define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL"
216#define SIMPAD_BACKLIGHT_MASK 0x00a10044 216#define SIMPAD_BACKLIGHT_MASK 0x00a10044
217 217
218QValueList <OLed> SIMpad::ledList() const 218QValueList <OLed> SIMpad::ledList() const
219{ 219{
220 QValueList <OLed> vl; 220 QValueList <OLed> vl;
221 vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one? 221 vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one?
222 //vl << Led_Mail; //TODO find out if LED1 is accessible anyway 222 //vl << Led_Mail; //TODO find out if LED1 is accessible anyway
223 return vl; 223 return vl;
224} 224}
225 225
226QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const 226QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const
227{ 227{
228 QValueList <OLedState> vl; 228 QValueList <OLedState> vl;
229 229
230 if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one? 230 if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one?
231 vl << Led_Off << Led_On; 231 vl << Led_Off << Led_On;
232 //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway 232 //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway
233 //vl << Led_Off; 233 //vl << Led_Off;
234 return vl; 234 return vl;
235} 235}
236 236
237OLedState SIMpad::ledState ( OLed l ) const 237OLedState SIMpad::ledState ( OLed l ) const
238{ 238{
239 switch ( l ) { 239 switch ( l ) {
240 case Led_Power: 240 case Led_Power:
diff --git a/libopie2/opiecore/device/odevice_yopy.cpp b/libopie2/opiecore/device/odevice_yopy.cpp
index a76f90b..d241db8 100644
--- a/libopie2/opiecore/device/odevice_yopy.cpp
+++ b/libopie2/opiecore/device/odevice_yopy.cpp
@@ -74,90 +74,90 @@ void Yopy::init()
74{ 74{
75 d->m_vendorstr = "G.Mate"; 75 d->m_vendorstr = "G.Mate";
76 d->m_vendor = Vendor_GMate; 76 d->m_vendor = Vendor_GMate;
77 d->m_modelstr = "Yopy3700"; 77 d->m_modelstr = "Yopy3700";
78 d->m_model = Model_Yopy_3700; 78 d->m_model = Model_Yopy_3700;
79 d->m_rotation = Rot0; 79 d->m_rotation = Rot0;
80 80
81 d->m_systemstr = "Linupy"; 81 d->m_systemstr = "Linupy";
82 d->m_system = System_Linupy; 82 d->m_system = System_Linupy;
83 83
84 QFile f ( "/etc/issue" ); 84 QFile f ( "/etc/issue" );
85 if ( f. open ( IO_ReadOnly ) ) 85 if ( f. open ( IO_ReadOnly ) )
86 { 86 {
87 QTextStream ts ( &f ); 87 QTextStream ts ( &f );
88 ts.readLine(); 88 ts.readLine();
89 d->m_sysverstr = ts. readLine(); 89 d->m_sysverstr = ts. readLine();
90 f. close(); 90 f. close();
91 } 91 }
92} 92}
93 93
94 94
95void Yopy::initButtons() 95void Yopy::initButtons()
96{ 96{
97 if ( d->m_buttons ) 97 if ( d->m_buttons )
98 return ; 98 return ;
99 99
100 d->m_buttons = new QValueList <ODeviceButton>; 100 d->m_buttons = new QValueList <ODeviceButton>;
101 101
102 for ( uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof( yopy_button ) ); i++ ) 102 for ( uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof( yopy_button ) ); i++ )
103 { 103 {
104 104
105 yopy_button *ib = yopy_buttons + i; 105 yopy_button *ib = yopy_buttons + i;
106 106
107 ODeviceButton b; 107 ODeviceButton b;
108 108
109 b. setKeycode ( ib->code ); 109 b. setKeycode ( ib->code );
110 b. setUserText ( QObject::tr ( "Button", ib->utext ) ); 110 b. setUserText ( QObject::tr ( "Button", ib->utext ) );
111 b. setPixmap ( Resource::loadPixmap ( ib->pix ) ); 111 b. setPixmap ( Resource::loadPixmap ( ib->pix ) );
112 b. setFactoryPresetPressedAction 112 b. setFactoryPresetPressedAction
113 ( OQCopMessage( makeChannel( ib->fpressedservice ), ib->fpressedaction ) ); 113 ( OQCopMessage( makeChannel( ib->fpressedservice ), ib->fpressedaction ) );
114 b. setFactoryPresetHeldAction 114 b. setFactoryPresetHeldAction
115 ( OQCopMessage( makeChannel( ib->fheldservice ), ib->fheldaction ) ); 115 ( OQCopMessage( makeChannel( ib->fheldservice ), ib->fheldaction ) );
116 116
117 d->m_buttons->append ( b ); 117 d->m_buttons->append ( b );
118 } 118 }
119 reloadButtonMapping(); 119 reloadButtonMapping();
120 120
121 QCopChannel *sysch = new QCopChannel( "QPE/System", this ); 121 QCopChannel *sysch = new QCopChannel( "QPE/System", this );
122 connect( sysch, SIGNAL( received( const QCString &, const QByteArray & ) ), 122 connect( sysch, SIGNAL( received(const QCString&,const QByteArray&) ),
123 this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); 123 this, SLOT( systemMessage(const QCString&,const QByteArray&) ) );
124} 124}
125 125
126 126
127bool Yopy::suspend() 127bool Yopy::suspend()
128{ 128{
129 /* Opie for Yopy does not implement its own power management at the 129 /* Opie for Yopy does not implement its own power management at the
130 moment. The public version runs parallel to X, and relies on the 130 moment. The public version runs parallel to X, and relies on the
131 existing power management features. */ 131 existing power management features. */
132 return false; 132 return false;
133} 133}
134 134
135 135
136bool Yopy::setDisplayBrightness( int bright ) 136bool Yopy::setDisplayBrightness( int bright )
137{ 137{
138 /* The code here works, but is disabled as the current version runs 138 /* The code here works, but is disabled as the current version runs
139 parallel to X, and relies on the existing backlight demon. */ 139 parallel to X, and relies on the existing backlight demon. */
140#if 0 140#if 0
141 if ( QFile::exists( "/proc/sys/pm/light" ) ) 141 if ( QFile::exists( "/proc/sys/pm/light" ) )
142 { 142 {
143 int fd = ::open( "/proc/sys/pm/light", O_WRONLY ); 143 int fd = ::open( "/proc/sys/pm/light", O_WRONLY );
144 if ( fd >= 0 ) 144 if ( fd >= 0 )
145 { 145 {
146 if ( bright ) 146 if ( bright )
147 ::write( fd, "1\n", 2 ); 147 ::write( fd, "1\n", 2 );
148 else 148 else
149 ::write( fd, "0\n", 2 ); 149 ::write( fd, "0\n", 2 );
150 ::close( fd ); 150 ::close( fd );
151 return true; 151 return true;
152 } 152 }
153 } 153 }
154#endif 154#endif
155 return false; 155 return false;
156} 156}
157 157
158 158
159int Yopy::displayBrightnessResolution() const 159int Yopy::displayBrightnessResolution() const
160{ 160{
161 return 2; 161 return 2;
162} 162}
163 163
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 9d23a12..8ab3cbe 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -207,98 +207,98 @@ void Zaurus::init()
207 case Model_Zaurus_SLB600: 207 case Model_Zaurus_SLB600:
208 case Model_Zaurus_SL5500: 208 case Model_Zaurus_SL5500:
209 case Model_Zaurus_SL5000: 209 case Model_Zaurus_SL5000:
210 default: 210 default:
211 d->m_rotation = Rot270; 211 d->m_rotation = Rot270;
212 break; 212 break;
213 } 213 }
214 m_leds [0] = Led_Off; 214 m_leds [0] = Led_Off;
215} 215}
216 216
217void Zaurus::initButtons() 217void Zaurus::initButtons()
218{ 218{
219 if ( d->m_buttons ) 219 if ( d->m_buttons )
220 return; 220 return;
221 221
222 d->m_buttons = new QValueList <ODeviceButton>; 222 d->m_buttons = new QValueList <ODeviceButton>;
223 223
224 struct z_button * pz_buttons; 224 struct z_button * pz_buttons;
225 int buttoncount; 225 int buttoncount;
226 switch ( d->m_model ) { 226 switch ( d->m_model ) {
227 case Model_Zaurus_SLC7x0: 227 case Model_Zaurus_SLC7x0:
228 pz_buttons = z_buttons_c700; 228 pz_buttons = z_buttons_c700;
229 buttoncount = ARRAY_SIZE(z_buttons_c700); 229 buttoncount = ARRAY_SIZE(z_buttons_c700);
230 break; 230 break;
231 default: 231 default:
232 pz_buttons = z_buttons; 232 pz_buttons = z_buttons;
233 buttoncount = ARRAY_SIZE(z_buttons); 233 buttoncount = ARRAY_SIZE(z_buttons);
234 break; 234 break;
235 } 235 }
236 236
237 for ( int i = 0; i < buttoncount; i++ ) { 237 for ( int i = 0; i < buttoncount; i++ ) {
238 struct z_button *zb = pz_buttons + i; 238 struct z_button *zb = pz_buttons + i;
239 ODeviceButton b; 239 ODeviceButton b;
240 240
241 b. setKeycode ( zb->code ); 241 b. setKeycode ( zb->code );
242 b. setUserText ( QObject::tr ( "Button", zb->utext )); 242 b. setUserText ( QObject::tr ( "Button", zb->utext ));
243 b. setPixmap ( Resource::loadPixmap ( zb->pix )); 243 b. setPixmap ( Resource::loadPixmap ( zb->pix ));
244 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb->fpressedservice ), 244 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb->fpressedservice ),
245 zb->fpressedaction )); 245 zb->fpressedaction ));
246 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb->fheldservice ), 246 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb->fheldservice ),
247 zb->fheldaction )); 247 zb->fheldaction ));
248 248
249 d->m_buttons->append ( b ); 249 d->m_buttons->append ( b );
250 } 250 }
251 251
252 reloadButtonMapping(); 252 reloadButtonMapping();
253 253
254 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 254 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
255 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), 255 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)),
256 this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 256 this, SLOT( systemMessage(const QCString&,const QByteArray&)));
257} 257}
258 258
259#include <unistd.h> 259#include <unistd.h>
260#include <fcntl.h> 260#include <fcntl.h>
261#include <sys/ioctl.h> 261#include <sys/ioctl.h>
262 262
263//#include <asm/sharp_char.h> // including kernel headers is evil ... 263//#include <asm/sharp_char.h> // including kernel headers is evil ...
264 264
265#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 265#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
266 266
267 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 267 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
268#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 268#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
269 269
270#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 270#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
271#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 271#define SHARP_BUZ_KEYSOUND 2 /* key sound */
272#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 272#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
273 273
274/* --- for SHARP_BUZZER device --- */ 274/* --- for SHARP_BUZZER device --- */
275 275
276 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 276 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
277//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 277//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
278 278
279#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) 279#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
280#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) 280#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
281#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) 281#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
282#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) 282#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
283#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) 283#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
284 284
285//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 285//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
286//#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 286//#define SHARP_BUZ_KEYSOUND 2 /* key sound */
287 287
288//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ 288//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */
289//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ 289//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */
290//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ 290//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */
291//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ 291//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */
292//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ 292//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */
293//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ 293//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */
294//#define SHARP_PDA_APPSTART 9 /* application start */ 294//#define SHARP_PDA_APPSTART 9 /* application start */
295//#define SHARP_PDA_APPQUIT 10 /* application ends */ 295//#define SHARP_PDA_APPQUIT 10 /* application ends */
296 296
297//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 297//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
298//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ 298//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */
299//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ 299//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */
300//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ 300//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */
301// 301//
302 302
303 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 303 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
304#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) 304#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1)
diff --git a/libopie2/opiecore/oprocess.cpp b/libopie2/opiecore/oprocess.cpp
index 0a361a1..6349c83 100644
--- a/libopie2/opiecore/oprocess.cpp
+++ b/libopie2/opiecore/oprocess.cpp
@@ -627,118 +627,118 @@ int OProcess::childError( int fdno )
627 if ( 0 < len ) 627 if ( 0 < len )
628 emit receivedStderr( this, buffer, len ); 628 emit receivedStderr( this, buffer, len );
629 return len; 629 return len;
630} 630}
631 631
632int OProcess::setupCommunication( Communication comm ) 632int OProcess::setupCommunication( Communication comm )
633{ 633{
634 int ok; 634 int ok;
635 635
636 communication = comm; 636 communication = comm;
637 637
638 ok = 1; 638 ok = 1;
639 if ( comm & Stdin ) 639 if ( comm & Stdin )
640 ok &= socketpair( AF_UNIX, SOCK_STREAM, 0, in ) >= 0; 640 ok &= socketpair( AF_UNIX, SOCK_STREAM, 0, in ) >= 0;
641 641
642 if ( comm & Stdout ) 642 if ( comm & Stdout )
643 ok &= socketpair( AF_UNIX, SOCK_STREAM, 0, out ) >= 0; 643 ok &= socketpair( AF_UNIX, SOCK_STREAM, 0, out ) >= 0;
644 644
645 if ( comm & Stderr ) 645 if ( comm & Stderr )
646 ok &= socketpair( AF_UNIX, SOCK_STREAM, 0, err ) >= 0; 646 ok &= socketpair( AF_UNIX, SOCK_STREAM, 0, err ) >= 0;
647 647
648 return ok; 648 return ok;
649} 649}
650 650
651int OProcess::commSetupDoneP() 651int OProcess::commSetupDoneP()
652{ 652{
653 int ok = 1; 653 int ok = 1;
654 654
655 if ( communication != NoCommunication ) 655 if ( communication != NoCommunication )
656 { 656 {
657 if ( communication & Stdin ) 657 if ( communication & Stdin )
658 close( in[ 0 ] ); 658 close( in[ 0 ] );
659 if ( communication & Stdout ) 659 if ( communication & Stdout )
660 close( out[ 1 ] ); 660 close( out[ 1 ] );
661 if ( communication & Stderr ) 661 if ( communication & Stderr )
662 close( err[ 1 ] ); 662 close( err[ 1 ] );
663 663
664 // Don't create socket notifiers and set the sockets non-blocking if 664 // Don't create socket notifiers and set the sockets non-blocking if
665 // blocking is requested. 665 // blocking is requested.
666 if ( run_mode == Block ) 666 if ( run_mode == Block )
667 return ok; 667 return ok;
668 668
669 if ( communication & Stdin ) 669 if ( communication & Stdin )
670 { 670 {
671 // ok &= (-1 != fcntl(in[1], F_SETFL, O_NONBLOCK)); 671 // ok &= (-1 != fcntl(in[1], F_SETFL, O_NONBLOCK));
672 innot = new QSocketNotifier( in[ 1 ], QSocketNotifier::Write, this ); 672 innot = new QSocketNotifier( in[ 1 ], QSocketNotifier::Write, this );
673 CHECK_PTR( innot ); 673 CHECK_PTR( innot );
674 innot->setEnabled( false ); // will be enabled when data has to be sent 674 innot->setEnabled( false ); // will be enabled when data has to be sent
675 QObject::connect( innot, SIGNAL( activated( int ) ), 675 QObject::connect( innot, SIGNAL( activated(int) ),
676 this, SLOT( slotSendData( int ) ) ); 676 this, SLOT( slotSendData(int) ) );
677 } 677 }
678 678
679 if ( communication & Stdout ) 679 if ( communication & Stdout )
680 { 680 {
681 // ok &= (-1 != fcntl(out[0], F_SETFL, O_NONBLOCK)); 681 // ok &= (-1 != fcntl(out[0], F_SETFL, O_NONBLOCK));
682 outnot = new QSocketNotifier( out[ 0 ], QSocketNotifier::Read, this ); 682 outnot = new QSocketNotifier( out[ 0 ], QSocketNotifier::Read, this );
683 CHECK_PTR( outnot ); 683 CHECK_PTR( outnot );
684 QObject::connect( outnot, SIGNAL( activated( int ) ), 684 QObject::connect( outnot, SIGNAL( activated(int) ),
685 this, SLOT( slotChildOutput( int ) ) ); 685 this, SLOT( slotChildOutput(int) ) );
686 if ( communication & NoRead ) 686 if ( communication & NoRead )
687 suspend(); 687 suspend();
688 } 688 }
689 689
690 if ( communication & Stderr ) 690 if ( communication & Stderr )
691 { 691 {
692 // ok &= (-1 != fcntl(err[0], F_SETFL, O_NONBLOCK)); 692 // ok &= (-1 != fcntl(err[0], F_SETFL, O_NONBLOCK));
693 errnot = new QSocketNotifier( err[ 0 ], QSocketNotifier::Read, this ); 693 errnot = new QSocketNotifier( err[ 0 ], QSocketNotifier::Read, this );
694 CHECK_PTR( errnot ); 694 CHECK_PTR( errnot );
695 QObject::connect( errnot, SIGNAL( activated( int ) ), 695 QObject::connect( errnot, SIGNAL( activated(int) ),
696 this, SLOT( slotChildError( int ) ) ); 696 this, SLOT( slotChildError(int) ) );
697 } 697 }
698 } 698 }
699 return ok; 699 return ok;
700} 700}
701 701
702int OProcess::commSetupDoneC() 702int OProcess::commSetupDoneC()
703{ 703{
704 int ok = 1; 704 int ok = 1;
705 struct linger so; 705 struct linger so;
706 memset( &so, 0, sizeof( so ) ); 706 memset( &so, 0, sizeof( so ) );
707 707
708 if ( communication & Stdin ) 708 if ( communication & Stdin )
709 close( in[ 1 ] ); 709 close( in[ 1 ] );
710 if ( communication & Stdout ) 710 if ( communication & Stdout )
711 close( out[ 0 ] ); 711 close( out[ 0 ] );
712 if ( communication & Stderr ) 712 if ( communication & Stderr )
713 close( err[ 0 ] ); 713 close( err[ 0 ] );
714 714
715 if ( communication & Stdin ) 715 if ( communication & Stdin )
716 ok &= dup2( in[ 0 ], STDIN_FILENO ) != -1; 716 ok &= dup2( in[ 0 ], STDIN_FILENO ) != -1;
717 else 717 else
718 { 718 {
719 int null_fd = open( "/dev/null", O_RDONLY ); 719 int null_fd = open( "/dev/null", O_RDONLY );
720 ok &= dup2( null_fd, STDIN_FILENO ) != -1; 720 ok &= dup2( null_fd, STDIN_FILENO ) != -1;
721 close( null_fd ); 721 close( null_fd );
722 } 722 }
723 if ( communication & Stdout ) 723 if ( communication & Stdout )
724 { 724 {
725 ok &= dup2( out[ 1 ], STDOUT_FILENO ) != -1; 725 ok &= dup2( out[ 1 ], STDOUT_FILENO ) != -1;
726 ok &= !setsockopt( out[ 1 ], SOL_SOCKET, SO_LINGER, ( char* ) & so, sizeof( so ) ); 726 ok &= !setsockopt( out[ 1 ], SOL_SOCKET, SO_LINGER, ( char* ) & so, sizeof( so ) );
727 } 727 }
728 else 728 else
729 { 729 {
730 int null_fd = open( "/dev/null", O_WRONLY ); 730 int null_fd = open( "/dev/null", O_WRONLY );
731 ok &= dup2( null_fd, STDOUT_FILENO ) != -1; 731 ok &= dup2( null_fd, STDOUT_FILENO ) != -1;
732 close( null_fd ); 732 close( null_fd );
733 } 733 }
734 if ( communication & Stderr ) 734 if ( communication & Stderr )
735 { 735 {
736 ok &= dup2( err[ 1 ], STDERR_FILENO ) != -1; 736 ok &= dup2( err[ 1 ], STDERR_FILENO ) != -1;
737 ok &= !setsockopt( err[ 1 ], SOL_SOCKET, SO_LINGER, reinterpret_cast<char *>( &so ), sizeof( so ) ); 737 ok &= !setsockopt( err[ 1 ], SOL_SOCKET, SO_LINGER, reinterpret_cast<char *>( &so ), sizeof( so ) );
738 } 738 }
739 else 739 else
740 { 740 {
741 int null_fd = open( "/dev/null", O_WRONLY ); 741 int null_fd = open( "/dev/null", O_WRONLY );
742 ok &= dup2( null_fd, STDERR_FILENO ) != -1; 742 ok &= dup2( null_fd, STDERR_FILENO ) != -1;
743 close( null_fd ); 743 close( null_fd );
744 } 744 }
diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp
index c12e138..4f9b504 100644
--- a/libopie2/opiepim/core/ocontactaccess.cpp
+++ b/libopie2/opiepim/core/ocontactaccess.cpp
@@ -28,102 +28,102 @@
28*/ 28*/
29/* 29/*
30 * ===================================================================== 30 * =====================================================================
31 * ToDo: XML-Backend: Automatic reload if something was changed... 31 * ToDo: XML-Backend: Automatic reload if something was changed...
32 * 32 *
33 * 33 *
34 */ 34 */
35 35
36#include "ocontactaccess.h" 36#include "ocontactaccess.h"
37#include "obackendfactory.h" 37#include "obackendfactory.h"
38 38
39#include <qasciidict.h> 39#include <qasciidict.h>
40#include <qdatetime.h> 40#include <qdatetime.h>
41#include <qfile.h> 41#include <qfile.h>
42#include <qregexp.h> 42#include <qregexp.h>
43#include <qlist.h> 43#include <qlist.h>
44#include <qcopchannel_qws.h> 44#include <qcopchannel_qws.h>
45 45
46//#include <qpe/qcopenvelope_qws.h> 46//#include <qpe/qcopenvelope_qws.h>
47#include <qpe/global.h> 47#include <qpe/global.h>
48 48
49#include <errno.h> 49#include <errno.h>
50#include <fcntl.h> 50#include <fcntl.h>
51#include <unistd.h> 51#include <unistd.h>
52#include <stdlib.h> 52#include <stdlib.h>
53 53
54#include <opie2/ocontactaccessbackend_xml.h> 54#include <opie2/ocontactaccessbackend_xml.h>
55 55
56namespace Opie { 56namespace Opie {
57 57
58OPimContactAccess::OPimContactAccess ( const QString appname, const QString , 58OPimContactAccess::OPimContactAccess ( const QString appname, const QString ,
59 OPimContactAccessBackend* end, bool autosync ): 59 OPimContactAccessBackend* end, bool autosync ):
60 OPimAccessTemplate<OPimContact>( end ) 60 OPimAccessTemplate<OPimContact>( end )
61{ 61{
62 /* take care of the backend. If there is no one defined, we 62 /* take care of the backend. If there is no one defined, we
63 * will use the XML-Backend as default (until we have a cute SQL-Backend..). 63 * will use the XML-Backend as default (until we have a cute SQL-Backend..).
64 */ 64 */
65 if( end == 0 ) { 65 if( end == 0 ) {
66 qWarning ("Using BackendFactory !"); 66 qWarning ("Using BackendFactory !");
67 end = OBackendFactory<OPimContactAccessBackend>::Default( "contact", appname ); 67 end = OBackendFactory<OPimContactAccessBackend>::Default( "contact", appname );
68 } 68 }
69 // Set backend locally and in template 69 // Set backend locally and in template
70 m_backEnd = end; 70 m_backEnd = end;
71 OPimAccessTemplate<OPimContact>::setBackEnd (end); 71 OPimAccessTemplate<OPimContact>::setBackEnd (end);
72 72
73 73
74 /* Connect signal of external db change to function */ 74 /* Connect signal of external db change to function */
75 QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); 75 QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this );
76 connect( dbchannel, SIGNAL(received(const QCString &, const QByteArray &)), 76 connect( dbchannel, SIGNAL(received(const QCString&,const QByteArray&)),
77 this, SLOT(copMessage( const QCString &, const QByteArray &)) ); 77 this, SLOT(copMessage(const QCString&,const QByteArray&)) );
78 if ( autosync ){ 78 if ( autosync ){
79 QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this ); 79 QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this );
80 connect( syncchannel, SIGNAL(received(const QCString &, const QByteArray &)), 80 connect( syncchannel, SIGNAL(received(const QCString&,const QByteArray&)),
81 this, SLOT(copMessage( const QCString &, const QByteArray &)) ); 81 this, SLOT(copMessage(const QCString&,const QByteArray&)) );
82 } 82 }
83 83
84 84
85} 85}
86OPimContactAccess::~OPimContactAccess () 86OPimContactAccess::~OPimContactAccess ()
87{ 87{
88 /* The user may forget to save the changed database, therefore try to 88 /* The user may forget to save the changed database, therefore try to
89 * do it for him.. 89 * do it for him..
90 */ 90 */
91 save(); 91 save();
92 // delete m_backEnd; is done by template.. 92 // delete m_backEnd; is done by template..
93} 93}
94 94
95 95
96bool OPimContactAccess::save () 96bool OPimContactAccess::save ()
97{ 97{
98 /* If the database was changed externally, we could not save the 98 /* If the database was changed externally, we could not save the
99 * Data. This will remove added items which is unacceptable ! 99 * Data. This will remove added items which is unacceptable !
100 * Therefore: Reload database and merge the data... 100 * Therefore: Reload database and merge the data...
101 */ 101 */
102 if ( OPimAccessTemplate<OPimContact>::wasChangedExternally() ) 102 if ( OPimAccessTemplate<OPimContact>::wasChangedExternally() )
103 reload(); 103 reload();
104 104
105 bool status = OPimAccessTemplate<OPimContact>::save(); 105 bool status = OPimAccessTemplate<OPimContact>::save();
106 if ( !status ) return false; 106 if ( !status ) return false;
107 107
108 /* Now tell everyone that new data is available. 108 /* Now tell everyone that new data is available.
109 */ 109 */
110 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" ); 110 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" );
111 111
112 return true; 112 return true;
113} 113}
114 114
115const uint OPimContactAccess::querySettings() 115const uint OPimContactAccess::querySettings()
116{ 116{
117 return ( m_backEnd->querySettings() ); 117 return ( m_backEnd->querySettings() );
118} 118}
119 119
120bool OPimContactAccess::hasQuerySettings ( int querySettings ) const 120bool OPimContactAccess::hasQuerySettings ( int querySettings ) const
121{ 121{
122 return ( m_backEnd->hasQuerySettings ( querySettings ) ); 122 return ( m_backEnd->hasQuerySettings ( querySettings ) );
123} 123}
124OPimRecordList<OPimContact> OPimContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const 124OPimRecordList<OPimContact> OPimContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const
125{ 125{
126 QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat ); 126 QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat );
127 return ( OPimRecordList<OPimContact>(matchingContacts, this) ); 127 return ( OPimRecordList<OPimContact>(matchingContacts, this) );
128} 128}
129 129
diff --git a/libopie2/opiepim/ui/opimmainwindow.cpp b/libopie2/opiepim/ui/opimmainwindow.cpp
index 10ed743..40dc297 100644
--- a/libopie2/opiepim/ui/opimmainwindow.cpp
+++ b/libopie2/opiepim/ui/opimmainwindow.cpp
@@ -2,100 +2,100 @@
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de) 3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
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#include <qapplication.h> 29#include <qapplication.h>
30#include <qdatetime.h> 30#include <qdatetime.h>
31#include <qcopchannel_qws.h> 31#include <qcopchannel_qws.h>
32 32
33#include <qpe/sound.h> 33#include <qpe/sound.h>
34#include <qpe/qcopenvelope_qws.h> 34#include <qpe/qcopenvelope_qws.h>
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36 36
37#include <opie2/opimresolver.h> 37#include <opie2/opimresolver.h>
38#include "opimmainwindow.h" 38#include "opimmainwindow.h"
39 39
40namespace Opie { 40namespace Opie {
41OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, 41OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent,
42 const char* name, WFlags flag ) 42 const char* name, WFlags flag )
43 : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) { 43 : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) {
44 44
45 /* 45 /*
46 * let's generate our QCopChannel 46 * let's generate our QCopChannel
47 */ 47 */
48 m_str = QString("QPE/"+m_service).local8Bit(); 48 m_str = QString("QPE/"+m_service).local8Bit();
49 m_channel= new QCopChannel(m_str, this ); 49 m_channel= new QCopChannel(m_str, this );
50 connect(m_channel, SIGNAL(received(const QCString&, const QByteArray& ) ), 50 connect(m_channel, SIGNAL(received(const QCString&,const QByteArray&) ),
51 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); 51 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
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 /* connect flush and reload */ 55 /* connect flush and reload */
56 connect(qApp, SIGNAL(flush() ), 56 connect(qApp, SIGNAL(flush() ),
57 this, SLOT(flush() ) ); 57 this, SLOT(flush() ) );
58 connect(qApp, SIGNAL(reload() ), 58 connect(qApp, SIGNAL(reload() ),
59 this, SLOT(reload() ) ); 59 this, SLOT(reload() ) );
60} 60}
61OPimMainWindow::~OPimMainWindow() { 61OPimMainWindow::~OPimMainWindow() {
62 delete m_channel; 62 delete m_channel;
63} 63}
64QCopChannel* OPimMainWindow::channel() { 64QCopChannel* OPimMainWindow::channel() {
65 return m_channel; 65 return m_channel;
66} 66}
67void OPimMainWindow::doSetDocument( const QString& ) { 67void OPimMainWindow::doSetDocument( const QString& ) {
68 68
69} 69}
70void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) { 70void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) {
71 bool needShow = false; 71 bool needShow = false;
72 /* 72 /*
73 * create demands to create 73 * create demands to create
74 * a new record... 74 * a new record...
75 */ 75 */
76 QDataStream stream(array, IO_ReadOnly); 76 QDataStream stream(array, IO_ReadOnly);
77 if ( cmd == "create()" ) { 77 if ( cmd == "create()" ) {
78 raise(); 78 raise();
79 int uid = create(); 79 int uid = create();
80 QCopEnvelope e(m_str, "created(int)" ); 80 QCopEnvelope e(m_str, "created(int)" );
81 e << uid; 81 e << uid;
82 needShow = true; 82 needShow = true;
83 }else if ( cmd == "remove(int)" ) { 83 }else if ( cmd == "remove(int)" ) {
84 int uid; 84 int uid;
85 stream >> uid; 85 stream >> uid;
86 bool rem = remove( uid ); 86 bool rem = remove( uid );
87 QCopEnvelope e(m_str, "removed(bool)" ); 87 QCopEnvelope e(m_str, "removed(bool)" );
88 e << rem; 88 e << rem;
89 needShow = true; 89 needShow = true;
90 }else if ( cmd == "beam(int)" ) { 90 }else if ( cmd == "beam(int)" ) {
91 int uid; 91 int uid;
92 stream >> uid; 92 stream >> uid;
93 beam( uid); 93 beam( uid);
94 }else if ( cmd == "show(int)" ) { 94 }else if ( cmd == "show(int)" ) {
95 raise(); 95 raise();
96 int uid; 96 int uid;
97 stream >> uid; 97 stream >> uid;
98 show( uid ); 98 show( uid );
99 needShow = true; 99 needShow = true;
100 }else if ( cmd == "edit(int)" ) { 100 }else if ( cmd == "edit(int)" ) {
101 raise(); 101 raise();
diff --git a/libopie2/opiepim/ui/opimrecurrencewidget.cpp b/libopie2/opiepim/ui/opimrecurrencewidget.cpp
index 569bdd5..90c1a5f 100644
--- a/libopie2/opiepim/ui/opimrecurrencewidget.cpp
+++ b/libopie2/opiepim/ui/opimrecurrencewidget.cpp
@@ -507,98 +507,98 @@ void OPimRecurrenceWidget::setupWeekly() {
507 // might as well set the day too... 507 // might as well set the day too...
508 if ( startWeekOnMonday ) { 508 if ( startWeekOnMonday ) {
509 fraExtra->setButton( start.dayOfWeek() - 1 ); 509 fraExtra->setButton( start.dayOfWeek() - 1 );
510 } else { 510 } else {
511 fraExtra->setButton( start.dayOfWeek() % 7 ); 511 fraExtra->setButton( start.dayOfWeek() % 7 );
512 } 512 }
513 lblFreq->setText( tr("week(s)") ); 513 lblFreq->setText( tr("week(s)") );
514 lblVar2->show(); 514 lblVar2->show();
515 showRepeatStuff(); 515 showRepeatStuff();
516 setupRepeatLabel( 1 ); 516 setupRepeatLabel( 1 );
517} 517}
518void OPimRecurrenceWidget::setupMonthly() { 518void OPimRecurrenceWidget::setupMonthly() {
519 hideExtras(); 519 hideExtras();
520 lblWeekVar->hide(); 520 lblWeekVar->hide();
521 fraExtra->setTitle( tr("Repeat By") ); 521 fraExtra->setTitle( tr("Repeat By") );
522 fraExtra->setExclusive( TRUE ); 522 fraExtra->setExclusive( TRUE );
523 fraExtra->show(); 523 fraExtra->show();
524 cmdExtra1->setText( tr("Day") ); 524 cmdExtra1->setText( tr("Day") );
525 cmdExtra1->show(); 525 cmdExtra1->show();
526 cmdExtra2->setText( tr("Date") ); 526 cmdExtra2->setText( tr("Date") );
527 cmdExtra2->show(); 527 cmdExtra2->show();
528 spinFreq->setValue( 1 ); 528 spinFreq->setValue( 1 );
529 lblFreq->setText( tr("month(s)") ); 529 lblFreq->setText( tr("month(s)") );
530 lblVar2->show(); 530 lblVar2->show();
531 showRepeatStuff(); 531 showRepeatStuff();
532 setupRepeatLabel( 1 ); 532 setupRepeatLabel( 1 );
533} 533}
534void OPimRecurrenceWidget::setupYearly() { 534void OPimRecurrenceWidget::setupYearly() {
535hideExtras(); 535hideExtras();
536 lblWeekVar->hide(); 536 lblWeekVar->hide();
537 spinFreq->setValue( 1 ); 537 spinFreq->setValue( 1 );
538 lblFreq->setText( tr("year(s)") ); 538 lblFreq->setText( tr("year(s)") );
539 lblFreq->show(); 539 lblFreq->show();
540 lblFreq->show(); 540 lblFreq->show();
541 showRepeatStuff(); 541 showRepeatStuff();
542 lblVar2->show(); 542 lblVar2->show();
543 QString strEvery = strYearTemplate.arg( start.monthName(start.month()) ).arg( numberPlacing(start.day()) ); 543 QString strEvery = strYearTemplate.arg( start.monthName(start.month()) ).arg( numberPlacing(start.day()) );
544 lblRepeat->setText( strEvery ); 544 lblRepeat->setText( strEvery );
545 setupRepeatLabel( 1 ); 545 setupRepeatLabel( 1 );
546 546
547} 547}
548void OPimRecurrenceWidget::init() { 548void OPimRecurrenceWidget::init() {
549 QPopupMenu *m1 = new QPopupMenu( this ); 549 QPopupMenu *m1 = new QPopupMenu( this );
550 repeatPicker = new DateBookMonth( m1, 0, TRUE ); 550 repeatPicker = new DateBookMonth( m1, 0, TRUE );
551 m1->insertItem( repeatPicker ); 551 m1->insertItem( repeatPicker );
552 cmdEnd->setPopup( m1 ); 552 cmdEnd->setPopup( m1 );
553 cmdEnd->setPopupDelay( 0 ); 553 cmdEnd->setPopupDelay( 0 );
554 554
555 QObject::connect( repeatPicker, SIGNAL(dateClicked(int, int, int)), 555 QObject::connect( repeatPicker, SIGNAL(dateClicked(int,int,int)),
556 this, SLOT(endDateChanged(int, int, int)) ); 556 this, SLOT(endDateChanged(int,int,int)) );
557 QObject::connect( qApp, SIGNAL(weekChanged(bool)), 557 QObject::connect( qApp, SIGNAL(weekChanged(bool)),
558 this, SLOT(slotChangeStartOfWeek(bool)) ); 558 this, SLOT(slotChangeStartOfWeek(bool)) );
559 559
560 listRTypeButtons.setAutoDelete( TRUE ); 560 listRTypeButtons.setAutoDelete( TRUE );
561 listRTypeButtons.append( cmdNone ); 561 listRTypeButtons.append( cmdNone );
562 listRTypeButtons.append( cmdDay ); 562 listRTypeButtons.append( cmdDay );
563 listRTypeButtons.append( cmdWeek ); 563 listRTypeButtons.append( cmdWeek );
564 listRTypeButtons.append( cmdMonth ); 564 listRTypeButtons.append( cmdMonth );
565 listRTypeButtons.append( cmdYear ); 565 listRTypeButtons.append( cmdYear );
566 566
567 listExtra.setAutoDelete( TRUE ); 567 listExtra.setAutoDelete( TRUE );
568 listExtra.append( cmdExtra1 ); 568 listExtra.append( cmdExtra1 );
569 listExtra.append( cmdExtra2 ); 569 listExtra.append( cmdExtra2 );
570 listExtra.append( cmdExtra3 ); 570 listExtra.append( cmdExtra3 );
571 listExtra.append( cmdExtra4 ); 571 listExtra.append( cmdExtra4 );
572 listExtra.append( cmdExtra5 ); 572 listExtra.append( cmdExtra5 );
573 listExtra.append( cmdExtra6 ); 573 listExtra.append( cmdExtra6 );
574 listExtra.append( cmdExtra7 ); 574 listExtra.append( cmdExtra7 );
575} 575}
576void OPimRecurrenceWidget::hideExtras() { 576void OPimRecurrenceWidget::hideExtras() {
577 // hide the extra buttons... 577 // hide the extra buttons...
578 fraExtra->hide(); 578 fraExtra->hide();
579 chkNoEnd->hide(); 579 chkNoEnd->hide();
580 QListIterator<QToolButton> it( listExtra ); 580 QListIterator<QToolButton> it( listExtra );
581 for ( ; *it; ++it ) { 581 for ( ; *it; ++it ) {
582 (*it)->hide(); 582 (*it)->hide();
583 (*it)->setOn( FALSE ); 583 (*it)->setOn( FALSE );
584 } 584 }
585} 585}
586void OPimRecurrenceWidget::showRepeatStuff() { 586void OPimRecurrenceWidget::showRepeatStuff() {
587 cmdEnd->show(); 587 cmdEnd->show();
588 chkNoEnd->show(); 588 chkNoEnd->show();
589 lblFreq->show(); 589 lblFreq->show();
590 lblEvery->show(); 590 lblEvery->show();
591 lblFreq->show(); 591 lblFreq->show();
592 spinFreq->show(); 592 spinFreq->show();
593 lblEnd->show(); 593 lblEnd->show();
594 lblRepeat->setText( tr("Every") ); 594 lblRepeat->setText( tr("Every") );
595} 595}
596 596
597 597
598static int week( const QDate &start ) 598static int week( const QDate &start )
599{ 599{
600 // figure out the week... 600 // figure out the week...
601 int stop = start.day(), 601 int stop = start.day(),
602 sentinel = start.dayOfWeek(), 602 sentinel = start.dayOfWeek(),
603 dayOfWeek = QDate( start.year(), start.month(), 1 ).dayOfWeek(), 603 dayOfWeek = QDate( start.year(), start.month(), 1 ).dayOfWeek(),
604 week = 1, 604 week = 1,
diff --git a/libopie2/opieui/fileselector/ofiledialog.cpp b/libopie2/opieui/fileselector/ofiledialog.cpp
index 2a89c5d..e7daead 100644
--- a/libopie2/opieui/fileselector/ofiledialog.cpp
+++ b/libopie2/opieui/fileselector/ofiledialog.cpp
@@ -66,98 +66,98 @@ void saveLastDir( const QString& key, const QString& file )
66{ 66{
67 if ( qApp->argc() < 1 ) 67 if ( qApp->argc() < 1 )
68 return; 68 return;
69 69
70 Config cfg( QFileInfo(qApp->argv()[0]).fileName() ); 70 Config cfg( QFileInfo(qApp->argv()[0]).fileName() );
71 cfg.setGroup( key ); 71 cfg.setGroup( key );
72 QFileInfo inf( file ); 72 QFileInfo inf( file );
73 cfg.writeEntry("LastDir", inf.dirPath( true ) ); 73 cfg.writeEntry("LastDir", inf.dirPath( true ) );
74} 74}
75}; 75};
76 76
77/** 77/**
78 * This constructs a modal dialog 78 * This constructs a modal dialog
79 * 79 *
80 * @param caption The caption of the dialog 80 * @param caption The caption of the dialog
81 * @param wid The parent widget 81 * @param wid The parent widget
82 * @param mode The mode of the OFileSelector @see OFileSelector 82 * @param mode The mode of the OFileSelector @see OFileSelector
83 * @param selector The selector of the OFileSelector 83 * @param selector The selector of the OFileSelector
84 * @param dirName the dir or resource to start from 84 * @param dirName the dir or resource to start from
85 * @param fileName a proposed or existing filename 85 * @param fileName a proposed or existing filename
86 * @param mimetypes The mimeTypes 86 * @param mimetypes The mimeTypes
87 */ 87 */
88OFileDialog::OFileDialog(const QString &caption, 88OFileDialog::OFileDialog(const QString &caption,
89 QWidget *wid, int mode, int selector, 89 QWidget *wid, int mode, int selector,
90 const QString &dirName, 90 const QString &dirName,
91 const QString &fileName, 91 const QString &fileName,
92 const QMap<QString,QStringList>& mimetypes ) 92 const QMap<QString,QStringList>& mimetypes )
93 : QDialog( wid, "OFileDialog", true ) 93 : QDialog( wid, "OFileDialog", true )
94{ 94{
95 // QVBoxLayout *lay = new QVBoxLayout(this); 95 // QVBoxLayout *lay = new QVBoxLayout(this);
96 //showMaximized(); 96 //showMaximized();
97 QVBoxLayout *lay = new QVBoxLayout(this ); 97 QVBoxLayout *lay = new QVBoxLayout(this );
98 file = new OFileSelector(this , mode, selector, 98 file = new OFileSelector(this , mode, selector,
99 dirName, fileName, 99 dirName, fileName,
100 mimetypes ); 100 mimetypes );
101 lay->addWidget( file ); 101 lay->addWidget( file );
102 102
103 //lay->addWidget( file ); 103 //lay->addWidget( file );
104 //showFullScreen(); 104 //showFullScreen();
105 setCaption( caption.isEmpty() ? tr("FileDialog") : caption ); 105 setCaption( caption.isEmpty() ? tr("FileDialog") : caption );
106 connect(file, SIGNAL(fileSelected(const QString&) ), 106 connect(file, SIGNAL(fileSelected(const QString&) ),
107 this, SLOT(slotFileSelected(const QString&) ) ); 107 this, SLOT(slotFileSelected(const QString&) ) );
108 connect(file, SIGNAL(ok() ), 108 connect(file, SIGNAL(ok() ),
109 this, SLOT(slotSelectorOk()) ) ; 109 this, SLOT(slotSelectorOk()) ) ;
110 110
111 connect(file, SIGNAL(dirSelected(const QString&) ), this, SLOT(slotDirSelected(const QString&) ) ); 111 connect(file, SIGNAL(dirSelected(const QString&) ), this, SLOT(slotDirSelected(const QString&) ) );
112 112
113#if 0 113#if 0
114 connect(file, SIGNAL(dirSelected(const QString &) ), 114 connect(file, SIGNAL(dirSelected(const QString&) ),
115 this, SLOT(slotDirSelected(const QString &) ) ); 115 this, SLOT(slotDirSelected(const QString&) ) );
116#endif 116#endif
117} 117}
118/** 118/**
119 * @returns the mimetype of the selected 119 * @returns the mimetype of the selected
120 * currently it return QString::null 120 * currently it return QString::null
121 */ 121 */
122QString OFileDialog::mimetype()const 122QString OFileDialog::mimetype()const
123{ 123{
124 return QString::null; 124 return QString::null;
125} 125}
126 126
127/** 127/**
128 * @return the fileName 128 * @return the fileName
129 */ 129 */
130QString OFileDialog::fileName()const 130QString OFileDialog::fileName()const
131{ 131{
132 return file->selectedName(); 132 return file->selectedName();
133} 133}
134 134
135/** 135/**
136 * return a DocLnk to the current file 136 * return a DocLnk to the current file
137 */ 137 */
138DocLnk OFileDialog::selectedDocument()const 138DocLnk OFileDialog::selectedDocument()const
139{ 139{
140 return file->selectedDocument(); 140 return file->selectedDocument();
141} 141}
142 142
143/** 143/**
144 * This opens up a filedialog in Open mode 144 * This opens up a filedialog in Open mode
145 * 145 *
146 * @param selector the Selector Mode 146 * @param selector the Selector Mode
147 * @param startDir Where to start from 147 * @param startDir Where to start from
148 * @param file A proposed filename 148 * @param file A proposed filename
149 * @param mimes A list of MimeTypes 149 * @param mimes A list of MimeTypes
150 * @param wid the parent 150 * @param wid the parent
151 * @param caption of the dialog if QString::null tr("Open") will be used 151 * @param caption of the dialog if QString::null tr("Open") will be used
152 * @return the fileName or QString::null 152 * @return the fileName or QString::null
153 */ 153 */
154QString OFileDialog::getOpenFileName(int selector, 154QString OFileDialog::getOpenFileName(int selector,
155 const QString &_startDir, 155 const QString &_startDir,
156 const QString &file, 156 const QString &file,
157 const MimeTypes &mimes, 157 const MimeTypes &mimes,
158 QWidget *wid, 158 QWidget *wid,
159 const QString &caption ) 159 const QString &caption )
160{ 160{
161 QString ret; 161 QString ret;
162 QString startDir = _startDir; 162 QString startDir = _startDir;
163 if (startDir.isEmpty() ) 163 if (startDir.isEmpty() )
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp
index 600daff..15cadd4 100644
--- a/libopie2/opieui/fileselector/ofileselector.cpp
+++ b/libopie2/opieui/fileselector/ofileselector.cpp
@@ -165,102 +165,102 @@ QString ODocumentFileView::selectedName()const
165 if (!m_selector) 165 if (!m_selector)
166 return QString::null; 166 return QString::null;
167 167
168 return m_selector->selectedDocument().file(); 168 return m_selector->selectedDocument().file();
169} 169}
170 170
171QString ODocumentFileView::selectedPath()const 171QString ODocumentFileView::selectedPath()const
172{ 172{
173 return QPEApplication::documentDir(); 173 return QPEApplication::documentDir();
174} 174}
175 175
176QString ODocumentFileView::directory()const 176QString ODocumentFileView::directory()const
177{ 177{
178 return selectedPath(); 178 return selectedPath();
179} 179}
180 180
181void ODocumentFileView::reread() 181void ODocumentFileView::reread()
182{ 182{
183 if (!m_selector) 183 if (!m_selector)
184 return; 184 return;
185 185
186 m_selector->setNewVisible( showNew() ); 186 m_selector->setNewVisible( showNew() );
187 m_selector->setCloseVisible( showClose() ); 187 m_selector->setCloseVisible( showClose() );
188 m_selector->filter = currentMimeType().join(";"); 188 m_selector->filter = currentMimeType().join(";");
189 m_selector->reread(); 189 m_selector->reread();
190} 190}
191 191
192int ODocumentFileView::fileCount()const 192int ODocumentFileView::fileCount()const
193{ 193{
194 if (!m_selector) 194 if (!m_selector)
195 return -1; 195 return -1;
196 196
197 return m_selector->fileCount(); 197 return m_selector->fileCount();
198} 198}
199 199
200DocLnk ODocumentFileView::selectedDocument()const 200DocLnk ODocumentFileView::selectedDocument()const
201{ 201{
202 if (!m_selector) 202 if (!m_selector)
203 return DocLnk(); 203 return DocLnk();
204 204
205 return m_selector->selectedDocument(); 205 return m_selector->selectedDocument();
206} 206}
207 207
208QWidget* ODocumentFileView::widget( QWidget* parent ) 208QWidget* ODocumentFileView::widget( QWidget* parent )
209{ 209{
210 if (!m_selector ) 210 if (!m_selector )
211 { 211 {
212 m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); 212 m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() );
213 QObject::connect(m_selector, SIGNAL(fileSelected( const DocLnk& ) ), 213 QObject::connect(m_selector, SIGNAL(fileSelected(const DocLnk&) ),
214 selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); 214 selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) );
215 QObject::connect(m_selector, SIGNAL(closeMe() ), 215 QObject::connect(m_selector, SIGNAL(closeMe() ),
216 selector(), SIGNAL(closeMe() ) ); 216 selector(), SIGNAL(closeMe() ) );
217 QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk& ) ), 217 QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk&) ),
218 selector(), SIGNAL(newSelected(const DocLnk& ) ) ); 218 selector(), SIGNAL(newSelected(const DocLnk&) ) );
219 } 219 }
220 220
221 return m_selector; 221 return m_selector;
222} 222}
223 223
224/* 224/*
225 * This is the file system view used 225 * This is the file system view used
226 * we use a QListView + QListViewItems for it 226 * we use a QListView + QListViewItems for it
227 */ 227 */
228 228
229OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, 229OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap,
230 const QString& path, const QString& date, 230 const QString& path, const QString& date,
231 const QString& size, const QString& dir, 231 const QString& size, const QString& dir,
232 bool isLocked, bool isDir ) 232 bool isLocked, bool isDir )
233 : QListViewItem( view ) 233 : QListViewItem( view )
234{ 234{
235 setPixmap(0, pixmap ); 235 setPixmap(0, pixmap );
236 setText(1, path ); 236 setText(1, path );
237 setText(2, size ); 237 setText(2, size );
238 setText(3, date ); 238 setText(3, date );
239 m_isDir = isDir; 239 m_isDir = isDir;
240 m_dir = dir; 240 m_dir = dir;
241 m_locked = isLocked; 241 m_locked = isLocked;
242} 242}
243 243
244OFileSelectorItem::~OFileSelectorItem() 244OFileSelectorItem::~OFileSelectorItem()
245{ 245{
246} 246}
247 247
248bool OFileSelectorItem::isLocked()const 248bool OFileSelectorItem::isLocked()const
249{ 249{
250 return m_locked; 250 return m_locked;
251} 251}
252 252
253QString OFileSelectorItem::directory()const 253QString OFileSelectorItem::directory()const
254{ 254{
255 return m_dir; 255 return m_dir;
256} 256}
257 257
258bool OFileSelectorItem::isDir()const 258bool OFileSelectorItem::isDir()const
259{ 259{
260 return m_isDir; 260 return m_isDir;
261} 261}
262 262
263QString OFileSelectorItem::path()const 263QString OFileSelectorItem::path()const
264{ 264{
265 return text( 1 ); 265 return text( 1 );
266} 266}
@@ -479,98 +479,98 @@ void OFileViewFileListView::reread( bool all )
479 { // couldn't resolve symlink add it as symlink 479 { // couldn't resolve symlink add it as symlink
480 addSymlink( fi ); 480 addSymlink( fi );
481 } 481 }
482 } // off for loop for symlink resolving 482 } // off for loop for symlink resolving
483 } 483 }
484 else if( fi->isDir() ) 484 else if( fi->isDir() )
485 addDir( fi ); 485 addDir( fi );
486 else if( fi->isFile() ) 486 else if( fi->isFile() )
487 addFile( fi ); 487 addFile( fi );
488 488
489 ++it; 489 ++it;
490 } // of while loop 490 } // of while loop
491 m_view->sort(); 491 m_view->sort();
492 492
493} 493}
494int OFileViewFileListView::fileCount()const 494int OFileViewFileListView::fileCount()const
495{ 495{
496 return m_view->childCount(); 496 return m_view->childCount();
497} 497}
498 498
499QString OFileViewFileListView::currentDir()const 499QString OFileViewFileListView::currentDir()const
500{ 500{
501 return m_currentDir; 501 return m_currentDir;
502} 502}
503 503
504OFileSelector* OFileViewFileListView::selector() 504OFileSelector* OFileViewFileListView::selector()
505{ 505{
506 return m_sel; 506 return m_sel;
507} 507}
508 508
509bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) 509bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e)
510{ 510{
511 if ( e->type() == QEvent::KeyPress ) 511 if ( e->type() == QEvent::KeyPress )
512 { 512 {
513 QKeyEvent *k = (QKeyEvent *)e; 513 QKeyEvent *k = (QKeyEvent *)e;
514 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) 514 if ( (k->key()==Key_Enter) || (k->key()==Key_Return))
515 { 515 {
516 slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); 516 slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0);
517 return true; 517 return true;
518 } 518 }
519 } 519 }
520 return false; 520 return false;
521} 521}
522 522
523void OFileViewFileListView::connectSlots() 523void OFileViewFileListView::connectSlots()
524{ 524{
525 connect(m_view, SIGNAL(clicked(QListViewItem*) ), 525 connect(m_view, SIGNAL(clicked(QListViewItem*) ),
526 this, SLOT(slotCurrentChanged(QListViewItem*) ) ); 526 this, SLOT(slotCurrentChanged(QListViewItem*) ) );
527 connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ), 527 connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),
528 this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) ); 528 this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) );
529} 529}
530 530
531void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) 531void OFileViewFileListView::slotCurrentChanged( QListViewItem* item)
532{ 532{
533 if (!item) 533 if (!item)
534 return; 534 return;
535#if 0 535#if 0
536 536
537 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 537 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
538 538
539 if (!sel->isDir() ) 539 if (!sel->isDir() )
540 { 540 {
541 selector()->m_lneEdit->setText( sel->text(1) ); 541 selector()->m_lneEdit->setText( sel->text(1) );
542 // if in fileselector mode we will emit selected 542 // if in fileselector mode we will emit selected
543 if ( selector()->mode() == OFileSelector::FileSelector ) 543 if ( selector()->mode() == OFileSelector::FileSelector )
544 { 544 {
545 qWarning("slot Current Changed"); 545 qWarning("slot Current Changed");
546 QStringList str = QStringList::split("->", sel->text(1) ); 546 QStringList str = QStringList::split("->", sel->text(1) );
547 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 547 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
548 emit selector()->fileSelected( path ); 548 emit selector()->fileSelected( path );
549 DocLnk lnk( path ); 549 DocLnk lnk( path );
550 emit selector()->fileSelected( lnk ); 550 emit selector()->fileSelected( lnk );
551 } 551 }
552 } 552 }
553#endif 553#endif
554} 554}
555 555
556void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) 556void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int )
557{ 557{
558 if (!item || ( button != Qt::LeftButton) ) 558 if (!item || ( button != Qt::LeftButton) )
559 return; 559 return;
560 560
561 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 561 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
562 if (!sel->isLocked() ) 562 if (!sel->isLocked() )
563 { 563 {
564 QStringList str = QStringList::split("->", sel->text(1) ); 564 QStringList str = QStringList::split("->", sel->text(1) );
565 if (sel->isDir() ) 565 if (sel->isDir() )
566 { 566 {
567 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); 567 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace();
568 emit selector()->dirSelected( m_currentDir ); 568 emit selector()->dirSelected( m_currentDir );
569 reread( m_all ); 569 reread( m_all );
570 } 570 }
571 else 571 else
572 { // file 572 { // file
573 qWarning("slot Clicked"); 573 qWarning("slot Clicked");
574 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); 574 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() );
575 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 575 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
576 emit selector()->fileSelected( path ); 576 emit selector()->fileSelected( path );
@@ -934,98 +934,98 @@ void OFileSelector::initUI()
934 m_cmbView = new QComboBox( m_cmbBox ); 934 m_cmbView = new QComboBox( m_cmbBox );
935 m_cmbMime = new QComboBox( m_cmbBox ); 935 m_cmbMime = new QComboBox( m_cmbBox );
936 lay->addWidget( m_cmbBox ); 936 lay->addWidget( m_cmbBox );
937} 937}
938 938
939/* 939/*
940 * This will make sure that the return key in the name edit causes dialogs to close 940 * This will make sure that the return key in the name edit causes dialogs to close
941 */ 941 */
942 942
943bool OFileSelector::eventFilter (QObject *o, QEvent *e) 943bool OFileSelector::eventFilter (QObject *o, QEvent *e)
944{ 944{
945 if ( e->type() == QEvent::KeyPress ) 945 if ( e->type() == QEvent::KeyPress )
946 { 946 {
947 QKeyEvent *k = (QKeyEvent *)e; 947 QKeyEvent *k = (QKeyEvent *)e;
948 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) 948 if ( (k->key()==Key_Enter) || (k->key()==Key_Return))
949 { 949 {
950 emit ok(); 950 emit ok();
951 return true; 951 return true;
952 } 952 }
953 } 953 }
954 return false; 954 return false;
955} 955}
956 956
957/* 957/*
958 * This will insert the MimeTypes into the Combo Box 958 * This will insert the MimeTypes into the Combo Box
959 * And also connect the changed signal 959 * And also connect the changed signal
960 * 960 *
961 * AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes 961 * AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes
962 */ 962 */
963void OFileSelector::initMime() 963void OFileSelector::initMime()
964{ 964{
965 MimeTypes::Iterator it; 965 MimeTypes::Iterator it;
966 for ( it = m_mimeType.begin(); it != m_mimeType.end(); ++it ) 966 for ( it = m_mimeType.begin(); it != m_mimeType.end(); ++it )
967 { 967 {
968 m_cmbMime->insertItem( it.key() ); 968 m_cmbMime->insertItem( it.key() );
969 } 969 }
970 m_cmbMime->setCurrentItem( 0 ); 970 m_cmbMime->setCurrentItem( 0 );
971 971
972 connect( m_cmbMime, SIGNAL(activated(int) ), 972 connect( m_cmbMime, SIGNAL(activated(int) ),
973 this, SLOT(slotMimeTypeChanged() ) ); 973 this, SLOT(slotMimeTypeChanged() ) );
974 974
975} 975}
976 976
977void OFileSelector::initViews() 977void OFileSelector::initViews()
978{ 978{
979 m_cmbView->insertItem( QObject::tr("Documents") ); 979 m_cmbView->insertItem( QObject::tr("Documents") );
980 m_cmbView->insertItem( QObject::tr("Files") ); 980 m_cmbView->insertItem( QObject::tr("Files") );
981 m_cmbView->insertItem( QObject::tr("All Files") ); 981 m_cmbView->insertItem( QObject::tr("All Files") );
982 connect(m_cmbView, SIGNAL(activated( const QString& ) ), 982 connect(m_cmbView, SIGNAL(activated(const QString&) ),
983 this, SLOT(slotViewChange( const QString& ) ) ); 983 this, SLOT(slotViewChange(const QString&) ) );
984 984
985 985
986 m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); 986 m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) );
987 987
988 /* see above why add both */ 988 /* see above why add both */
989 OFileViewInterface* in = new OFileViewFileSystem( this ); 989 OFileViewInterface* in = new OFileViewFileSystem( this );
990 m_views.insert( QObject::tr("Files"), in ); 990 m_views.insert( QObject::tr("Files"), in );
991 m_views.insert( QObject::tr("All Files"), in ); 991 m_views.insert( QObject::tr("All Files"), in );
992} 992}
993 993
994/** 994/**
995 * d'tor 995 * d'tor
996 */ 996 */
997OFileSelector::~OFileSelector() 997OFileSelector::~OFileSelector()
998{ 998{
999} 999}
1000 1000
1001 1001
1002 1002
1003/** 1003/**
1004 * Convience function for the fileselector 1004 * Convience function for the fileselector
1005 * make sure to delete the DocLnk 1005 * make sure to delete the DocLnk
1006 * 1006 *
1007 * @see DocLnk 1007 * @see DocLnk
1008 * @todo remove in ODP 1008 * @todo remove in ODP
1009 */ 1009 */
1010const DocLnk* OFileSelector::selected() 1010const DocLnk* OFileSelector::selected()
1011{ 1011{
1012 DocLnk* lnk = new DocLnk( currentView()->selectedDocument() ); 1012 DocLnk* lnk = new DocLnk( currentView()->selectedDocument() );
1013 return lnk; 1013 return lnk;
1014} 1014}
1015 1015
1016/** 1016/**
1017 * 1017 *
1018 * @return the name of the selected file 1018 * @return the name of the selected file
1019 */ 1019 */
1020QString OFileSelector::selectedName()const 1020QString OFileSelector::selectedName()const
1021{ 1021{
1022 return currentView()->selectedName(); 1022 return currentView()->selectedName();
1023} 1023}
1024 1024
1025 1025
1026/** 1026/**
1027 * @return the selected path 1027 * @return the selected path
1028 */ 1028 */
1029QString OFileSelector::selectedPath()const 1029QString OFileSelector::selectedPath()const
1030{ 1030{
1031 return currentView()->selectedPath(); 1031 return currentView()->selectedPath();
diff --git a/libopie2/opieui/ofontselector.cpp b/libopie2/opieui/ofontselector.cpp
index 49ddeb6..f93781f 100644
--- a/libopie2/opieui/ofontselector.cpp
+++ b/libopie2/opieui/ofontselector.cpp
@@ -87,111 +87,111 @@ public:
87 87
88 const QValueList<int> &sizes() const 88 const QValueList<int> &sizes() const
89 { 89 {
90 return m_sizes; 90 return m_sizes;
91 } 91 }
92 92
93private: 93private:
94 QStringList m_styles; 94 QStringList m_styles;
95 QValueList<int> m_sizes; 95 QValueList<int> m_sizes;
96 QString m_name; 96 QString m_name;
97}; 97};
98 98
99 99
100static int findItemCB( QComboBox *box, const QString &str ) 100static int findItemCB( QComboBox *box, const QString &str )
101{ 101{
102 for ( int i = 0; i < box->count(); i++ ) 102 for ( int i = 0; i < box->count(); i++ )
103 { 103 {
104 if ( box->text ( i ) == str ) 104 if ( box->text ( i ) == str )
105 return i; 105 return i;
106 } 106 }
107 return -1; 107 return -1;
108} 108}
109 109
110} 110}
111/* static same as anon. namespace */ 111/* static same as anon. namespace */
112static int qt_version() 112static int qt_version()
113{ 113{
114 const char *qver = qVersion(); 114 const char *qver = qVersion();
115 115
116 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); 116 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' );
117} 117}
118 118
119/** 119/**
120 * Constructs the Selector object 120 * Constructs the Selector object
121 * @param withpreview If a font preview should be given 121 * @param withpreview If a font preview should be given
122 * @param parent The parent of the Font Selector 122 * @param parent The parent of the Font Selector
123 * @param name The name of the object 123 * @param name The name of the object
124 * @param fl WidgetFlags 124 * @param fl WidgetFlags
125 */ 125 */
126OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) 126OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl )
127{ 127{
128 d = new OFontSelectorPrivate(); 128 d = new OFontSelectorPrivate();
129 129
130 QGridLayout *gridLayout = new QGridLayout( this, 0, 0, 4, 4 ); 130 QGridLayout *gridLayout = new QGridLayout( this, 0, 0, 4, 4 );
131 gridLayout->setRowStretch( 4, 10 ); 131 gridLayout->setRowStretch( 4, 10 );
132 132
133 d->m_font_family_list = new QListBox( this, "FontListBox" ); 133 d->m_font_family_list = new QListBox( this, "FontListBox" );
134 gridLayout->addMultiCellWidget( d->m_font_family_list, 0, 4, 0, 0 ); 134 gridLayout->addMultiCellWidget( d->m_font_family_list, 0, 4, 0, 0 );
135 connect( d->m_font_family_list, SIGNAL( highlighted( int ) ), this, SLOT( fontFamilyClicked( int ) ) ); 135 connect( d->m_font_family_list, SIGNAL( highlighted(int) ), this, SLOT( fontFamilyClicked(int) ) );
136 136
137 QLabel *label = new QLabel( tr( "Style" ), this ); 137 QLabel *label = new QLabel( tr( "Style" ), this );
138 gridLayout->addWidget( label, 0, 1 ); 138 gridLayout->addWidget( label, 0, 1 );
139 139
140 d->m_font_style_list = new QComboBox( this, "StyleListBox" ); 140 d->m_font_style_list = new QComboBox( this, "StyleListBox" );
141 connect( d->m_font_style_list, SIGNAL( activated( int ) ), this, SLOT( fontStyleClicked( int ) ) ); 141 connect( d->m_font_style_list, SIGNAL( activated(int) ), this, SLOT( fontStyleClicked(int) ) );
142 gridLayout->addWidget( d->m_font_style_list, 1, 1 ); 142 gridLayout->addWidget( d->m_font_style_list, 1, 1 );
143 143
144 label = new QLabel( tr( "Size" ), this ); 144 label = new QLabel( tr( "Size" ), this );
145 gridLayout->addWidget( label, 2, 1 ); 145 gridLayout->addWidget( label, 2, 1 );
146 146
147 d->m_font_size_list = new QComboBox( this, "SizeListBox" ); 147 d->m_font_size_list = new QComboBox( this, "SizeListBox" );
148 connect( d->m_font_size_list, SIGNAL( activated( int ) ), 148 connect( d->m_font_size_list, SIGNAL( activated(int) ),
149 this, SLOT( fontSizeClicked( int ) ) ); 149 this, SLOT( fontSizeClicked(int) ) );
150 gridLayout->addWidget( d->m_font_size_list, 3, 1 ); 150 gridLayout->addWidget( d->m_font_size_list, 3, 1 );
151 151
152 d->m_pointbug = ( qt_version() <= 233 ); 152 d->m_pointbug = ( qt_version() <= 233 );
153 153
154 if ( withpreview ) 154 if ( withpreview )
155 { 155 {
156 d->m_preview = new QMultiLineEdit ( this, "Preview" ); 156 d->m_preview = new QMultiLineEdit ( this, "Preview" );
157 d->m_preview->setAlignment ( AlignCenter ); 157 d->m_preview->setAlignment ( AlignCenter );
158 d->m_preview->setWordWrap ( QMultiLineEdit::WidgetWidth ); 158 d->m_preview->setWordWrap ( QMultiLineEdit::WidgetWidth );
159 d->m_preview->setMargin ( 3 ); 159 d->m_preview->setMargin ( 3 );
160 d->m_preview->setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); 160 d->m_preview->setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" ));
161 gridLayout->addRowSpacing ( 5, 4 ); 161 gridLayout->addRowSpacing ( 5, 4 );
162 gridLayout->addMultiCellWidget ( d->m_preview, 6, 6, 0, 1 ); 162 gridLayout->addMultiCellWidget ( d->m_preview, 6, 6, 0, 1 );
163 gridLayout->setRowStretch ( 6, 5 ); 163 gridLayout->setRowStretch ( 6, 5 );
164 } 164 }
165 else 165 else
166 d->m_preview = 0; 166 d->m_preview = 0;
167 167
168 loadFonts ( d->m_font_family_list ); 168 loadFonts ( d->m_font_family_list );
169} 169}
170 170
171OFontSelector::~OFontSelector() 171OFontSelector::~OFontSelector()
172{ 172{
173 delete d; 173 delete d;
174} 174}
175 175
176/** 176/**
177 * This methods tries to set the font 177 * This methods tries to set the font
178 * @param f The wishes font 178 * @param f The wishes font
179 * @return success or failure 179 * @return success or failure
180 */ 180 */
181bool OFontSelector::setSelectedFont ( const QFont &f ) 181bool OFontSelector::setSelectedFont ( const QFont &f )
182{ 182{
183 return setSelectedFont ( f. family(), d->m_fdb. styleString ( f ), f. pointSize(), QFont::encodingName ( f. charSet())); 183 return setSelectedFont ( f. family(), d->m_fdb. styleString ( f ), f. pointSize(), QFont::encodingName ( f. charSet()));
184} 184}
185 185
186 186
187/** 187/**
188 * This is an overloaded method @see setSelectedFont 188 * This is an overloaded method @see setSelectedFont
189 * @param familyStr The family of the font 189 * @param familyStr The family of the font
190 * @param styleStr The style of the font 190 * @param styleStr The style of the font
191 * @param sizeVal The size of font 191 * @param sizeVal The size of font
192 * @param charset The charset to be used. Will be deprecated by QT3 192 * @param charset The charset to be used. Will be deprecated by QT3
193 */ 193 */
194bool OFontSelector::setSelectedFont( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) 194bool OFontSelector::setSelectedFont( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset )
195{ 195{
196 QString sizeStr = QString::number ( sizeVal ); 196 QString sizeStr = QString::number ( sizeVal );
197 197
diff --git a/libopie2/opieui/otabwidget.cpp b/libopie2/opieui/otabwidget.cpp
index ec6af9d..f47c90b 100644
--- a/libopie2/opieui/otabwidget.cpp
+++ b/libopie2/opieui/otabwidget.cpp
@@ -29,101 +29,101 @@
29 29
30*/ 30*/
31 31
32#include <opie2/otabwidget.h> 32#include <opie2/otabwidget.h>
33 33
34/* OPIE */ 34/* OPIE */
35#include <qpe/applnk.h> 35#include <qpe/applnk.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
37#include <qpe/resource.h> 37#include <qpe/resource.h>
38#include <opie2/otabbar.h> 38#include <opie2/otabbar.h>
39 39
40/* QT */ 40/* QT */
41#include <qcombobox.h> 41#include <qcombobox.h>
42#include <qwidgetstack.h> 42#include <qwidgetstack.h>
43 43
44using namespace Opie; 44using namespace Opie;
45 45
46OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) 46OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p )
47 : QWidget( parent, name ) 47 : QWidget( parent, name )
48{ 48{
49 if ( s == Global ) 49 if ( s == Global )
50 { 50 {
51 Config config( "qpe" ); 51 Config config( "qpe" );
52 config.setGroup( "Appearance" ); 52 config.setGroup( "Appearance" );
53 s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); 53 s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab );
54 if ( s <= Global || s > IconList) 54 if ( s <= Global || s > IconList)
55 { 55 {
56 s = IconTab; 56 s = IconTab;
57 } 57 }
58 QString pos = config.readEntry( "TabPosition", "Top"); 58 QString pos = config.readEntry( "TabPosition", "Top");
59 if ( pos == "Bottom" ) 59 if ( pos == "Bottom" )
60 { 60 {
61 p = Bottom; 61 p = Bottom;
62 } 62 }
63 else 63 else
64 { 64 {
65 p = Top; 65 p = Top;
66 } 66 }
67 } 67 }
68 68
69 widgetStack = new QWidgetStack( this, "widgetstack" ); 69 widgetStack = new QWidgetStack( this, "widgetstack" );
70 widgetStack->setFrameStyle( QFrame::NoFrame ); 70 widgetStack->setFrameStyle( QFrame::NoFrame );
71 widgetStack->setLineWidth( style().defaultFrameWidth() ); 71 widgetStack->setLineWidth( style().defaultFrameWidth() );
72 72
73 tabBarStack = new QWidgetStack( this, "tabbarstack" ); 73 tabBarStack = new QWidgetStack( this, "tabbarstack" );
74 74
75 tabBar = new OTabBar( tabBarStack, "tabbar" ); 75 tabBar = new OTabBar( tabBarStack, "tabbar" );
76 tabBarStack->addWidget( tabBar, 0 ); 76 tabBarStack->addWidget( tabBar, 0 );
77 connect( tabBar, SIGNAL( selected( int ) ), this, SLOT( slotTabBarSelected( int ) ) ); 77 connect( tabBar, SIGNAL( selected(int) ), this, SLOT( slotTabBarSelected(int) ) );
78 78
79 tabList = new QComboBox( false, tabBarStack, "tablist" ); 79 tabList = new QComboBox( false, tabBarStack, "tablist" );
80 tabBarStack->addWidget( tabList, 1 ); 80 tabBarStack->addWidget( tabList, 1 );
81 connect( tabList, SIGNAL( activated( int ) ), this, SLOT( slotTabListSelected( int ) ) ); 81 connect( tabList, SIGNAL( activated(int) ), this, SLOT( slotTabListSelected(int) ) );
82 82
83 tabBarPosition = p; 83 tabBarPosition = p;
84 setTabStyle( s ); 84 setTabStyle( s );
85 setTabPosition( p ); 85 setTabPosition( p );
86 86
87 currTab= 0x0; 87 currTab= 0x0;
88} 88}
89 89
90OTabWidget::~OTabWidget() 90OTabWidget::~OTabWidget()
91{} 91{}
92 92
93void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) 93void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label )
94{ 94{
95 QPixmap iconset = loadSmooth( icon ); 95 QPixmap iconset = loadSmooth( icon );
96 96
97 QTab *tab = new QTab(); 97 QTab *tab = new QTab();
98 if ( tabBarStyle == IconTab ) 98 if ( tabBarStyle == IconTab )
99 { 99 {
100 tab->label = QString::null; 100 tab->label = QString::null;
101 } 101 }
102 else 102 else
103 { 103 {
104 tab->label = label; 104 tab->label = label;
105 } 105 }
106 if ( tabBarStyle == IconTab || tabBarStyle == IconList ) 106 if ( tabBarStyle == IconTab || tabBarStyle == IconList )
107 { 107 {
108 tab->iconset = new QIconSet( iconset ); 108 tab->iconset = new QIconSet( iconset );
109 } 109 }
110 int tabid = tabBar->addTab( tab ); 110 int tabid = tabBar->addTab( tab );
111 111
112 if ( tabBarStyle == IconTab || tabBarStyle == IconList ) 112 if ( tabBarStyle == IconTab || tabBarStyle == IconList )
113 { 113 {
114 tabList->insertItem( iconset, label, -1 ); 114 tabList->insertItem( iconset, label, -1 );
115 } 115 }
116 else 116 else
117 { 117 {
118 tabList->insertItem( label ); 118 tabList->insertItem( label );
119 } 119 }
120 120
121 widgetStack->addWidget( child, tabid ); 121 widgetStack->addWidget( child, tabid );
122 widgetStack->raiseWidget( child ); 122 widgetStack->raiseWidget( child );
123 widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); 123 widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
124 124
125 OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label ); 125 OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label );
126 tabs.append( tabinfo ); 126 tabs.append( tabinfo );
127 selectTab( tabinfo ); 127 selectTab( tabinfo );
128} 128}
129 129
diff --git a/libopie2/opieui/otimepicker.cpp b/libopie2/opieui/otimepicker.cpp
index d4712a4..66f9ce0 100644
--- a/libopie2/opieui/otimepicker.cpp
+++ b/libopie2/opieui/otimepicker.cpp
@@ -176,102 +176,102 @@ void OTimePicker::setTime( int h, int m )
176 * @param m minutes 176 * @param m minutes
177 */ 177 */
178void OTimePicker::setMinute(int m) 178void OTimePicker::setMinute(int m)
179{ 179{
180 180
181 QString minute; 181 QString minute;
182 minute.sprintf("%.2d",m); 182 minute.sprintf("%.2d",m);
183 183
184 QValueListIterator<OClickableLabel *> it; 184 QValueListIterator<OClickableLabel *> it;
185 for (it=minuteLst.begin(); it!=minuteLst.end(); it++) 185 for (it=minuteLst.begin(); it!=minuteLst.end(); it++)
186 { 186 {
187 if ((*it)->text() == minute) (*it)->setOn(true); 187 if ((*it)->text() == minute) (*it)->setOn(true);
188 else (*it)->setOn(false); 188 else (*it)->setOn(false);
189 } 189 }
190 190
191 tm.setHMS(tm.hour(),m,0); 191 tm.setHMS(tm.hour(),m,0);
192} 192}
193 193
194/** 194/**
195 * Method to set the hour 195 * Method to set the hour
196 */ 196 */
197void OTimePicker::setHour(int h) 197void OTimePicker::setHour(int h)
198{ 198{
199 199
200 QString hour; 200 QString hour;
201 hour.sprintf("%.2d",h); 201 hour.sprintf("%.2d",h);
202 202
203 QValueListIterator<OClickableLabel *> it; 203 QValueListIterator<OClickableLabel *> it;
204 for (it=hourLst.begin(); it!=hourLst.end(); it++) 204 for (it=hourLst.begin(); it!=hourLst.end(); it++)
205 { 205 {
206 if ((*it)->text() == hour) (*it)->setOn(true); 206 if ((*it)->text() == hour) (*it)->setOn(true);
207 else (*it)->setOn(false); 207 else (*it)->setOn(false);
208 } 208 }
209 tm.setHMS(h,tm.minute(),0); 209 tm.setHMS(h,tm.minute(),0);
210} 210}
211 211
212 212
213/** 213/**
214 * This is a modal Dialog. 214 * This is a modal Dialog.
215 * 215 *
216 * @param parent The parent widget 216 * @param parent The parent widget
217 * @param name The name of the object 217 * @param name The name of the object
218 * @param fl Possible window flags 218 * @param fl Possible window flags
219 */ 219 */
220OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl ) 220OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl )
221 : OTimePickerDialogBase (parent , name, true , fl) 221 : OTimePickerDialogBase (parent , name, true , fl)
222{ 222{
223 223
224 connect ( m_timePicker, SIGNAL( timeChanged( const QTime& ) ), 224 connect ( m_timePicker, SIGNAL( timeChanged(const QTime&) ),
225 this, SLOT( setTime ( const QTime& ) ) ); 225 this, SLOT( setTime(const QTime&) ) );
226 connect ( minuteField, SIGNAL( textChanged ( const QString& ) ), 226 connect ( minuteField, SIGNAL( textChanged(const QString&) ),
227 this, SLOT ( setMinute ( const QString& ) ) ); 227 this, SLOT ( setMinute(const QString&) ) );
228 connect ( hourField, SIGNAL( textChanged ( const QString& ) ), 228 connect ( hourField, SIGNAL( textChanged(const QString&) ),
229 this, SLOT ( setHour ( const QString& ) ) ); 229 this, SLOT ( setHour(const QString&) ) );
230 230
231} 231}
232 232
233/** 233/**
234 * @return the time 234 * @return the time
235 */ 235 */
236QTime OTimePickerDialog::time()const 236QTime OTimePickerDialog::time()const
237{ 237{
238 return m_time; 238 return m_time;
239} 239}
240 240
241/** 241/**
242 * Set the time to time 242 * Set the time to time
243 * @param time The time to be set 243 * @param time The time to be set
244 */ 244 */
245void OTimePickerDialog::setTime( const QTime& time ) 245void OTimePickerDialog::setTime( const QTime& time )
246{ 246{
247 m_time = time; 247 m_time = time;
248 248
249 m_timePicker->setHour ( time.hour() ); 249 m_timePicker->setHour ( time.hour() );
250 m_timePicker->setMinute( time.minute() ); 250 m_timePicker->setMinute( time.minute() );
251 251
252 // Set Textfields 252 // Set Textfields
253 if ( time.hour() < 10 ) 253 if ( time.hour() < 10 )
254 hourField->setText( "0" + QString::number( time.hour() ) ); 254 hourField->setText( "0" + QString::number( time.hour() ) );
255 else 255 else
256 hourField->setText( QString::number( time.hour() ) ); 256 hourField->setText( QString::number( time.hour() ) );
257 257
258 if ( time.minute() < 10 ) 258 if ( time.minute() < 10 )
259 minuteField->setText( "0" + QString::number( time.minute() ) ); 259 minuteField->setText( "0" + QString::number( time.minute() ) );
260 else 260 else
261 minuteField->setText( QString::number( time.minute() ) ); 261 minuteField->setText( QString::number( time.minute() ) );
262 262
263} 263}
264 264
265/** 265/**
266 * This method takes the current minute and tries to set hour 266 * This method takes the current minute and tries to set hour
267 * to hour. This succeeds if the resulting date is valid 267 * to hour. This succeeds if the resulting date is valid
268 * @param hour The hour as a string 268 * @param hour The hour as a string
269 */ 269 */
270void OTimePickerDialog::setHour ( const QString& hour ) 270void OTimePickerDialog::setHour ( const QString& hour )
271{ 271{
272 if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) ) 272 if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) )
273 { 273 {
274 m_time.setHMS ( hour.toInt(), m_time.minute() , 00 ); 274 m_time.setHMS ( hour.toInt(), m_time.minute() , 00 );
275 setTime ( m_time ); 275 setTime ( m_time );
276 } 276 }
277 277
diff --git a/libopie2/opieui/oversatileview.cpp b/libopie2/opieui/oversatileview.cpp
index 8839456..78154b7 100644
--- a/libopie2/opieui/oversatileview.cpp
+++ b/libopie2/opieui/oversatileview.cpp
@@ -125,142 +125,142 @@ OVersatileView::OVersatileView( QWidget* parent, const char* name, int mode )
125 125
126 _listview = new OListView( this, "oversatileview embedded listview" ); 126 _listview = new OListView( this, "oversatileview embedded listview" );
127 _iconview = new QIconView( this, "oversatileview embedded iconview" ); 127 _iconview = new QIconView( this, "oversatileview embedded iconview" );
128 128
129 _listview->setAllColumnsShowFocus( true ); 129 _listview->setAllColumnsShowFocus( true );
130 _listview->setRootIsDecorated( true ); 130 _listview->setRootIsDecorated( true );
131 _listview->setShowSortIndicator( true ); 131 _listview->setShowSortIndicator( true );
132 _iconview->setGridX( 90 ); 132 _iconview->setGridX( 90 );
133 _iconview->setGridY( 42 ); 133 _iconview->setGridY( 42 );
134 _iconview->setAutoArrange( true ); 134 _iconview->setAutoArrange( true );
135 135
136 #ifdef QWS // TODO: Let this depend on current geometry (rotation) 136 #ifdef QWS // TODO: Let this depend on current geometry (rotation)
137 _iconview->setArrangement( QIconView::TopToBottom ); 137 _iconview->setArrangement( QIconView::TopToBottom );
138 #else 138 #else
139 _iconview->setArrangement( QIconView::LeftToRight ); 139 _iconview->setArrangement( QIconView::LeftToRight );
140 #endif 140 #endif
141 141
142 _iconview->setResizeMode( QIconView::Adjust ); 142 _iconview->setResizeMode( QIconView::Adjust );
143 143
144 // qt-embedded: map stylus right on hold to right button press 144 // qt-embedded: map stylus right on hold to right button press
145 145
146 #ifdef QWS 146 #ifdef QWS
147 ( (QPEApplication*) qApp)->setStylusOperation( _iconview->viewport(), QPEApplication::RightOnHold ); 147 ( (QPEApplication*) qApp)->setStylusOperation( _iconview->viewport(), QPEApplication::RightOnHold );
148 ( (QPEApplication*) qApp)->setStylusOperation( _listview->viewport(), QPEApplication::RightOnHold ); 148 ( (QPEApplication*) qApp)->setStylusOperation( _listview->viewport(), QPEApplication::RightOnHold );
149 #endif 149 #endif
150 150
151 setViewMode( mode ); // TODO: Read last style from config 151 setViewMode( mode ); // TODO: Read last style from config
152 // setSynchronization( true ); // TODO: Implement this 152 // setSynchronization( true ); // TODO: Implement this
153 153
154 // create context menu allowing to switch between the views 154 // create context menu allowing to switch between the views
155 155
156 _contextmenu = new QPopupMenu( 0, "oversatileview contextmenu" ); 156 _contextmenu = new QPopupMenu( 0, "oversatileview contextmenu" );
157 _contextmenu->setCaption( "Style" ); 157 _contextmenu->setCaption( "Style" );
158 _contextmenu->setCheckable( true ); 158 _contextmenu->setCheckable( true );
159 QActionGroup* ag = new QActionGroup( _contextmenu, "style option group" ); 159 QActionGroup* ag = new QActionGroup( _contextmenu, "style option group" );
160 QAction* a1 = new QAction( "View Items in Icon Style", QIconSet( QPixmap( view_icon_xpm ) ), 160 QAction* a1 = new QAction( "View Items in Icon Style", QIconSet( QPixmap( view_icon_xpm ) ),
161 "View Icons", 0, ag, "viewicon action", true ); 161 "View Icons", 0, ag, "viewicon action", true );
162 QAction* a2 = new QAction( "View Items in Tree Style", QIconSet( QPixmap( view_tree_xpm ) ), 162 QAction* a2 = new QAction( "View Items in Tree Style", QIconSet( QPixmap( view_tree_xpm ) ),
163 "View Tree", 0, ag, "viewtree action", true ); 163 "View Tree", 0, ag, "viewtree action", true );
164 ag->addTo( _contextmenu ); 164 ag->addTo( _contextmenu );
165 if ( mode == Icons ) 165 if ( mode == Icons )
166 a1->setOn( true ); 166 a1->setOn( true );
167 else if ( mode == Tree ) 167 else if ( mode == Tree )
168 a2->setOn( true ); 168 a2->setOn( true );
169 connect( a1, SIGNAL( activated() ), this, SLOT( setIconViewMode() ) ); 169 connect( a1, SIGNAL( activated() ), this, SLOT( setIconViewMode() ) );
170 connect( a2, SIGNAL( activated() ), this, SLOT( setTreeViewMode() ) ); 170 connect( a2, SIGNAL( activated() ), this, SLOT( setTreeViewMode() ) );
171 171
172 #if (QT_VERSION >= 0x030000) 172 #if (QT_VERSION >= 0x030000)
173 connect( _listview, SIGNAL( contextMenuRequested( QListViewItem*, const QPoint&, int ) ), this, SLOT( contextMenuRequested( QListViewItem*, const QPoint&, int ) ) ); 173 connect( _listview, SIGNAL( contextMenuRequested(QListViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) );
174 connect( _iconview, SIGNAL( contextMenuRequested( QIconViewItem*, const QPoint& ) ), this, SLOT( contextMenuRequested( QIconViewItem*, const QPoint& ) ) ); 174 connect( _iconview, SIGNAL( contextMenuRequested(QIconViewItem*,const QPoint&) ), this, SLOT( contextMenuRequested(QIconViewItem*,const QPoint&) ) );
175 #else 175 #else
176 connect( _listview, SIGNAL( rightButtonPressed( QListViewItem*, const QPoint&, int ) ), this, SLOT( contextMenuRequested( QListViewItem*, const QPoint&, int ) ) ); 176 connect( _listview, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) );
177 connect( _iconview, SIGNAL( rightButtonPressed( QIconViewItem*, const QPoint& ) ), this, SLOT( contextMenuRequested( QIconViewItem*, const QPoint& ) ) ); 177 connect( _iconview, SIGNAL( rightButtonPressed(QIconViewItem*,const QPoint&) ), this, SLOT( contextMenuRequested(QIconViewItem*,const QPoint&) ) );
178 #endif 178 #endif
179 179
180 // 180 //
181 // signal forwarders 181 // signal forwarders
182 // 182 //
183 // unfortunately we can't short-circuit all the QListView and QIconView signals 183 // unfortunately we can't short-circuit all the QListView and QIconView signals
184 // to OVersatileView signals, because the signal/slot mechanism doesn't allow 184 // to OVersatileView signals, because the signal/slot mechanism doesn't allow
185 // type-conversion :-( 185 // type-conversion :-(
186 186
187 // common signals for listview 187 // common signals for listview
188 188
189 connect( _listview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); 189 connect( _listview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) );
190 connect( _listview, SIGNAL( selectionChanged( QListViewItem * ) ), this, SLOT( selectionChanged( QListViewItem * ) ) ); 190 connect( _listview, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( selectionChanged(QListViewItem*) ) );
191 connect( _listview, SIGNAL( currentChanged( QListViewItem * ) ), this, SLOT( currentChanged( QListViewItem * ) ) ); 191 connect( _listview, SIGNAL( currentChanged(QListViewItem*) ), this, SLOT( currentChanged(QListViewItem*) ) );
192 connect( _listview, SIGNAL( clicked( QListViewItem * ) ), this, SLOT( clicked( QListViewItem * ) ) ); 192 connect( _listview, SIGNAL( clicked(QListViewItem*) ), this, SLOT( clicked(QListViewItem*) ) );
193 connect( _listview, SIGNAL( pressed( QListViewItem * ) ), this, SLOT( pressed( QListViewItem * ) ) ); 193 connect( _listview, SIGNAL( pressed(QListViewItem*) ), this, SLOT( pressed(QListViewItem*) ) );
194 194
195 connect( _listview, SIGNAL( doubleClicked( QListViewItem * ) ), this, SLOT( doubleClicked( QListViewItem * ) ) ); 195 connect( _listview, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( doubleClicked(QListViewItem*) ) );
196 connect( _listview, SIGNAL( returnPressed( QListViewItem * ) ), this, SLOT( returnPressed( QListViewItem * ) ) ); 196 connect( _listview, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( returnPressed(QListViewItem*) ) );
197 197
198 connect( _listview, SIGNAL( onItem( QListViewItem * ) ), this, SLOT( onItem( QListViewItem * ) ) ); 198 connect( _listview, SIGNAL( onItem(QListViewItem*) ), this, SLOT( onItem(QListViewItem*) ) );
199 connect( _listview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) ); 199 connect( _listview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) );
200 200
201 // common signals for iconview 201 // common signals for iconview
202 202
203 connect( _iconview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); 203 connect( _iconview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) );
204 connect( _iconview, SIGNAL( selectionChanged( QIconViewItem * ) ), this, SLOT( selectionChanged( QIconViewItem * ) ) ); 204 connect( _iconview, SIGNAL( selectionChanged(QIconViewItem*) ), this, SLOT( selectionChanged(QIconViewItem*) ) );
205 connect( _iconview, SIGNAL( currentChanged( QIconViewItem * ) ), this, SLOT( currentChanged( QIconViewItem * ) ) ); 205 connect( _iconview, SIGNAL( currentChanged(QIconViewItem*) ), this, SLOT( currentChanged(QIconViewItem*) ) );
206 connect( _iconview, SIGNAL( clicked( QIconViewItem * ) ), this, SLOT( clicked( QIconViewItem * ) ) ); 206 connect( _iconview, SIGNAL( clicked(QIconViewItem*) ), this, SLOT( clicked(QIconViewItem*) ) );
207 connect( _iconview, SIGNAL( pressed( QIconViewItem * ) ), this, SLOT( pressed( QIconViewItem * ) ) ); 207 connect( _iconview, SIGNAL( pressed(QIconViewItem*) ), this, SLOT( pressed(QIconViewItem*) ) );
208 208
209 connect( _iconview, SIGNAL( doubleClicked( QIconViewItem * ) ), this, SLOT( doubleClicked( QIconViewItem * ) ) ); 209 connect( _iconview, SIGNAL( doubleClicked(QIconViewItem*) ), this, SLOT( doubleClicked(QIconViewItem*) ) );
210 connect( _iconview, SIGNAL( returnPressed( QIconViewItem * ) ), this, SLOT( returnPressed( QIconViewItem * ) ) ); 210 connect( _iconview, SIGNAL( returnPressed(QIconViewItem*) ), this, SLOT( returnPressed(QIconViewItem*) ) );
211 211
212 connect( _iconview, SIGNAL( onItem( QIconViewItem * ) ), this, SLOT( onItem( QIconViewItem * ) ) ); 212 connect( _iconview, SIGNAL( onItem(QIconViewItem*) ), this, SLOT( onItem(QIconViewItem*) ) );
213 connect( _iconview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) ); 213 connect( _iconview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) );
214 214
215 // listview only signals 215 // listview only signals
216 216
217 connect( _listview, SIGNAL( expanded( QListViewItem * ) ), this, SLOT( expanded( QListViewItem * ) ) ); 217 connect( _listview, SIGNAL( expanded(QListViewItem*) ), this, SLOT( expanded(QListViewItem*) ) );
218 connect( _listview, SIGNAL( collapsed( QListViewItem * ) ), this, SLOT( collapsed( QListViewItem * ) ) ); 218 connect( _listview, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( collapsed(QListViewItem*) ) );
219 219
220 // iconview only signals 220 // iconview only signals
221 221
222 connect( _iconview, SIGNAL( moved() ), this, SIGNAL( moved() ) ); 222 connect( _iconview, SIGNAL( moved() ), this, SIGNAL( moved() ) );
223} 223}
224 224
225OVersatileView::~OVersatileView() 225OVersatileView::~OVersatileView()
226{ 226{
227} 227}
228 228
229QPopupMenu* OVersatileView::contextMenu() const 229QPopupMenu* OVersatileView::contextMenu() const
230{ 230{
231 return _contextmenu; 231 return _contextmenu;
232} 232}
233 233
234void OVersatileView::contextMenuRequested( QListViewItem* item, const QPoint& pos, int col ) 234void OVersatileView::contextMenuRequested( QListViewItem* item, const QPoint& pos, int col )
235{ 235{
236 // can't use QObject::inherits here, because ListViewItems, beit Q, O or K, 236 // can't use QObject::inherits here, because ListViewItems, beit Q, O or K,
237 // do not inherit from QObject - assuming here the programmer is 237 // do not inherit from QObject - assuming here the programmer is
238 // disciplined enough to only add OVersatileViewItems to an OVersatileView 238 // disciplined enough to only add OVersatileViewItems to an OVersatileView
239 popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, col ); 239 popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, col );
240} 240}
241 241
242void OVersatileView::contextMenuRequested( QIconViewItem* item, const QPoint& pos ) 242void OVersatileView::contextMenuRequested( QIconViewItem* item, const QPoint& pos )
243{ 243{
244 // see above 244 // see above
245 popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, -1 ); 245 popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, -1 );
246} 246}
247 247
248void OVersatileView::popupContextMenu( OVersatileViewItem* item, const QPoint& pos, int col ) 248void OVersatileView::popupContextMenu( OVersatileViewItem* item, const QPoint& pos, int col )
249{ 249{
250 if ( !item ) 250 if ( !item )
251 _contextmenu->exec( pos ); 251 _contextmenu->exec( pos );
252 else 252 else
253 emit( contextMenuRequested( item, pos, col ) ); 253 emit( contextMenuRequested( item, pos, col ) );
254} 254}
255 255
256void OVersatileView::setSynchronization( bool sync ) 256void OVersatileView::setSynchronization( bool sync )
257{ 257{
258 _synchronization = sync; 258 _synchronization = sync;
259} 259}
260 260
261bool OVersatileView::synchronization() 261bool OVersatileView::synchronization()
262{ 262{
263 return _synchronization; 263 return _synchronization;
264} 264}
265 265
266void OVersatileView::setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened, QPixmap& closed ) 266void OVersatileView::setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened, QPixmap& closed )