summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -28,6 +28,8 @@
#include <qpe/applnk.h>
#include <qpe/config.h>
-#include <qsocket.h>
+#include <qpe/ir.h>
+// #include <qsocket.h>
+// #include <qclipboard.h>
#include <qmultilineedit.h>
#include <qlistbox.h>
@@ -36,4 +38,5 @@
#include <qdir.h>
+#include <qfile.h>
#include <qpoint.h>
#include <qpushbutton.h>
@@ -91,5 +94,7 @@ NotesControl::NotesControl( QWidget *parent, const char *name )
box = new QListBox(this, "OpieNotesBox");
+
QPEApplication::setStylusOperation( box->viewport(),QPEApplication::RightOnHold);
+
box->setFixedHeight(50);
@@ -110,4 +115,8 @@ NotesControl::NotesControl( QWidget *parent, const char *name )
hbox->addWidget( newButton);
+ saveButton= new QPushButton( this, "saveButton" );
+ saveButton->setText(tr("Save"));
+ hbox->addWidget( saveButton);
+
deleteButton= new QPushButton( this, "deleteButton" );
deleteButton->setText(tr("Delete"));
@@ -118,9 +127,13 @@ NotesControl::NotesControl( QWidget *parent, const char *name )
connect( box, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint&)),
this,SLOT( boxPressed(int, QListBoxItem *, const QPoint&)) );
+
connect(box, SIGNAL(highlighted(const QString&)), this, SLOT(slotBoxSelected(const QString &)));
+
connect( &menuTimer, SIGNAL( timeout() ), SLOT( showMenu() ) );
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()));
@@ -131,6 +144,14 @@ 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) ) {
case 0:
@@ -181,5 +202,25 @@ 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) {
case 1:{
@@ -205,6 +246,7 @@ void NotesControl::showMenu() {
QPopupMenu *m = new QPopupMenu(0);
+ m->insertItem( tr( "Beam Out" ), this, SLOT( slotBeamButton() ));
+ m->insertSeparator();
m->insertItem( tr( "Delete" ), this, SLOT( slotDeleteButton() ));
-
m->setFocus();
m->exec( QCursor::pos() );
@@ -257,4 +299,6 @@ void NotesControl::save() {
cfg.write();
}
+ else
+ qDebug("oldname equals docname");
doc = new DocLnk(docname);
@@ -294,4 +338,5 @@ void NotesControl::populateBox() {
box->insertStringList(list,-1);
doPopulate=false;
+ update();
}
@@ -347,4 +392,29 @@ 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
@@ -22,4 +22,5 @@
#include <qtimer.h>
#include <qpe/filemanager.h>
+#include <qpe/ir.h>
#include <qstring.h>
@@ -54,5 +55,8 @@ private:
void load(const QString&);
private slots:
+ void slotBeamButton();
+ void slotBeamFinished( Ir*);
void slotDeleteButton();
+ void slotSaveButton();
void slotDeleteButtonClicked();
void slotNewButton();
@@ -62,4 +66,6 @@ private slots:
void slotViewEdited();
void slotBoxSelected(const QString &);
+// void keyReleaseEvent( QKeyEvent *);
+
};