* highlighting of column header which is current sort column

* workaround for initial-size bug in Qt-1.32 for composer/attachments
* confirm dialog for emptying folders
* sender names now without email addr in message list

svn path=/trunk/kdenetwork/kmail/; revision=5900
wilder-work
Stefan Taferner 28 years ago
parent 76a9ec004a
commit 9e1c261426
  1. 2
      KMail.kdelnk
  2. 2
      Makefile.am
  3. 58
      kmcomposewin.cpp
  4. 33
      kmcomposewin.h
  5. 20
      kmheaders.cpp
  6. 1
      kmheaders.h
  7. 22
      kmmainwin.cpp
  8. 2
      kmmsglist.h
  9. 2
      kmversion.h

@ -8,7 +8,7 @@ Name[fi]=S
Name[hu]=Levelezõ program
Name[pt]=Cliente de Mail
Type=Application
Exec=kmail
Exec=kmail -caption "%c" %i %m
Icon=kmail.xpm
DocPath=kmail.html
Comment=Mail Client

@ -51,7 +51,7 @@ uninstall-local:
rm -f $(appsdir)/KMail.kdelnk
rm -f $(kde_icondir)/kmail.xpm
rm -f $(kde_minidir)/kmail.xpm
messages:
@XGETTEXT@ -ki18n -C -x../../kdelibs/po/kde.pot $(kmail_SOURCES) && mv messages.po ../po/kmail.pot

