summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-30 11:05:14 (UTC)
committer zautrix <zautrix>2005-06-30 11:05:14 (UTC)
commitb03b54ce54c1391db8979db0df1369e1c68656fa (patch) (side-by-side diff)
treeadf1bb74f5f56cb54a18a2bbfa3bc327e2e32217
parent00e631189f1dca0d596b6ce5816f2fcde9124bd7 (diff)
downloadkdepimpi-b03b54ce54c1391db8979db0df1369e1c68656fa.zip
kdepimpi-b03b54ce54c1391db8979db0df1369e1c68656fa.tar.gz
kdepimpi-b03b54ce54c1391db8979db0df1369e1c68656fa.tar.bz2
fixxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorgeneral.cpp51
-rw-r--r--korganizer/koeditorgeneral.h7
-rw-r--r--korganizer/koprefs.cpp16
-rw-r--r--korganizer/kotodoview.cpp33
4 files changed, 76 insertions, 31 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 915c7ec..50a04ea 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -142,17 +142,56 @@ void KOEditorGeneral::editCategories()
csd->exec();
delete csd;
}
+
+void KOEditorGeneral::showCatPopup()
+{
+ mCatPopup->clear();
+ QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text());
+ int index = 0;
+ for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
+ it != KOPrefs::instance()->mCustomCategories.end ();
+ ++it) {
+ mCatPopup->insertItem (*it, index );
+ //mCategory[index] = *it;
+ if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true);
+ ++index;
+ }
+}
+void KOEditorGeneral::selectedCatPopup( int index )
+{
+ qDebug("i %d c %d ", index, KOPrefs::instance()->mCustomCategories.count());
+ QStringList categories = QStringList::split (",", mCategoriesLabel->text());
+ QString colcat = categories.first();
+ if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ())
+ categories.remove (KOPrefs::instance()->mCustomCategories[index]);
+ else
+ categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]);
+ categories.sort ();
+ if ( !colcat.isEmpty() ) {
+ if ( categories.find ( colcat ) != categories.end () ) {
+ categories.remove( colcat );
+ categories.prepend( colcat );
+ }
+ }
+ mCategoriesLabel->setText( categories.join(",") );
+}
+
void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
{
QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
-
+ mCatPopup = new QPopupMenu ( parent );
+ mCatPopup->setCheckable (true);
+ connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup()));
+ connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int )));
mCategoriesButton = new QPushButton(parent);
- mCategoriesButton->setText(i18n("Categories..."));
- connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
+ mCategoriesButton->setText(i18n("Categories"));
+ //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
categoriesLayout->addWidget(mCategoriesButton);
-
- mCategoriesLabel = new QLabel(parent);
- mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
+ mCategoriesButton->setPopup( mCatPopup );
+ mCategoriesLabel = new QPushButton(parent);//new QLabel(parent);
+ mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
+ connect(mCategoriesLabel,SIGNAL(clicked()),this, SLOT(editCategories() ));
+ //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
categoriesLayout->addWidget(mCategoriesLabel,1);
}
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h
index a8f6443..c463403 100644
--- a/korganizer/koeditorgeneral.h
+++ b/korganizer/koeditorgeneral.h
@@ -27,6 +27,7 @@
#include <qlabel.h>
#include <qcheckbox.h>
#include <qpushbutton.h>
+#include <qpopupmenu.h>
#include <qgroupbox.h>
#include <qlineedit.h>
#include <qcombobox.h>
@@ -82,6 +83,9 @@ class KOEditorGeneral : public QObject
void pickAlarmSound();
void pickAlarmProgram();
void slotSetFocusOn();
+ void showCatPopup();
+ void selectedCatPopup( int );
+
signals:
void openCategoryDialog();
void allAccepted();
@@ -104,9 +108,10 @@ class KOEditorGeneral : public QObject
QComboBox *mSecrecyCombo;
QCheckBox *mCancelBox;
QPushButton *mCategoriesButton;
- QLabel *mCategoriesLabel;
+ QPushButton *mCategoriesLabel;
private:
+ QPopupMenu * mCatPopup;
QString getFittingPath( const QString ) ;
QString mAlarmSound;
QString mAlarmProgram;
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 7ba7269..9db2040 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -391,19 +391,19 @@ QStringList KOPrefs::getLocationDefaultList()
QStringList KOPrefs::getDefaultList()
{
QStringList retval ;
- retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer")
- << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner")
- << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts")
- << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids")
- << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel")
- << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping")
- << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
+ retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Cinema") << i18n("Customer")
+ << i18n("Break")
+ << i18n("Family") << i18n("Favorites") << i18n("Fishing")<< i18n("Flight") << i18n("Gifts")
+ << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Key Customer")
+ << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal")
+ << i18n("PHB") << i18n("Phone Calls") << i18n("School") << i18n("Shopping")
+ << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
<< i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ;
retval.sort();
//qDebug("cat %s ", retval.join("-").latin1());
return retval;
}
-
+// << i18n("Business Travel") << i18n("Education") << i18n("Hiking") << i18n("Hunting") << i18n("Recurring") << i18n("Personal Travel") << i18n("Speach") << i18n("Festival") << i18n("Competition")<< i18n("Party")<< i18n("Projects")<< i18n("Kids") << i18n("Special Occasion")<< i18n("Breakfast")<< i18n("Dinner") << i18n("Lunch")
void KOPrefs::usrReadConfig()
{
config()->setGroup("General");
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 1bfdef9..873a776 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -497,6 +497,7 @@ void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
KOrg::BaseView(calendar,parent,name)
{
+ mCategoryPopupMenu = 0;
mPendingUpdateBeforeRepaint = false;
isFlatDisplay = false;
mNavigator = 0;
@@ -1158,22 +1159,22 @@ void KOTodoView::setNewPercentage(int index)
QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
{
- QPopupMenu* tempMenu = new QPopupMenu (this);
- QStringList checkedCategories = todoItem->todo()->categories ();
-
- tempMenu->setCheckable (true);
- for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
- it != KOPrefs::instance()->mCustomCategories.end ();
- ++it) {
- int index = tempMenu->insertItem (*it);
- mCategory[index] = *it;
- if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true);
- }
-
- connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
- return tempMenu;
-
-
+ if ( !mCategoryPopupMenu ) {
+ mCategoryPopupMenu = new QPopupMenu (this);
+ mCategoryPopupMenu->setCheckable (true);
+ connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
+ }
+ mCategoryPopupMenu->clear();
+ QStringList checkedCategories = todoItem->todo()->categories ();
+
+ for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
+ it != KOPrefs::instance()->mCustomCategories.end ();
+ ++it) {
+ int index = mCategoryPopupMenu->insertItem (*it);
+ mCategory[index] = *it;
+ if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true);
+ }
+ return mCategoryPopupMenu;
}
void KOTodoView::changedCategories(int index)
{