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

List:       kmail-devel
Subject:    patch for attachment dialog
From:       Daniel Naber <dnaber () mini ! gt ! owl ! de>
Date:       2000-04-25 17:58:59
[Download RAW message or body]

Hi,

I wonder if the attachment dialog really has to pop up automatically for 
every file. In Netscape, e.g., there's no such dialog. The only thing I use
this dialog for is to correct the mime type, which KMimeMagic often gets
wrong. I never change the name, description or encoding for the file.

Waht about you? Who is actually using this dialog regularly? Do you need
it to come up automatically (you can always select "Properties..." in the RMB
menu to get it back later)?

Anyway, I made a patch that makes it easier to correct the mime type (for
most cases). It shows a selection of very common mime types. Don,
can you please apply this if nobody objects? Thanks.

Regards
 Daniel

["attach-dialog-combobox.diff" (text/plain)]

--- kmmsgpartdlg.cpp.org	Mon Apr 24 23:05:38 2000
+++ kmmsgpartdlg.cpp	Tue Apr 25 18:44:27 2000
@@ -15,6 +15,7 @@
 
 #include "kbusyptr.h"
 #include <kapp.h>
+#include <kcombobox.h>
 #include <qcombobox.h>
 #include <qpushbutton.h>
 #include <qlabel.h>
@@ -36,7 +37,6 @@
 
   mMsgPart = NULL;
 
-  resize(320, 190);
   if (aCaption) setCaption(aCaption);
   else setCaption(i18n("Message Part Properties"));
 
@@ -45,13 +45,22 @@
   grid->addMultiCellWidget(mLblIcon, 0, 1, 0, 0);
 
   //-----
-  mEdtMimetype = new QLineEdit(this);
-  mEdtMimetype->adjustSize();
+  mEdtMimetype = new KComboBox(true, this);
+  mEdtMimetype->setInsertionPolicy(QComboBox::NoInsertion);
+  // here's only a small selection of what I think are very common mime types (dnaber, 2000-04-24):
+  mEdtMimetype->insertItem("text/html");
+  mEdtMimetype->insertItem("text/plain");
+  mEdtMimetype->insertItem("image/gif");
+  mEdtMimetype->insertItem("image/jpeg");
+  mEdtMimetype->insertItem("image/png");
+  mEdtMimetype->insertItem("application/octet-stream");
+  mEdtMimetype->insertItem("application/x-gunzip");
+  mEdtMimetype->insertItem("application/zip");
   h = mEdtMimetype->sizeHint().height();
   mEdtMimetype->setMinimumSize(100, h);
   mEdtMimetype->setMaximumSize(1024, h);
   grid->addMultiCellWidget(mEdtMimetype, 0, 0, 1, 3);
-
+  
   //-----
   mLblSize = new QLabel(this);
   mLblSize->adjustSize();
@@ -106,7 +115,7 @@
   btnOk->adjustSize();
   btnOk->setMinimumSize(btnOk->sizeHint());
   connect(btnOk, SIGNAL(clicked()), SLOT(accept()));
-  grid->addMultiCellWidget(btnOk, 5, 5, 0, 1);
+  grid->addMultiCellWidget(btnOk, 5, 5, 1, 1);
 
   btnCancel = new QPushButton(i18n("Cancel"), this);
   btnCancel->adjustSize();
@@ -128,7 +137,7 @@
   grid->setColStretch(3, 10);
   grid->activate();
 
-  adjustSize();
+  resize(420, 190);
 }
 
 
@@ -149,7 +158,9 @@
 
   mEdtComment->setText(mMsgPart->contentDescription());
   mEdtName->setText(mMsgPart->name());
-  mEdtMimetype->setText(mMsgPart->typeStr()+"/"+mMsgPart->subtypeStr());
+  QString mimeType = mMsgPart->typeStr() + "/" + mMsgPart->subtypeStr();
+  mEdtMimetype->setEditText(mimeType);
+  mEdtMimetype->insertItem(mimeType, 0);
 
   len = mMsgPart->size();
   if (len > 9999) lenStr.sprintf("%u KB", (len>>10));
@@ -192,7 +203,7 @@
   else if (idx==2) str = "quoted-printable";
   else str = "8bit";
 
-  type = mEdtMimetype->text();
+  type = mEdtMimetype->currentText();
   idx = type.find('/');
   if (idx < 0) subtype = "";
   else
--- kmmsgpartdlg.h.org	Mon Apr 24 23:11:16 2000
+++ kmmsgpartdlg.h	Mon Apr 24 23:45:20 2000
@@ -4,6 +4,7 @@
 #ifndef kmmsgpartdlg_h
 #define kmmsgpartdlg_h
 
+#include <kcombobox.h>
 #include <qdialog.h>
 #include <qpixmap.h>
 
@@ -37,8 +38,9 @@
   virtual void applyChanges(void);
 
   KMMessagePart *mMsgPart;
-  QLineEdit *mEdtName, *mEdtComment, *mEdtMimetype;
+  QLineEdit *mEdtName, *mEdtComment;
   QComboBox *mCbxEncoding;
+  KComboBox *mEdtMimetype;
   QLabel *mLblIcon, *mLblSize;
   QPixmap mIconPixmap;
 };


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

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