Diffstat (limited to 'korganizer/koeditorgeneral.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeditorgeneral.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index 50a04ea..5c94f62 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp @@ -114,111 +114,110 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) headerLayout->addWidget(mLocationEdit,2,1); headerLayout->setColStretch( 1, 10); } } void KOEditorGeneral::setFocusOn( int i ) { mNextFocus = i; QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); } void KOEditorGeneral::slotSetFocusOn() { mNextFocus; if ( mNextFocus == 1 ) { mDescriptionEdit->setFocus(); mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); } if ( mNextFocus == 2 ) { mSummaryEdit->setFocus(); } } void KOEditorGeneral::editCategories() { // qDebug("KOEditorGeneral::editCategories() "); KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); //KOGlobals::fitDialogToScreen( csd ); csd->setColorEnabled(); csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); 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(",") ); + setCategories( 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() )); categoriesLayout->addWidget(mCategoriesButton); 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); } void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) { QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); secrecyLayout->addWidget(mCancelBox); secrecyLayout->addWidget(secrecyLabel); mSecrecyCombo = new QComboBox(parent); mSecrecyCombo->insertStringList(Incidence::secrecyList()); secrecyLayout->addWidget(mSecrecyCombo); } void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) { mDescriptionEdit = new KTextEdit(parent); mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); mDescriptionEdit->append(""); mDescriptionEdit->setReadOnly(false); mDescriptionEdit->setOverwriteMode(false); mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); topLayout->addWidget(mDescriptionEdit); #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); #endif @@ -353,96 +352,98 @@ QString KOEditorGeneral::getFittingPath( const QString s ) void KOEditorGeneral::enableAlarmEdit(bool enable) { if ( enable ) { if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { mAlarmSoundButton->setOn( true ); if ( mAlarmSound.isEmpty() ) mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; else { if ( ! QFile::exists( mAlarmSound ) ) mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; } } } ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); mAlarmTimeEdit->setEnabled(enable); mAlarmSoundButton->setEnabled(enable); mAlarmProgramButton->setEnabled(enable); mAlarmIncrCombo->setEnabled(enable); } void KOEditorGeneral::disableAlarmEdit(bool disable) { enableAlarmEdit( !disable ); } void KOEditorGeneral::enableAlarm( bool enable ) { enableAlarmEdit( enable ); } void KOEditorGeneral::alarmDisable(bool disable) { if (!disable) { //mAlarmBell->setEnabled(true); mAlarmButton->setEnabled(true); } else { //mAlarmBell->setEnabled(false); mAlarmButton->setEnabled(false); mAlarmButton->setChecked(false); mAlarmTimeEdit->setEnabled(false); mAlarmSoundButton->setEnabled(false); mAlarmProgramButton->setEnabled(false); mAlarmIncrCombo->setEnabled(false); } } void KOEditorGeneral::setCategories(const QString &str) { + QString tt = str; + QToolTip::add( mCategoriesLabel, i18n("<b>Click here to edit categories: </b>") +"<em>"+tt.replace( QRegExp(","),", ")+"</em>"); mCategoriesLabel->setText(str); } void KOEditorGeneral::setDefaults(bool allDay) { #if 0 mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); #endif mAlarmMessage = i18n("Edit new item"); enableAlarmEdit( !allDay ); // TODO: Implement a KPrefsComboItem to solve this in a clean way. int alarmTime; int a[] = { 1,5,10,15,30,60,180, 1440 }; int index = KOPrefs::instance()->mAlarmTime; if (index < 0 || index > 7) { alarmTime = 15; } else { alarmTime = a[index]; } mAlarmButton ->setChecked( false ); mAlarmTimeEdit->setValue(alarmTime); mAlarmIncrCombo->setCurrentItem(0); enableAlarmEdit( false ); //alarmDisable (false); mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); mCancelBox->setChecked( false ); mSummaryEdit->setEditText(""); mLocationEdit->setEditText(""); mDescriptionEdit->setText(""); mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; setCategories(""); } void KOEditorGeneral::setSecrecy( int num ) { mSecrecyCombo->setCurrentItem(num); } void KOEditorGeneral::readIncidence(Incidence *event) { mAlarmMessage = event->summary(); if ( ! event->location().isEmpty() ) mAlarmMessage += " ("+event->location()+")"; mAlarmIncrCombo->setCurrentItem(0); mSummaryEdit->setEditText(event->summary()); mLocationEdit->setEditText(event->location()); mDescriptionEdit->setText(event->description()); |