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