summaryrefslogtreecommitdiffstats
path: root/korganizer/koeditorattachments.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'korganizer/koeditorattachments.cpp')
-rw-r--r--korganizer/koeditorattachments.cpp26
1 files changed, 8 insertions, 18 deletions
diff --git a/korganizer/koeditorattachments.cpp b/korganizer/koeditorattachments.cpp
index 6f46ac5f..bf57cb22 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() );