-rw-r--r-- | noncore/applets/notesapplet/config.in | 2 | ||||
-rw-r--r-- | noncore/applets/notesapplet/notes.cpp | 54 | ||||
-rw-r--r-- | noncore/applets/notesapplet/notesapplet.pro | 4 |
3 files changed, 31 insertions, 29 deletions
diff --git a/noncore/applets/notesapplet/config.in b/noncore/applets/notesapplet/config.in index 27a8187..c92c1d5 100644 --- a/noncore/applets/notesapplet/config.in +++ b/noncore/applets/notesapplet/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config NOTESAPPLET | 1 | config NOTESAPPLET |
2 | boolean "opie-notesapplet (quick note taking applet)" | 2 | boolean "opie-notesapplet (quick note taking applet)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE |
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp index 13f7cf3..b3e72a7 100644 --- a/noncore/applets/notesapplet/notes.cpp +++ b/noncore/applets/notesapplet/notes.cpp | |||
@@ -6,56 +6,58 @@ | |||
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 | /* OPIE */ |
19 | #include <stdlib.h> | 19 | #include <opie2/odebug.h> |
20 | #include <qstringlist.h> | ||
21 | |||
22 | #include <opie2/otaskbarapplet.h> | 20 | #include <opie2/otaskbarapplet.h> |
23 | #include <qpe/filemanager.h> | 21 | #include <qpe/filemanager.h> |
24 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/timestring.h> | 23 | #include <qpe/timestring.h> |
26 | #include <qpe/applnk.h> | 24 | #include <qpe/applnk.h> |
27 | #include <qpe/ir.h> | 25 | #include <qpe/ir.h> |
28 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
27 | using namespace Opie::Core; | ||
28 | using namespace Opie::Ui; | ||
29 | 29 | ||
30 | // #include <qsocket.h> | 30 | /* QT */ |
31 | // #include <qclipboard.h> | ||
32 | #include <qmultilineedit.h> | 31 | #include <qmultilineedit.h> |
33 | #include <qlistbox.h> | 32 | #include <qlistbox.h> |
34 | #include <qpopupmenu.h> | 33 | #include <qpopupmenu.h> |
35 | #include <qmessagebox.h> | 34 | #include <qmessagebox.h> |
36 | 35 | #include <qapplication.h> | |
37 | #include <qdir.h> | 36 | #include <qdir.h> |
38 | #include <qfile.h> | 37 | #include <qfile.h> |
39 | #include <qpoint.h> | 38 | #include <qpoint.h> |
40 | #include <qpushbutton.h> | 39 | #include <qpushbutton.h> |
41 | #include <qpainter.h> | 40 | #include <qpainter.h> |
42 | #include <qlayout.h> | 41 | #include <qlayout.h> |
43 | #include <qframe.h> | 42 | #include <qframe.h> |
44 | #include <qpixmap.h> | 43 | #include <qpixmap.h> |
45 | #include <qstring.h> | 44 | #include <qstring.h> |
45 | #include <qstringlist.h> | ||
46 | #include <qtimer.h> | 46 | #include <qtimer.h> |
47 | 47 | ||
48 | /* STD */ | ||
49 | #include <stdlib.h> | ||
50 | |||
48 | /* XPM */ | 51 | /* XPM */ |
49 | using namespace Opie::Ui; | ||
50 | static char * notes_xpm[] = { | 52 | static char * notes_xpm[] = { |
51 | "16 16 11 1", | 53 | "16 16 11 1", |
52 | " c None", | 54 | " c None", |
53 | ". c #000000", | 55 | ". c #000000", |
54 | "+ c #7F7F7F", | 56 | "+ c #7F7F7F", |
55 | "@ c #BFBFBF", | 57 | "@ c #BFBFBF", |
56 | "# c #BFC1FF", | 58 | "# c #BFC1FF", |
57 | "$ c #FF0000", | 59 | "$ c #FF0000", |
58 | "% c #FFFFFF", | 60 | "% c #FFFFFF", |
59 | "& c #00037F", | 61 | "& c #00037F", |
60 | "* c #0006FF", | 62 | "* c #0006FF", |
61 | "= c #0005BF", | 63 | "= c #0005BF", |
@@ -75,27 +77,27 @@ static char * notes_xpm[] = { | |||
75 | " ..=**=#&=&=.. ", | 77 | " ..=**=#&=&=.. ", |
76 | " ..=*=&=.. ", | 78 | " ..=*=&=.. ", |
77 | " ..=.. ", | 79 | " ..=.. ", |
78 | " . "}; | 80 | " . "}; |
79 | 81 | ||
80 | 82 | ||
81 | NotesControl::NotesControl( QWidget *, const char * ) | 83 | NotesControl::NotesControl( QWidget *, const char * ) |
82 | : QVBox( 0, "NotesControl",/* WDestructiveClose | */WStyle_StaysOnTop ) | 84 | : QVBox( 0, "NotesControl",/* WDestructiveClose | */WStyle_StaysOnTop ) |
83 | // : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) | 85 | // : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) |
84 | { | 86 | { |
85 | QDir d( QDir::homeDirPath()+"/notes"); | 87 | QDir d( QDir::homeDirPath()+"/notes"); |
86 | if( !d.exists()) { | 88 | if( !d.exists()) { |
87 | qDebug("make dir"); | 89 | odebug << "make dir" << oendl; |
88 | if(!d.mkdir( QDir::homeDirPath()+"/notes", true)) | 90 | if(!d.mkdir( QDir::homeDirPath()+"/notes", true)) |
89 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed"); | 91 | odebug << "<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed" << oendl; |
90 | } | 92 | } |
91 | Config cfg("Notes"); | 93 | Config cfg("Notes"); |
92 | cfg.setGroup("Options"); | 94 | cfg.setGroup("Options"); |
93 | showMax = cfg.readBoolEntry("ShowMax", false); | 95 | showMax = cfg.readBoolEntry("ShowMax", false); |
94 | 96 | ||
95 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); | 97 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); |
96 | loaded=false; | 98 | loaded=false; |
97 | edited=false; | 99 | edited=false; |
98 | doPopulate=true; | 100 | doPopulate=true; |
99 | isNew=false; | 101 | isNew=false; |
100 | QVBox *vbox = new QVBox( this, "Vlayout" ); | 102 | QVBox *vbox = new QVBox( this, "Vlayout" ); |
101 | QHBox *hbox = new QHBox( this, "HLayout" ); | 103 | QHBox *hbox = new QHBox( this, "HLayout" ); |
@@ -156,55 +158,55 @@ void NotesControl::slotDeleteButtonClicked() { | |||
156 | switch ( QMessageBox::warning(this,tr("Delete?") | 158 | switch ( QMessageBox::warning(this,tr("Delete?") |
157 | ,tr("Do you really want to<BR><B> delete</B> this note ?") | 159 | ,tr("Do you really want to<BR><B> delete</B> this note ?") |
158 | ,tr("Yes"),tr("No"),0,1,1) ) { | 160 | ,tr("Yes"),tr("No"),0,1,1) ) { |
159 | case 0: | 161 | case 0: |
160 | slotDeleteButton(); | 162 | slotDeleteButton(); |
161 | break; | 163 | break; |
162 | }; | 164 | }; |
163 | } | 165 | } |
164 | 166 | ||
165 | void NotesControl::slotDeleteButton() { | 167 | void NotesControl::slotDeleteButton() { |
166 | 168 | ||
167 | QString selectedText = box->currentText(); | 169 | QString selectedText = box->currentText(); |
168 | qDebug("deleting "+selectedText); | 170 | odebug << "deleting "+selectedText << oendl; |
169 | 171 | ||
170 | if( !selectedText.isEmpty()) { | 172 | if( !selectedText.isEmpty()) { |
171 | 173 | ||
172 | Config cfg("Notes"); | 174 | Config cfg("Notes"); |
173 | cfg.setGroup("Docs"); | 175 | cfg.setGroup("Docs"); |
174 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 176 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
175 | QString entryName, entryName2;; | 177 | QString entryName, entryName2;; |
176 | for ( int i = 0; i < noOfFiles; i++ ) { | 178 | for ( int i = 0; i < noOfFiles; i++ ) { |
177 | entryName.sprintf( "File%i", i + 1 ); | 179 | entryName.sprintf( "File%i", i + 1 ); |
178 | if(selectedText == cfg.readEntry( entryName )) { | 180 | if(selectedText == cfg.readEntry( entryName )) { |
179 | qDebug("removing %s, %d", selectedText.latin1(), i); | 181 | odebug << "removing " << selectedText.latin1() << ", " << i << "" << oendl; |
180 | for ( int j = i; j < noOfFiles; j++ ) { | 182 | for ( int j = i; j < noOfFiles; j++ ) { |
181 | entryName.sprintf( "File%i", i + 1 ); | 183 | entryName.sprintf( "File%i", i + 1 ); |
182 | entryName2.sprintf( "File%i", i + 2 ); | 184 | entryName2.sprintf( "File%i", i + 2 ); |
183 | QString temp = cfg.readEntry(entryName2); | 185 | QString temp = cfg.readEntry(entryName2); |
184 | qDebug("move "+temp); | 186 | odebug << "move "+temp << oendl; |
185 | cfg.writeEntry(entryName, temp); | 187 | cfg.writeEntry(entryName, temp); |
186 | i++; | 188 | i++; |
187 | } | 189 | } |
188 | cfg.writeEntry("NumberOfFiles", noOfFiles-1 ); | 190 | cfg.writeEntry("NumberOfFiles", noOfFiles-1 ); |
189 | entryName.sprintf( "File%i", noOfFiles ); | 191 | entryName.sprintf( "File%i", noOfFiles ); |
190 | cfg.removeEntry(entryName); | 192 | cfg.removeEntry(entryName); |
191 | cfg.write(); | 193 | cfg.write(); |
192 | DocLnk nf(selectedText); | 194 | DocLnk nf(selectedText); |
193 | nf.removeFiles(); | 195 | nf.removeFiles(); |
194 | QString fi=QPEApplication::documentDir()+"/text/plain/"+selectedText+".desktop"; | 196 | QString fi=QPEApplication::documentDir()+"/text/plain/"+selectedText+".desktop"; |
195 | qDebug(fi); | 197 | odebug << fi << oendl; |
196 | 198 | ||
197 | QFile f( fi); | 199 | QFile f( fi); |
198 | if( !f.remove()) qDebug(".desktop file not removed"); | 200 | if( !f.remove()) odebug << ".desktop file not removed" << oendl; |
199 | 201 | ||
200 | } | 202 | } |
201 | } | 203 | } |
202 | view->clear(); | 204 | view->clear(); |
203 | 205 | ||
204 | populateBox(); | 206 | populateBox(); |
205 | } | 207 | } |
206 | } | 208 | } |
207 | 209 | ||
208 | void NotesControl::slotNewButton() { | 210 | void NotesControl::slotNewButton() { |
209 | if(edited) save(); | 211 | if(edited) save(); |
210 | view->clear(); | 212 | view->clear(); |
@@ -274,81 +276,81 @@ void NotesControl::focusOutEvent ( QFocusEvent * e) { | |||
274 | if(!loaded) { | 276 | if(!loaded) { |
275 | populateBox(); | 277 | populateBox(); |
276 | load(); | 278 | load(); |
277 | } | 279 | } |
278 | } | 280 | } |
279 | QWidget::focusOutEvent(e); | 281 | QWidget::focusOutEvent(e); |
280 | } | 282 | } |
281 | 283 | ||
282 | void NotesControl::save() { | 284 | void NotesControl::save() { |
283 | Config cfg("Notes"); | 285 | Config cfg("Notes"); |
284 | cfg.setGroup("Docs"); | 286 | cfg.setGroup("Docs"); |
285 | if( edited) { | 287 | if( edited) { |
286 | // qDebug("is edited"); | 288 | // odebug << "is edited" << oendl; |
287 | QString rt = view->text(); | 289 | QString rt = view->text(); |
288 | if( rt.length()>1) { | 290 | if( rt.length()>1) { |
289 | QString pt = rt.simplifyWhiteSpace(); | 291 | QString pt = rt.simplifyWhiteSpace(); |
290 | int i = pt.find( ' ', pt.find( ' ' )+2 ); | 292 | int i = pt.find( ' ', pt.find( ' ' )+2 ); |
291 | QString docname = pt; | 293 | QString docname = pt; |
292 | if ( i > 0 ) | 294 | if ( i > 0 ) |
293 | docname = pt.left(i); | 295 | docname = pt.left(i); |
294 | // remove "." at the beginning | 296 | // remove "." at the beginning |
295 | while( docname.startsWith( "." ) ) | 297 | while( docname.startsWith( "." ) ) |
296 | docname = docname.mid( 1 ); | 298 | docname = docname.mid( 1 ); |
297 | docname.replace( QRegExp("/"), "_" ); | 299 | docname.replace( QRegExp("/"), "_" ); |
298 | // cut the length. filenames longer than that don't make sense | 300 | // cut the length. filenames longer than that don't make sense |
299 | // and something goes wrong when they get too long. | 301 | // and something goes wrong when they get too long. |
300 | if ( docname.length() > 40 ) | 302 | if ( docname.length() > 40 ) |
301 | docname = docname.left(40); | 303 | docname = docname.left(40); |
302 | if ( docname.isEmpty() ) | 304 | if ( docname.isEmpty() ) |
303 | docname = "Empty Text"; | 305 | docname = "Empty Text"; |
304 | // qDebug(docname); | 306 | // odebug << docname << oendl; |
305 | 307 | ||
306 | if( oldDocName != docname) { | 308 | if( oldDocName != docname) { |
307 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 309 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
308 | QString entryName; | 310 | QString entryName; |
309 | entryName.sprintf( "File%i", noOfFiles + 1 ); | 311 | entryName.sprintf( "File%i", noOfFiles + 1 ); |
310 | cfg.writeEntry( entryName,docname ); | 312 | cfg.writeEntry( entryName,docname ); |
311 | cfg.writeEntry("NumberOfFiles", noOfFiles+1 ); | 313 | cfg.writeEntry("NumberOfFiles", noOfFiles+1 ); |
312 | cfg.write(); | 314 | cfg.write(); |
313 | } | 315 | } |
314 | // else | 316 | // else |
315 | // qDebug("oldname equals docname"); | 317 | // odebug << "oldname equals docname" << oendl; |
316 | 318 | ||
317 | doc = new DocLnk(docname); | 319 | doc = new DocLnk(docname); |
318 | if(QFile(doc->linkFile()).exists()) | 320 | if(QFile(doc->linkFile()).exists()) |
319 | qDebug("puppie"); | 321 | odebug << "puppie" << oendl; |
320 | doc->setType("text/plain"); | 322 | doc->setType("text/plain"); |
321 | doc->setName(docname); | 323 | doc->setName(docname); |
322 | QString temp = docname.replace( QRegExp(" "), "_" ); | 324 | QString temp = docname.replace( QRegExp(" "), "_" ); |
323 | doc->setFile( QDir::homeDirPath()+"/notes/"+temp); | 325 | doc->setFile( QDir::homeDirPath()+"/notes/"+temp); |
324 | FileManager fm; | 326 | FileManager fm; |
325 | if ( !fm.saveFile( *doc, rt ) ) { | 327 | if ( !fm.saveFile( *doc, rt ) ) { |
326 | } | 328 | } |
327 | 329 | ||
328 | oldDocName=docname; | 330 | oldDocName=docname; |
329 | edited=false; | 331 | edited=false; |
330 | // qDebug("save"); | 332 | // odebug << "save" << oendl; |
331 | if (doPopulate) | 333 | if (doPopulate) |
332 | populateBox(); | 334 | populateBox(); |
333 | } | 335 | } |
334 | cfg.writeEntry( "LastDoc",oldDocName ); | 336 | cfg.writeEntry( "LastDoc",oldDocName ); |
335 | cfg.write(); | 337 | cfg.write(); |
336 | 338 | ||
337 | } | 339 | } |
338 | } | 340 | } |
339 | 341 | ||
340 | void NotesControl::populateBox() { | 342 | void NotesControl::populateBox() { |
341 | box->clear(); | 343 | box->clear(); |
342 | // qDebug("populate"); | 344 | // odebug << "populate" << oendl; |
343 | Config cfg("Notes"); | 345 | Config cfg("Notes"); |
344 | cfg.setGroup("Docs"); | 346 | cfg.setGroup("Docs"); |
345 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 347 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
346 | QStringList list; | 348 | QStringList list; |
347 | QString entryName; | 349 | QString entryName; |
348 | for ( int i = 0; i < noOfFiles; i++ ) { | 350 | for ( int i = 0; i < noOfFiles; i++ ) { |
349 | entryName.sprintf( "File%i", i + 1 ); | 351 | entryName.sprintf( "File%i", i + 1 ); |
350 | list.append(cfg.readEntry( entryName )); | 352 | list.append(cfg.readEntry( entryName )); |
351 | } | 353 | } |
352 | list.sort(); | 354 | list.sort(); |
353 | box->insertStringList(list,-1); | 355 | box->insertStringList(list,-1); |
354 | doPopulate=false; | 356 | doPopulate=false; |
@@ -365,25 +367,25 @@ void NotesControl::load() { | |||
365 | nf.setType("text/plain"); | 367 | nf.setType("text/plain"); |
366 | nf.setFile(lastDoc); | 368 | nf.setFile(lastDoc); |
367 | 369 | ||
368 | loadDoc(nf); | 370 | loadDoc(nf); |
369 | loaded=true; | 371 | loaded=true; |
370 | oldDocName=lastDoc; | 372 | oldDocName=lastDoc; |
371 | cfg.writeEntry( "LastDoc",oldDocName ); | 373 | cfg.writeEntry( "LastDoc",oldDocName ); |
372 | cfg.write(); | 374 | cfg.write(); |
373 | } | 375 | } |
374 | } | 376 | } |
375 | 377 | ||
376 | void NotesControl::load(const QString & file) { | 378 | void NotesControl::load(const QString & file) { |
377 | qDebug("loading "+file); | 379 | odebug << "loading "+file << oendl; |
378 | QString name = file; | 380 | QString name = file; |
379 | QString temp; | 381 | QString temp; |
380 | if( !QFile( QDir::homeDirPath()+"/"+file).exists() ) | 382 | if( !QFile( QDir::homeDirPath()+"/"+file).exists() ) |
381 | temp = QDir::homeDirPath()+"/notes/"+ name.replace( QRegExp(" "), "_" ); | 383 | temp = QDir::homeDirPath()+"/notes/"+ name.replace( QRegExp(" "), "_" ); |
382 | else | 384 | else |
383 | temp = name; | 385 | temp = name; |
384 | if(!loaded) { | 386 | if(!loaded) { |
385 | DocLnk nf; | 387 | DocLnk nf; |
386 | nf.setType("text/plain"); | 388 | nf.setType("text/plain"); |
387 | nf.setFile( temp); | 389 | nf.setFile( temp); |
388 | if(!temp.isEmpty()) | 390 | if(!temp.isEmpty()) |
389 | loadDoc(nf); | 391 | loadDoc(nf); |
@@ -392,25 +394,25 @@ void NotesControl::load(const QString & file) { | |||
392 | // view->setFocus(); | 394 | // view->setFocus(); |
393 | oldDocName=file; | 395 | oldDocName=file; |
394 | Config cfg("Notes"); | 396 | Config cfg("Notes"); |
395 | cfg.setGroup("Docs"); | 397 | cfg.setGroup("Docs"); |
396 | cfg.writeEntry( "LastDoc",oldDocName ); | 398 | cfg.writeEntry( "LastDoc",oldDocName ); |
397 | cfg.write(); | 399 | cfg.write(); |
398 | } | 400 | } |
399 | 401 | ||
400 | void NotesControl::loadDoc( const DocLnk &f) { | 402 | void NotesControl::loadDoc( const DocLnk &f) { |
401 | FileManager fm; | 403 | FileManager fm; |
402 | QString txt; | 404 | QString txt; |
403 | if ( !fm.loadFile( f, txt ) ) { | 405 | if ( !fm.loadFile( f, txt ) ) { |
404 | qDebug("could not load file "+f.file()); | 406 | odebug << "could not load file "+f.file() << oendl; |
405 | return; | 407 | return; |
406 | } | 408 | } |
407 | view->setText(txt); | 409 | view->setText(txt); |
408 | } | 410 | } |
409 | 411 | ||
410 | void NotesControl::slotViewEdited() { | 412 | void NotesControl::slotViewEdited() { |
411 | if(loaded) { | 413 | if(loaded) { |
412 | edited=true; | 414 | edited=true; |
413 | } | 415 | } |
414 | } | 416 | } |
415 | 417 | ||
416 | 418 | ||
@@ -426,25 +428,25 @@ void NotesControl::slotShowMax() { | |||
426 | void NotesControl::slotSearch() { | 428 | void NotesControl::slotSearch() { |
427 | int boxCount = box->count(); | 429 | int boxCount = box->count(); |
428 | for(int i=0;i< boxCount;i++) { | 430 | for(int i=0;i< boxCount;i++) { |
429 | 431 | ||
430 | } | 432 | } |
431 | } | 433 | } |
432 | 434 | ||
433 | // void NotesControl::keyReleaseEvent( QKeyEvent *e) { | 435 | // void NotesControl::keyReleaseEvent( QKeyEvent *e) { |
434 | 436 | ||
435 | // switch ( e->state() ) { | 437 | // switch ( e->state() ) { |
436 | // case ControlButton: | 438 | // case ControlButton: |
437 | // if(e->key() == Key_C) { //copy | 439 | // if(e->key() == Key_C) { //copy |
438 | // qDebug("copy"); | 440 | // odebug << "copy" << oendl; |
439 | // QClipboard *cb = QApplication::clipboard(); | 441 | // QClipboard *cb = QApplication::clipboard(); |
440 | // QString text; | 442 | // QString text; |
441 | 443 | ||
442 | // // Copy text from the clipboard (paste) | 444 | // // Copy text from the clipboard (paste) |
443 | // text = cb->text(); | 445 | // text = cb->text(); |
444 | // } | 446 | // } |
445 | // if(e->key() == Key_X) { //cut | 447 | // if(e->key() == Key_X) { //cut |
446 | // } | 448 | // } |
447 | // if(e->key() == Key_V) { //paste | 449 | // if(e->key() == Key_V) { //paste |
448 | // QClipboard *cb = QApplication::clipboard(); | 450 | // QClipboard *cb = QApplication::clipboard(); |
449 | // QString text; | 451 | // QString text; |
450 | // //view | 452 | // //view |
@@ -473,28 +475,28 @@ int NotesApplet::position() | |||
473 | return 6; | 475 | return 6; |
474 | } | 476 | } |
475 | 477 | ||
476 | void NotesApplet::mousePressEvent( QMouseEvent *) { | 478 | void NotesApplet::mousePressEvent( QMouseEvent *) { |
477 | if( !vc->isHidden()) { | 479 | if( !vc->isHidden()) { |
478 | vc->doPopulate=false; | 480 | vc->doPopulate=false; |
479 | vc->save(); | 481 | vc->save(); |
480 | vc->close(); | 482 | vc->close(); |
481 | } else { | 483 | } else { |
482 | // vc = new NotesControl; | 484 | // vc = new NotesControl; |
483 | // QPoint curPos = mapToGlobal( rect().topLeft() ); | 485 | // QPoint curPos = mapToGlobal( rect().topLeft() ); |
484 | if(vc->showMax) { | 486 | if(vc->showMax) { |
485 | qDebug("show max"); | 487 | odebug << "show max" << oendl; |
486 | vc->showMaximized(); | 488 | vc->showMaximized(); |
487 | } else { | 489 | } else { |
488 | qDebug("no show max"); | 490 | odebug << "no show max" << oendl; |
489 | QWidget *wid = QPEApplication::desktop(); | 491 | QWidget *wid = QPEApplication::desktop(); |
490 | QRect rect = QApplication::desktop()->geometry(); | 492 | QRect rect = QApplication::desktop()->geometry(); |
491 | vc->setGeometry( ( wid->width() / 2) - ( vc->width() / 2 ) , 28 , wid->width() -10 , 180); | 493 | vc->setGeometry( ( wid->width() / 2) - ( vc->width() / 2 ) , 28 , wid->width() -10 , 180); |
492 | vc->move ( (rect.center()/2) - (vc->rect().center()/2)); | 494 | vc->move ( (rect.center()/2) - (vc->rect().center()/2)); |
493 | // vc->move( (( wid->width() / 2) - ( vc->width() / 2 ))-4, 28); | 495 | // vc->move( (( wid->width() / 2) - ( vc->width() / 2 ))-4, 28); |
494 | } | 496 | } |
495 | vc->show(); | 497 | vc->show(); |
496 | vc->doPopulate=true; | 498 | vc->doPopulate=true; |
497 | vc->populateBox(); | 499 | vc->populateBox(); |
498 | vc->doPopulate=false; | 500 | vc->doPopulate=false; |
499 | vc->loaded=false; | 501 | vc->loaded=false; |
500 | 502 | ||
diff --git a/noncore/applets/notesapplet/notesapplet.pro b/noncore/applets/notesapplet/notesapplet.pro index 44e5b34..c3f9b1c 100644 --- a/noncore/applets/notesapplet/notesapplet.pro +++ b/noncore/applets/notesapplet/notesapplet.pro | |||
@@ -1,12 +1,12 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt plugin warn_on | 2 | CONFIG += qt plugin warn_on |
3 | HEADERS = notes.h | 3 | HEADERS = notes.h |
4 | SOURCES = notes.cpp | 4 | SOURCES = notes.cpp |
5 | TARGET = notesapplet | 5 | TARGET = notesapplet |
6 | DESTDIR = $(OPIEDIR)/plugins/applets | 6 | DESTDIR = $(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe -lopiecore2 |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.1 |
11 | 11 | ||
12 | include ( $(OPIEDIR)/include.pro ) | 12 | include ( $(OPIEDIR)/include.pro ) |