/*************************************************************************** * * * 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_0.h" #include "pwmview.h" #include "listviewpwm.h" #include "commentbox.h" #include #include "pwmprefs.h" PwMViewStyle_0::PwMViewStyle_0(PwMView *view) : QObject() { vbox1 = new QVBox(view); vbox1->setSpacing(3); hbox1 = new QHBox(vbox1); hbox1->setSpacing(3); categoriesTitle = new QLabel(hbox1); categoriesTitle->setText(i18n("Categories:")); categoriesCombo = new QComboBox(hbox1); renCatButton = new QPushButton(i18n("&Rename"), hbox1); delCatButton = new QPushButton(i18n("&Delete"), hbox1); #ifndef PWM_EMBEDDED splitter1 = new QSplitter(vbox1); splitter1->setOrientation(Qt::Vertical); #else splitter1 = new KDGanttMinimizeSplitter( Qt::Vertical, vbox1); splitter1->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); //US topLayout->addWidget(mMiniSplitter ); #endif lv = new ListViewPwM(splitter1); commentBox = new CommentBox(splitter1); // set sizes and styles commentBox->resize(commentBox->size().width(), 60); categoriesTitle->setAlignment(Qt::AlignVCenter | Qt::AlignRight); // connections connect(categoriesCombo, SIGNAL(activated(int)), view, SLOT(shiftToView())); connect(renCatButton, SIGNAL(clicked()), view, SLOT(renCatButton_slot())); connect(delCatButton, SIGNAL(clicked()), view, SLOT(delCatButton_slot())); } PwMViewStyle_0::~PwMViewStyle_0() { delete vbox1; } void PwMViewStyle_0::delCategory(const QString &cat) { PWM_ASSERT(categoriesCombo); int i, count = categoriesCombo->count(); for (i = 0; i < count; ++i) { if (categoriesCombo->text(i) == cat) { categoriesCombo->removeItem(i); return; } } BUG(); } void PwMViewStyle_0::selectCategory(const QString &cat) { PWM_ASSERT(categoriesCombo); int i, count = categoriesCombo->count(); for (i = 0; i < count; ++i) { if (categoriesCombo->text(i) == cat) { categoriesCombo->setCurrentItem(i); return; } } // fall back to 0 categoriesCombo->setCurrentItem(0); } //US ENH: I need a place to load the view dependend settings. Eg. splittersize void PwMViewStyle_0::restoreSettings(PWMPrefs* prefs) { //load and store the size of the listviewcolumns lv->restoreLayout(prefs->getConfig(), "listview"); splitter1->setSizes( prefs->mCommentSplitter ); commentBox->setFont( prefs->mViewFont ); } //US ENH: I need a place to load the view dependend settings. Eg. splittersize void PwMViewStyle_0::saveSettings(PWMPrefs* prefs) { //store the size of the listviewcolumns lv->saveLayout(prefs->getConfig(), "listview"); prefs->mCommentSplitter = splitter1->sizes(); }