From a569a96a1dccf036b6b8ca0eb3580ece996bf183 Mon Sep 17 00:00:00 2001 From: Roman Savochenko Date: Wed, 22 Nov 2023 10:13:36 +0200 Subject: Korganizer: Appending anniversary tooltips in the Month View, Improving dialogs of the attachments and categories Signed-off-by: Roman Savochenko --- korganizer/koeditorattachments.cpp | 26 ++++++++------------------ korganizer/komonthview.cpp | 8 +++++--- korganizer/komonthview.h | 6 +++++- libtdepim/categoryeditdialog.cpp | 4 ++++ libtdepim/categoryselectdialog.cpp | 3 +++ libtdepim/kpimprefs.cpp | 2 +- libtdepim/kpimprefs.h | 3 ++- 7 files changed, 28 insertions(+), 24 deletions(-) diff --git a/korganizer/koeditorattachments.cpp b/korganizer/koeditorattachments.cpp index 6f46ac5f1..bf57cb222 100644 --- a/korganizer/koeditorattachments.cpp +++ b/korganizer/koeditorattachments.cpp @@ -79,8 +79,7 @@ class AttachmentListItem : public TDEIconViewItem if ( att ) { mAttachment = new KCal::Attachment( *att ); } else { - mAttachment = new KCal::Attachment( TQChar('\0') ); //use the non-uri constructor - //as we want inline by default + mAttachment = new KCal::Attachment( "" ); } readAttachment(); setDragEnabled( true ); @@ -203,7 +202,7 @@ AttachmentEditDialog::AttachmentEditDialog( AttachmentListItem *item, mInline = new TQCheckBox( i18n( "Store attachment inline" ), topFrame ); grid->addMultiCellWidget( mInline, 3, 3, 0, 2 ); - mInline->setChecked( item->isBinary() ); + mInline->setChecked( item->isBinary() || item->label().isEmpty() ); TQToolTip::add( mInline, i18n( "Store the attachment file inside the calendar" ) ); TQWhatsThis::add( mInline, @@ -214,7 +213,7 @@ AttachmentEditDialog::AttachmentEditDialog( AttachmentListItem *item, "attachments that change often or may be moved (or removed) from " "their current location." ) ); - if ( item->attachment()->isUri() || !item->attachment()->data() ) { + if ( item->attachment()->isUri() || item->label().isEmpty() || !item->attachment()->data() ) { label = new TQLabel( i18n( "Location:" ), topFrame ); grid->addWidget( label, 4, 0 ); mURLRequester = new KURLRequester( item->uri(), topFrame ); @@ -242,21 +241,12 @@ AttachmentEditDialog::AttachmentEditDialog( AttachmentListItem *item, void AttachmentEditDialog::slotApply() { - if ( !mLabelEdit->text().isEmpty() ) { + if ( !mLabelEdit->text().isEmpty() ) mItem->setLabel( mLabelEdit->text() ); - } else { - if ( mURLRequester ) { - KURL url( mURLRequester->url() ); - if ( url.isLocalFile() ) { - mItem->setLabel( url.fileName() ); - } else { - mItem->setLabel( url.url() ); - } - } - } - if ( mItem->label().isEmpty() ) { - mItem->setLabel( i18n( "New attachment" ) ); - } + else if ( mURLRequester && !mURLRequester->url().isEmpty() ) { + KURL url( mURLRequester->url() ); + mItem->setLabel( url.isLocalFile() ? url.fileName() : url.url() ); + } else mItem->setLabel( i18n( "New attachment" ) ); mItem->setMimeType( mMimeType->name() ); if ( mURLRequester ) { KURL url( mURLRequester->url() ); diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 9000361cf..b4921a5ac 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -64,8 +64,9 @@ KOMonthCellToolTip::KOMonthCellToolTip( TQWidget *parent, Calendar *calendar, const TQDate &date, - KNoScrollListBox *lv ) - : TQToolTip( parent ), mCalendar( calendar ), mDate( date ) + KNoScrollListBox *lv, + MonthViewCell* cl ) + : TQToolTip( parent ), mCalendar( calendar ), mDate( date ), cell(cl) { eventlist = lv; } @@ -81,6 +82,7 @@ void KOMonthCellToolTip::maybeTip( const TQPoint &pos ) r=eventlist->itemRect( it ); /* Show the tip */ TQString tipText( IncidenceFormatter::toolTipStr( mCalendar, i->incidence(), mDate ) ); + if(tipText.isEmpty()) tipText = cell->holidayString(); if ( !tipText.isEmpty() ) { tip( r, tipText ); } @@ -438,7 +440,7 @@ void MonthViewCell::setDate( const TQDate &date ) new KOMonthCellToolTip( mItemList->viewport(), monthView()->calendar(), mDate, - static_cast( mItemList ) ); + static_cast( mItemList ), this ); resizeEvent( 0 ); } diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 706a2e9fb..c7537c2fb 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -32,11 +32,12 @@ #include "koeventview.h" class KNoScrollListBox; +class MonthViewCell; class KOMonthCellToolTip : public TQToolTip { public: - KOMonthCellToolTip (TQWidget* parent, Calendar *calendar, const TQDate &date, KNoScrollListBox* lv ); + KOMonthCellToolTip (TQWidget* parent, Calendar *calendar, const TQDate &date, KNoScrollListBox* lv, MonthViewCell* cl); protected: void maybeTip( const TQPoint & pos); @@ -45,6 +46,7 @@ class KOMonthCellToolTip : public TQToolTip Calendar *mCalendar; TQDate mDate; KNoScrollListBox* eventlist; + MonthViewCell* cell; }; @@ -140,6 +142,8 @@ class MonthViewCell : public TQWidget class CreateItemVisitor; MonthViewCell( KOMonthView * ); + TQString holidayString( ) { return mHolidayString; } + /** Sets the date of the cell */ void setDate( const TQDate & ); /** @return Date of cell */ diff --git a/libtdepim/categoryeditdialog.cpp b/libtdepim/categoryeditdialog.cpp index 26abbc070..f4dc38c22 100644 --- a/libtdepim/categoryeditdialog.cpp +++ b/libtdepim/categoryeditdialog.cpp @@ -29,6 +29,7 @@ #include #include "kpimprefs.h" +#include "categoryselectdialog.h" #include "categoryeditdialog.h" @@ -177,6 +178,9 @@ void CategoryEditDialog::slotApply() mPrefs->writeConfig(); emit categoryConfigChanged(); + + if(dynamic_cast(mPrefs->toNotify)) + ((CategorySelectDialog*)mPrefs->toNotify)->updateCategoryConfig(); } void CategoryEditDialog::slotCancel() diff --git a/libtdepim/categoryselectdialog.cpp b/libtdepim/categoryselectdialog.cpp index cf1b2ac6d..b4d9060d7 100644 --- a/libtdepim/categoryselectdialog.cpp +++ b/libtdepim/categoryselectdialog.cpp @@ -48,6 +48,8 @@ CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, TQWidget* parent, TQT_SIGNAL(editCategories()) ); connect( mWidget->mButtonClear, TQT_SIGNAL(clicked()), TQT_SLOT(clear()) ); + + mPrefs->toNotify = this; } void CategorySelectDialog::setCategories( const TQStringList &categoryList ) @@ -69,6 +71,7 @@ void CategorySelectDialog::setCategories( const TQStringList &categoryList ) CategorySelectDialog::~CategorySelectDialog() { + mPrefs->toNotify = NULL; } void CategorySelectDialog::setSelected(const TQStringList &selList) diff --git a/libtdepim/kpimprefs.cpp b/libtdepim/kpimprefs.cpp index d58ca447e..933bd98df 100644 --- a/libtdepim/kpimprefs.cpp +++ b/libtdepim/kpimprefs.cpp @@ -36,7 +36,7 @@ #include "kpimprefs.h" KPimPrefs::KPimPrefs( const TQString &name ) - : TDEConfigSkeleton( name ) + : TDEConfigSkeleton( name ), toNotify(NULL) { } diff --git a/libtdepim/kpimprefs.h b/libtdepim/kpimprefs.h index b67d24916..b3346dad4 100644 --- a/libtdepim/kpimprefs.h +++ b/libtdepim/kpimprefs.h @@ -78,7 +78,8 @@ class KDE_EXPORT KPimPrefs : public TDEConfigSkeleton public: TQStringList mCustomCategories; - + TQObject *toNotify; + protected: virtual void setCategoryDefaults() {} }; -- cgit v1.2.1