author | zautrix <zautrix> | 2004-10-20 11:31:39 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-20 11:31:39 (UTC) |
commit | 07c93af78c721c302a69df475235962ee003d532 (patch) (unidiff) | |
tree | ee87f2d89bbaf4ac7ec502c751718fb2274306aa | |
parent | c45d38a1574bcb53e1b0fd0dc4987cb725d430c0 (diff) | |
download | kdepimpi-07c93af78c721c302a69df475235962ee003d532.zip kdepimpi-07c93af78c721c302a69df475235962ee003d532.tar.gz kdepimpi-07c93af78c721c302a69df475235962ee003d532.tar.bz2 |
fixed categorie dialog access
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle_1.cpp | 10 | ||||
-rw-r--r-- | pwmanager/pwmanager/rencatwnd.cpp | 6 |
2 files changed, 13 insertions, 3 deletions
diff --git a/pwmanager/pwmanager/pwmviewstyle_1.cpp b/pwmanager/pwmanager/pwmviewstyle_1.cpp index a85cece..6b9def3 100644 --- a/pwmanager/pwmanager/pwmviewstyle_1.cpp +++ b/pwmanager/pwmanager/pwmviewstyle_1.cpp | |||
@@ -1,152 +1,162 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2004 by Michael Buesch * | 3 | * copyright (C) 2004 by Michael Buesch * |
4 | * email: mbuesch@freenet.de * | 4 | * email: mbuesch@freenet.de * |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "pwmviewstyle_1.h" | 20 | #include "pwmviewstyle_1.h" |
21 | #include "pwmview.h" | 21 | #include "pwmview.h" |
22 | #include "listviewpwm.h" | 22 | #include "listviewpwm.h" |
23 | #include "commentbox.h" | 23 | #include "commentbox.h" |
24 | 24 | ||
25 | #include <klocale.h> | 25 | #include <klocale.h> |
26 | #include "pwmprefs.h" | 26 | #include "pwmprefs.h" |
27 | 27 | ||
28 | #ifndef DESKTOP_VERSION | ||
29 | #include <qpe/qpeapplication.h> | ||
30 | #else | ||
31 | #include <qapplication.h> | ||
32 | #endif | ||
28 | #define INITIAL_CATEGORIES_WIDTH100 | 33 | #define INITIAL_CATEGORIES_WIDTH100 |
29 | 34 | ||
30 | PwMViewStyle_1::PwMViewStyle_1(PwMView *view) | 35 | PwMViewStyle_1::PwMViewStyle_1(PwMView *view) |
31 | : QObject() | 36 | : QObject() |
32 | { | 37 | { |
33 | #ifndef PWM_EMBEDDED | 38 | #ifndef PWM_EMBEDDED |
34 | splitter = new QSplitter(view); | 39 | splitter = new QSplitter(view); |
35 | #else | 40 | #else |
36 | splitter = new KDGanttMinimizeSplitter( Qt::Horizontal, view); | 41 | splitter = new KDGanttMinimizeSplitter( Qt::Horizontal, view); |
37 | splitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Left ); | 42 | splitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Left ); |
38 | 43 | ||
39 | //US topLayout->addWidget(mMiniSplitter ); | 44 | //US topLayout->addWidget(mMiniSplitter ); |
40 | #endif | 45 | #endif |
41 | 46 | ||
42 | vbox1 = new QVBox(splitter); | 47 | vbox1 = new QVBox(splitter); |
43 | categoriesTitle = new QLabel(vbox1); | 48 | categoriesTitle = new QLabel(vbox1); |
44 | categoriesList = new QListBox(vbox1); | 49 | categoriesList = new QListBox(vbox1); |
45 | #ifndef PWM_EMBEDDED | 50 | #ifndef PWM_EMBEDDED |
46 | splitter2 = new QSplitter(splitter); | 51 | splitter2 = new QSplitter(splitter); |
47 | splitter2->setOrientation(Qt::Vertical); | 52 | splitter2->setOrientation(Qt::Vertical); |
48 | #else | 53 | #else |
49 | splitter2 = new KDGanttMinimizeSplitter( Qt::Vertical, splitter); | 54 | splitter2 = new KDGanttMinimizeSplitter( Qt::Vertical, splitter); |
50 | splitter2->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 55 | splitter2->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
51 | 56 | ||
52 | //US topLayout->addWidget(mMiniSplitter ); | 57 | //US topLayout->addWidget(mMiniSplitter ); |
53 | #endif | 58 | #endif |
54 | lv = new ListViewPwM(splitter2); | 59 | lv = new ListViewPwM(splitter2); |
55 | commentBox = new CommentBox(splitter2); | 60 | commentBox = new CommentBox(splitter2); |
56 | // set sizes and styles | 61 | // set sizes and styles |
57 | //UScommentBox->resize(commentBox->size().width(), 60); | 62 | //UScommentBox->resize(commentBox->size().width(), 60); |
58 | QValueList<int> sizes; | 63 | QValueList<int> sizes; |
59 | #ifndef PWM_EMBEDDED | 64 | #ifndef PWM_EMBEDDED |
60 | sizes.push_back(INITIAL_CATEGORIES_WIDTH); | 65 | sizes.push_back(INITIAL_CATEGORIES_WIDTH); |
61 | sizes.push_back(view->height() - INITIAL_CATEGORIES_WIDTH); | 66 | sizes.push_back(view->height() - INITIAL_CATEGORIES_WIDTH); |
62 | #else | 67 | #else |
63 | sizes.append(INITIAL_CATEGORIES_WIDTH); | 68 | sizes.append(INITIAL_CATEGORIES_WIDTH); |
64 | sizes.append(view->height() - INITIAL_CATEGORIES_WIDTH); | 69 | sizes.append(view->height() - INITIAL_CATEGORIES_WIDTH); |
65 | #endif | 70 | #endif |
66 | //USsplitter->setSizes(sizes); | 71 | //USsplitter->setSizes(sizes); |
67 | categoriesTitle->setAlignment(Qt::AlignHCenter); | 72 | categoriesTitle->setAlignment(Qt::AlignHCenter); |
68 | #ifndef PWM_EMBEDDED | 73 | #ifndef PWM_EMBEDDED |
69 | categoriesTitle->setFrameShape(QFrame::MenuBarPanel); | 74 | categoriesTitle->setFrameShape(QFrame::MenuBarPanel); |
70 | #else | 75 | #else |
71 | categoriesTitle->setFrameShape(QFrame::StyledPanel); | 76 | categoriesTitle->setFrameShape(QFrame::StyledPanel); |
72 | #endif | 77 | #endif |
73 | categoriesTitle->setText(i18n("Categories:")); | 78 | categoriesTitle->setText(i18n("Categories:")); |
74 | catCtxMenu = new QPopupMenu(view); | 79 | catCtxMenu = new QPopupMenu(view); |
75 | catCtxMenu->insertItem(i18n("&Rename"), | 80 | catCtxMenu->insertItem(i18n("&Rename"), |
76 | view, SLOT(renCatButton_slot())); | 81 | view, SLOT(renCatButton_slot())); |
77 | catCtxMenu->insertItem(i18n("&Delete"), | 82 | catCtxMenu->insertItem(i18n("&Delete"), |
78 | view, SLOT(delCatButton_slot())); | 83 | view, SLOT(delCatButton_slot())); |
84 | |||
85 | #ifndef DESKTOP_VERSION | ||
86 | QPEApplication::setStylusOperation( categoriesList->viewport(), QPEApplication::RightOnHold ); | ||
87 | #endif | ||
88 | |||
79 | // connections | 89 | // connections |
80 | connect(categoriesList, SIGNAL(highlighted(int)), | 90 | connect(categoriesList, SIGNAL(highlighted(int)), |
81 | view, SLOT(shiftToView())); | 91 | view, SLOT(shiftToView())); |
82 | connect(categoriesList, | 92 | connect(categoriesList, |
83 | SIGNAL(rightButtonClicked(QListBoxItem *, const QPoint &)), | 93 | SIGNAL(rightButtonClicked(QListBoxItem *, const QPoint &)), |
84 | this, | 94 | this, |
85 | SLOT(catRightClick(QListBoxItem *, const QPoint &))); | 95 | SLOT(catRightClick(QListBoxItem *, const QPoint &))); |
86 | } | 96 | } |
87 | 97 | ||
88 | PwMViewStyle_1::~PwMViewStyle_1() | 98 | PwMViewStyle_1::~PwMViewStyle_1() |
89 | { | 99 | { |
90 | delete catCtxMenu; | 100 | delete catCtxMenu; |
91 | delete splitter; | 101 | delete splitter; |
92 | } | 102 | } |
93 | 103 | ||
94 | void PwMViewStyle_1::catRightClick(QListBoxItem *item, const QPoint &point) | 104 | void PwMViewStyle_1::catRightClick(QListBoxItem *item, const QPoint &point) |
95 | { | 105 | { |
96 | if (!item) | 106 | if (!item) |
97 | return; | 107 | return; |
98 | catCtxMenu->move(point); | 108 | catCtxMenu->move(point); |
99 | catCtxMenu->show(); | 109 | catCtxMenu->show(); |
100 | } | 110 | } |
101 | 111 | ||
102 | void PwMViewStyle_1::delCategory(const QString &cat) | 112 | void PwMViewStyle_1::delCategory(const QString &cat) |
103 | { | 113 | { |
104 | PWM_ASSERT(categoriesList); | 114 | PWM_ASSERT(categoriesList); |
105 | int i, count = categoriesList->count(); | 115 | int i, count = categoriesList->count(); |
106 | for (i = 0; i < count; ++i) { | 116 | for (i = 0; i < count; ++i) { |
107 | if (categoriesList->text(i) == cat) { | 117 | if (categoriesList->text(i) == cat) { |
108 | categoriesList->removeItem(i); | 118 | categoriesList->removeItem(i); |
109 | return; | 119 | return; |
110 | } | 120 | } |
111 | } | 121 | } |
112 | BUG(); | 122 | BUG(); |
113 | } | 123 | } |
114 | 124 | ||
115 | void PwMViewStyle_1::selectCategory(const QString &cat) | 125 | void PwMViewStyle_1::selectCategory(const QString &cat) |
116 | { | 126 | { |
117 | PWM_ASSERT(categoriesList); | 127 | PWM_ASSERT(categoriesList); |
118 | int i, count = categoriesList->count(); | 128 | int i, count = categoriesList->count(); |
119 | for (i = 0; i < count; ++i) { | 129 | for (i = 0; i < count; ++i) { |
120 | if (categoriesList->text(i) == cat) { | 130 | if (categoriesList->text(i) == cat) { |
121 | categoriesList->setCurrentItem(i); | 131 | categoriesList->setCurrentItem(i); |
122 | return; | 132 | return; |
123 | } | 133 | } |
124 | } | 134 | } |
125 | // fall back to 0 | 135 | // fall back to 0 |
126 | categoriesList->setCurrentItem(0); | 136 | categoriesList->setCurrentItem(0); |
127 | } | 137 | } |
128 | 138 | ||
129 | //US ENH: I need a place to load the view dependend settings. Eg. splittersize | 139 | //US ENH: I need a place to load the view dependend settings. Eg. splittersize |
130 | void PwMViewStyle_1::restoreSettings(PWMPrefs* prefs) | 140 | void PwMViewStyle_1::restoreSettings(PWMPrefs* prefs) |
131 | { | 141 | { |
132 | //load and store the size of the listviewcolumns | 142 | //load and store the size of the listviewcolumns |
133 | lv->restoreLayout(prefs->getConfig(), "listview"); | 143 | lv->restoreLayout(prefs->getConfig(), "listview"); |
134 | splitter->setSizes( prefs->mCategorySplitter ); | 144 | splitter->setSizes( prefs->mCategorySplitter ); |
135 | splitter2->setSizes( prefs->mCommentSplitter ); | 145 | splitter2->setSizes( prefs->mCommentSplitter ); |
136 | 146 | ||
137 | } | 147 | } |
138 | 148 | ||
139 | //US ENH: I need a place to load the view dependend settings. Eg. splittersize | 149 | //US ENH: I need a place to load the view dependend settings. Eg. splittersize |
140 | void PwMViewStyle_1::saveSettings(PWMPrefs* prefs) | 150 | void PwMViewStyle_1::saveSettings(PWMPrefs* prefs) |
141 | { | 151 | { |
142 | //store the size of the listviewcolumns | 152 | //store the size of the listviewcolumns |
143 | lv->saveLayout(prefs->getConfig(), "listview"); | 153 | lv->saveLayout(prefs->getConfig(), "listview"); |
144 | prefs->mCategorySplitter = splitter->sizes(); | 154 | prefs->mCategorySplitter = splitter->sizes(); |
145 | prefs->mCommentSplitter = splitter2->sizes(); | 155 | prefs->mCommentSplitter = splitter2->sizes(); |
146 | 156 | ||
147 | } | 157 | } |
148 | 158 | ||
149 | 159 | ||
150 | #ifndef PWM_EMBEDDED | 160 | #ifndef PWM_EMBEDDED |
151 | #include "pwmviewstyle_1.moc" | 161 | #include "pwmviewstyle_1.moc" |
152 | #endif | 162 | #endif |
diff --git a/pwmanager/pwmanager/rencatwnd.cpp b/pwmanager/pwmanager/rencatwnd.cpp index 1e8f9e9..3c4de27 100644 --- a/pwmanager/pwmanager/rencatwnd.cpp +++ b/pwmanager/pwmanager/rencatwnd.cpp | |||
@@ -1,70 +1,70 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2003 by Michael Buesch * | 3 | * copyright (C) 2003 by Michael Buesch * |
4 | * email: mbuesch@freenet.de * | 4 | * email: mbuesch@freenet.de * |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "rencatwnd.h" | 20 | #include "rencatwnd.h" |
21 | 21 | ||
22 | #include <klocale.h> | 22 | #include <klocale.h> |
23 | 23 | ||
24 | 24 | ||
25 | RenCatWnd::RenCatWnd(QWidget *parent, | 25 | RenCatWnd::RenCatWnd(QWidget *parent, |
26 | const char *name, bool modal, WFlags f) | 26 | const char *name, bool modal, WFlags f) |
27 | : QDialog(parent, name, modal, f) | 27 | : QDialog(parent, name, true, f) |
28 | { | 28 | { |
29 | vbox1 = new QVBox(this); | 29 | vbox1 = new QVBox(this); |
30 | label = new QLabel(vbox1); | 30 | label = new QLabel(vbox1); |
31 | newName = new QLineEdit(vbox1); | 31 | newName = new QLineEdit(vbox1); |
32 | hbox1 = new QHBox(vbox1); | 32 | hbox1 = new QHBox(vbox1); |
33 | okButton = new QPushButton(i18n("&Ok"), hbox1); | 33 | okButton = new QPushButton(i18n("&Ok"), hbox1); |
34 | cancelButton = new QPushButton(i18n("&Cancel"), hbox1); | 34 | cancelButton = new QPushButton(i18n("&Cancel"), hbox1); |
35 | 35 | ||
36 | vbox1->setSpacing(10); | 36 | vbox1->setSpacing(10); |
37 | vbox1->setMargin(10); | 37 | vbox1->setMargin(10); |
38 | hbox1->setSpacing(10); | 38 | hbox1->setSpacing(10); |
39 | 39 | ||
40 | resize(400, 100); | 40 | resize(220, 100); |
41 | 41 | ||
42 | setCaption(i18n("rename category")); | 42 | setCaption(i18n("Rename category")); |
43 | label->setText(i18n("New category name:")); | 43 | label->setText(i18n("New category name:")); |
44 | 44 | ||
45 | connect(okButton, SIGNAL(clicked()), this, SLOT(okButton_slot())); | 45 | connect(okButton, SIGNAL(clicked()), this, SLOT(okButton_slot())); |
46 | connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButton_slot())); | 46 | connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButton_slot())); |
47 | } | 47 | } |
48 | 48 | ||
49 | RenCatWnd::~RenCatWnd() | 49 | RenCatWnd::~RenCatWnd() |
50 | { | 50 | { |
51 | } | 51 | } |
52 | 52 | ||
53 | void RenCatWnd::resizeEvent(QResizeEvent *) | 53 | void RenCatWnd::resizeEvent(QResizeEvent *) |
54 | { | 54 | { |
55 | vbox1->resize(size()); | 55 | vbox1->resize(size()); |
56 | } | 56 | } |
57 | 57 | ||
58 | void RenCatWnd::okButton_slot() | 58 | void RenCatWnd::okButton_slot() |
59 | { | 59 | { |
60 | done(1); | 60 | done(1); |
61 | } | 61 | } |
62 | 62 | ||
63 | void RenCatWnd::cancelButton_slot() | 63 | void RenCatWnd::cancelButton_slot() |
64 | { | 64 | { |
65 | done(2); | 65 | done(2); |
66 | } | 66 | } |
67 | 67 | ||
68 | #ifndef PWM_EMBEDDED | 68 | #ifndef PWM_EMBEDDED |
69 | #include "rencatwnd.moc" | 69 | #include "rencatwnd.moc" |
70 | #endif | 70 | #endif |