-rw-r--r-- | noncore/applets/notesapplet/notes.cpp | 45 | ||||
-rw-r--r-- | noncore/applets/notesapplet/notes.h | 10 | ||||
-rw-r--r-- | noncore/applets/notesapplet/notesappletimpl.cpp | 1 |
3 files changed, 28 insertions, 28 deletions
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp index 4e98b31..e2b0c2a 100644 --- a/noncore/applets/notesapplet/notes.cpp +++ b/noncore/applets/notesapplet/notes.cpp | |||
@@ -1,508 +1,507 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 L.J. Potter <llornkcor@handhelds.org> | 2 | ** Copyright (C) 2002 L.J. Potter <llornkcor@handhelds.org> |
3 | 3 | ||
4 | ** All rights reserved. | 4 | ** All rights reserved. |
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 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "notes.h" | 16 | #include "notes.h" |
17 | 17 | ||
18 | #include <qapplication.h> | 18 | #include <qapplication.h> |
19 | #include <stdlib.h> | 19 | #include <stdlib.h> |
20 | #include <qstringlist.h> | 20 | #include <qstringlist.h> |
21 | 21 | ||
22 | #include <qpe/filemanager.h> | 22 | #include <qpe/filemanager.h> |
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/timestring.h> | 25 | #include <qpe/timestring.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
28 | #include <qpe/applnk.h> | 28 | #include <qpe/applnk.h> |
29 | #include <qpe/config.h> | 29 | #include <qpe/config.h> |
30 | #include <qpe/ir.h> | 30 | #include <qpe/ir.h> |
31 | 31 | ||
32 | // #include <qsocket.h> | 32 | // #include <qsocket.h> |
33 | // #include <qclipboard.h> | 33 | // #include <qclipboard.h> |
34 | #include <qmultilineedit.h> | 34 | #include <qmultilineedit.h> |
35 | #include <qlistbox.h> | 35 | #include <qlistbox.h> |
36 | #include <qpopupmenu.h> | 36 | #include <qpopupmenu.h> |
37 | #include <qmessagebox.h> | 37 | #include <qmessagebox.h> |
38 | 38 | ||
39 | #include <qdir.h> | 39 | #include <qdir.h> |
40 | #include <qfile.h> | 40 | #include <qfile.h> |
41 | #include <qpoint.h> | 41 | #include <qpoint.h> |
42 | #include <qpushbutton.h> | 42 | #include <qpushbutton.h> |
43 | #include <qpainter.h> | 43 | #include <qpainter.h> |
44 | #include <qlayout.h> | 44 | #include <qlayout.h> |
45 | #include <qframe.h> | 45 | #include <qframe.h> |
46 | #include <qpixmap.h> | 46 | #include <qpixmap.h> |
47 | #include <qstring.h> | 47 | #include <qstring.h> |
48 | #include <qtimer.h> | 48 | #include <qtimer.h> |
49 | 49 | ||
50 | /* XPM */ | 50 | /* XPM */ |
51 | static char * notes_xpm[] = { | 51 | static char * notes_xpm[] = { |
52 | "16 16 11 1", | 52 | "16 16 11 1", |
53 | " c None", | 53 | " c None", |
54 | ". c #000000", | 54 | ". c #000000", |
55 | "+ c #7F7F7F", | 55 | "+ c #7F7F7F", |
56 | "@ c #BFBFBF", | 56 | "@ c #BFBFBF", |
57 | "# c #BFC1FF", | 57 | "# c #BFC1FF", |
58 | "$ c #FF0000", | 58 | "$ c #FF0000", |
59 | "% c #FFFFFF", | 59 | "% c #FFFFFF", |
60 | "& c #00037F", | 60 | "& c #00037F", |
61 | "* c #0006FF", | 61 | "* c #0006FF", |
62 | "= c #0005BF", | 62 | "= c #0005BF", |
63 | "- c #7F0000", | 63 | "- c #7F0000", |
64 | " .. ", | 64 | " .. ", |
65 | " .. ", | 65 | " .. ", |
66 | " ... ", | 66 | " ... ", |
67 | " .+ ", | 67 | " .+ ", |
68 | " .@. ", | 68 | " .@. ", |
69 | " . .+ ", | 69 | " . .+ ", |
70 | " ..#.@. ", | 70 | " ..#.@. ", |
71 | " ..###.+.. ", | 71 | " ..###.+.. ", |
72 | " ..###$...##.. ", | 72 | " ..###$...##.. ", |
73 | "..###$$$%+$$##&.", | 73 | "..###$$$%+$$##&.", |
74 | ".*=####$-###&=&.", | 74 | ".*=####$-###&=&.", |
75 | ".=**=###==&=&=..", | 75 | ".=**=###==&=&=..", |
76 | " ..=**=#&=&=.. ", | 76 | " ..=**=#&=&=.. ", |
77 | " ..=*=&=.. ", | 77 | " ..=*=&=.. ", |
78 | " ..=.. ", | 78 | " ..=.. ", |
79 | " . "}; | 79 | " . "}; |
80 | 80 | ||
81 | 81 | ||
82 | NotesControl::NotesControl( QWidget *parent, const char *name ) | 82 | NotesControl::NotesControl( QWidget *, const char * ) |
83 | : QFrame( parent, name,/* WDestructiveClose | */WStyle_StaysOnTop ) | 83 | : QVBox( 0, "NotesControl",/* WDestructiveClose | */WStyle_StaysOnTop ) |
84 | // : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) | 84 | // : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) |
85 | { | 85 | { |
86 | QDir d( QDir::homeDirPath()+"/notes"); | 86 | QDir d( QDir::homeDirPath()+"/notes"); |
87 | if( !d.exists()) { | 87 | if( !d.exists()) { |
88 | qDebug("make dir"); | 88 | qDebug("make dir"); |
89 | if(!d.mkdir( QDir::homeDirPath()+"/notes", true)) | 89 | if(!d.mkdir( QDir::homeDirPath()+"/notes", true)) |
90 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed"); | 90 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed"); |
91 | } | 91 | } |
92 | Config cfg("Notes"); | 92 | Config cfg("Notes"); |
93 | cfg.setGroup("Options"); | 93 | cfg.setGroup("Options"); |
94 | showMax = cfg.readBoolEntry("ShowMax", false); | 94 | showMax = cfg.readBoolEntry("ShowMax", false); |
95 | 95 | ||
96 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); | 96 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); |
97 | loaded=false; | 97 | loaded=false; |
98 | edited=false; | 98 | edited=false; |
99 | doPopulate=true; | 99 | doPopulate=true; |
100 | isNew=false; | 100 | isNew=false; |
101 | QVBoxLayout *vbox = new QVBoxLayout( this,0, -1, "Vlayout" ); | 101 | QVBox *vbox = new QVBox( this, "Vlayout" ); |
102 | QHBoxLayout *hbox = new QHBoxLayout( this, 0, -1, "HLayout" ); | 102 | QHBox *hbox = new QHBox( this, "HLayout" ); |
103 | 103 | ||
104 | view = new QMultiLineEdit(this, "OpieNotesView"); | 104 | view = new QMultiLineEdit(vbox, "OpieNotesView"); |
105 | 105 | ||
106 | box = new QListBox(this, "OpieNotesBox"); | 106 | box = new QListBox(vbox, "OpieNotesBox"); |
107 | 107 | ||
108 | QPEApplication::setStylusOperation( box->viewport(),QPEApplication::RightOnHold); | 108 | QPEApplication::setStylusOperation( box->viewport(),QPEApplication::RightOnHold); |
109 | 109 | ||
110 | box->setFixedHeight(50); | 110 | box->setFixedHeight(50); |
111 | 111 | ||
112 | vbox->setMargin( 6 ); | 112 | vbox->setMargin( 6 ); |
113 | vbox->setSpacing( 3 ); | 113 | vbox->setSpacing( 3 ); |
114 | 114 | ||
115 | vbox->addWidget( view); | 115 | |
116 | vbox->addWidget( box); | ||
117 | 116 | ||
118 | setFocusPolicy(QWidget::StrongFocus); | 117 | setFocusPolicy(QWidget::StrongFocus); |
119 | 118 | ||
120 | newButton= new QPushButton( this, "newButton" ); | 119 | newButton= new QPushButton( hbox, "newButton" ); |
121 | newButton->setText(tr("New")); | 120 | newButton->setText(tr("New")); |
122 | hbox->addWidget( newButton); | ||
123 | 121 | ||
124 | saveButton= new QPushButton( this, "saveButton" ); | 122 | |
123 | saveButton= new QPushButton( hbox, "saveButton" ); | ||
125 | saveButton->setText(tr("Save")); | 124 | saveButton->setText(tr("Save")); |
126 | hbox->addWidget( saveButton); | ||
127 | 125 | ||
128 | deleteButton= new QPushButton( this, "deleteButton" ); | 126 | |
127 | deleteButton= new QPushButton( hbox, "deleteButton" ); | ||
129 | deleteButton->setText(tr("Delete")); | 128 | deleteButton->setText(tr("Delete")); |
130 | hbox->addWidget( deleteButton); | 129 | |
131 | 130 | ||
132 | vbox->addItem(hbox); | ||
133 | 131 | ||
134 | connect( box, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint&)), | 132 | connect( box, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint&)), |
135 | this,SLOT( boxPressed(int, QListBoxItem *, const QPoint&)) ); | 133 | this,SLOT( boxPressed(int, QListBoxItem *, const QPoint&)) ); |
136 | 134 | ||
137 | connect(box, SIGNAL(highlighted(const QString&)), this, SLOT(slotBoxSelected(const QString &))); | 135 | connect(box, SIGNAL(highlighted(const QString&)), this, SLOT(slotBoxSelected(const QString &))); |
138 | 136 | ||
139 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showMenu() ) ); | 137 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showMenu() ) ); |
140 | 138 | ||
141 | connect(view,SIGNAL( textChanged() ), this, SLOT(slotViewEdited() ) ); | 139 | connect(view,SIGNAL( textChanged() ), this, SLOT(slotViewEdited() ) ); |
142 | 140 | ||
143 | connect(newButton, SIGNAL(clicked()), this, SLOT(slotNewButton())); | 141 | connect(newButton, SIGNAL(clicked()), this, SLOT(slotNewButton())); |
144 | connect(saveButton, SIGNAL(clicked()), this, SLOT(slotSaveButton())); | 142 | connect(saveButton, SIGNAL(clicked()), this, SLOT(slotSaveButton())); |
145 | connect(deleteButton, SIGNAL(clicked()), this, SLOT(slotDeleteButtonClicked())); | 143 | connect(deleteButton, SIGNAL(clicked()), this, SLOT(slotDeleteButtonClicked())); |
146 | 144 | ||
147 | populateBox(); | 145 | populateBox(); |
148 | load(); | 146 | load(); |
149 | setCaption("Notes"); | 147 | setCaption("Notes"); |
150 | // parent->setFocus(); | 148 | // parent->setFocus(); |
151 | } | 149 | } |
152 | 150 | ||
153 | void NotesControl::slotSaveButton() { | 151 | void NotesControl::slotSaveButton() { |
154 | slotNewButton(); | 152 | slotNewButton(); |
155 | populateBox(); | 153 | populateBox(); |
156 | } | 154 | } |
157 | 155 | ||
158 | void NotesControl::slotDeleteButtonClicked() { | 156 | void NotesControl::slotDeleteButtonClicked() { |
159 | switch ( QMessageBox::warning(this,tr("Delete?") | 157 | switch ( QMessageBox::warning(this,tr("Delete?") |
160 | ,tr("Do you really want to<BR><B> delete</B> this note ?") | 158 | ,tr("Do you really want to<BR><B> delete</B> this note ?") |
161 | ,tr("Yes"),tr("No"),0,1,1) ) { | 159 | ,tr("Yes"),tr("No"),0,1,1) ) { |
162 | case 0: | 160 | case 0: |
163 | slotDeleteButton(); | 161 | slotDeleteButton(); |
164 | break; | 162 | break; |
165 | }; | 163 | }; |
166 | } | 164 | } |
167 | 165 | ||
168 | void NotesControl::slotDeleteButton() { | 166 | void NotesControl::slotDeleteButton() { |
169 | 167 | ||
170 | QString selectedText = box->currentText(); | 168 | QString selectedText = box->currentText(); |
171 | qDebug("deleting "+selectedText); | 169 | qDebug("deleting "+selectedText); |
172 | 170 | ||
173 | if( !selectedText.isEmpty()) { | 171 | if( !selectedText.isEmpty()) { |
174 | 172 | ||
175 | Config cfg("Notes"); | 173 | Config cfg("Notes"); |
176 | cfg.setGroup("Docs"); | 174 | cfg.setGroup("Docs"); |
177 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 175 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
178 | QString entryName, entryName2;; | 176 | QString entryName, entryName2;; |
179 | for ( int i = 0; i < noOfFiles; i++ ) { | 177 | for ( int i = 0; i < noOfFiles; i++ ) { |
180 | entryName.sprintf( "File%i", i + 1 ); | 178 | entryName.sprintf( "File%i", i + 1 ); |
181 | if(selectedText == cfg.readEntry( entryName )) { | 179 | if(selectedText == cfg.readEntry( entryName )) { |
182 | qDebug("removing %s, %d", selectedText.latin1(), i); | 180 | qDebug("removing %s, %d", selectedText.latin1(), i); |
183 | for ( int j = i; j < noOfFiles; j++ ) { | 181 | for ( int j = i; j < noOfFiles; j++ ) { |
184 | entryName.sprintf( "File%i", i + 1 ); | 182 | entryName.sprintf( "File%i", i + 1 ); |
185 | entryName2.sprintf( "File%i", i + 2 ); | 183 | entryName2.sprintf( "File%i", i + 2 ); |
186 | QString temp = cfg.readEntry(entryName2); | 184 | QString temp = cfg.readEntry(entryName2); |
187 | qDebug("move "+temp); | 185 | qDebug("move "+temp); |
188 | cfg.writeEntry(entryName, temp); | 186 | cfg.writeEntry(entryName, temp); |
189 | i++; | 187 | i++; |
190 | } | 188 | } |
191 | cfg.writeEntry("NumberOfFiles", noOfFiles-1 ); | 189 | cfg.writeEntry("NumberOfFiles", noOfFiles-1 ); |
192 | entryName.sprintf( "File%i", noOfFiles ); | 190 | entryName.sprintf( "File%i", noOfFiles ); |
193 | cfg.removeEntry(entryName); | 191 | cfg.removeEntry(entryName); |
194 | cfg.write(); | 192 | cfg.write(); |
195 | DocLnk nf(selectedText); | 193 | DocLnk nf(selectedText); |
196 | nf.removeFiles(); | 194 | nf.removeFiles(); |
197 | QString fi=QPEApplication::documentDir()+"/text/plain/"+selectedText+".desktop"; | 195 | QString fi=QPEApplication::documentDir()+"/text/plain/"+selectedText+".desktop"; |
198 | qDebug(fi); | 196 | qDebug(fi); |
199 | 197 | ||
200 | QFile f( fi); | 198 | QFile f( fi); |
201 | if( !f.remove()) qDebug(".desktop file not removed"); | 199 | if( !f.remove()) qDebug(".desktop file not removed"); |
202 | 200 | ||
203 | } | 201 | } |
204 | } | 202 | } |
205 | view->clear(); | 203 | view->clear(); |
206 | 204 | ||
207 | populateBox(); | 205 | populateBox(); |
208 | } | 206 | } |
209 | } | 207 | } |
210 | 208 | ||
211 | void NotesControl::slotNewButton() { | 209 | void NotesControl::slotNewButton() { |
212 | if(edited) save(); | 210 | if(edited) save(); |
213 | view->clear(); | 211 | view->clear(); |
214 | view->setFocus(); | 212 | view->setFocus(); |
215 | edited=false; | 213 | edited=false; |
216 | isNew=false; | 214 | isNew=false; |
217 | } | 215 | } |
218 | 216 | ||
219 | void NotesControl::slotBeamButton() { | 217 | void NotesControl::slotBeamButton() { |
220 | Ir ir; | 218 | Ir ir; |
221 | if(!ir.supported()){ | 219 | if(!ir.supported()){ |
222 | } else { | 220 | } else { |
223 | this->hide(); | 221 | this->hide(); |
224 | QString selectedText = box->currentText(); | 222 | QString selectedText = box->currentText(); |
225 | if( !selectedText.isEmpty()) { | 223 | if( !selectedText.isEmpty()) { |
226 | QString file = QDir::homeDirPath()+"/"+selectedText; | 224 | QString file = QDir::homeDirPath()+"/"+selectedText; |
227 | QFile f(file); | 225 | QFile f(file); |
228 | Ir *irFile = new Ir(this, "IR"); | 226 | Ir *irFile = new Ir(this, "IR"); |
229 | connect( irFile, SIGNAL(done(Ir*)), this, SLOT( slotBeamFinished( Ir * ))); | 227 | connect( irFile, SIGNAL(done(Ir*)), this, SLOT( slotBeamFinished( Ir * ))); |
230 | irFile->send( file, "Note", "text/plain" ); | 228 | irFile->send( file, "Note", "text/plain" ); |
231 | } | 229 | } |
232 | } | 230 | } |
233 | } | 231 | } |
234 | 232 | ||
235 | void NotesControl::slotBeamFinished(Ir *) { | 233 | void NotesControl::slotBeamFinished(Ir *) { |
236 | this->show(); | 234 | this->show(); |
237 | } | 235 | } |
238 | 236 | ||
239 | void NotesControl::boxPressed(int mouse, QListBoxItem *, const QPoint&) { | 237 | void NotesControl::boxPressed(int mouse, QListBoxItem *, const QPoint&) { |
240 | switch (mouse) { | 238 | switch (mouse) { |
241 | case 1:{ | 239 | case 1:{ |
242 | } | 240 | } |
243 | break; | 241 | break; |
244 | case 2: | 242 | case 2: |
245 | menuTimer.start( 500, TRUE ); | 243 | menuTimer.start( 500, TRUE ); |
246 | break; | 244 | break; |
247 | }; | 245 | }; |
248 | } | 246 | } |
249 | 247 | ||
250 | void NotesControl::slotBoxSelected(const QString &itemString) { | 248 | void NotesControl::slotBoxSelected(const QString &itemString) { |
251 | if(edited) { | 249 | if(edited) { |
252 | save(); | 250 | save(); |
253 | } | 251 | } |
254 | loaded=false; | 252 | loaded=false; |
255 | edited=false; | 253 | edited=false; |
256 | load(itemString); | 254 | load(itemString); |
257 | } | 255 | } |
258 | 256 | ||
259 | 257 | ||
260 | void NotesControl::showMenu() { | 258 | void NotesControl::showMenu() { |
261 | QPopupMenu *m = new QPopupMenu(0); | 259 | QPopupMenu *m = new QPopupMenu(0); |
262 | m->insertItem( tr( "Beam Out" ), this, SLOT( slotBeamButton() )); | 260 | m->insertItem( tr( "Beam Out" ), this, SLOT( slotBeamButton() )); |
263 | m->insertItem( tr( "Search For..." ), this, SLOT( slotSearch() )); | 261 | m->insertItem( tr( "Search For..." ), this, SLOT( slotSearch() )); |
264 | m->insertItem( tr( "Toggle Maximized" ), this, SLOT( slotShowMax() )); | 262 | m->insertItem( tr( "Toggle Maximized" ), this, SLOT( slotShowMax() )); |
265 | m->insertSeparator(); | 263 | m->insertSeparator(); |
266 | m->insertItem( tr( "Delete" ), this, SLOT( slotDeleteButton() )); | 264 | m->insertItem( tr( "Delete" ), this, SLOT( slotDeleteButton() )); |
267 | m->setFocus(); | 265 | m->setFocus(); |
268 | m->exec( QCursor::pos() ); | 266 | m->exec( QCursor::pos() ); |
269 | 267 | ||
270 | if(m) delete m; | 268 | if(m) delete m; |
271 | } | 269 | } |
272 | 270 | ||
273 | void NotesControl::focusOutEvent ( QFocusEvent * e) { | 271 | void NotesControl::focusOutEvent ( QFocusEvent * e) { |
274 | if( e->reason() == QFocusEvent::Popup) | 272 | if( e->reason() == QFocusEvent::Popup) |
275 | save(); | 273 | save(); |
276 | else { | 274 | else { |
277 | if(!loaded) { | 275 | if(!loaded) { |
278 | populateBox(); | 276 | populateBox(); |
279 | load(); | 277 | load(); |
280 | } | 278 | } |
281 | } | 279 | } |
282 | QWidget::focusOutEvent(e); | 280 | QWidget::focusOutEvent(e); |
283 | } | 281 | } |
284 | 282 | ||
285 | void NotesControl::save() { | 283 | void NotesControl::save() { |
286 | Config cfg("Notes"); | 284 | Config cfg("Notes"); |
287 | cfg.setGroup("Docs"); | 285 | cfg.setGroup("Docs"); |
288 | if( edited) { | 286 | if( edited) { |
289 | // qDebug("is edited"); | 287 | // qDebug("is edited"); |
290 | QString rt = view->text(); | 288 | QString rt = view->text(); |
291 | if( rt.length()>1) { | 289 | if( rt.length()>1) { |
292 | QString pt = rt.simplifyWhiteSpace(); | 290 | QString pt = rt.simplifyWhiteSpace(); |
293 | int i = pt.find( ' ', pt.find( ' ' )+2 ); | 291 | int i = pt.find( ' ', pt.find( ' ' )+2 ); |
294 | QString docname = pt; | 292 | QString docname = pt; |
295 | if ( i > 0 ) | 293 | if ( i > 0 ) |
296 | docname = pt.left(i); | 294 | docname = pt.left(i); |
297 | // remove "." at the beginning | 295 | // remove "." at the beginning |
298 | while( docname.startsWith( "." ) ) | 296 | while( docname.startsWith( "." ) ) |
299 | docname = docname.mid( 1 ); | 297 | docname = docname.mid( 1 ); |
300 | docname.replace( QRegExp("/"), "_" ); | 298 | docname.replace( QRegExp("/"), "_" ); |
301 | // cut the length. filenames longer than that don't make sense | 299 | // cut the length. filenames longer than that don't make sense |
302 | // and something goes wrong when they get too long. | 300 | // and something goes wrong when they get too long. |
303 | if ( docname.length() > 40 ) | 301 | if ( docname.length() > 40 ) |
304 | docname = docname.left(40); | 302 | docname = docname.left(40); |
305 | if ( docname.isEmpty() ) | 303 | if ( docname.isEmpty() ) |
306 | docname = "Empty Text"; | 304 | docname = "Empty Text"; |
307 | // qDebug(docname); | 305 | // qDebug(docname); |
308 | 306 | ||
309 | if( oldDocName != docname) { | 307 | if( oldDocName != docname) { |
310 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 308 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
311 | QString entryName; | 309 | QString entryName; |
312 | entryName.sprintf( "File%i", noOfFiles + 1 ); | 310 | entryName.sprintf( "File%i", noOfFiles + 1 ); |
313 | cfg.writeEntry( entryName,docname ); | 311 | cfg.writeEntry( entryName,docname ); |
314 | cfg.writeEntry("NumberOfFiles", noOfFiles+1 ); | 312 | cfg.writeEntry("NumberOfFiles", noOfFiles+1 ); |
315 | cfg.write(); | 313 | cfg.write(); |
316 | } | 314 | } |
317 | // else | 315 | // else |
318 | // qDebug("oldname equals docname"); | 316 | // qDebug("oldname equals docname"); |
319 | 317 | ||
320 | doc = new DocLnk(docname); | 318 | doc = new DocLnk(docname); |
321 | if(QFile(doc->linkFile()).exists()) | 319 | if(QFile(doc->linkFile()).exists()) |
322 | qDebug("puppie"); | 320 | qDebug("puppie"); |
323 | doc->setType("text/plain"); | 321 | doc->setType("text/plain"); |
324 | doc->setName(docname); | 322 | doc->setName(docname); |
325 | QString temp = docname.replace( QRegExp(" "), "_" ); | 323 | QString temp = docname.replace( QRegExp(" "), "_" ); |
326 | doc->setFile( QDir::homeDirPath()+"/notes/"+temp); | 324 | doc->setFile( QDir::homeDirPath()+"/notes/"+temp); |
327 | FileManager fm; | 325 | FileManager fm; |
328 | if ( !fm.saveFile( *doc, rt ) ) { | 326 | if ( !fm.saveFile( *doc, rt ) ) { |
329 | } | 327 | } |
330 | 328 | ||
331 | oldDocName=docname; | 329 | oldDocName=docname; |
332 | edited=false; | 330 | edited=false; |
333 | // qDebug("save"); | 331 | // qDebug("save"); |
334 | if (doPopulate) | 332 | if (doPopulate) |
335 | populateBox(); | 333 | populateBox(); |
336 | } | 334 | } |
337 | cfg.writeEntry( "LastDoc",oldDocName ); | 335 | cfg.writeEntry( "LastDoc",oldDocName ); |
338 | cfg.write(); | 336 | cfg.write(); |
339 | 337 | ||
340 | } | 338 | } |
341 | } | 339 | } |
342 | 340 | ||
343 | void NotesControl::populateBox() { | 341 | void NotesControl::populateBox() { |
344 | box->clear(); | 342 | box->clear(); |
345 | // qDebug("populate"); | 343 | // qDebug("populate"); |
346 | Config cfg("Notes"); | 344 | Config cfg("Notes"); |
347 | cfg.setGroup("Docs"); | 345 | cfg.setGroup("Docs"); |
348 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 346 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
349 | QStringList list; | 347 | QStringList list; |
350 | QString entryName; | 348 | QString entryName; |
351 | for ( int i = 0; i < noOfFiles; i++ ) { | 349 | for ( int i = 0; i < noOfFiles; i++ ) { |
352 | entryName.sprintf( "File%i", i + 1 ); | 350 | entryName.sprintf( "File%i", i + 1 ); |
353 | list.append(cfg.readEntry( entryName )); | 351 | list.append(cfg.readEntry( entryName )); |
354 | } | 352 | } |
355 | list.sort(); | 353 | list.sort(); |
356 | box->insertStringList(list,-1); | 354 | box->insertStringList(list,-1); |
357 | doPopulate=false; | 355 | doPopulate=false; |
358 | update(); | 356 | update(); |
359 | } | 357 | } |
360 | 358 | ||
361 | void NotesControl::load() { | 359 | void NotesControl::load() { |
362 | 360 | ||
363 | if(!loaded) { | 361 | if(!loaded) { |
364 | Config cfg("Notes"); | 362 | Config cfg("Notes"); |
365 | cfg.setGroup("Docs"); | 363 | cfg.setGroup("Docs"); |
366 | QString lastDoc=cfg.readEntry( "LastDoc","notes"); | 364 | QString lastDoc=cfg.readEntry( "LastDoc","notes"); |
367 | DocLnk nf; | 365 | DocLnk nf; |
368 | nf.setType("text/plain"); | 366 | nf.setType("text/plain"); |
369 | nf.setFile(lastDoc); | 367 | nf.setFile(lastDoc); |
370 | 368 | ||
371 | loadDoc(nf); | 369 | loadDoc(nf); |
372 | loaded=true; | 370 | loaded=true; |
373 | oldDocName=lastDoc; | 371 | oldDocName=lastDoc; |
374 | cfg.writeEntry( "LastDoc",oldDocName ); | 372 | cfg.writeEntry( "LastDoc",oldDocName ); |
375 | cfg.write(); | 373 | cfg.write(); |
376 | } | 374 | } |
377 | } | 375 | } |
378 | 376 | ||
379 | void NotesControl::load(const QString & file) { | 377 | void NotesControl::load(const QString & file) { |
380 | qDebug("loading "+file); | 378 | qDebug("loading "+file); |
381 | QString name = file; | 379 | QString name = file; |
382 | QString temp; | 380 | QString temp; |
383 | if( !QFile( QDir::homeDirPath()+"/"+file).exists() ) | 381 | if( !QFile( QDir::homeDirPath()+"/"+file).exists() ) |
384 | temp = QDir::homeDirPath()+"/notes/"+ name.replace( QRegExp(" "), "_" ); | 382 | temp = QDir::homeDirPath()+"/notes/"+ name.replace( QRegExp(" "), "_" ); |
385 | else | 383 | else |
386 | temp = name; | 384 | temp = name; |
387 | if(!loaded) { | 385 | if(!loaded) { |
388 | DocLnk nf; | 386 | DocLnk nf; |
389 | nf.setType("text/plain"); | 387 | nf.setType("text/plain"); |
390 | nf.setFile( temp); | 388 | nf.setFile( temp); |
391 | if(!temp.isEmpty()) | 389 | if(!temp.isEmpty()) |
392 | loadDoc(nf); | 390 | loadDoc(nf); |
393 | loaded=true; | 391 | loaded=true; |
394 | } | 392 | } |
395 | // view->setFocus(); | 393 | // view->setFocus(); |
396 | oldDocName=file; | 394 | oldDocName=file; |
397 | Config cfg("Notes"); | 395 | Config cfg("Notes"); |
398 | cfg.setGroup("Docs"); | 396 | cfg.setGroup("Docs"); |
399 | cfg.writeEntry( "LastDoc",oldDocName ); | 397 | cfg.writeEntry( "LastDoc",oldDocName ); |
400 | cfg.write(); | 398 | cfg.write(); |
401 | } | 399 | } |
402 | 400 | ||
403 | void NotesControl::loadDoc( const DocLnk &f) { | 401 | void NotesControl::loadDoc( const DocLnk &f) { |
404 | FileManager fm; | 402 | FileManager fm; |
405 | QString txt; | 403 | QString txt; |
406 | if ( !fm.loadFile( f, txt ) ) { | 404 | if ( !fm.loadFile( f, txt ) ) { |
407 | qDebug("could not load file "+f.file()); | 405 | qDebug("could not load file "+f.file()); |
408 | return; | 406 | return; |
409 | } | 407 | } |
410 | view->setText(txt); | 408 | view->setText(txt); |
411 | } | 409 | } |
412 | 410 | ||
413 | void NotesControl::slotViewEdited() { | 411 | void NotesControl::slotViewEdited() { |
414 | if(loaded) { | 412 | if(loaded) { |
415 | edited=true; | 413 | edited=true; |
416 | } | 414 | } |
417 | } | 415 | } |
418 | 416 | ||
419 | 417 | ||
420 | void NotesControl::slotShowMax() { | 418 | void NotesControl::slotShowMax() { |
421 | Config cfg("Notes"); | 419 | Config cfg("Notes"); |
422 | cfg.setGroup("Options"); | 420 | cfg.setGroup("Options"); |
423 | showMax=!showMax; | 421 | showMax=!showMax; |
424 | cfg.writeEntry("ShowMax", showMax); | 422 | cfg.writeEntry("ShowMax", showMax); |
425 | cfg.write(); | 423 | cfg.write(); |
426 | hide(); | 424 | hide(); |
427 | } | 425 | } |
428 | 426 | ||
429 | void NotesControl::slotSearch() { | 427 | void NotesControl::slotSearch() { |
430 | int boxCount = box->count(); | 428 | int boxCount = box->count(); |
431 | for(int i=0;i< boxCount;i++) { | 429 | for(int i=0;i< boxCount;i++) { |
432 | 430 | ||
433 | } | 431 | } |
434 | } | 432 | } |
435 | 433 | ||
436 | // void NotesControl::keyReleaseEvent( QKeyEvent *e) { | 434 | // void NotesControl::keyReleaseEvent( QKeyEvent *e) { |
437 | 435 | ||
438 | // switch ( e->state() ) { | 436 | // switch ( e->state() ) { |
439 | // case ControlButton: | 437 | // case ControlButton: |
440 | // if(e->key() == Key_C) { //copy | 438 | // if(e->key() == Key_C) { //copy |
441 | // qDebug("copy"); | 439 | // qDebug("copy"); |
442 | // QClipboard *cb = QApplication::clipboard(); | 440 | // QClipboard *cb = QApplication::clipboard(); |
443 | // QString text; | 441 | // QString text; |
444 | 442 | ||
445 | // // Copy text from the clipboard (paste) | 443 | // // Copy text from the clipboard (paste) |
446 | // text = cb->text(); | 444 | // text = cb->text(); |
447 | // } | 445 | // } |
448 | // if(e->key() == Key_X) { //cut | 446 | // if(e->key() == Key_X) { //cut |
449 | // } | 447 | // } |
450 | // if(e->key() == Key_V) { //paste | 448 | // if(e->key() == Key_V) { //paste |
451 | // QClipboard *cb = QApplication::clipboard(); | 449 | // QClipboard *cb = QApplication::clipboard(); |
452 | // QString text; | 450 | // QString text; |
453 | // //view | 451 | // //view |
454 | // cb->setText(); | 452 | // cb->setText(); |
455 | // } | 453 | // } |
456 | // break; | 454 | // break; |
457 | // }; | 455 | // }; |
458 | // QWidget::keyReleaseEvent(e); | 456 | // QWidget::keyReleaseEvent(e); |
459 | // } | 457 | // } |
460 | 458 | ||
461 | //=========================================================================== | 459 | //=========================================================================== |
462 | 460 | ||
463 | NotesApplet::NotesApplet( QWidget *parent, const char *name ) | 461 | NotesApplet::NotesApplet( QWidget *parent, const char *name ) |
464 | : QWidget( parent, name ) { | 462 | : QWidget( parent, name ) { |
465 | setFixedHeight( 18 ); | 463 | setFixedHeight( 18 ); |
466 | setFixedWidth( 14 ); | 464 | setFixedWidth( 14 ); |
467 | vc = new NotesControl; | 465 | vc = new NotesControl; |
468 | } | 466 | } |
469 | 467 | ||
470 | NotesApplet::~NotesApplet() { | 468 | NotesApplet::~NotesApplet() { |
469 | delete vc; | ||
471 | } | 470 | } |
472 | 471 | ||
473 | void NotesApplet::mousePressEvent( QMouseEvent *) { | 472 | void NotesApplet::mousePressEvent( QMouseEvent *) { |
474 | if( !vc->isHidden()) { | 473 | if( !vc->isHidden()) { |
475 | vc->doPopulate=false; | 474 | vc->doPopulate=false; |
476 | vc->save(); | 475 | vc->save(); |
477 | vc->close(); | 476 | vc->close(); |
478 | } else { | 477 | } else { |
479 | // vc = new NotesControl; | 478 | // vc = new NotesControl; |
480 | // QPoint curPos = mapToGlobal( rect().topLeft() ); | 479 | // QPoint curPos = mapToGlobal( rect().topLeft() ); |
481 | if(vc->showMax) { | 480 | if(vc->showMax) { |
482 | qDebug("show max"); | 481 | qDebug("show max"); |
483 | vc->showMaximized(); | 482 | vc->showMaximized(); |
484 | } else { | 483 | } else { |
485 | qDebug("no show max"); | 484 | qDebug("no show max"); |
486 | QWidget *wid = QPEApplication::desktop(); | 485 | QWidget *wid = QPEApplication::desktop(); |
487 | QRect rect = QApplication::desktop()->geometry(); | 486 | QRect rect = QApplication::desktop()->geometry(); |
488 | vc->setGeometry( ( wid->width() / 2) - ( vc->width() / 2 ) , 28 , wid->width() -10 , 180); | 487 | vc->setGeometry( ( wid->width() / 2) - ( vc->width() / 2 ) , 28 , wid->width() -10 , 180); |
489 | vc->move ( (rect.center()/2) - (vc->rect().center()/2)); | 488 | vc->move ( (rect.center()/2) - (vc->rect().center()/2)); |
490 | // vc->move( (( wid->width() / 2) - ( vc->width() / 2 ))-4, 28); | 489 | // vc->move( (( wid->width() / 2) - ( vc->width() / 2 ))-4, 28); |
491 | } | 490 | } |
492 | vc->show(); | 491 | vc->show(); |
493 | vc->doPopulate=true; | 492 | vc->doPopulate=true; |
494 | vc->populateBox(); | 493 | vc->populateBox(); |
495 | vc->doPopulate=false; | 494 | vc->doPopulate=false; |
496 | vc->loaded=false; | 495 | vc->loaded=false; |
497 | 496 | ||
498 | vc->load(); | 497 | vc->load(); |
499 | // this->setFocus(); | 498 | // this->setFocus(); |
500 | vc->view->setFocus(); | 499 | vc->view->setFocus(); |
501 | } | 500 | } |
502 | } | 501 | } |
503 | 502 | ||
504 | void NotesApplet::paintEvent( QPaintEvent* ) { | 503 | void NotesApplet::paintEvent( QPaintEvent* ) { |
505 | QPainter p(this); | 504 | QPainter p(this); |
506 | p.drawPixmap( 0, 1, ( const char** ) notes_xpm ); | 505 | p.drawPixmap( 0, 1, ( const char** ) notes_xpm ); |
507 | } | 506 | } |
508 | 507 | ||
diff --git a/noncore/applets/notesapplet/notes.h b/noncore/applets/notesapplet/notes.h index c428efe..08253cb 100644 --- a/noncore/applets/notesapplet/notes.h +++ b/noncore/applets/notesapplet/notes.h | |||
@@ -1,93 +1,93 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com | 2 | ** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com |
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 | #ifndef __NOTES_APPLET_H__ | 15 | #ifndef __NOTES_APPLET_H__ |
16 | #define __NOTES_APPLET_H__ | 16 | #define __NOTES_APPLET_H__ |
17 | 17 | ||
18 | #include <qwidget.h> | 18 | #include <qwidget.h> |
19 | #include <qframe.h> | 19 | #include <qvbox.h> |
20 | #include <qpixmap.h> | 20 | #include <qpixmap.h> |
21 | #include <qguardedptr.h> | 21 | #include <qguardedptr.h> |
22 | #include <qtimer.h> | 22 | #include <qtimer.h> |
23 | #include <qpe/filemanager.h> | 23 | #include <qpe/filemanager.h> |
24 | #include <qpe/ir.h> | 24 | #include <qpe/ir.h> |
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | 26 | ||
27 | class QComboBox; | 27 | class QComboBox; |
28 | class QCheckBox; | 28 | class QCheckBox; |
29 | class QSpinBox; | 29 | class QSpinBox; |
30 | class QPushButton; | 30 | class QPushButton; |
31 | class QMultiLineEdit; | 31 | class QMultiLineEdit; |
32 | class QListBox; | 32 | class QListBox; |
33 | class QListBoxItem; | 33 | class QListBoxItem; |
34 | class NotesControl : public QFrame { | 34 | class NotesControl : public QVBox { |
35 | Q_OBJECT | 35 | Q_OBJECT |
36 | public: | 36 | public: |
37 | NotesControl( QWidget *parent=0, const char *name=0 ); | 37 | NotesControl( QWidget *parent=0, const char *name=0 ); |
38 | 38 | ||
39 | QPixmap notes; | 39 | QPixmap notes; |
40 | QMultiLineEdit *view; | 40 | QMultiLineEdit *view; |
41 | QListBox *box; | 41 | QListBox *box; |
42 | QPushButton *saveButton, *deleteButton, *newButton; | 42 | QPushButton *saveButton, *deleteButton, *newButton; |
43 | QString FileNamePath; | 43 | QString FileNamePath; |
44 | bool loaded, edited, doPopulate, isNew; | 44 | bool loaded, edited, doPopulate, isNew; |
45 | bool showMax; | 45 | bool showMax; |
46 | void save(); | 46 | void save(); |
47 | void populateBox(); | 47 | void populateBox(); |
48 | void load(); | 48 | void load(); |
49 | 49 | ||
50 | private: | 50 | private: |
51 | QTimer menuTimer; | 51 | QTimer menuTimer; |
52 | DocLnk *doc; | 52 | DocLnk *doc; |
53 | QString oldDocName; | 53 | QString oldDocName; |
54 | void focusOutEvent( QFocusEvent * ); | 54 | void focusOutEvent( QFocusEvent * ); |
55 | void load(const QString&); | 55 | void load(const QString&); |
56 | private slots: | 56 | private slots: |
57 | void slotSearch(); | 57 | void slotSearch(); |
58 | void slotShowMax(); | 58 | void slotShowMax(); |
59 | void slotBeamButton(); | 59 | void slotBeamButton(); |
60 | void slotBeamFinished( Ir*); | 60 | void slotBeamFinished( Ir*); |
61 | void slotDeleteButton(); | 61 | void slotDeleteButton(); |
62 | void slotSaveButton(); | 62 | void slotSaveButton(); |
63 | void slotDeleteButtonClicked(); | 63 | void slotDeleteButtonClicked(); |
64 | void slotNewButton(); | 64 | void slotNewButton(); |
65 | void boxPressed(int, QListBoxItem *, const QPoint&); | 65 | void boxPressed(int, QListBoxItem *, const QPoint&); |
66 | void showMenu(); | 66 | void showMenu(); |
67 | void loadDoc( const DocLnk &); | 67 | void loadDoc( const DocLnk &); |
68 | void slotViewEdited(); | 68 | void slotViewEdited(); |
69 | void slotBoxSelected(const QString &); | 69 | void slotBoxSelected(const QString &); |
70 | // void keyReleaseEvent( QKeyEvent *); | 70 | // void keyReleaseEvent( QKeyEvent *); |
71 | 71 | ||
72 | }; | 72 | }; |
73 | 73 | ||
74 | class NotesApplet : public QWidget { | 74 | class NotesApplet : public QWidget { |
75 | Q_OBJECT | 75 | Q_OBJECT |
76 | public: | 76 | public: |
77 | NotesApplet( QWidget *parent = 0, const char *name=0 ); | 77 | NotesApplet( QWidget *parent = 0, const char *name=0 ); |
78 | ~NotesApplet(); | 78 | ~NotesApplet(); |
79 | NotesControl *vc; | 79 | NotesControl *vc; |
80 | public slots: | 80 | public slots: |
81 | private: | 81 | private: |
82 | void mousePressEvent( QMouseEvent * ); | 82 | void mousePressEvent( QMouseEvent * ); |
83 | void paintEvent( QPaintEvent* ); | 83 | void paintEvent( QPaintEvent* ); |
84 | 84 | ||
85 | private: | 85 | private: |
86 | QPixmap notesPixmap; | 86 | QPixmap notesPixmap; |
87 | private slots: | 87 | private slots: |
88 | 88 | ||
89 | 89 | ||
90 | }; | 90 | }; |
91 | 91 | ||
92 | #endif // __NOTES_APPLET_H__ | 92 | #endif // __NOTES_APPLET_H__ |
93 | 93 | ||
diff --git a/noncore/applets/notesapplet/notesappletimpl.cpp b/noncore/applets/notesapplet/notesappletimpl.cpp index 93e1e97..0526bad 100644 --- a/noncore/applets/notesapplet/notesappletimpl.cpp +++ b/noncore/applets/notesapplet/notesappletimpl.cpp | |||
@@ -1,50 +1,51 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 L.J. Potter <llornkcor@handhelds.org> | 2 | ** Copyright (C) 2002 L.J. Potter <llornkcor@handhelds.org> |
3 | ** | 3 | ** |
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 | ** | 10 | ** |
11 | **********************************************************************/ | 11 | **********************************************************************/ |
12 | #include "notes.h" | 12 | #include "notes.h" |
13 | #include "notesappletimpl.h" | 13 | #include "notesappletimpl.h" |
14 | 14 | ||
15 | 15 | ||
16 | NotesAppletImpl::NotesAppletImpl() | 16 | NotesAppletImpl::NotesAppletImpl() |
17 | : notes(0), ref(0) { | 17 | : notes(0), ref(0) { |
18 | } | 18 | } |
19 | 19 | ||
20 | NotesAppletImpl::~NotesAppletImpl() { | 20 | NotesAppletImpl::~NotesAppletImpl() { |
21 | // not needed though cause we should have a valid parent | ||
21 | delete notes; | 22 | delete notes; |
22 | } | 23 | } |
23 | 24 | ||
24 | QWidget *NotesAppletImpl::applet( QWidget *parent ) { | 25 | QWidget *NotesAppletImpl::applet( QWidget *parent ) { |
25 | if ( !notes ) | 26 | if ( !notes ) |
26 | notes = new NotesApplet( parent ); | 27 | notes = new NotesApplet( parent ); |
27 | return notes; | 28 | return notes; |
28 | } | 29 | } |
29 | 30 | ||
30 | int NotesAppletImpl::position() const { | 31 | int NotesAppletImpl::position() const { |
31 | return 6; | 32 | return 6; |
32 | } | 33 | } |
33 | 34 | ||
34 | QRESULT NotesAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { | 35 | QRESULT NotesAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { |
35 | *iface = 0; | 36 | *iface = 0; |
36 | if ( uuid == IID_QUnknown ) | 37 | if ( uuid == IID_QUnknown ) |
37 | *iface = this; | 38 | *iface = this; |
38 | else if ( uuid == IID_TaskbarApplet ) | 39 | else if ( uuid == IID_TaskbarApplet ) |
39 | *iface = this; | 40 | *iface = this; |
40 | 41 | ||
41 | if ( *iface ) | 42 | if ( *iface ) |
42 | (*iface)->addRef(); | 43 | (*iface)->addRef(); |
43 | return QS_OK; | 44 | return QS_OK; |
44 | } | 45 | } |
45 | 46 | ||
46 | Q_EXPORT_INTERFACE() { | 47 | Q_EXPORT_INTERFACE() { |
47 | Q_CREATE_INSTANCE( NotesAppletImpl ) | 48 | Q_CREATE_INSTANCE( NotesAppletImpl ) |
48 | } | 49 | } |
49 | 50 | ||
50 | 51 | ||