summaryrefslogtreecommitdiff
path: root/noncore/apps/qashmoney/memorydialog.cpp
authorallenforsythe <allenforsythe>2003-05-04 22:02:48 (UTC)
committer allenforsythe <allenforsythe>2003-05-04 22:02:48 (UTC)
commit4593e3cf4eca4867e34b3220007c24523cf642b6 (patch) (side-by-side diff)
treebd8071834dec2a5008b1b270c7953f5cfd65754d /noncore/apps/qashmoney/memorydialog.cpp
parent2894d0b14c0b3efa3ce259214b5aa597a6abfed1 (diff)
downloadopie-4593e3cf4eca4867e34b3220007c24523cf642b6.zip
opie-4593e3cf4eca4867e34b3220007c24523cf642b6.tar.gz
opie-4593e3cf4eca4867e34b3220007c24523cf642b6.tar.bz2
Initial revision
Diffstat (limited to 'noncore/apps/qashmoney/memorydialog.cpp') (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/apps/qashmoney/memorydialog.cpp86
1 files changed, 86 insertions, 0 deletions
diff --git a/noncore/apps/qashmoney/memorydialog.cpp b/noncore/apps/qashmoney/memorydialog.cpp
new file mode 100755
index 0000000..e9ebd54
--- a/dev/null
+++ b/noncore/apps/qashmoney/memorydialog.cpp
@@ -0,0 +1,86 @@
+#include "memorydialog.h"
+#include "memory.h"
+#include <qmessagebox.h>
+
+extern Memory *memory;
+
+MemoryDialog::MemoryDialog () : QDialog ( 0, 0, TRUE )
+{
+ setCaption ( tr ( "Edit Memory" ) );
+
+ listbox = new QListBox ( this, "listbox" );
+ memory->displayMemoryItems ( listbox );
+ listbox->clearSelection();
+
+ secondline = new QHBox ( this );
+
+ newbutton = new QPushButton ( secondline );
+ newbutton->setPixmap( QPixmap ("/opt/QtPalmtop/pics/new.png") );
+ connect ( newbutton, SIGNAL ( released () ), this, SLOT ( addItem () ) );
+
+ editbutton = new QPushButton ( secondline );
+ editbutton->setPixmap( QPixmap ("/opt/QtPalmtop/pics/edit.png") );
+ connect ( editbutton, SIGNAL ( released () ), this, SLOT ( editItem () ) );
+
+ deletebutton = new QPushButton( secondline );
+ deletebutton->setPixmap( QPixmap ("/opt/QtPalmtop/pics/delete.png") );
+ connect ( deletebutton, SIGNAL ( released () ), this, SLOT ( deleteItem () ) );
+
+ lineedit = new QLineEdit ( this );
+
+ layout = new QVBoxLayout ( this, 2, 2 );
+ layout->addWidget ( listbox );
+ layout->addWidget ( secondline );
+ layout->addWidget ( lineedit );
+}
+
+MemoryDialog::~MemoryDialog()
+ {
+ }
+
+void MemoryDialog::addItem ()
+ {
+ if ( lineedit->text().length() != 0 )
+ {
+ memory->addMemoryItem ( lineedit->text() );
+ listbox->clear ();
+ memory->displayMemoryItems ( listbox );
+ listbox->clearFocus();
+ listbox->clearSelection ();
+ lineedit->clear();
+ }
+ }
+
+void MemoryDialog::editItem ()
+ {
+ if ( listbox->currentItem() != -1 )
+ {
+ lineedit->setText ( listbox->currentText() );
+ memory->deleteMemoryItem ( listbox->currentText() );
+ listbox->clear ();
+ memory->displayMemoryItems ( listbox );
+ listbox->clearSelection();
+ }
+ else
+ QMessageBox::warning ( this, "QashMoney", "Please select an item to edit." );
+ }
+
+void MemoryDialog::deleteItem ()
+ {
+ if ( listbox->currentItem() != -1 )
+ {
+ memory->deleteMemoryItem ( listbox->currentText() );
+ listbox->clear ();
+ memory->displayMemoryItems ( listbox );
+ listbox->clearSelection();
+ }
+ else
+ QMessageBox::warning ( this, "QashMoney", "Please select an item to delete." );
+ }
+
+
+
+
+
+
+