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

List:       kmail-devel
Subject:    argh 6:45am is much too late to be up
From:       George Staikos <staikos () 0wned ! org>
Date:       2000-01-30 11:40:26
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----


Man I must be overtired

Here's the patch... for real this time :)


- -- 

George Staikos 


-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.2

iQEVAwUBOJQjW/aardfOEhQRAQFRCwf9HvZjIc8SpBcOj5NkN2m2QnqtPcK9Yuel
E+2dpjKAQZBYk8Rsm24QR887bM1VUUvKRMfPgraze0fOmX1uz9LxqJnbUSGQnPPX
PB0cCylPbgyuSrIWn3MfzSQdEwepMJgUMO90t1Y+NMThWcBU8FO6SzPPI2/U4q9b
IB4alxW9hgV1KAig7T/A1eQKyo6AqOPNtHkyJ51gVprHzd2N6HnSgTKDIcIlBF9X
rXIlZ/Jzr3It7ThKGydmeRYTEZ7Tn1vEM+zOXk3+My7wJvXE3zog77wKznnmN4rr
LS9t7f8mQ7OShwP6Nv7S0o5t0oNrTUvlzNsj/NIADW+8wCKrjP0DZw==
=/E+F
-----END PGP SIGNATURE-----

["kmail-cust-mime.patch" (text/plain)]

diff -u -x *~ -x *.moc -x *.o kmail.orig/kmcomposewin.cpp kmail/kmcomposewin.cpp
--- kmail.orig/kmcomposewin.cpp	Fri Jan 28 03:57:16 2000
+++ kmail/kmcomposewin.cpp	Sun Jan 30 06:18:36 2000
@@ -258,6 +258,23 @@
   config->setGroup("General");
   mExtEditor = config->readEntry("external-editor", DEFAULT_EDITOR_STR);
   useExtEditor = config->readBoolEntry("use-external-editor", FALSE);
+
+  int headerCount = config->readNumEntry("mime-header-count", 0);
+  mCustHeaders.clear();
+  mCustHeaders.setAutoDelete(true);
+  for (int i = 0; i < headerCount; i++) {
+    QString thisGroup;
+    _StringPair *thisItem = new _StringPair;
+    thisGroup.sprintf("Mime #%d", i);
+    config->setGroup(thisGroup);
+    thisItem->name = config->readEntry("name", "");
+    if ((thisItem->name).length() > 0) {
+      thisItem->value = config->readEntry("value", "");
+      mCustHeaders.append(thisItem);
+    } else {
+      delete thisItem;
+    }
+  }
 #endif
 
   config->setGroup("Fonts");
@@ -904,6 +921,16 @@
     mMsg->setHeaderField("X-PRIORITY", "2 (High)");
     mMsg->setHeaderField("Priority", "urgent");
   }
+
+#ifndef KRN
+  _StringPair *pCH;
+  for (pCH  = mCustHeaders.first();
+       pCH != NULL;
+       pCH  = mCustHeaders.next()) {
+    mMsg->setHeaderField(pCH->name, pCH->value);
+  }
+
+#endif
 
   if(mAtmList.count() <= 0)
   {
diff -u -x *~ -x *.moc -x *.o kmail.orig/kmcomposewin.h kmail/kmcomposewin.h
--- kmail.orig/kmcomposewin.h	Fri Jan 28 03:06:21 2000
+++ kmail/kmcomposewin.h	Sun Jan 30 06:16:42 2000
@@ -23,6 +23,15 @@
 #include "kmtopwidget.h"
 
 
+#ifndef KRN
+class _StringPair {
+ public:
+   QString name;
+   QString value;
+};
+#endif
+
+
 
 class QLineEdit;
 class QGridLayout;
@@ -341,6 +350,7 @@
 #ifndef KRN
   QString mExtEditor;
   bool useExtEditor;
+  QList<_StringPair> mCustHeaders;
 #endif
   int mNumHeaders;
   int mLineBreak;
diff -u -x *~ -x *.moc -x *.o kmail.orig/kmsettings.cpp kmail/kmsettings.cpp
--- kmail.orig/kmsettings.cpp	Fri Jan 28 13:59:07 2000
+++ kmail/kmsettings.cpp	Sun Jan 30 03:56:06 2000
@@ -70,6 +70,7 @@
   createTabNetwork(this);
   createTabAppearance(this);
   createTabComposer(this);
+  createTabMime(this);
   createTabMisc(this);
   createTabPgp(this);
 }
@@ -177,10 +178,94 @@
 
 
 //-----------------------------------------------------------------------------
