Diffstat (limited to 'noncore/apps/checkbook/qcheckmainmenu.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/qcheckmainmenu.cpp | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/noncore/apps/checkbook/qcheckmainmenu.cpp b/noncore/apps/checkbook/qcheckmainmenu.cpp deleted file mode 100644 index 2382513..0000000 --- a/noncore/apps/checkbook/qcheckmainmenu.cpp +++ b/dev/null | |||
@@ -1,74 +0,0 @@ | |||
1 | #include "qcheckmainmenu.h" | ||
2 | #include "qcheckname.h" | ||
3 | |||
4 | QCheckMainMenu::QCheckMainMenu(QWidget *parent) | ||
5 | : QCheckMMBase(parent) | ||
6 | { | ||
7 | init(); | ||
8 | } | ||
9 | |||
10 | void QCheckMainMenu::init() | ||
11 | { | ||
12 | lstCheckBooks->clear(); | ||
13 | QString checkdirname = QDir::homeDirPath(); | ||
14 | checkdirname.append("/.checkbooks"); | ||
15 | QDir checkdir(checkdirname); | ||
16 | if (checkdir.exists() == true) | ||
17 | { | ||
18 | QStringList checkbooks = checkdir.entryList("*.qcb", QDir::Files|QDir::Readable|QDir::Writable, QDir::Time); | ||
19 | for (QStringList::Iterator it = checkbooks.begin(); it != checkbooks.end(); it++) | ||
20 | { | ||
21 | (*it) = (*it).remove((*it).find('.'), (*it).length()); | ||
22 | } | ||
23 | lstCheckBooks->insertStringList(checkbooks); | ||
24 | } | ||
25 | lstCheckBooks->clearSelection(); | ||
26 | connect(lstCheckBooks, SIGNAL(clicked(QListBoxItem *)), this, SLOT(slotSelected(QListBoxItem *))); | ||
27 | lstCheckBooks->clearSelection(); | ||
28 | } | ||
29 | |||
30 | void QCheckMainMenu::slotSelected(QListBoxItem *item) | ||
31 | { | ||
32 | if (item != 0) | ||
33 | { | ||
34 | QString text = item->text(); | ||
35 | if (text.isEmpty() == false) | ||
36 | { | ||
37 | text.append(".qcb"); | ||
38 | QString checkdirname = QDir::homeDirPath(); | ||
39 | checkdirname.append("/.checkbooks/"); | ||
40 | text.prepend(checkdirname); | ||
41 | emit itemSelected(text); | ||
42 | } | ||
43 | } | ||
44 | } | ||
45 | |||
46 | void QCheckMainMenu::newClicked() | ||
47 | { | ||
48 | QString checkname = QCheckName::getName(); | ||
49 | if (checkname.isEmpty() == false) | ||
50 | { | ||
51 | QString checkdirname = QDir::homeDirPath(); | ||
52 | checkdirname.append("/.checkbooks"); | ||
53 | QDir checkdir(checkdirname); | ||
54 | if (checkdir.exists() == false) | ||
55 | { | ||
56 | checkdir.mkdir(checkdirname); | ||
57 | } | ||
58 | checkdirname.append("/"); | ||
59 | checkdirname.append(checkname); | ||
60 | checkdirname.append(".qcb"); | ||
61 | QFile file(checkdirname); | ||
62 | if (file.exists() == false) | ||
63 | { | ||
64 | file.open(IO_WriteOnly); | ||
65 | QTextStream os(&file); | ||
66 | os << ""; | ||
67 | file.close(); | ||
68 | } | ||
69 | QFileInfo fi(file); | ||
70 | QString noextension = fi.fileName(); | ||
71 | noextension = noextension.remove(noextension.find('.'), noextension.length()); | ||
72 | lstCheckBooks->insertItem(noextension); | ||
73 | } | ||
74 | } | ||