summaryrefslogtreecommitdiff
path: root/core/pim
Unidiff
Diffstat (limited to 'core/pim') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp4
-rw-r--r--core/pim/datebook/datebook.cpp4
-rw-r--r--core/pim/datebook2/mainwindow.cpp4
-rw-r--r--core/pim/osearch/mainwindow.cpp4
4 files changed, 8 insertions, 8 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 438c270..406ced6 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -1,192 +1,192 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** Copyright (C) 2003 Stefan Eilers (eilers.stefan@epost.de) 3** Copyright (C) 2003 Stefan Eilers (eilers.stefan@epost.de)
4** 4**
5** This file is part of the Open Palmtop Environment (see www.opie.info). 5** This file is part of the Open Palmtop Environment (see www.opie.info).
6** 6**
7** This file may be distributed and/or modified under the terms of the 7** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software 8** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file. 10** packaging of this file.
11** 11**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14** 14**
15** See http://www.trolltech.com/gpl/ for GPL licensing information. 15** See http://www.trolltech.com/gpl/ for GPL licensing information.
16** 16**
17** 17**
18**********************************************************************/ 18**********************************************************************/
19 19
20#define QTOPIA_INTERNAL_FD 20#define QTOPIA_INTERNAL_FD
21 21
22#include "contacteditor.h" 22#include "contacteditor.h"
23#include "ablabel.h" 23#include "ablabel.h"
24#include "abview.h" 24#include "abview.h"
25#include "abtable.h" 25#include "abtable.h"
26// #include "addresssettings.h" 26// #include "addresssettings.h"
27#include "addressbook.h" 27#include "addressbook.h"
28 28
29 29
30#include <opie/ofileselector.h> 30#include <opie/ofileselector.h>
31#include <opie/ofiledialog.h> 31#include <opie/ofiledialog.h>
32#include <opie/ocontact.h> 32#include <opie/ocontact.h>
33#include <opie/ocontactaccessbackend_vcard.h> 33#include <opie/ocontactaccessbackend_vcard.h>
34 34
35#include <qpe/resource.h> 35#include <qpe/resource.h>
36#include <qpe/ir.h> 36#include <qpe/ir.h>
37#include <qpe/qpemessagebox.h> 37#include <qpe/qpemessagebox.h>
38#include <qpe/qcopenvelope_qws.h> 38#include <qpe/qcopenvelope_qws.h>
39#include <qpe/qpetoolbar.h> 39#include <qpe/qpetoolbar.h>
40#include <qpe/qpemenubar.h> 40#include <qmenubar.h>
41// #include <qtoolbar.h> 41// #include <qtoolbar.h>
42// #include <qmenubar.h> 42// #include <qmenubar.h>
43#include <qpe/qpeapplication.h> 43#include <qpe/qpeapplication.h>
44#include <qpe/config.h> 44#include <qpe/config.h>
45 45
46#include <qaction.h> 46#include <qaction.h>
47#include <qdialog.h> 47#include <qdialog.h>
48#include <qdir.h> 48#include <qdir.h>
49#include <qfile.h> 49#include <qfile.h>
50#include <qimage.h> 50#include <qimage.h>
51#include <qlayout.h> 51#include <qlayout.h>
52#include <qmessagebox.h> 52#include <qmessagebox.h>
53#include <qpixmap.h> 53#include <qpixmap.h>
54#include <qpopupmenu.h> 54#include <qpopupmenu.h>
55#include <qstringlist.h> 55#include <qstringlist.h>
56#include <qtoolbutton.h> 56#include <qtoolbutton.h>
57#include <qwhatsthis.h> 57#include <qwhatsthis.h>
58#include <qdatetime.h> 58#include <qdatetime.h>
59 59
60#include <stdlib.h> 60#include <stdlib.h>
61#include <sys/stat.h> 61#include <sys/stat.h>
62#include <sys/types.h> 62#include <sys/types.h>
63#include <fcntl.h> 63#include <fcntl.h>
64#include <unistd.h> 64#include <unistd.h>
65 65
66 66
67#include "picker.h" 67#include "picker.h"
68#include "configdlg.h" 68#include "configdlg.h"
69 69
70extern QString addressbookPersonalVCardName(); 70extern QString addressbookPersonalVCardName();
71 71
72AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, 72AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
73 WFlags f ) 73 WFlags f )
74 : QMainWindow( parent, name, f ), 74 : QMainWindow( parent, name, f ),
75 catMenu (0l), 75 catMenu (0l),
76 abEditor(0l), 76 abEditor(0l),
77 syncing(FALSE), 77 syncing(FALSE),
78 m_tableViewButton(0l), 78 m_tableViewButton(0l),
79 m_cardViewButton(0l) 79 m_cardViewButton(0l)
80{ 80{
81 isLoading = true; 81 isLoading = true;
82 82
83 m_config.load(); 83 m_config.load();
84 84
85 setCaption( tr("Contacts") ); 85 setCaption( tr("Contacts") );
86 setIcon( Resource::loadPixmap( "AddressBook" ) ); 86 setIcon( Resource::loadPixmap( "AddressBook" ) );
87 87
88 // Settings for Main Menu 88 // Settings for Main Menu
89 // setToolBarsMovable( false ); 89 // setToolBarsMovable( false );
90 setToolBarsMovable( !m_config.fixedBars() ); 90 setToolBarsMovable( !m_config.fixedBars() );
91 setRightJustification( true ); 91 setRightJustification( true );
92 92
93 QPEToolBar *bar = new QPEToolBar( this ); 93 QPEToolBar *bar = new QPEToolBar( this );
94 bar->setHorizontalStretchable( TRUE ); 94 bar->setHorizontalStretchable( TRUE );
95 95
96 QPEMenuBar *mbList = new QPEMenuBar( bar ); 96 QMenuBar *mbList = new QMenuBar( bar );
97 mbList->setMargin( 0 ); 97 mbList->setMargin( 0 );
98 98
99 QPopupMenu *edit = new QPopupMenu( mbList ); 99 QPopupMenu *edit = new QPopupMenu( mbList );
100 mbList->insertItem( tr( "Contact" ), edit ); 100 mbList->insertItem( tr( "Contact" ), edit );
101 101
102 // Category Menu 102 // Category Menu
103 catMenu = new QPopupMenu( this ); 103 catMenu = new QPopupMenu( this );
104 catMenu->setCheckable( TRUE ); 104 catMenu->setCheckable( TRUE );
105 connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); 105 connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) );
106 mbList->insertItem( tr("View"), catMenu ); 106 mbList->insertItem( tr("View"), catMenu );
107 107
108 // Create Toolbar 108 // Create Toolbar
109 listTools = new QPEToolBar( this, "list operations" ); 109 listTools = new QPEToolBar( this, "list operations" );
110 listTools->setHorizontalStretchable( true ); 110 listTools->setHorizontalStretchable( true );
111 addToolBar( listTools ); 111 addToolBar( listTools );
112 moveToolBar( listTools, m_config.getToolBarPos() ); 112 moveToolBar( listTools, m_config.getToolBarPos() );
113 113
114 // View Icons 114 // View Icons
115 m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/listview" ), 115 m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/listview" ),
116 QString::null, 0, this, 0 ); 116 QString::null, 0, this, 0 );
117 connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); 117 connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) );
118 m_tableViewButton->setToggleAction( true ); 118 m_tableViewButton->setToggleAction( true );
119 m_tableViewButton->addTo( listTools ); 119 m_tableViewButton->addTo( listTools );
120 m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "addressbook/cardview" ), QString::null, 0, this, 0 ); 120 m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "addressbook/cardview" ), QString::null, 0, this, 0 );
121 connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); 121 connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) );
122 m_cardViewButton->setToggleAction( true ); 122 m_cardViewButton->setToggleAction( true );
123 m_cardViewButton->addTo( listTools ); 123 m_cardViewButton->addTo( listTools );
124 124
125 listTools->addSeparator(); 125 listTools->addSeparator();
126 126
127 // Other Buttons 127 // Other Buttons
128 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 128 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null,
129 0, this, 0 ); 129 0, this, 0 );
130 actionNew = a; 130 actionNew = a;
131 connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); 131 connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) );
132 a->addTo( edit ); 132 a->addTo( edit );
133 a->addTo( listTools ); 133 a->addTo( listTools );
134 134
135 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, 135 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null,
136 0, this, 0 ); 136 0, this, 0 );
137 actionEdit = a; 137 actionEdit = a;
138 connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); 138 connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) );
139 a->addTo( edit ); 139 a->addTo( edit );
140 a->addTo( listTools ); 140 a->addTo( listTools );
141 141
142 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 142 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null,
143 0, this, 0 ); 143 0, this, 0 );
144 actionTrash = a; 144 actionTrash = a;
145 connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); 145 connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) );
146 a->addTo( edit ); 146 a->addTo( edit );
147 a->addTo( listTools ); 147 a->addTo( listTools );
148 148
149 149
150 // make it possible to go directly to businesscard via qcop call 150 // make it possible to go directly to businesscard via qcop call
151 //#if defined(Q_WS_QWS) // Why this ? (se) 151 //#if defined(Q_WS_QWS) // Why this ? (se)
152#if !defined(QT_NO_COP) 152#if !defined(QT_NO_COP)
153 QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); 153 QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this );
154 connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), 154 connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)),
155 this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); 155 this, SLOT ( appMessage(const QCString &, const QByteArray &) ) );
156#endif 156#endif
157 // #endif 157 // #endif
158 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), 158 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ),
159 QString::null, 0, this, 0 ); 159 QString::null, 0, this, 0 );
160 actionFind = a; 160 actionFind = a;
161 connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); 161 connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) );
162 a->addTo( edit ); 162 a->addTo( edit );
163 a->addTo( listTools ); 163 a->addTo( listTools );
164 164
165 // Much better search widget, taken from QTReader.. (se) 165 // Much better search widget, taken from QTReader.. (se)
166 searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); 166 searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE );
167 searchBar->setHorizontalStretchable( TRUE ); 167 searchBar->setHorizontalStretchable( TRUE );
168 searchBar->hide(); 168 searchBar->hide();
169 searchEdit = new QLineEdit( searchBar, "searchEdit" ); 169 searchEdit = new QLineEdit( searchBar, "searchEdit" );
170 170
171 // QFont f("unifont", 16 /*, QFont::Bold*/); 171 // QFont f("unifont", 16 /*, QFont::Bold*/);
172 // searchEdit->setFont( f ); 172 // searchEdit->setFont( f );
173 173
174 searchBar->setStretchableWidget( searchEdit ); 174 searchBar->setStretchableWidget( searchEdit );
175 connect( searchEdit, SIGNAL( returnPressed( ) ), 175 connect( searchEdit, SIGNAL( returnPressed( ) ),
176 this, SLOT( slotFind( ) ) ); 176 this, SLOT( slotFind( ) ) );
177 177
178 a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); 178 a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 );
179 connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); 179 connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) );
180 a->addTo( searchBar ); 180 a->addTo( searchBar );
181 181
182 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 182 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
183 connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); 183 connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) );
184 a->addTo( searchBar ); 184 a->addTo( searchBar );
185 185
186 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), 186 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ),
187 QString::null, 0, this, 0 ); 187 QString::null, 0, this, 0 );
188 //a->setEnabled( FALSE ); we got support for it now :) zecke 188 //a->setEnabled( FALSE ); we got support for it now :) zecke
189 actionMail = a; 189 actionMail = a;
190 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); 190 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) );
191 a->addTo( edit ); 191 a->addTo( edit );
192 a->addTo( listTools ); 192 a->addTo( listTools );
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index 07d7164..a040d7c 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -1,202 +1,202 @@
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** $Id$ 19** $Id$
20** 20**
21**********************************************************************/ 21**********************************************************************/
22 22
23#define QTOPIA_INTERNAL_FD 23#define QTOPIA_INTERNAL_FD
24 24
25#include "datebook.h" 25#include "datebook.h"
26#include "datebookday.h" 26#include "datebookday.h"
27#include "datebooksettings.h" 27#include "datebooksettings.h"
28#include "datebookweek.h" 28#include "datebookweek.h"
29#include "datebookweeklst.h" 29#include "datebookweeklst.h"
30#include "dateentryimpl.h" 30#include "dateentryimpl.h"
31 31
32#include <qpe/datebookmonth.h> 32#include <qpe/datebookmonth.h>
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#include <qpe/config.h> 34#include <qpe/config.h>
35#include <qpe/qpedebug.h> 35#include <qpe/qpedebug.h>
36#include <qpe/event.h> 36#include <qpe/event.h>
37#include <qpe/finddialog.h> 37#include <qpe/finddialog.h>
38#include <qpe/ir.h> 38#include <qpe/ir.h>
39#include <qpe/qpemenubar.h> 39#include <qmenubar.h>
40#include <qpe/qpemessagebox.h> 40#include <qpe/qpemessagebox.h>
41#include <qpe/resource.h> 41#include <qpe/resource.h>
42#include <qpe/sound.h> 42#include <qpe/sound.h>
43#include <qpe/timestring.h> 43#include <qpe/timestring.h>
44#include <qpe/qpetoolbar.h> 44#include <qpe/qpetoolbar.h>
45#include <qpe/tzselect.h> 45#include <qpe/tzselect.h>
46#include <qpe/xmlreader.h> 46#include <qpe/xmlreader.h>
47 47
48#include <qaction.h> 48#include <qaction.h>
49#include <qcopchannel_qws.h> 49#include <qcopchannel_qws.h>
50#include <qdatetime.h> 50#include <qdatetime.h>
51#include <qdialog.h> 51#include <qdialog.h>
52#include <qfile.h> 52#include <qfile.h>
53#include <qlabel.h> 53#include <qlabel.h>
54#include <qlayout.h> 54#include <qlayout.h>
55#include <qmessagebox.h> 55#include <qmessagebox.h>
56#include <qpopupmenu.h> 56#include <qpopupmenu.h>
57#include <qpushbutton.h> 57#include <qpushbutton.h>
58#include <qregexp.h> 58#include <qregexp.h>
59#include <qtextcodec.h> 59#include <qtextcodec.h>
60#include <qtextstream.h> 60#include <qtextstream.h>
61#include <qtimer.h> 61#include <qtimer.h>
62#include <qtl.h> 62#include <qtl.h>
63#include <qwidgetstack.h> 63#include <qwidgetstack.h>
64#include <qwindowsystem_qws.h> 64#include <qwindowsystem_qws.h>
65 65
66#include <sys/stat.h> 66#include <sys/stat.h>
67#include <sys/types.h> 67#include <sys/types.h>
68#include <fcntl.h> 68#include <fcntl.h>
69#include <unistd.h> 69#include <unistd.h>
70 70
71#include <stdlib.h> 71#include <stdlib.h>
72 72
73DateBook::DateBook( QWidget *parent, const char *, WFlags f ) 73DateBook::DateBook( QWidget *parent, const char *, WFlags f )
74 : QMainWindow( parent, "datebook", f ), 74 : QMainWindow( parent, "datebook", f ),
75 aPreset( FALSE ), 75 aPreset( FALSE ),
76 presetTime( -1 ), 76 presetTime( -1 ),
77 startTime( 8 ), // an acceptable default 77 startTime( 8 ), // an acceptable default
78 rowStyle( 0 ), 78 rowStyle( 0 ),
79 bJumpToCurTime(FALSE), 79 bJumpToCurTime(FALSE),
80 syncing(FALSE), 80 syncing(FALSE),
81 inSearch(FALSE), 81 inSearch(FALSE),
82 alarmCounter(0) 82 alarmCounter(0)
83{ 83{
84 bool needEvilHack= false; // if we need an Evil Hack 84 bool needEvilHack= false; // if we need an Evil Hack
85 QTime t; 85 QTime t;
86 t.start(); 86 t.start();
87 db = new DateBookDBHack; 87 db = new DateBookDBHack;
88 qDebug("loading db t=%d", t.elapsed() ); 88 qDebug("loading db t=%d", t.elapsed() );
89 loadSettings(); 89 loadSettings();
90 setCaption( tr("Calendar") ); 90 setCaption( tr("Calendar") );
91 setIcon( Resource::loadPixmap( "datebook_icon" ) ); 91 setIcon( Resource::loadPixmap( "datebook_icon" ) );
92 92
93 setToolBarsMovable( FALSE ); 93 setToolBarsMovable( FALSE );
94 94
95 views = new QWidgetStack( this ); 95 views = new QWidgetStack( this );
96 setCentralWidget( views ); 96 setCentralWidget( views );
97 97
98 dayView = 0; 98 dayView = 0;
99 weekView = 0; 99 weekView = 0;
100 weekLstView = 0; 100 weekLstView = 0;
101 monthView = 0; 101 monthView = 0;
102 102
103// QPEToolBar *bar = new QPEToolBar( this ); 103// QPEToolBar *bar = new QPEToolBar( this );
104// bar->setHorizontalStretchable( TRUE ); 104// bar->setHorizontalStretchable( TRUE );
105 105
106// QPEMenuBar *mb = new QPEMenuBar( bar ); 106// QMenuBar *mb = new QMenuBar( bar );
107// mb->setMargin( 0 ); 107// mb->setMargin( 0 );
108 108
109// QPopupMenu *view = new QPopupMenu( this ); 109// QPopupMenu *view = new QPopupMenu( this );
110// mb->insertItem( tr( "View" ), view ); 110// mb->insertItem( tr( "View" ), view );
111 111
112 QPEToolBar *sub_bar = new QPEToolBar(this); 112 QPEToolBar *sub_bar = new QPEToolBar(this);
113 sub_bar->setHorizontalStretchable(TRUE); 113 sub_bar->setHorizontalStretchable(TRUE);
114 114
115 QActionGroup *g = new QActionGroup( this ); 115 QActionGroup *g = new QActionGroup( this );
116 g->setExclusive( TRUE ); 116 g->setExclusive( TRUE );
117 117
118 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); 118 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
119 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 119 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
120 a->addTo( sub_bar ); 120 a->addTo( sub_bar );
121 121
122 sub_bar->addSeparator(); 122 sub_bar->addSeparator();
123 123
124 a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/to_day" ), QString::null, 0, g, 0 ); 124 a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/to_day" ), QString::null, 0, g, 0 );
125 connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); 125 connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) );
126 a->addTo( sub_bar ); 126 a->addTo( sub_bar );
127 //a->addTo( view ); 127 //a->addTo( view );
128 128
129 sub_bar->addSeparator(); 129 sub_bar->addSeparator();
130 130
131 a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); 131 a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 );
132 connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); 132 connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) );
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 a->setOn( TRUE ); 136 a->setOn( TRUE );
137 dayAction = a; 137 dayAction = a;
138 138
139 a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); 139 a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 );
140 connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); 140 connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) );
141 a->addTo( sub_bar ); 141 a->addTo( sub_bar );
142// a->addTo( view ); 142// a->addTo( view );
143 a->setToggleAction( TRUE ); 143 a->setToggleAction( TRUE );
144 weekAction = a; 144 weekAction = a;
145 145
146 a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 ); 146 a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 );
147 connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) ); 147 connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) );
148 a->addTo( sub_bar ); 148 a->addTo( sub_bar );
149// a->addTo( view ); 149// a->addTo( view );
150 a->setToggleAction( TRUE ); 150 a->setToggleAction( TRUE );
151 weekLstAction = a; 151 weekLstAction = a;
152 152
153 a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); 153 a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 );
154 connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); 154 connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) );
155 a->addTo( sub_bar ); 155 a->addTo( sub_bar );
156// a->addTo( view ); 156// a->addTo( view );
157 a->setToggleAction( TRUE ); 157 a->setToggleAction( TRUE );
158 monthAction = a; 158 monthAction = a;
159 159
160 sub_bar->addSeparator(); 160 sub_bar->addSeparator();
161 161
162 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 ); 162 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 );
163 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); 163 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) );
164 a->addTo( sub_bar ); 164 a->addTo( sub_bar );
165 165
166 a = new QAction( tr( "Edit..." ), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0 ); 166 a = new QAction( tr( "Edit..." ), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0 );
167 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); 167 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
168 a->addTo( sub_bar ); 168 a->addTo( sub_bar );
169 169
170 if(defaultView==DAY) viewDay(); 170 if(defaultView==DAY) viewDay();
171 if(defaultView==WEEK) needEvilHack=true;// viewWeek(); 171 if(defaultView==WEEK) needEvilHack=true;// viewWeek();
172 if(defaultView==WEEKLST) viewWeekLst(); 172 if(defaultView==WEEKLST) viewWeekLst();
173 if(defaultView==MONTH) viewMonth(); 173 if(defaultView==MONTH) viewMonth();
174 174
175 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); 175 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) );
176 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) ); 176 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) );
177 177
178#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 178#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
179 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), this, SLOT(appMessage(const QCString&, const QByteArray&)) ); 179 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), this, SLOT(appMessage(const QCString&, const QByteArray&)) );
180#endif 180#endif
181 181
182 // listen on QPE/System 182 // listen on QPE/System
183#if defined(Q_WS_QWS) 183#if defined(Q_WS_QWS)
184#if !defined(QT_NO_COP) 184#if !defined(QT_NO_COP)
185 QCopChannel *channel = new QCopChannel( "QPE/System", this ); 185 QCopChannel *channel = new QCopChannel( "QPE/System", this );
186 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); 186 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) );
187 channel = new QCopChannel( "QPE/Datebook", this ); 187 channel = new QCopChannel( "QPE/Datebook", this );
188 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); 188 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) );
189 qDebug("olle\n"); 189 qDebug("olle\n");
190#endif 190#endif
191#endif 191#endif
192 192
193 qDebug("done t=%d", t.elapsed() ); 193 qDebug("done t=%d", t.elapsed() );
194 194
195 connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) ); 195 connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) );
196 connect( qApp, SIGNAL( reload()), this, SLOT( reload() ) ); 196 connect( qApp, SIGNAL( reload()), this, SLOT( reload() ) );
197 /* 197 /*
198 * Here is a problem description: 198 * Here is a problem description:
199 * When Weekview is the default view 199 * When Weekview is the default view
200 * a DateBookWeekView get's created 200 * a DateBookWeekView get's created
201 * redraw() get's called. So what? 201 * redraw() get's called. So what?
202 * Remember that we're still in the c'tor 202 * Remember that we're still in the c'tor
diff --git a/core/pim/datebook2/mainwindow.cpp b/core/pim/datebook2/mainwindow.cpp
index 68525b3..7d436ae 100644
--- a/core/pim/datebook2/mainwindow.cpp
+++ b/core/pim/datebook2/mainwindow.cpp
@@ -1,192 +1,192 @@
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 <qpe/qpemenubar.h> 11#include <qmenubar.h>
12#include <qpe/qpetoolbar.h> 12#include <qpe/qpetoolbar.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 );
91 setCentralWidget( m_stack ); 91 setCentralWidget( m_stack );
92 92
93 m_toolBar = new QPEToolBar( this ); 93 m_toolBar = new QPEToolBar( this );
94 m_toolBar->setHorizontalStretchable( TRUE ); 94 m_toolBar->setHorizontalStretchable( TRUE );
95 95
96 QPEMenuBar* mb = new QPEMenuBar( m_toolBar ); 96 QMenuBar* mb = new QMenuBar( m_toolBar );
97 97
98 m_popView = new QPopupMenu( this ); 98 m_popView = new QPopupMenu( this );
99 m_popSetting = new QPopupMenu( this ); 99 m_popSetting = new QPopupMenu( this );
100 100
101 mb->insertItem( tr("View"), m_popView ); 101 mb->insertItem( tr("View"), m_popView );
102 mb->insertItem( tr("Settings" ), m_popSetting ); 102 mb->insertItem( tr("Settings" ), m_popSetting );
103 103
104 m_popTemplate = new QPopupMenu( this ); 104 m_popTemplate = new QPopupMenu( this );
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}
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index f768d81..80738df 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -1,214 +1,214 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 9
10// (c) 2002 Patrick S. Vogt <tille@handhelds.org> 10// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
11 11
12 12
13 13
14#include <qaction.h> 14#include <qaction.h>
15#include <qmessagebox.h> 15#include <qmessagebox.h>
16#include <qpopupmenu.h> 16#include <qpopupmenu.h>
17#include <qtoolbutton.h> 17#include <qtoolbutton.h>
18#include <qstring.h> 18#include <qstring.h>
19#include <qlabel.h> 19#include <qlabel.h>
20#include <qfile.h> 20#include <qfile.h>
21#include <qhbuttongroup.h> 21#include <qhbuttongroup.h>
22#include <qhbox.h> 22#include <qhbox.h>
23#include <qpushbutton.h> 23#include <qpushbutton.h>
24#include <qintdict.h> 24#include <qintdict.h>
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qlineedit.h> 26#include <qlineedit.h>
27#include <qsignalmapper.h> 27#include <qsignalmapper.h>
28#include <qtextbrowser.h> 28#include <qtextbrowser.h>
29#include <qregexp.h> 29#include <qregexp.h>
30#include <qwhatsthis.h> 30#include <qwhatsthis.h>
31#include <qpe/qpemenubar.h> 31#include <qmenubar.h>
32#include <qpe/qpemessagebox.h> 32#include <qpe/qpemessagebox.h>
33#include <qpe/resource.h> 33#include <qpe/resource.h>
34#include <qpe/config.h> 34#include <qpe/config.h>
35#include <qpe/qpetoolbar.h> 35#include <qpe/qpetoolbar.h>
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37#include <qpe/config.h> 37#include <qpe/config.h>
38#include <qpe/global.h> 38#include <qpe/global.h>
39#include <opie/owait.h> 39#include <opie/owait.h>
40 40
41#include "olistview.h" 41#include "olistview.h"
42#include "olistviewitem.h" 42#include "olistviewitem.h"
43#include "resultitem.h" 43#include "resultitem.h"
44#include "adresssearch.h" 44#include "adresssearch.h"
45#include "todosearch.h" 45#include "todosearch.h"
46#include "datebooksearch.h" 46#include "datebooksearch.h"
47#include "applnksearch.h" 47#include "applnksearch.h"
48#include "doclnksearch.h" 48#include "doclnksearch.h"
49#include "mainwindow.h" 49#include "mainwindow.h"
50 50
51MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : 51MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
52 QMainWindow( parent, name, f ), _currentItem(0) 52 QMainWindow( parent, name, f ), _currentItem(0)
53{ 53{
54 setCaption( tr("OSearch") ); 54 setCaption( tr("OSearch") );
55 55
56 setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 56 setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
57 57
58 QFrame *mainFrame = new QFrame( this, "mainFrame" ); 58 QFrame *mainFrame = new QFrame( this, "mainFrame" );
59 mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 59 mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
60 60
61 mainLayout = new QVBoxLayout( mainFrame ); 61 mainLayout = new QVBoxLayout( mainFrame );
62 mainLayout->setSpacing( 0 ); 62 mainLayout->setSpacing( 0 );
63 mainLayout->setMargin( 0 ); 63 mainLayout->setMargin( 0 );
64 64
65 resultsList = new OListView( mainFrame ); 65 resultsList = new OListView( mainFrame );
66 resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 66 resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
67 mainLayout->addWidget( resultsList ); 67 mainLayout->addWidget( resultsList );
68 68
69 detailsFrame = new QFrame( mainFrame, "detailsFrame" ); 69 detailsFrame = new QFrame( mainFrame, "detailsFrame" );
70 QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); 70 QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame );
71 richEdit = new QTextView( detailsFrame ); 71 richEdit = new QTextView( detailsFrame );
72 QWhatsThis::add( richEdit, tr("The details of the current result") ); 72 QWhatsThis::add( richEdit, tr("The details of the current result") );
73 richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 73 richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
74 detailsLayout->addWidget( richEdit ); 74 detailsLayout->addWidget( richEdit );
75 75
76 buttonBox = new QHBox( mainFrame, "Button Box" ); 76 buttonBox = new QHBox( mainFrame, "Button Box" );
77 77
78 _buttonCount = 0; 78 _buttonCount = 0;
79 79
80 mainLayout->addWidget( detailsFrame ); 80 mainLayout->addWidget( detailsFrame );
81 mainLayout->addWidget( buttonBox ); 81 mainLayout->addWidget( buttonBox );
82 detailsFrame->hide(); 82 detailsFrame->hide();
83 buttonBox->hide(); 83 buttonBox->hide();
84 84
85 searches.append( new AppLnkSearch( resultsList, tr("Applications") ) ); 85 searches.append( new AppLnkSearch( resultsList, tr("Applications") ) );
86 searches.append( new DocLnkSearch( resultsList, tr("Documents") ) ); 86 searches.append( new DocLnkSearch( resultsList, tr("Documents") ) );
87 searches.append( new TodoSearch( resultsList, tr("Todo List") ) ); 87 searches.append( new TodoSearch( resultsList, tr("Todo List") ) );
88 searches.append( new DatebookSearch( resultsList, tr("Calendar") ) ); 88 searches.append( new DatebookSearch( resultsList, tr("Calendar") ) );
89 searches.append( new AdressSearch( resultsList, tr("Contacts") ) ); 89 searches.append( new AdressSearch( resultsList, tr("Contacts") ) );
90 90
91 setCentralWidget( mainFrame ); 91 setCentralWidget( mainFrame );
92 92
93 popupTimer = new QTimer(); 93 popupTimer = new QTimer();
94 searchTimer = new QTimer(); 94 searchTimer = new QTimer();
95 95
96 connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); 96 connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup()));
97 connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); 97 connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged()));
98 connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); 98 connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*)));
99 connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); 99 connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*)));
100 100
101 signalMapper = new QSignalMapper( this ); 101 signalMapper = new QSignalMapper( this );
102 102
103 connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) ); 103 connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) );
104 104
105 makeMenu(); 105 makeMenu();
106 106
107 Config cfg( "osearch", Config::User ); 107 Config cfg( "osearch", Config::User );
108 cfg.setGroup( "search_settings" ); 108 cfg.setGroup( "search_settings" );
109 actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) ); 109 actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) );
110 actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) ); 110 actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) );
111// actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) ); 111// actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) );
112} 112}
113 113
114void MainWindow::makeMenu() 114void MainWindow::makeMenu()
115{ 115{
116 QPEToolBar *toolBar = new QPEToolBar( this ); 116 QPEToolBar *toolBar = new QPEToolBar( this );
117 QPEToolBar *searchBar = new QPEToolBar(this); 117 QPEToolBar *searchBar = new QPEToolBar(this);
118 QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); 118 QMenuBar *menuBar = new QMenuBar( toolBar );
119 QPopupMenu *searchMenu = new QPopupMenu( menuBar ); 119 QPopupMenu *searchMenu = new QPopupMenu( menuBar );
120// QPopupMenu *viewMenu = new QPopupMenu( menuBar ); 120// QPopupMenu *viewMenu = new QPopupMenu( menuBar );
121 QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); 121 QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
122 QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); 122 QPopupMenu *searchOptions = new QPopupMenu( cfgMenu );
123 123
124 setToolBarsMovable( false ); 124 setToolBarsMovable( false );
125 toolBar->setHorizontalStretchable( true ); 125 toolBar->setHorizontalStretchable( true );
126 menuBar->insertItem( tr( "Search" ), searchMenu ); 126 menuBar->insertItem( tr( "Search" ), searchMenu );
127 menuBar->insertItem( tr( "Settings" ), cfgMenu ); 127 menuBar->insertItem( tr( "Settings" ), cfgMenu );
128 128
129 //SETTINGS MENU 129 //SETTINGS MENU
130 cfgMenu->insertItem( tr( "Search" ), searchOptions ); 130 cfgMenu->insertItem( tr( "Search" ), searchOptions );
131 QPopupMenu *pop; 131 QPopupMenu *pop;
132 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ 132 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
133 pop = s->popupMenu(); 133 pop = s->popupMenu();
134 if (pop){ 134 if (pop){
135 cfgMenu->insertItem( s->text(0), pop ); 135 cfgMenu->insertItem( s->text(0), pop );
136 } 136 }
137 } 137 }
138 138
139 139
140 //SEARCH 140 //SEARCH
141 SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); 141 SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 );
142 SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); 142 SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) );
143 // QWhatsThis::add( SearchAllAction, tr("Search everything...") ); 143 // QWhatsThis::add( SearchAllAction, tr("Search everything...") );
144 connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); 144 connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) );
145 SearchAllAction->addTo( searchMenu ); 145 SearchAllAction->addTo( searchMenu );
146 searchMenu->insertItem( tr( "Options" ), searchOptions ); 146 searchMenu->insertItem( tr( "Options" ), searchOptions );
147 147
148 //SEARCH OPTIONS 148 //SEARCH OPTIONS
149 //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); 149 //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true );
150 //actionWholeWordsOnly->addTo( searchOptions ); 150 //actionWholeWordsOnly->addTo( searchOptions );
151 actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); 151 actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true );
152 actionCaseSensitiv->addTo( searchOptions ); 152 actionCaseSensitiv->addTo( searchOptions );
153 actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); 153 actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true );
154 actionWildcards->addTo( searchOptions ); 154 actionWildcards->addTo( searchOptions );
155 155
156 //SEARCH BAR 156 //SEARCH BAR
157 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 157 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
158 QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); 158 QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" );
159 QWhatsThis::add( searchEdit, tr("Enter your search terms here") ); 159 QWhatsThis::add( searchEdit, tr("Enter your search terms here") );
160 searchEdit->setFocus(); 160 searchEdit->setFocus();
161 searchBar->setHorizontalStretchable( TRUE ); 161 searchBar->setHorizontalStretchable( TRUE );
162 searchBar->setStretchableWidget( searchEdit ); 162 searchBar->setStretchableWidget( searchEdit );
163 SearchAllAction->addTo( searchBar ); 163 SearchAllAction->addTo( searchBar );
164 connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 164 connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
165 this, SLOT( setSearch( const QString & ) ) ); 165 this, SLOT( setSearch( const QString & ) ) );
166 166
167} 167}
168 168
169MainWindow::~MainWindow() 169MainWindow::~MainWindow()
170{ 170{
171 Config cfg( "osearch", Config::User ); 171 Config cfg( "osearch", Config::User );
172 cfg.setGroup( "search_settings" ); 172 cfg.setGroup( "search_settings" );
173 cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); 173 cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() );
174 cfg.writeEntry( "wildcards", actionWildcards->isOn() ); 174 cfg.writeEntry( "wildcards", actionWildcards->isOn() );
175 //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); 175 //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() );
176} 176}
177 177
178void MainWindow::setCurrent(QListViewItem *item) 178void MainWindow::setCurrent(QListViewItem *item)
179{ 179{
180 if (!item) return; 180 if (!item) return;
181 _currentItem = (OListViewItem*)item; 181 _currentItem = (OListViewItem*)item;
182 //_currentItem = dynamic_cast<OListViewItem*>(item); 182 //_currentItem = dynamic_cast<OListViewItem*>(item);
183 if (_currentItem->rtti() == OListViewItem::Result){ 183 if (_currentItem->rtti() == OListViewItem::Result){
184 ResultItem *res = (ResultItem*)item; 184 ResultItem *res = (ResultItem*)item;
185 // ResultItem *res = dynamic_cast<ResultItem*>(item); 185 // ResultItem *res = dynamic_cast<ResultItem*>(item);
186 richEdit->setText( res->toRichText() ); 186 richEdit->setText( res->toRichText() );
187 QIntDict<QString> acts = res->actions(); 187 QIntDict<QString> acts = res->actions();
188 QButton *button; 188 QButton *button;
189 for (uint i = 0; i < acts.count(); i++){ 189 for (uint i = 0; i < acts.count(); i++){
190 button = buttonMap[i]; 190 button = buttonMap[i];
191 if (!button) { 191 if (!button) {
192 qWarning(" no button for %s", (*acts[i]).latin1() ); 192 qWarning(" no button for %s", (*acts[i]).latin1() );
193 button = new QPushButton( buttonBox ); 193 button = new QPushButton( buttonBox );
194 buttonMap.insert( i, button ); 194 buttonMap.insert( i, button );
195 signalMapper->setMapping(button, i ); 195 signalMapper->setMapping(button, i );
196 connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) ); 196 connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) );
197 } 197 }
198 button->setText( *acts[i] ); 198 button->setText( *acts[i] );
199 button->show(); 199 button->show();
200 } 200 }
201 for (uint i = acts.count(); i < _buttonCount; i++){ 201 for (uint i = acts.count(); i < _buttonCount; i++){
202 button = buttonMap[i]; 202 button = buttonMap[i];
203 if (button) button->hide(); 203 if (button) button->hide();
204 } 204 }
205 _buttonCount = acts.count(); 205 _buttonCount = acts.count();
206 detailsFrame->show(); 206 detailsFrame->show();
207 buttonBox->show(); 207 buttonBox->show();
208 208
209 }else { 209 }else {
210 detailsFrame->hide(); 210 detailsFrame->hide();
211 buttonBox->hide(); 211 buttonBox->hide();
212 } 212 }
213 popupTimer->start( 300, true ); 213 popupTimer->start( 300, true );
214} 214}