author | llornkcor <llornkcor> | 2002-09-27 13:54:48 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-09-27 13:54:48 (UTC) |
commit | b575c9fe0f3f4173bdc64004cc13af6323016df1 (patch) (side-by-side diff) | |
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 @@ #include <qpe/config.h> -#include <qsocket.h> +#include <qpe/ir.h> +// #include <qsocket.h> +// #include <qclipboard.h> #include <qmultilineedit.h> @@ -37,2 +39,3 @@ #include <qdir.h> +#include <qfile.h> #include <qpoint.h> @@ -92,3 +95,5 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) box = new QListBox(this, "OpieNotesBox"); + QPEApplication::setStylusOperation( box->viewport(),QPEApplication::RightOnHold); + box->setFixedHeight(50); @@ -111,2 +116,6 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) + saveButton= new QPushButton( this, "saveButton" ); + saveButton->setText(tr("Save")); + hbox->addWidget( saveButton); + deleteButton= new QPushButton( this, "deleteButton" ); @@ -119,3 +128,5 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) this,SLOT( boxPressed(int, QListBoxItem *, const QPoint&)) ); + connect(box, SIGNAL(highlighted(const QString&)), this, SLOT(slotBoxSelected(const QString &))); + connect( &menuTimer, SIGNAL( timeout() ), SLOT( showMenu() ) ); @@ -123,3 +134,5 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) connect(view,SIGNAL( textChanged() ), this, SLOT(slotViewEdited() ) ); + connect(newButton, SIGNAL(clicked()), this, SLOT(slotNewButton())); + connect(saveButton, SIGNAL(clicked()), this, SLOT(slotSaveButton())); connect(deleteButton, SIGNAL(clicked()), this, SLOT(slotDeleteButtonClicked())); @@ -132,4 +145,12 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) +void NotesControl::slotSaveButton() { + if(edited) { + save(); + populateBox(); + } +} + void NotesControl::slotDeleteButtonClicked() { - switch ( QMessageBox::warning(this,tr("Delete?"),tr("Do you really want to<BR><B> delete</B> this note ?") + switch ( QMessageBox::warning(this,tr("Delete?") + ,tr("Do you really want to<BR><B> delete</B> this note ?") ,tr("Yes"),tr("No"),0,1,1) ) { @@ -182,3 +203,23 @@ void NotesControl::slotNewButton() { -void NotesControl::boxPressed(int mouse, QListBoxItem *item, const QPoint&) { +void NotesControl::slotBeamButton() { + Ir ir; + if(!ir.supported()){ + } else { + this->hide(); + QString selectedText = box->currentText(); + if( !selectedText.isEmpty()) { + QString file = QDir::homeDirPath()+"/"+selectedText; + QFile f(file); + Ir *irFile = new Ir(this, "IR"); + connect( irFile, SIGNAL(done(Ir*)), this, SLOT( slotBeamFinished( Ir * ))); + irFile->send( file, "Note", "text/plain" ); + } + } +} + +void NotesControl::slotBeamFinished(Ir *) { + this->show(); +} + +void NotesControl::boxPressed(int mouse, QListBoxItem *, const QPoint&) { switch (mouse) { @@ -206,4 +247,5 @@ void NotesControl::showMenu() { + m->insertItem( tr( "Beam Out" ), this, SLOT( slotBeamButton() )); + m->insertSeparator(); m->insertItem( tr( "Delete" ), this, SLOT( slotDeleteButton() )); - m->setFocus(); @@ -258,2 +300,4 @@ void NotesControl::save() { } + else + qDebug("oldname equals docname"); doc = new DocLnk(docname); @@ -295,2 +339,3 @@ void NotesControl::populateBox() { doPopulate=false; + update(); } @@ -348,2 +393,27 @@ void NotesControl::slotViewEdited() { +// void NotesControl::keyReleaseEvent( QKeyEvent *e) { + +// switch ( e->state() ) { +// case ControlButton: +// if(e->key() == Key_C) { //copy +// qDebug("copy"); +// QClipboard *cb = QApplication::clipboard(); +// QString text; + +// // Copy text from the clipboard (paste) +// text = cb->text(); +// } +// if(e->key() == Key_X) { //cut +// } +// if(e->key() == Key_V) { //paste +// QClipboard *cb = QApplication::clipboard(); +// QString text; +// view +// cb->setText(); +// } +// break; +// }; +// QWidget::keyReleaseEvent(e); +// } + //=========================================================================== 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 @@ #include <qpe/filemanager.h> +#include <qpe/ir.h> #include <qstring.h> @@ -55,3 +56,6 @@ private: private slots: + void slotBeamButton(); + void slotBeamFinished( Ir*); void slotDeleteButton(); + void slotSaveButton(); void slotDeleteButtonClicked(); @@ -63,2 +67,4 @@ private slots: void slotBoxSelected(const QString &); +// void keyReleaseEvent( QKeyEvent *); + }; |