+void KMSettings::createTabMime(QWidget* parent)
+{
+  QWidget *tab = new QWidget(parent);
+  QBoxLayout *box = new QBoxLayout(tab, QBoxLayout::TopToBottom, 2);
+  QPushButton *bNew, *bDel;
+  QGroupBox *grp = new QGroupBox(i18n("Custom Tags"), tab);
+  QGridLayout *grid = new QGridLayout(grp, 8, 4, 20, 8);
+  QLabel *mhAbout = new QLabel(grp);  
+  QLabel *mhName = new QLabel(grp);  
+  QLabel *mhValue = new QLabel(grp);
+  KConfig* config = app->config();
+
+  curMHItem = NULL;    // not pointing to anything yet
+
+  box->addWidget(grp);
+
+  mhAbout->setText(i18n("Define custom mime header tags for outgoing emails:"));
+  mhAbout->setMinimumSize(mhAbout->size());
+  grid->addMultiCellWidget(mhAbout, 0, 0, 0, 3);
+
+  tagList = new QListView(grp, "LstTags");
+  tagList->addColumn(QString("Name"), tagList->width()/2);
+  tagList->addColumn(QString("Value"), tagList->width()/2);
+  tagList->setColumnWidthMode(0, QListView::Maximum);
+  tagList->setColumnWidthMode(1, QListView::Maximum);
+  tagList->setMultiSelection(false);
+  grid->addMultiCellWidget(tagList, 1, 4, 0, 3);
+  tagList->setMultiSelection(false);
+
+  connect(tagList,SIGNAL(selectionChanged()),this,SLOT(slotMHSelectionChanged()));
+
+  mhName->setText(i18n("Name:"));
+  mhName->setMinimumSize(mhName->size());
+  grid->addWidget(mhName, 5, 0);
+  tagNameEdit = new QLineEdit(grp);
+  tagNameEdit->setMinimumSize(100, mhName->height()+2);
+  tagNameEdit->setMaximumSize(1000, mhName->height()+2);
+  grid->addMultiCellWidget(tagNameEdit, 5, 5, 1, 3);
+  connect(tagNameEdit,SIGNAL(textChanged(const \
QString&)),this,SLOT(slotMHNameChanged(const QString&))); +
+  mhValue->setText(i18n("Value:"));
+  mhValue->setMinimumSize(mhValue->size());
+  grid->addWidget(mhValue, 6, 0);
+  tagValueEdit = new QLineEdit(grp);
+  tagValueEdit->setMinimumSize(100, mhValue->height()+2);
+  tagValueEdit->setMaximumSize(1000, mhValue->height()+2);
+  grid->addMultiCellWidget(tagValueEdit, 6, 6, 1, 3);
+  connect(tagValueEdit,SIGNAL(textChanged(const \
QString&)),this,SLOT(slotMHValueChanged(const QString&))); +
+  tagNameEdit->setEnabled(false);
+  tagValueEdit->setEnabled(false);
+
+  bNew = new QPushButton(i18n("&New"), grp);
+  grid->addWidget(bNew, 7, 2);
+  bDel = new QPushButton(i18n("D&elete"), grp);
+  grid->addWidget(bDel, 7, 3);
+
+  connect(bNew,SIGNAL(clicked()),this,SLOT(slotMHNew()));
+  connect(bDel,SIGNAL(clicked()),this,SLOT(slotMHDelete()));
+
+  // read in all the values
+  config->setGroup("General");
+  int count = config->readNumEntry("mime-header-count", 0);
+  for (int i = 0; i < count; i++) {
+    QString group, thisName, thisValue;
+    group.sprintf("Mime #%d", i);
+    config->setGroup(group);
+    thisName = config->readEntry("name", "");
+    thisValue = config->readEntry("value", "");
+    if (thisName.length() > 0) {
+      new QListViewItem(tagList, thisName, thisValue);
+    }
+  }
+
+  addTab(tab, i18n("Mime Headers"));
+  grid->activate();
+  grp->adjustSize();
+  box->addStretch(100);
+  box->activate();
+  tab->adjustSize();
+}
+
+
+//-----------------------------------------------------------------------------
 void KMSettings::createTabIdentity(QWidget* parent)
 {
   QWidget* tab = new QWidget(parent);
-  QGridLayout* grid = new QGridLayout(tab, 7, 3, 20, 6);
+  QGridLayout* grid = new QGridLayout(tab, 6, 3, 20, 6);
   QPushButton* button;
 
   nameEdit = createLabeledEntry(tab, grid, i18n("Name:"), 
@@ -841,6 +926,8 @@
 //  FIXME:
 //  There is a problem here.  If an interactive console program is given,
 //  the program is stopped.  How do we work around this?
+//  FIXME:
+//  Use the KDE launching service instead
 //
 
 class ExtEditLaunch {
@@ -931,6 +1018,77 @@
   
 }
 
+
+//-----------------------------------------------------------------------------
+void KMSettings::slotMHValueChanged(const QString& x)
+{
+
+  curMHItem->setText(1, x);
+
+}
+
+
+//-----------------------------------------------------------------------------
+void KMSettings::slotMHNameChanged(const QString& x)
+{
+
+  curMHItem->setText(0, x);
+
+}
+
+
+//-----------------------------------------------------------------------------
+void KMSettings::slotMHSelectionChanged()
+{
+
+  // get text from the selection
+  curMHItem = tagList->selectedItem();
+
+  // put it in the entry fields
+  tagNameEdit->setText(curMHItem->text(0));
+  tagValueEdit->setText(curMHItem->text(1));
+
+  // enable them
+  tagNameEdit->setEnabled(true);
+  tagValueEdit->setEnabled(true);
+
+}
+
+
+//-----------------------------------------------------------------------------
+void KMSettings::slotMHNew()
+{
+
+  curMHItem = new QListViewItem(tagList, QString(""), QString(""));
+  tagNameEdit->setEnabled(true);
+  tagValueEdit->setEnabled(true);
+  tagList->setCurrentItem(curMHItem);
+  tagNameEdit->setFocus();
+
+}
+
+
+//-----------------------------------------------------------------------------
+void KMSettings::slotMHDelete()
+{
+
+  // Verify that it is selected
+  if (!curMHItem)
+    return;
+
+  // clear the entry fields
+  tagNameEdit->setText("");
+  tagValueEdit->setText("");
+  tagNameEdit->setEnabled(false);
+  tagValueEdit->setEnabled(false);
+
+  // Remove the item
+  tagList->takeItem(curMHItem);
+  curMHItem = NULL;
+
+}
+
+
 //-----------------------------------------------------------------------------
 void KMSettings::accountSelected(int,int)
 {
@@ -1138,6 +1296,27 @@
   config->writeEntry("send-receipts", sendReceipts->isChecked());
   config->writeEntry("external-editor", extEditorEdit->text());
   config->writeEntry("use-external-editor", useExternalEditor->isChecked());
+
+  //----- mime headers
+  int count = tagList->childCount();
+  int countDelta = 0;
+  for (int i = 0; i < count; i++) {
+    QString groupName;
+    QListViewItem *thisChild;
+
+    groupName.sprintf("Mime #%d", i); 
+    config->setGroup(groupName);
+    thisChild = tagList->firstChild();
+    if (thisChild->text(0) && strlen(thisChild->text(0)) > 0) {
+      config->writeEntry("name", thisChild->text(0));
+      config->writeEntry("value", thisChild->text(1));
+    } else {
+      countDelta++;
+    }
+    tagList->takeItem(thisChild);
+  }
+  config->setGroup("General");
+  config->writeEntry("mime-header-count", count - countDelta);
 
   //-----
   config->sync();
diff -u -x *~ -x *.moc -x *.o kmail.orig/kmsettings.h kmail/kmsettings.h
--- kmail.orig/kmsettings.h	Fri Jan 28 01:27:49 2000
+++ kmail/kmsettings.h	Sun Jan 30 02:48:56 2000
@@ -4,6 +4,7 @@
 #include <qtabdialog.h>
 #include <qstring.h>
 #include <qcheckbox.h>
+#include <qlistview.h>
 
 class KMAccount;
 class KMAccountSettings;
@@ -35,6 +36,7 @@
   virtual void createTabNetwork(QWidget*);
   virtual void createTabComposer(QWidget*);
   virtual void createTabMisc(QWidget*);
+  virtual void createTabMime(QWidget*);
   virtual void createTabAppearance(QWidget*);
   virtual void createTabPgp(QWidget *parent);
 
@@ -69,12 +71,19 @@
   void slotFolderlistFontSelect();
   void slotDefaultColorSelect();
   void slotSigModify();
+  void slotMHNew();
+  void slotMHDelete();
+  void slotMHSelectionChanged();
+  void slotMHNameChanged(const QString& x);
+  void slotMHValueChanged(const QString& x);
 
 private:
+  QListViewItem *curMHItem;
   QLineEdit *nameEdit,*orgEdit,*emailEdit,*replytoEdit,*sigEdit;
   QLineEdit *smtpServerEdit,*smtpPortEdit,*sendmailLocationEdit;
   QLineEdit *phraseReplyEdit, *phraseReplyAllEdit, *phraseForwardEdit;
   QLineEdit *indentPrefixEdit, *wrapColumnEdit, *extEditorEdit;
+  QLineEdit *tagNameEdit, *tagValueEdit;
   QCheckBox *autoAppSignFile, *wordWrap, *monospFont, *pgpAutoSign, *smartQuote;
   QCheckBox *emptyTrashOnExit, *sendOnCheck, *longFolderList, *sendReceipts,
     *compactOnExit, *useExternalEditor;
@@ -82,6 +91,7 @@
   QRadioButton *allow8Bit, *quotedPrintable;
   QButtonGroup *incomingGroup,*outgoingGroup;
   KTabListBox *accountList;
+  QListView  *tagList;
   QPushButton *addButton,*modifyButton,*removeButton;
   QCheckBox *defaultFonts, *defaultColors;
   QLabel *bodyFontLabel, *listFontLabel, *folderListFontLabel;



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

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