author | llornkcor <llornkcor> | 2002-09-27 13:54:48 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-09-27 13:54:48 (UTC) |
commit | b575c9fe0f3f4173bdc64004cc13af6323016df1 (patch) (unidiff) | |
tree | d2caa75aae00e148ca0802510baacb6fdfce510c | |
parent | ef78bebf57560f2d99eec2cbb1934454fd3ea8d1 (diff) | |
download | opie-b575c9fe0f3f4173bdc64004cc13af6323016df1.zip opie-b575c9fe0f3f4173bdc64004cc13af6323016df1.tar.gz opie-b575c9fe0f3f4173bdc64004cc13af6323016df1.tar.bz2 |
added stuff
-rw-r--r-- | noncore/applets/notesapplet/notes.cpp | 78 | ||||
-rw-r--r-- | noncore/applets/notesapplet/notes.h | 6 |
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 | |||
@@ -29,4 +29,6 @@ | |||
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> |
@@ -37,2 +39,3 @@ | |||
37 | #include <qdir.h> | 39 | #include <qdir.h> |
40 | #include <qfile.h> | ||
38 | #include <qpoint.h> | 41 | #include <qpoint.h> |
@@ -92,3 +95,5 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) | |||
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); |
@@ -111,2 +116,6 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) | |||
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" ); |
@@ -119,3 +128,5 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) | |||
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() ) ); |
@@ -123,3 +134,5 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) | |||
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())); |
@@ -132,4 +145,12 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) | |||
132 | 145 | ||
146 | void NotesControl::slotSaveButton() { | ||
147 | if(edited) { | ||
148 | save(); | ||
149 | populateBox(); | ||
150 | } | ||
151 | } | ||
152 | |||
133 | void NotesControl::slotDeleteButtonClicked() { | 153 | void 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) ) { |
@@ -182,3 +203,23 @@ void NotesControl::slotNewButton() { | |||
182 | 203 | ||
183 | void NotesControl::boxPressed(int mouse, QListBoxItem *item, const QPoint&) { | 204 | void 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 | |||
220 | void NotesControl::slotBeamFinished(Ir *) { | ||
221 | this->show(); | ||
222 | } | ||
223 | |||
224 | void NotesControl::boxPressed(int mouse, QListBoxItem *, const QPoint&) { | ||
184 | switch (mouse) { | 225 | switch (mouse) { |
@@ -206,4 +247,5 @@ void NotesControl::showMenu() { | |||
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(); |
@@ -258,2 +300,4 @@ void NotesControl::save() { | |||
258 | } | 300 | } |
301 | else | ||
302 | qDebug("oldname equals docname"); | ||
259 | doc = new DocLnk(docname); | 303 | doc = new DocLnk(docname); |
@@ -295,2 +339,3 @@ void NotesControl::populateBox() { | |||
295 | doPopulate=false; | 339 | doPopulate=false; |
340 | update(); | ||
296 | } | 341 | } |
@@ -348,2 +393,27 @@ void NotesControl::slotViewEdited() { | |||
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 | //=========================================================================== |
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 | |||
@@ -23,2 +23,3 @@ | |||
23 | #include <qpe/filemanager.h> | 23 | #include <qpe/filemanager.h> |
24 | #include <qpe/ir.h> | ||
24 | #include <qstring.h> | 25 | #include <qstring.h> |
@@ -55,3 +56,6 @@ private: | |||
55 | private slots: | 56 | private slots: |
57 | void slotBeamButton(); | ||
58 | void slotBeamFinished( Ir*); | ||
56 | void slotDeleteButton(); | 59 | void slotDeleteButton(); |
60 | void slotSaveButton(); | ||
57 | void slotDeleteButtonClicked(); | 61 | void slotDeleteButtonClicked(); |
@@ -63,2 +67,4 @@ private slots: | |||
63 | void slotBoxSelected(const QString &); | 67 | void slotBoxSelected(const QString &); |
68 | // void keyReleaseEvent( QKeyEvent *); | ||
69 | |||
64 | }; | 70 | }; |