@ -2,7 +2,6 @@
// Author: Markus Wuebben <markus.wuebben@kde.org>
// This code is published under the GPL.
#include <keditcl.h>
#include "kmcomposewin.h"
#include "kmmessage.h"
#include "kmmsgpart.h"
@ -329,6 +328,7 @@ void KMComposeWin::rethinkFields(void)
mGrid->setColStretch(2, 1);
mGrid->setRowStretch(mNumHeaders, 100);
mEdtList.clear();
row = 0;
rethinkHeaderLine(showHeaders,HDR_FROM, row, i18n("&From:"),
&mLblFrom, &mEdtFrom, &mBtnFrom);
@ -379,7 +379,9 @@ void KMComposeWin::rethinkHeaderLine(int aValue, int aMask, int& aRow,
aEdt->show();
aEdt->setMinimumSize(100, aLbl->height()+2);
aEdt->setMaximumSize(1000, aLbl->height()+2);
aEdt->setFocusPolicy(QWidget::StrongFocus);
aEdt->setFocusPolicy(QWidget::ClickFocus);
//aEdt->setFocusPolicy(QWidget::StrongFocus);
mEdtList.append(aEdt);
if (aBtn)
{
@ -613,8 +615,9 @@ void KMComposeWin::updateCursorPosition() {
void KMComposeWin::setupEditor(void)
{
QPopupMenu* menu;
mEditor = new KEdit(kapp, &mMainWidget);
mEditor = new KMEdit(kapp, &mMainWidget);
mEditor->toggleModified(FALSE);
mEditor->setFocusPolicy(QWidget::ClickFocus);
// Word wrapping setup
if(mWordWrap)
@ -964,6 +967,7 @@ void KMComposeWin::addAttach(const QString aUrl)
// add the new attachment to the list
addAttach(msgPart);
rethinkFields(); //work around initial-size bug in Qt-1.32
}
@ -1743,10 +1747,29 @@ void KMComposeWin::setEditCharset(){
cout<<"Setting font to: "<<kcharset.name()<<"\n";
mEditor->setFont(kcharset.setQFont(fnt));
}
#endif //CHARSETS
//-----------------------------------------------------------------------------
void KMComposeWin::focusNextPrevEdit(const QLineEdit* aCur, bool aNext)
{
QLineEdit* cur;
if (!aCur) cur=mEdtList.last();
else
{
for (cur=mEdtList.first(); aCur!=cur && cur; cur=mEdtList.next())
;
if (!cur) return;
if (aNext) cur = mEdtList.next();
else cur = mEdtList.prev();
}
if (!cur) return;
cur->setFocus();
}
//=============================================================================
//
// Class KMLineEdit
@ -1794,7 +1817,7 @@ void KMLineEdit::cut()
if(hasMarkedText())
{
QString t = markedText();
QKeyEvent k( Event_KeyPress, Key_D , 0 , ControlButton);
QKeyEvent k(Event_KeyPress, Key_D, 0, ControlButton);
keyPressEvent(&k);
QApplication::clipboard()->setText(t);
}
@ -1803,7 +1826,7 @@ void KMLineEdit::cut()
//-----------------------------------------------------------------------------
void KMLineEdit::paste()
{
QKeyEvent k( Event_KeyPress, Key_V , 0 , ControlButton);
QKeyEvent k(Event_KeyPress, Key_V, 0, ControlButton);
keyPressEvent(&k);
}
@ -1815,7 +1838,26 @@ void KMLineEdit::markAll()
//=============================================================================
//
// Class KMEdit
//
//=============================================================================
KMEdit::KMEdit(KApplication *a,QWidget *parent, const char *name,
const char *filename):
KMEditInherited(a, parent, name, filename)
{
initMetaObject();
}
//-----------------------------------------------------------------------------
void KMEdit::keyPressEvent(QKeyEvent* e)
{
if (e->key()==Key_Tab && (e->state() & ShiftButton))
{
printf("shift-tab\n");
parent()->focusNextPrevEdit(NULL,FALSE);
}
else KMEditInherited::keyPressEvent(e);
}

@ -16,6 +16,7 @@
#include <qpalette.h>
#include <kmsgbox.h>
#include "kmmsgpart.h"
#include <keditcl.h>
#ifdef HAS_KSPELL
#include <kspell.h>
#endif
@ -34,10 +35,26 @@ class QPushButton;
class QCloseEvent;
class KSpell;
class KSpellConfig;
class KMComposeWin;
typedef QList<KMMessagePart> KMMsgPartList;
//-----------------------------------------------------------------------------
#define KMEditInherited KEdit
class KMEdit: public KEdit
{
Q_OBJECT
public:
KMEdit(KApplication *a=NULL,QWidget *parent=NULL, const char *name=NULL,
const char *filename=NULL);
KMComposeWin* parent(void) const
{ return (KMComposeWin*)KMEditInherited::parent(); }
protected:
virtual void keyPressEvent(QKeyEvent*);
};
//-----------------------------------------------------------------------------
class KMLineEdit : public QLineEdit
{
@ -52,8 +69,6 @@ public slots:
void paste();
void markAll();
private:
protected:
virtual void mousePressEvent(QMouseEvent *);
};
@ -165,11 +180,14 @@ public slots:
/** Append current message to ~/dead.letter */
virtual void deadLetter(void);
void updateCursorPosition();
void updateCursorPosition();
void slotConfigureCharsets();
void slotSetCharsets(const char *message,const char *composer,
bool ascii,bool quote,bool def);
void slotConfigureCharsets();
void slotSetCharsets(const char *message,const char *composer,
bool ascii,bool quote,bool def);
/** Move focus to next/prev edit widget */
virtual void focusNextPrevEdit(const QLineEdit* current, bool next);
protected:
/** Install grid management and header fields. If fields exist that
@ -250,7 +268,7 @@ protected:
/* end Added for KRN */
QPopupMenu *mMnuView, *mMnuOptions;
KEdit* mEditor;
KMEdit* mEditor;
QGridLayout* mGrid;
KDNDDropZone *mDropZone;
KMMessage *mMsg;
@ -269,6 +287,7 @@ protected:
short mBtnIdSign, mBtnIdEncrypt;
short mMnuIdUrgent, mMnuIdConfDeliver, mMnuIdConfRead;
QString mForeColor, mBackColor;
QList<QLineEdit> mEdtList;
#ifdef HAS_KSPELL
KSpell* mKSpell;
KSpellConfig* mKSpellConfig;

@ -32,7 +32,7 @@ KMHeaders::KMHeaders(KMMainWin *aOwner, QWidget *parent,
mOwner = aOwner;
mFolder = NULL;
getMsgIndex = -1;
mSortField = KMMsgList::sfDate;
mSortCol = KMMsgList::sfDate;
setColumn(0, i18n("F"), 17, KMHeadersInherited::PixmapColumn);
setColumn(1, i18n("Sender"), 200);
@ -88,9 +88,8 @@ void KMHeaders::readFolderConfig (void)
setColumnWidth(1, config->readNumEntry("SenderWidth", 200));
setColumnWidth(2, config->readNumEntry("SubjectWidth", 270));
setColumnWidth(3, config->readNumEntry("DateWidth", 300));
mSortField = (KMMsgList::SortField)
config->readNumEntry("SortColumn", (int)KMMsgList::sfDate);
mFolder->sort(mSortField);
mSortCol = config->readNumEntry("SortColumn", (int)KMMsgList::sfDate);
mFolder->sort((KMMsgList::SortField)mSortCol);
}
@ -104,7 +103,7 @@ void KMHeaders::writeFolderConfig (void)
config->writeEntry("SenderWidth", columnWidth(1));
config->writeEntry("SubjectWidth", columnWidth(2));
config->writeEntry("DateWidth", columnWidth(3));
config->writeEntry("SortColumn", (int)mSortField);
config->writeEntry("SortColumn", mSortCol);
}
@ -208,14 +207,10 @@ void KMHeaders::headerClicked(int column)
if (idx >= 0) cur = (*mFolder)[idx];
else cur = NULL;
if (column==0) mSortField = KMMsgList::sfStatus;
else if (column==1) mSortField = KMMsgList::sfFrom;
else if (column==2) mSortField = KMMsgList::sfSubject;
else if (column==3) mSortField = KMMsgList::sfDate;
else return;
mSortCol = column;
kbp->busy();
mFolder->sort(mSortField);
mFolder->sort((KMMsgList::SortField)mSortCol);
kbp->idle();
if (cur) idx = mFolder->find(cur);
@ -604,7 +599,8 @@ void KMHeaders::updateMessageList(void)
assert(mb != NULL); // otherwise using count() above is wrong
flag = mb->status();
hdr.sprintf("%c\n%s\n %s\n%s", (char)flag, (const char*)mb->from(),
hdr.sprintf("%c\n%s\n %s\n%s", (char)flag,
(const char*)KMMessage::stripEmailAddr(mb->from()),
(const char*)mb->subject(), (const char*)mb->dateStr());
insertItem(hdr);

@ -108,7 +108,6 @@ private:
int getMsgIndex;
bool getMsgMulti;
KMMessageList mSelMsgList;
KMMsgList::SortField mSortField;
};
#endif

@ -18,7 +18,6 @@
#include "kmglobal.h"
#include "kmfolderseldlg.h"
#include "kmfiltermgr.h"
#include "kmversion.h"
#include "kmsender.h"
#include "kmaddrbookdlg.h"
#include "kmaddrbook.h"
@ -324,10 +323,22 @@ void KMMainWin::slotModifyFolder()
//-----------------------------------------------------------------------------
void KMMainWin::slotEmptyFolder()
{
kbp->busy();
mFolder->expunge();
mHeaders->setFolder(mFolder);
kbp->idle();
QString str(256);
if (!mFolder) return;
str.sprintf(i18n("Are you sure you want to discard the\n"
"contents of the folder \"%s\" ?"),
(const char*)mFolder->label());
if ((KMsgBox::yesNo(this,i18n("Confirmation"),str))==1)
{
kbp->busy();
mHeaders->setFolder(NULL);
mMsgView->clear();
mFolder->expunge();
mHeaders->setFolder(mFolder);
kbp->idle();
}
}
@ -350,6 +361,7 @@ void KMMainWin::slotRemoveFolder()
if ((KMsgBox::yesNo(this,i18n("Confirmation"),str))==1)
{
mHeaders->setFolder(NULL);
mMsgView->clear();
folderMgr->remove(mFolder);
}
}

@ -14,7 +14,7 @@ class KMMsgList: public QArray<KMMsgBasePtr>
{
public:
/** Valid parameters for sort() */
typedef enum { sfStatus=0, sfSubject=1, sfFrom=2, sfDate=3 } SortField;
typedef enum { sfStatus=0, sfFrom=1, sfSubject=2, sfDate=3 } SortField;
/** Constructor with optional initial size. */
KMMsgList(int initialSize=32);

@ -3,6 +3,6 @@
#ifndef kmversion_h
#define kmversion_h
#define KMAIL_VERSION "0.6.0"
#define KMAIL_VERSION "0.6.1"
#endif /*kmversion_h*/

Loading…
Cancel
Save