[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    Re: PATCH: Outlook compatible attachment naming
From:       Don Sanders <sanders () kde ! org>
Date:       2004-05-05 3:35:36
Message-ID: 200405051335.36848.sanders () kde ! org
[Download RAW message or body]

Hi,

I attach an updated patch, that uses a message box to warn the user 
when outlook compatible attachment naming is turned on.

I believe this patch has majority support, so I'll commit it if there 
aren't any objections. If someone has any minor objections regarding 
the wording of the text, maybe they can just edit the text after the 
patch has been committed. I'm okay with that.

Don.

["kmaildiffa" (text/x-diff)]

Index: configuredialog.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/configuredialog.cpp,v
retrieving revision 1.433
diff -d -u -p -r1.433 configuredialog.cpp
--- configuredialog.cpp	24 Apr 2004 17:38:39 -0000	1.433
+++ configuredialog.cpp	5 May 2004 03:20:18 -0000
@@ -2968,6 +2968,20 @@ ComposerPageAttachmentsTab::ComposerPage

   vlay = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() );

+  // "Outlook compatible attachment naming" check box
+  mOutlookCompatibleCheck =
+    new QCheckBox( i18n( "Outlook compatible attachment naming" ), this );
+  mOutlookCompatibleCheck->setChecked( false );
+  QToolTip::add( mOutlookCompatibleCheck, i18n(
+    "Turn this option on to make Outlook(tm) understand attachment names "
+    "containing non-English characters" ) );
+  connect( mOutlookCompatibleCheck, SIGNAL( stateChanged( int ) ),
+           this, SLOT( slotEmitChanged( void ) ) );
+  connect( mOutlookCompatibleCheck, SIGNAL( stateChanged( int ) ),
+           this, SLOT( slotOutlookCompatibleChanged( int ) ) );
+  vlay->addWidget( mOutlookCompatibleCheck );
+  vlay->addSpacing( 5 );
+
   // "Enable detection of missing attachments" check box
   mMissingAttachmentDetectionCheck =
     new QCheckBox( i18n("E&nable detection of missing attachments"), this );
@@ -3002,6 +3016,8 @@ ComposerPageAttachmentsTab::ComposerPage
 void ComposerPage::AttachmentsTab::load() {
   KConfigGroup composer( KMKernel::config(), "Composer" );

+  mOutlookCompatibleCheck->setChecked(
+    composer.readBoolEntry( "outlook-compatible-attachments", false ) );
   mMissingAttachmentDetectionCheck->setChecked(
     composer.readBoolEntry( "showForgottenAttachmentWarning", true ) );
   QStringList attachWordsList =
@@ -3021,12 +3037,28 @@ void ComposerPage::AttachmentsTab::load(

 void ComposerPage::AttachmentsTab::save() {
   KConfigGroup composer( KMKernel::config(), "Composer" );
+  composer.writeEntry( "outlook-compatible-attachments",
+                       mOutlookCompatibleCheck->isChecked() );
   composer.writeEntry( "showForgottenAttachmentWarning",
                        mMissingAttachmentDetectionCheck->isChecked() );
   composer.writeEntry( "attachment-keywords",
                        mAttachWordsListEditor->stringList() );
 }

+void ComposerPageAttachmentsTab::slotOutlookCompatibleChanged( int state )
+{
+  if (state == QButton::On) {
+    KMessageBox::information(0,i18n("You have choosen to "
+    "encode attachment names containing non-English characters in a way that "
+    "is understood by Outlook(tm) and other mail clients that do not "
+    "support standard-compliant encoded attachment names.\n"
+    "Note that KMail may create non-standard compliant messages, "
+    "and consequently it's possible that your messages will not be "
+    "understood by standard compliant mail clients. So, unless you have no "
+    "other choice, you should not enable this option." ) );
+  }
+}
+
 // *************************************************************
 // *                                                           *
 // *                      SecurityPage                         *
Index: configuredialog_p.h
===================================================================
RCS file: /home/kde/kdepim/kmail/configuredialog_p.h,v
retrieving revision 1.80
diff -d -u -p -r1.80 configuredialog_p.h
--- configuredialog_p.h	6 Apr 2004 16:14:13 -0000	1.80
+++ configuredialog_p.h	5 May 2004 03:20:19 -0000
@@ -624,7 +624,11 @@ public:
   void save();
   void defaults() {};

+protected slots:
+  void slotOutlookCompatibleChanged( int );
+
 protected:
+  QCheckBox   *mOutlookCompatibleCheck;
   QCheckBox   *mMissingAttachmentDetectionCheck;
   SimpleStringListEditor *mAttachWordsListEditor;
 };
Index: kmcomposewin.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/kmcomposewin.cpp,v
retrieving revision 1.814
diff -d -u -p -r1.814 kmcomposewin.cpp
--- kmcomposewin.cpp	24 Apr 2004 19:27:20 -0000	1.814
+++ kmcomposewin.cpp	5 May 2004 03:20:21 -0000
@@ -451,6 +451,7 @@ void KMComposeWin::readConfig(void)
     mLineBreak = 78;
   if (mLineBreak < 30)
     mLineBreak = 30;
+  mOutlookCompatible = config->readBoolEntry( "outlook-compatible-attachments", false );
   mAutoPgpSign = config->readBoolEntry("pgp-auto-sign", false);
   mAutoPgpEncrypt = config->readBoolEntry("pgp-auto-encrypt", false);
   mNeverSignWhenSavingInDrafts = config->readBoolEntry("never-sign-drafts", true);
@@ -2038,8 +2039,15 @@ void KMComposeWin::slotAttachFileResult(
   QCString encoding = KMMsgBase::autoDetectCharset(mCharset,
     KMMessage::preferredCharsets(), name);
   if (encoding.isEmpty()) encoding = "utf-8";
-  QCString encName = KMMsgBase::encodeRFC2231String(name, encoding);
-  bool RFC2231encoded = name != QString(encName);
+
+  QCString encName;
+  if ( mOutlookCompatible )
+    encName = KMMsgBase::encodeRFC2047String( name, encoding );
+  else
+    encName = KMMsgBase::encodeRFC2231String( name, encoding );
+  bool RFC2231encoded = false;
+  if ( !mOutlookCompatible )
+    RFC2231encoded = name != QString( encName );

   // create message part
   msgPart = new KMMessagePart;
Index: kmcomposewin.h
===================================================================
RCS file: /home/kde/kdepim/kmail/kmcomposewin.h,v
retrieving revision 1.242
diff -d -u -p -r1.242 kmcomposewin.h
--- kmcomposewin.h	24 Apr 2004 19:27:20 -0000	1.242
+++ kmcomposewin.h	5 May 2004 03:20:21 -0000
@@ -786,6 +786,7 @@ protected:
   bool mAutoCharset;

   bool mAlwaysSend;
+  bool mOutlookCompatible;

   QStringList mFolderNames;
   QValueList<QGuardedPtr<KMFolder> > mFolderList;


_______________________________________________
KMail developers mailing list
KMail-devel@kde.org
https://mail.kde.org/mailman/listinfo/kmail-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic