summaryrefslogtreecommitdiff
path: root/noncore/apps/checkbook/qcheckbook.cpp
Unidiff
Diffstat (limited to 'noncore/apps/checkbook/qcheckbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/qcheckbook.cpp153
1 files changed, 0 insertions, 153 deletions
diff --git a/noncore/apps/checkbook/qcheckbook.cpp b/noncore/apps/checkbook/qcheckbook.cpp
deleted file mode 100644
index 26caad9..0000000
--- a/noncore/apps/checkbook/qcheckbook.cpp
+++ b/dev/null
@@ -1,153 +0,0 @@
1#include "qcheckbook.h"
2
3#include <qmenubar.h>
4#include <qstatusbar.h>
5#include <qpopupmenu.h>
6#include <qapplication.h>
7#include <qfile.h>
8#include <qdir.h>
9
10QCheckBook::QCheckBook()
11 : QMainWindow(),
12 m_view(),
13 m_view2(),
14 m_view3()
15{
16 initCheck = false;
17 initMM = false;
18 setCaption("Checking");
19 statusBar()->hide();
20 menuBar()->hide();
21
22 bar = new QToolBar(this);
23 bar->setHorizontalStretchable( TRUE );
24
25 addToolBar(bar);
26
27 Config config("qcheckbook");
28 config.setGroup("Global");
29 QString lastCheck = config.readEntry("LastCheckBook", QString(""));
30
31 QString checkdirname = QDir::homeDirPath();
32 checkdirname.append("/.checkbooks/");
33 checkdirname.append(lastCheck);
34 QFile f(checkdirname);
35
36
37 if (lastCheck.isEmpty() == false && lastCheck != "" && f.exists() == true)
38 {
39 newCheck(lastCheck);
40 } else {
41 initMainMenus();
42 }
43
44 setToolBarsMovable( FALSE );
45}
46
47void QCheckBook::newCheck(const QString &filename)
48{
49 if (filename.isEmpty() == false)
50 {
51 initCheck = true;
52 if (m_view != 0)
53 {
54 m_view=0;
55 delete m_view;
56 }
57 m_view = new QCheckView(this, filename);
58 m_view->hide();
59 connect(m_view, SIGNAL(reload(const QString &)), this, SLOT(newCheck(const QString &)));
60 if (initMM == true)
61 {
62 delete nb1;
63 }
64 bar->clear();
65 mbar = new QMenuBar(bar);
66 mbar->setMargin(0);
67
68 QPixmap newIcon = Resource::loadPixmap( "new" );
69 nb2 = new QToolButton( newIcon, "New", QString::null, m_view, SLOT(newClicked()), bar, "new item" );
70 QPixmap pixmap = Resource::loadPixmap( "pixmap" );
71 m_filename = filename;
72 nb3 = new QToolButton( pixmap, "Graph", QString::null, this, SLOT(newGraph()), bar, "new graph" );
73
74 QPixmap closeIcon = Resource::loadPixmap( "close" );
75 nb4 = new QToolButton( closeIcon, "Close", QString::null, this, SLOT(initMainMenus()), bar, "close graph" );
76
77 popup = new QPopupMenu(m_view);
78 popup->insertItem("&New Entry", m_view, SLOT(newClicked()));
79 popup->insertItem("&Graph Checkbook", this, SLOT(newGraph()));
80 popup->insertItem("&Close Checkbook", this, SLOT(initMainMenus()));
81 popup->insertItem("&Exit", this, SLOT(close()));
82 mbar->insertItem("&File", popup);
83
84 setCentralWidget(m_view);
85 m_view->show();
86
87 Config config("qcheckbook");
88 config.setGroup("Global");
89 config.writeEntry("LastCheckBook", filename);
90 initMM = false;
91 }
92}
93
94void QCheckBook::deleteCheck(const QString &filename)
95{
96 qDebug("Deleting "+filename);
97}
98
99void QCheckBook::close()
100{
101 QApplication::exit();
102}
103
104void QCheckBook::newGraph()
105{
106 if (m_filename.isEmpty() == false)
107 {
108 m_view2 = new QCheckGraph(m_filename);
109 m_view2->showMaximized();
110 }
111}
112
113void QCheckBook::initMainMenus()
114{
115 Config config("qcheckbook");
116 config.setGroup("Global");
117 config.writeEntry("LastCheckBook", QString(""));
118 initMM = true;
119 m_filename = "";
120 if (m_view3 != 0)
121 {
122 delete m_view3;
123 }
124 m_view3 = new QCheckMainMenu(this);
125 m_view3->hide();
126
127 if (initCheck == true)
128 {
129 delete nb2;
130 delete nb3;
131 delete nb4;
132 }
133
134 bar->clear();
135
136 mbar = new QMenuBar(bar);
137 mbar->setMargin(0);
138
139 QPixmap newIcon = Resource::loadPixmap( "new" );
140 nb1 = new QToolButton( newIcon, "New", QString::null, m_view3, SLOT(newClicked()), bar, "new book" );
141
142 popup = new QPopupMenu();
143 popup->insertItem("&New", m_view3, SLOT(newClicked()));
144 popup->insertItem("&Delete", m_view3, SLOT(deleteClicked()));
145 popup->insertItem("&Exit", this, SLOT(close()));
146 mbar->insertItem("&File", popup);
147
148 setCentralWidget(m_view3);
149 m_view3->show();
150
151 connect(m_view3, SIGNAL(itemSelected(const QString &)), this, SLOT(newCheck(const QString &)));
152 initCheck = false;
153}