author | llornkcor <llornkcor> | 2002-10-20 14:04:56 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-10-20 14:04:56 (UTC) |
commit | b915686dd38e99df72db332e1ea0b12a0895bdb3 (patch) (unidiff) | |
tree | ac5590b057da22eadc96e44eafad7f4dd27688a5 | |
parent | 6924185b50abfa448daa16a9f7cb6e532ec77ff9 (diff) | |
download | opie-b915686dd38e99df72db332e1ea0b12a0895bdb3.zip opie-b915686dd38e99df72db332e1ea0b12a0895bdb3.tar.gz opie-b915686dd38e99df72db332e1ea0b12a0895bdb3.tar.bz2 |
added ability to delete checkbook account
-rw-r--r-- | noncore/apps/checkbook/checkbook.pro | 3 | ||||
-rw-r--r-- | noncore/apps/checkbook/qcheckbook.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/checkbook/qcheckbook.h | 1 | ||||
-rw-r--r-- | noncore/apps/checkbook/qcheckmainmenu.cpp | 31 | ||||
-rw-r--r-- | noncore/apps/checkbook/qcheckmainmenu.h | 1 | ||||
-rw-r--r-- | noncore/apps/checkbook/qchecknamebase.cpp | 81 | ||||
-rw-r--r-- | noncore/apps/checkbook/qchecknamebase.h | 38 |
7 files changed, 160 insertions, 1 deletions
diff --git a/noncore/apps/checkbook/checkbook.pro b/noncore/apps/checkbook/checkbook.pro index e9e2167..cf78739 100644 --- a/noncore/apps/checkbook/checkbook.pro +++ b/noncore/apps/checkbook/checkbook.pro | |||
@@ -8,6 +8,7 @@ HEADERS = config.h \ | |||
8 | qcheckmainmenu.h \ | 8 | qcheckmainmenu.h \ |
9 | qcheckname.h \ | 9 | qcheckname.h \ |
10 | qcheckview.h \ | 10 | qcheckview.h \ |
11 | qchecknamebase.h \ | ||
11 | qrestrictedcombo.h \ | 12 | qrestrictedcombo.h \ |
12 | qrestrictedline.h | 13 | qrestrictedline.h |
13 | SOURCES = config.cpp \ | 14 | SOURCES = config.cpp \ |
@@ -20,12 +21,12 @@ SOURCES = config.cpp \ | |||
20 | qcheckname.cpp \ | 21 | qcheckname.cpp \ |
21 | qcheckview.cpp \ | 22 | qcheckview.cpp \ |
22 | qrestrictedcombo.cpp \ | 23 | qrestrictedcombo.cpp \ |
24 | qchecknamebase.cpp \ | ||
23 | qrestrictedline.cpp | 25 | qrestrictedline.cpp |
24 | INTERFACES= qcheckdetailsbase.ui \ | 26 | INTERFACES= qcheckdetailsbase.ui \ |
25 | qcheckentrybase.ui \ | 27 | qcheckentrybase.ui \ |
26 | qcheckgraphbase.ui \ | 28 | qcheckgraphbase.ui \ |
27 | qcheckmmbase.ui \ | 29 | qcheckmmbase.ui \ |
28 | qchecknamebase.ui \ | ||
29 | qcheckviewbase.ui | 30 | qcheckviewbase.ui |
30 | INCLUDEPATH += $(OPIEDIR)/include | 31 | INCLUDEPATH += $(OPIEDIR)/include |
31 | DEPENDPATH += $(OPIEDIR)/include | 32 | DEPENDPATH += $(OPIEDIR)/include |
diff --git a/noncore/apps/checkbook/qcheckbook.cpp b/noncore/apps/checkbook/qcheckbook.cpp index bb7a5ac..26caad9 100644 --- a/noncore/apps/checkbook/qcheckbook.cpp +++ b/noncore/apps/checkbook/qcheckbook.cpp | |||
@@ -91,6 +91,11 @@ void QCheckBook::newCheck(const QString &filename) | |||
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
94 | void QCheckBook::deleteCheck(const QString &filename) | ||
95 | { | ||
96 | qDebug("Deleting "+filename); | ||
97 | } | ||
98 | |||
94 | void QCheckBook::close() | 99 | void QCheckBook::close() |
95 | { | 100 | { |
96 | QApplication::exit(); | 101 | QApplication::exit(); |
@@ -136,6 +141,7 @@ void QCheckBook::initMainMenus() | |||
136 | 141 | ||
137 | popup = new QPopupMenu(); | 142 | popup = new QPopupMenu(); |
138 | popup->insertItem("&New", m_view3, SLOT(newClicked())); | 143 | popup->insertItem("&New", m_view3, SLOT(newClicked())); |
144 | popup->insertItem("&Delete", m_view3, SLOT(deleteClicked())); | ||
139 | popup->insertItem("&Exit", this, SLOT(close())); | 145 | popup->insertItem("&Exit", this, SLOT(close())); |
140 | mbar->insertItem("&File", popup); | 146 | mbar->insertItem("&File", popup); |
141 | 147 | ||
diff --git a/noncore/apps/checkbook/qcheckbook.h b/noncore/apps/checkbook/qcheckbook.h index 52c0d40..64b6628 100644 --- a/noncore/apps/checkbook/qcheckbook.h +++ b/noncore/apps/checkbook/qcheckbook.h | |||
@@ -16,6 +16,7 @@ class QCheckBook : public QMainWindow | |||
16 | QCheckBook(); | 16 | QCheckBook(); |
17 | private slots: | 17 | private slots: |
18 | void newCheck(const QString &filename); | 18 | void newCheck(const QString &filename); |
19 | void deleteCheck(const QString &filename); | ||
19 | void newGraph(); | 20 | void newGraph(); |
20 | void close(); | 21 | void close(); |
21 | void initMainMenus(); | 22 | void initMainMenus(); |
diff --git a/noncore/apps/checkbook/qcheckmainmenu.cpp b/noncore/apps/checkbook/qcheckmainmenu.cpp index 2382513..1aead88 100644 --- a/noncore/apps/checkbook/qcheckmainmenu.cpp +++ b/noncore/apps/checkbook/qcheckmainmenu.cpp | |||
@@ -72,3 +72,34 @@ void QCheckMainMenu::newClicked() | |||
72 | lstCheckBooks->insertItem(noextension); | 72 | lstCheckBooks->insertItem(noextension); |
73 | } | 73 | } |
74 | } | 74 | } |
75 | |||
76 | void QCheckMainMenu::deleteClicked() | ||
77 | { | ||
78 | QString checkname = lstCheckBooks->currentText(); | ||
79 | if (checkname.isEmpty() == false) { | ||
80 | switch ( QMessageBox::warning(this,tr("Delete Account"),tr("Really delete the\n") | ||
81 | +checkname+tr(" account?") | ||
82 | ,tr("Yes"),tr("No"),0,1,1) ) { | ||
83 | case 0: { | ||
84 | |||
85 | QString checkdirname = QDir::homeDirPath(); | ||
86 | checkdirname.append("/.checkbooks"); | ||
87 | QDir checkdir(checkdirname); | ||
88 | QString checkDir=checkdirname; | ||
89 | |||
90 | checkdirname.append("/"); | ||
91 | checkdirname.append(checkname); | ||
92 | checkdirname.append(".qcb"); | ||
93 | QFile file(checkdirname); | ||
94 | if (file.exists() == true) { | ||
95 | if(!file.remove()) { | ||
96 | QMessageBox::message(tr("Checkbook"),tr("Could not remove account")); | ||
97 | return; | ||
98 | } else | ||
99 | lstCheckBooks->removeItem(lstCheckBooks->currentItem()); | ||
100 | } | ||
101 | } | ||
102 | break; | ||
103 | } | ||
104 | } | ||
105 | } | ||
diff --git a/noncore/apps/checkbook/qcheckmainmenu.h b/noncore/apps/checkbook/qcheckmainmenu.h index 456d3df..24d601b 100644 --- a/noncore/apps/checkbook/qcheckmainmenu.h +++ b/noncore/apps/checkbook/qcheckmainmenu.h | |||
@@ -23,5 +23,6 @@ class QCheckMainMenu : public QCheckMMBase | |||
23 | void slotSelected(QListBoxItem *); | 23 | void slotSelected(QListBoxItem *); |
24 | public slots: | 24 | public slots: |
25 | void newClicked(); | 25 | void newClicked(); |
26 | void deleteClicked(); | ||
26 | }; | 27 | }; |
27 | 28 | ||
diff --git a/noncore/apps/checkbook/qchecknamebase.cpp b/noncore/apps/checkbook/qchecknamebase.cpp new file mode 100644 index 0000000..27bebc1 --- a/dev/null +++ b/noncore/apps/checkbook/qchecknamebase.cpp | |||
@@ -0,0 +1,81 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form implementation generated from reading ui file 'qchecknamebase.ui' | ||
3 | ** | ||
4 | ** Created: Wed Sep 18 09:40:57 2002 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #include "qchecknamebase.h" | ||
10 | |||
11 | #include <qlabel.h> | ||
12 | #include <qpushbutton.h> | ||
13 | #include "qrestrictedline.h" | ||
14 | #include <qlayout.h> | ||
15 | #include <qvariant.h> | ||
16 | #include <qtooltip.h> | ||
17 | #include <qwhatsthis.h> | ||
18 | |||
19 | /* | ||
20 | * Constructs a QCheckNameBase which is a child of 'parent', with the | ||
21 | * name 'name' and widget flags set to 'f' | ||
22 | * | ||
23 | * The dialog will by default be modeless, unless you set 'modal' to | ||
24 | * TRUE to construct a modal dialog. | ||
25 | */ | ||
26 | QCheckNameBase::QCheckNameBase( QWidget* parent, const char* name, bool modal, WFlags fl ) | ||
27 | : QDialog( parent, name, modal, fl ) | ||
28 | { | ||
29 | if ( !name ) | ||
30 | setName( "QCheckNameBase" ); | ||
31 | resize( 228, 108 ); | ||
32 | setCaption( tr( "Check Book Name" ) ); | ||
33 | |||
34 | TextLabel3 = new QLabel( this, "TextLabel3" ); | ||
35 | TextLabel3->setGeometry( QRect( 10, 5, 70, 16 ) ); | ||
36 | QFont TextLabel3_font( TextLabel3->font() ); | ||
37 | TextLabel3_font.setFamily( "BDF-helvetica" ); | ||
38 | TextLabel3_font.setPointSize( 19 ); | ||
39 | TextLabel3_font.setBold( TRUE ); | ||
40 | TextLabel3->setFont( TextLabel3_font ); | ||
41 | TextLabel3->setText( tr( "Name..." ) ); | ||
42 | |||
43 | TextLabel4 = new QLabel( this, "TextLabel4" ); | ||
44 | TextLabel4->setGeometry( QRect( 10, 25, 210, 25 ) ); | ||
45 | TextLabel4->setText( tr( "Please name your check book.\n(limit: 15 characters):" ) ); | ||
46 | TextLabel4->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) ); | ||
47 | |||
48 | cmdDone = new QPushButton( this, "cmdDone" ); | ||
49 | cmdDone->setGeometry( QRect( 75, 80, 75, 25 ) ); | ||
50 | cmdDone->setText( tr( "&Done" ) ); | ||
51 | |||
52 | leText = new QRestrictedLine( this, "leText" ); | ||
53 | leText->setGeometry( QRect( 5, 51, 216, 25 ) ); | ||
54 | leText->setFocus(); | ||
55 | } | ||
56 | |||
57 | /* | ||
58 | * Destroys the object and frees any allocated resources | ||
59 | */ | ||
60 | QCheckNameBase::~QCheckNameBase() | ||
61 | { | ||
62 | // no need to delete child widgets, Qt does it all for us | ||
63 | } | ||
64 | |||
65 | /* | ||
66 | * Main event handler. Reimplemented to handle application | ||
67 | * font changes | ||
68 | */ | ||
69 | bool QCheckNameBase::event( QEvent* ev ) | ||
70 | { | ||
71 | bool ret = QDialog::event( ev ); | ||
72 | if ( ev->type() == QEvent::ApplicationFontChange ) { | ||
73 | QFont TextLabel3_font( TextLabel3->font() ); | ||
74 | TextLabel3_font.setFamily( "BDF-helvetica" ); | ||
75 | TextLabel3_font.setPointSize( 19 ); | ||
76 | TextLabel3_font.setBold( TRUE ); | ||
77 | TextLabel3->setFont( TextLabel3_font ); | ||
78 | } | ||
79 | return ret; | ||
80 | } | ||
81 | |||
diff --git a/noncore/apps/checkbook/qchecknamebase.h b/noncore/apps/checkbook/qchecknamebase.h new file mode 100644 index 0000000..864ecd6 --- a/dev/null +++ b/noncore/apps/checkbook/qchecknamebase.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form interface generated from reading ui file 'qchecknamebase.ui' | ||
3 | ** | ||
4 | ** Created: Wed Sep 18 09:40:11 2002 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #ifndef QCHECKNAMEBASE_H | ||
10 | #define QCHECKNAMEBASE_H | ||
11 | |||
12 | #include <qvariant.h> | ||
13 | #include <qdialog.h> | ||
14 | class QVBoxLayout; | ||
15 | class QHBoxLayout; | ||
16 | class QGridLayout; | ||
17 | class QLabel; | ||
18 | class QPushButton; | ||
19 | class QRestrictedLine; | ||
20 | |||
21 | class QCheckNameBase : public QDialog | ||
22 | { | ||
23 | Q_OBJECT | ||
24 | |||
25 | public: | ||
26 | QCheckNameBase( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | ||
27 | ~QCheckNameBase(); | ||
28 | |||
29 | QLabel* TextLabel3; | ||
30 | QLabel* TextLabel4; | ||
31 | QPushButton* cmdDone; | ||
32 | QRestrictedLine* leText; | ||
33 | |||
34 | protected: | ||
35 | bool event( QEvent* ); | ||
36 | }; | ||
37 | |||
38 | #endif // QCHECKNAMEBASE_H | ||