Korganizer: Appending anniversary tooltips in the Month View, Improving dialogs of the attachments and categories

Signed-off-by: Roman Savochenko <roman@home.home>
feat/korganizer
Roman Savochenko 7 months ago
parent d470e73134
commit a569a96a1d

@ -79,8 +79,7 @@ class AttachmentListItem : public TDEIconViewItem
if ( att ) { if ( att ) {
mAttachment = new KCal::Attachment( *att ); mAttachment = new KCal::Attachment( *att );
} else { } else {
mAttachment = new KCal::Attachment( TQChar('\0') ); //use the non-uri constructor mAttachment = new KCal::Attachment( "" );
//as we want inline by default
} }
readAttachment(); readAttachment();
setDragEnabled( true ); setDragEnabled( true );
@ -203,7 +202,7 @@ AttachmentEditDialog::AttachmentEditDialog( AttachmentListItem *item,
mInline = new TQCheckBox( i18n( "Store attachment inline" ), topFrame ); mInline = new TQCheckBox( i18n( "Store attachment inline" ), topFrame );
grid->addMultiCellWidget( mInline, 3, 3, 0, 2 ); 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" ) ); TQToolTip::add( mInline, i18n( "Store the attachment file inside the calendar" ) );
TQWhatsThis::add( TQWhatsThis::add(
mInline, mInline,
@ -214,7 +213,7 @@ AttachmentEditDialog::AttachmentEditDialog( AttachmentListItem *item,
"attachments that change often or may be moved (or removed) from " "attachments that change often or may be moved (or removed) from "
"their current location." ) ); "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 ); label = new TQLabel( i18n( "Location:" ), topFrame );
grid->addWidget( label, 4, 0 ); grid->addWidget( label, 4, 0 );
mURLRequester = new KURLRequester( item->uri(), topFrame ); mURLRequester = new KURLRequester( item->uri(), topFrame );
@ -242,21 +241,12 @@ AttachmentEditDialog::AttachmentEditDialog( AttachmentListItem *item,
void AttachmentEditDialog::slotApply() void AttachmentEditDialog::slotApply()
{ {
if ( !mLabelEdit->text().isEmpty() ) { if ( !mLabelEdit->text().isEmpty() )
mItem->setLabel( mLabelEdit->text() ); mItem->setLabel( mLabelEdit->text() );
} else { else if ( mURLRequester && !mURLRequester->url().isEmpty() ) {
if ( mURLRequester ) { KURL url( mURLRequester->url() );
KURL url( mURLRequester->url() ); mItem->setLabel( url.isLocalFile() ? url.fileName() : url.url() );
if ( url.isLocalFile() ) { } else mItem->setLabel( i18n( "New attachment" ) );
mItem->setLabel( url.fileName() );
} else {
mItem->setLabel( url.url() );
}
}
}
if ( mItem->label().isEmpty() ) {
mItem->setLabel( i18n( "New attachment" ) );
}
mItem->setMimeType( mMimeType->name() ); mItem->setMimeType( mMimeType->name() );
if ( mURLRequester ) { if ( mURLRequester ) {
KURL url( mURLRequester->url() ); KURL url( mURLRequester->url() );

@ -64,8 +64,9 @@
KOMonthCellToolTip::KOMonthCellToolTip( TQWidget *parent, KOMonthCellToolTip::KOMonthCellToolTip( TQWidget *parent,
Calendar *calendar, Calendar *calendar,
const TQDate &date, const TQDate &date,
KNoScrollListBox *lv ) KNoScrollListBox *lv,
: TQToolTip( parent ), mCalendar( calendar ), mDate( date ) MonthViewCell* cl )
: TQToolTip( parent ), mCalendar( calendar ), mDate( date ), cell(cl)
{ {
eventlist = lv; eventlist = lv;
} }
@ -81,6 +82,7 @@ void KOMonthCellToolTip::maybeTip( const TQPoint &pos )
r=eventlist->itemRect( it ); r=eventlist->itemRect( it );
/* Show the tip */ /* Show the tip */
TQString tipText( IncidenceFormatter::toolTipStr( mCalendar, i->incidence(), mDate ) ); TQString tipText( IncidenceFormatter::toolTipStr( mCalendar, i->incidence(), mDate ) );
if(tipText.isEmpty()) tipText = cell->holidayString();
if ( !tipText.isEmpty() ) { if ( !tipText.isEmpty() ) {
tip( r, tipText ); tip( r, tipText );
} }
@ -438,7 +440,7 @@ void MonthViewCell::setDate( const TQDate &date )
new KOMonthCellToolTip( mItemList->viewport(), new KOMonthCellToolTip( mItemList->viewport(),
monthView()->calendar(), monthView()->calendar(),
mDate, mDate,
static_cast<KNoScrollListBox *>( mItemList ) ); static_cast<KNoScrollListBox *>( mItemList ), this );
resizeEvent( 0 ); resizeEvent( 0 );
} }

@ -32,11 +32,12 @@
#include "koeventview.h" #include "koeventview.h"
class KNoScrollListBox; class KNoScrollListBox;
class MonthViewCell;
class KOMonthCellToolTip : public TQToolTip class KOMonthCellToolTip : public TQToolTip
{ {
public: public:
KOMonthCellToolTip (TQWidget* parent, Calendar *calendar, const TQDate &date, KNoScrollListBox* lv ); KOMonthCellToolTip (TQWidget* parent, Calendar *calendar, const TQDate &date, KNoScrollListBox* lv, MonthViewCell* cl);
protected: protected:
void maybeTip( const TQPoint & pos); void maybeTip( const TQPoint & pos);
@ -45,6 +46,7 @@ class KOMonthCellToolTip : public TQToolTip
Calendar *mCalendar; Calendar *mCalendar;
TQDate mDate; TQDate mDate;
KNoScrollListBox* eventlist; KNoScrollListBox* eventlist;
MonthViewCell* cell;
}; };
@ -140,6 +142,8 @@ class MonthViewCell : public TQWidget
class CreateItemVisitor; class CreateItemVisitor;
MonthViewCell( KOMonthView * ); MonthViewCell( KOMonthView * );
TQString holidayString( ) { return mHolidayString; }
/** Sets the date of the cell */ /** Sets the date of the cell */
void setDate( const TQDate & ); void setDate( const TQDate & );
/** @return Date of cell */ /** @return Date of cell */

@ -29,6 +29,7 @@
#include <tdelocale.h> #include <tdelocale.h>
#include "kpimprefs.h" #include "kpimprefs.h"
#include "categoryselectdialog.h"
#include "categoryeditdialog.h" #include "categoryeditdialog.h"
@ -177,6 +178,9 @@ void CategoryEditDialog::slotApply()
mPrefs->writeConfig(); mPrefs->writeConfig();
emit categoryConfigChanged(); emit categoryConfigChanged();
if(dynamic_cast<CategorySelectDialog*>(mPrefs->toNotify))
((CategorySelectDialog*)mPrefs->toNotify)->updateCategoryConfig();
} }
void CategoryEditDialog::slotCancel() void CategoryEditDialog::slotCancel()

@ -48,6 +48,8 @@ CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, TQWidget* parent,
TQT_SIGNAL(editCategories()) ); TQT_SIGNAL(editCategories()) );
connect( mWidget->mButtonClear, TQT_SIGNAL(clicked()), connect( mWidget->mButtonClear, TQT_SIGNAL(clicked()),
TQT_SLOT(clear()) ); TQT_SLOT(clear()) );
mPrefs->toNotify = this;
} }
void CategorySelectDialog::setCategories( const TQStringList &categoryList ) void CategorySelectDialog::setCategories( const TQStringList &categoryList )
@ -69,6 +71,7 @@ void CategorySelectDialog::setCategories( const TQStringList &categoryList )
CategorySelectDialog::~CategorySelectDialog() CategorySelectDialog::~CategorySelectDialog()
{ {
mPrefs->toNotify = NULL;
} }
void CategorySelectDialog::setSelected(const TQStringList &selList) void CategorySelectDialog::setSelected(const TQStringList &selList)

@ -36,7 +36,7 @@
#include "kpimprefs.h" #include "kpimprefs.h"
KPimPrefs::KPimPrefs( const TQString &name ) KPimPrefs::KPimPrefs( const TQString &name )
: TDEConfigSkeleton( name ) : TDEConfigSkeleton( name ), toNotify(NULL)
{ {
} }

@ -78,7 +78,8 @@ class KDE_EXPORT KPimPrefs : public TDEConfigSkeleton
public: public:
TQStringList mCustomCategories; TQStringList mCustomCategories;
TQObject *toNotify;
protected: protected:
virtual void setCategoryDefaults() {} virtual void setCategoryDefaults() {}
}; };

Loading…
Cancel
Save