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.cpp147
1 files changed, 0 insertions, 147 deletions
diff --git a/noncore/apps/checkbook/qcheckbook.cpp b/noncore/apps/checkbook/qcheckbook.cpp
deleted file mode 100644
index bb7a5ac..0000000
--- a/noncore/apps/checkbook/qcheckbook.cpp
+++ b/dev/null
@@ -1,147 +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::close()
95{
96 QApplication::exit();
97}
98
99void QCheckBook::newGraph()
100{
101 if (m_filename.isEmpty() == false)
102 {
103 m_view2 = new QCheckGraph(m_filename);
104 m_view2->showMaximized();
105 }
106}
107
108void QCheckBook::initMainMenus()
109{
110 Config config("qcheckbook");
111 config.setGroup("Global");
112 config.writeEntry("LastCheckBook", QString(""));
113 initMM = true;
114 m_filename = "";
115 if (m_view3 != 0)
116 {
117 delete m_view3;
118 }
119 m_view3 = new QCheckMainMenu(this);
120 m_view3->hide();
121
122 if (initCheck == true)
123 {
124 delete nb2;
125 delete nb3;
126 delete nb4;
127 }
128
129 bar->clear();
130
131 mbar = new QMenuBar(bar);
132 mbar->setMargin(0);
133
134 QPixmap newIcon = Resource::loadPixmap( "new" );
135 nb1 = new QToolButton( newIcon, "New", QString::null, m_view3, SLOT(newClicked()), bar, "new book" );
136
137 popup = new QPopupMenu();
138 popup->insertItem("&New", m_view3, SLOT(newClicked()));
139 popup->insertItem("&Exit", this, SLOT(close()));
140 mbar->insertItem("&File", popup);
141
142 setCentralWidget(m_view3);
143 m_view3->show();
144
145 connect(m_view3, SIGNAL(itemSelected(const QString &)), this, SLOT(newCheck(const QString &)));
146 initCheck = false;
147}