author | llornkcor <llornkcor> | 2002-11-21 00:54:20 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-21 00:54:20 (UTC) |
commit | a65963a06def8cb064bf7d99ff2776877f5f6315 (patch) (unidiff) | |
tree | 1134ef93e2ee628b4bcff73b0d0965266439d073 | |
parent | 9cef034e112118ad388b0678cd492d81b1695021 (diff) | |
download | opie-a65963a06def8cb064bf7d99ff2776877f5f6315.zip opie-a65963a06def8cb064bf7d99ff2776877f5f6315.tar.gz opie-a65963a06def8cb064bf7d99ff2776877f5f6315.tar.bz2 |
changed title, added maximixed mode. save to /notes
-rw-r--r-- | noncore/applets/notesapplet/notes.cpp | 70 | ||||
-rw-r--r-- | noncore/applets/notesapplet/notes.h | 3 |
2 files changed, 57 insertions, 16 deletions
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp index 90c2550..2b25476 100644 --- a/noncore/applets/notesapplet/notes.cpp +++ b/noncore/applets/notesapplet/notes.cpp | |||
@@ -85,3 +85,13 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) | |||
85 | { | 85 | { |
86 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); | 86 | QDir d( QDir::homeDirPath()+"/notes"); |
87 | if( !d.exists()) { | ||
88 | qDebug("make dir"); | ||
89 | if(!d.mkdir( QDir::homeDirPath()+"/notes", true)) | ||
90 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed"); | ||
91 | } | ||
92 | Config cfg("Notes"); | ||
93 | cfg.setGroup("Options"); | ||
94 | showMax = cfg.readBoolEntry("ShowMax", false); | ||
95 | |||
96 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); | ||
87 | loaded=false; | 97 | loaded=false; |
@@ -107,6 +117,2 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) | |||
107 | 117 | ||
108 | setFixedHeight(180); | ||
109 | QWidget *wid = QPEApplication::desktop(); | ||
110 | setFixedWidth( wid->width()-10 /*200*/); | ||
111 | |||
112 | setFocusPolicy(QWidget::StrongFocus); | 118 | setFocusPolicy(QWidget::StrongFocus); |
@@ -255,4 +261,5 @@ void NotesControl::showMenu() { | |||
255 | QPopupMenu *m = new QPopupMenu(0); | 261 | QPopupMenu *m = new QPopupMenu(0); |
256 | |||
257 | m->insertItem( tr( "Beam Out" ), this, SLOT( slotBeamButton() )); | 262 | m->insertItem( tr( "Beam Out" ), this, SLOT( slotBeamButton() )); |
263 | m->insertItem( tr( "Search For..." ), this, SLOT( slotSearch() )); | ||
264 | m->insertItem( tr( "Toggle Maximized" ), this, SLOT( slotShowMax() )); | ||
258 | m->insertSeparator(); | 265 | m->insertSeparator(); |
@@ -263,3 +270,2 @@ void NotesControl::showMenu() { | |||
263 | if(m) delete m; | 270 | if(m) delete m; |
264 | |||
265 | } | 271 | } |
@@ -286,6 +292,6 @@ void NotesControl::save() { | |||
286 | QString pt = rt.simplifyWhiteSpace(); | 292 | QString pt = rt.simplifyWhiteSpace(); |
287 | int i = pt.find( ' ' ); | 293 | int i = pt.find( ' ', pt.find( ' ' )+2 ); |
288 | QString docname = pt; | 294 | QString docname = pt; |
289 | if ( i > 0 ) | 295 | if ( i > 0 ) |
290 | docname = pt.left( i ); | 296 | docname = pt.left(i); |
291 | // remove "." at the beginning | 297 | // remove "." at the beginning |
@@ -313,5 +319,3 @@ void NotesControl::save() { | |||
313 | 319 | ||
314 | |||
315 | doc = new DocLnk(docname); | 320 | doc = new DocLnk(docname); |
316 | |||
317 | if(QFile(doc->linkFile()).exists()) | 321 | if(QFile(doc->linkFile()).exists()) |
@@ -319,5 +323,5 @@ void NotesControl::save() { | |||
319 | doc->setType("text/plain"); | 323 | doc->setType("text/plain"); |
320 | doc->setFile(QDir::homeDirPath()+"/"+docname); | ||
321 | doc->setName(docname); | 324 | doc->setName(docname); |
322 | 325 | QString temp = docname.replace( QRegExp(" "), "_" ); | |
326 | doc->setFile( QDir::homeDirPath()+"/notes/"+temp); | ||
323 | FileManager fm; | 327 | FileManager fm; |
@@ -376,6 +380,12 @@ void NotesControl::load(const QString & file) { | |||
376 | qDebug("loading "+file); | 380 | qDebug("loading "+file); |
377 | if(!loaded) { | 381 | QString name = file; |
382 | QString temp; | ||
383 | if( !QFile( QDir::homeDirPath()+"/"+file).exists() ) | ||
384 | temp = QDir::homeDirPath()+"/notes/"+ name.replace( QRegExp(" "), "_" ); | ||
385 | else | ||
386 | temp = name; | ||
387 | if(!loaded) { | ||
378 | DocLnk nf; | 388 | DocLnk nf; |
379 | nf.setType("text/plain"); | 389 | nf.setType("text/plain"); |
380 | nf.setFile( file); | 390 | nf.setFile( temp); |
381 | 391 | ||
@@ -396,2 +406,3 @@ void NotesControl::loadDoc( const DocLnk &f) { | |||
396 | if ( !fm.loadFile( f, txt ) ) { | 406 | if ( !fm.loadFile( f, txt ) ) { |
407 | qDebug("could not load file "+f.file()); | ||
397 | return; | 408 | return; |
@@ -407,2 +418,19 @@ void NotesControl::slotViewEdited() { | |||
407 | 418 | ||
419 | |||
420 | void NotesControl::slotShowMax() { | ||
421 | Config cfg("Notes"); | ||
422 | cfg.setGroup("Options"); | ||
423 | showMax=!showMax; | ||
424 | cfg.writeEntry("ShowMax", showMax); | ||
425 | cfg.write(); | ||
426 | hide(); | ||
427 | } | ||
428 | |||
429 | void NotesControl::slotSearch() { | ||
430 | int boxCount = box->count(); | ||
431 | for(int i=0;i< boxCount;i++) { | ||
432 | |||
433 | } | ||
434 | } | ||
435 | |||
408 | // void NotesControl::keyReleaseEvent( QKeyEvent *e) { | 436 | // void NotesControl::keyReleaseEvent( QKeyEvent *e) { |
@@ -452,4 +480,14 @@ void NotesApplet::mousePressEvent( QMouseEvent *) { | |||
452 | // QPoint curPos = mapToGlobal( rect().topLeft() ); | 480 | // QPoint curPos = mapToGlobal( rect().topLeft() ); |
481 | if(vc->showMax) { | ||
482 | qDebug("show max"); | ||
483 | vc->showMaximized(); | ||
484 | } else { | ||
485 | qDebug("no show max"); | ||
486 | QWidget *wid = QPEApplication::desktop(); | ||
487 | QRect rect = QApplication::desktop()->geometry(); | ||
488 | vc->setGeometry( ( wid->width() / 2) - ( vc->width() / 2 ) , 28 , wid->width() -10 , 180); | ||
489 | vc->move ( (rect.center()/2) - (vc->rect().center()/2)); | ||
490 | // vc->move( (( wid->width() / 2) - ( vc->width() / 2 ))-4, 28); | ||
491 | } | ||
453 | vc->show(); | 492 | vc->show(); |
454 | vc->move( 2, 28); | ||
455 | vc->doPopulate=true; | 493 | vc->doPopulate=true; |
diff --git a/noncore/applets/notesapplet/notes.h b/noncore/applets/notesapplet/notes.h index 381dc80..c428efe 100644 --- a/noncore/applets/notesapplet/notes.h +++ b/noncore/applets/notesapplet/notes.h | |||
@@ -44,2 +44,3 @@ public: | |||
44 | bool loaded, edited, doPopulate, isNew; | 44 | bool loaded, edited, doPopulate, isNew; |
45 | bool showMax; | ||
45 | void save(); | 46 | void save(); |
@@ -55,2 +56,4 @@ private: | |||
55 | private slots: | 56 | private slots: |
57 | void slotSearch(); | ||
58 | void slotShowMax(); | ||
56 | void slotBeamButton(); | 59 | void slotBeamButton(); |