summaryrefslogtreecommitdiffabout
path: root/pwmanager
authorzautrix <zautrix>2004-10-20 11:31:39 (UTC)
committer zautrix <zautrix>2004-10-20 11:31:39 (UTC)
commit07c93af78c721c302a69df475235962ee003d532 (patch) (side-by-side diff)
treeee87f2d89bbaf4ac7ec502c751718fb2274306aa /pwmanager
parentc45d38a1574bcb53e1b0fd0dc4987cb725d430c0 (diff)
downloadkdepimpi-07c93af78c721c302a69df475235962ee003d532.zip
kdepimpi-07c93af78c721c302a69df475235962ee003d532.tar.gz
kdepimpi-07c93af78c721c302a69df475235962ee003d532.tar.bz2
fixed categorie dialog access
Diffstat (limited to 'pwmanager') (more/less context) (show whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwmviewstyle_1.cpp10
-rw-r--r--pwmanager/pwmanager/rencatwnd.cpp6
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 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "pwmviewstyle_1.h"
#include "pwmview.h"
#include "listviewpwm.h"
#include "commentbox.h"
#include <klocale.h>
#include "pwmprefs.h"
+#ifndef DESKTOP_VERSION
+#include <qpe/qpeapplication.h>
+#else
+#include <qapplication.h>
+#endif
#define INITIAL_CATEGORIES_WIDTH 100
PwMViewStyle_1::PwMViewStyle_1(PwMView *view)
: QObject()
{
#ifndef PWM_EMBEDDED
splitter = new QSplitter(view);
#else
splitter = new KDGanttMinimizeSplitter( Qt::Horizontal, view);
splitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Left );
//US topLayout->addWidget(mMiniSplitter );
#endif
vbox1 = new QVBox(splitter);
categoriesTitle = new QLabel(vbox1);
categoriesList = new QListBox(vbox1);
#ifndef PWM_EMBEDDED
splitter2 = new QSplitter(splitter);
splitter2->setOrientation(Qt::Vertical);
#else
splitter2 = new KDGanttMinimizeSplitter( Qt::Vertical, splitter);
splitter2->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
//US topLayout->addWidget(mMiniSplitter );
#endif
lv = new ListViewPwM(splitter2);
commentBox = new CommentBox(splitter2);
// set sizes and styles
//US commentBox->resize(commentBox->size().width(), 60);
QValueList<int> sizes;
#ifndef PWM_EMBEDDED
sizes.push_back(INITIAL_CATEGORIES_WIDTH);
sizes.push_back(view->height() - INITIAL_CATEGORIES_WIDTH);
#else
sizes.append(INITIAL_CATEGORIES_WIDTH);
sizes.append(view->height() - INITIAL_CATEGORIES_WIDTH);
#endif
//US splitter->setSizes(sizes);
categoriesTitle->setAlignment(Qt::AlignHCenter);
#ifndef PWM_EMBEDDED
categoriesTitle->setFrameShape(QFrame::MenuBarPanel);
#else
categoriesTitle->setFrameShape(QFrame::StyledPanel);
#endif
categoriesTitle->setText(i18n("Categories:"));
catCtxMenu = new QPopupMenu(view);
catCtxMenu->insertItem(i18n("&Rename"),
view, SLOT(renCatButton_slot()));
catCtxMenu->insertItem(i18n("&Delete"),
view, SLOT(delCatButton_slot()));
+
+#ifndef DESKTOP_VERSION
+ QPEApplication::setStylusOperation( categoriesList->viewport(), QPEApplication::RightOnHold );
+#endif
+
// connections
connect(categoriesList, SIGNAL(highlighted(int)),
view, SLOT(shiftToView()));
connect(categoriesList,
SIGNAL(rightButtonClicked(QListBoxItem *, const QPoint &)),
this,
SLOT(catRightClick(QListBoxItem *, const QPoint &)));
}
PwMViewStyle_1::~PwMViewStyle_1()
{
delete catCtxMenu;
delete splitter;
}
void PwMViewStyle_1::catRightClick(QListBoxItem *item, const QPoint &point)
{
if (!item)
return;
catCtxMenu->move(point);
catCtxMenu->show();
}
void PwMViewStyle_1::delCategory(const QString &cat)
{
PWM_ASSERT(categoriesList);
int i, count = categoriesList->count();
for (i = 0; i < count; ++i) {
if (categoriesList->text(i) == cat) {
categoriesList->removeItem(i);
return;
}
}
BUG();
}
void PwMViewStyle_1::selectCategory(const QString &cat)
{
PWM_ASSERT(categoriesList);
int i, count = categoriesList->count();
for (i = 0; i < count; ++i) {
if (categoriesList->text(i) == cat) {
categoriesList->setCurrentItem(i);
return;
}
}
// fall back to 0
categoriesList->setCurrentItem(0);
}
//US ENH: I need a place to load the view dependend settings. Eg. splittersize
void PwMViewStyle_1::restoreSettings(PWMPrefs* prefs)
{
//load and store the size of the listviewcolumns
lv->restoreLayout(prefs->getConfig(), "listview");
splitter->setSizes( prefs->mCategorySplitter );
splitter2->setSizes( prefs->mCommentSplitter );
}
//US ENH: I need a place to load the view dependend settings. Eg. splittersize
void PwMViewStyle_1::saveSettings(PWMPrefs* prefs)
{
//store the size of the listviewcolumns
lv->saveLayout(prefs->getConfig(), "listview");
prefs->mCategorySplitter = splitter->sizes();
prefs->mCommentSplitter = splitter2->sizes();
}
#ifndef PWM_EMBEDDED
#include "pwmviewstyle_1.moc"
#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 @@
/***************************************************************************
* *
* copyright (C) 2003 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "rencatwnd.h"
#include <klocale.h>
RenCatWnd::RenCatWnd(QWidget *parent,
const char *name, bool modal, WFlags f)
- : QDialog(parent, name, modal, f)
+ : QDialog(parent, name, true, f)
{
vbox1 = new QVBox(this);
label = new QLabel(vbox1);
newName = new QLineEdit(vbox1);
hbox1 = new QHBox(vbox1);
okButton = new QPushButton(i18n("&Ok"), hbox1);
cancelButton = new QPushButton(i18n("&Cancel"), hbox1);
vbox1->setSpacing(10);
vbox1->setMargin(10);
hbox1->setSpacing(10);
- resize(400, 100);
+ resize(220, 100);
- setCaption(i18n("rename category"));
+ setCaption(i18n("Rename category"));
label->setText(i18n("New category name:"));
connect(okButton, SIGNAL(clicked()), this, SLOT(okButton_slot()));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButton_slot()));
}
RenCatWnd::~RenCatWnd()
{
}
void RenCatWnd::resizeEvent(QResizeEvent *)
{
vbox1->resize(size());
}
void RenCatWnd::okButton_slot()
{
done(1);
}
void RenCatWnd::cancelButton_slot()
{
done(2);
}
#ifndef PWM_EMBEDDED
#include "rencatwnd.moc"
#endif