[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/pim/mailody
From: Tom Albers <tomalbers () kde ! nl>
Date: 2006-11-13 20:55:19
Message-ID: 1163451319.192145.16721.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 604701 by toma:
- Speed up for opening large mailboxes. I already wrote that the code was slow for \
threading; it had to determine if a message was Unseen, to determine if a thread \
should be open. This improves that part of the code.
- prevent a popup when opening a mailbox with new mail.
- use short date format in headerlist
- update unseen count to 0 when mark all as read is used. This saves a round trip to \
the server to determine it.
M +0 -1 TODO
M +1 -1 src/db.cpp
M +4 -1 src/imap.cpp
M +13 -6 src/mainwindow.cpp
M +1 -1 src/messagedata.h
M +19 -1 src/tooltip.cpp
M +29 -9 src/tooltip.h
--- trunk/playground/pim/mailody/TODO #604700:604701
@@ -6,7 +6,6 @@
------------------------------------
Notifications:
-dont show the popup when it is the current mailbox [allee]
make an area clickable to go to that mailbox [allee]
-----------------------------------
--- trunk/playground/pim/mailody/src/db.cpp #604700:604701
@@ -397,7 +397,7 @@
if (mb == "*")
getResult( "SELECT uid, mailbox, header FROM messages ", values );
else
- getResult( QString("SELECT uid, mailbox, header FROM messages "
+ getResult( QString("SELECT uid, mailbox, header, flags FROM messages "
"where mailbox = '%2'")
.arg( escapeString(mb)), values );
}
--- trunk/playground/pim/mailody/src/imap.cpp #604700:604701
@@ -436,6 +436,8 @@
headersToSend.append(rx.cap(1));
headersToSend.append(m_currentQueueItem.mailbox());
headersToSend.append(text);
+ headersToSend.append(m_db->getFlags(rx.cap(1).toInt(),
+ m_currentQueueItem.mailbox()));
if (text.isEmpty())
text = "Message corrupt";
@@ -559,7 +561,8 @@
void Imap::moveMessage(const int uid, const QString& origbox, const QString& \
destbox) {
- kdDebug() << "Move " << origbox << " - " << uid << " -> " << destbox << endl;
+ // kdDebug() << "Move " << origbox
+ // << " - " << uid << " -> " << destbox << endl;
m_queue.append(Queue(Queue::Move, origbox,
"UID COPY " + QString::number(uid) + " \"" + destbox+ "\""));
addFlag(uid, origbox, "\\Deleted");
--- trunk/playground/pim/mailody/src/mainwindow.cpp #604700:604701
@@ -482,8 +482,9 @@
const QStringList& values)
{
slotUpdateStatusBar(i18n("Opening %1").arg(mailbox));
- //kdDebug() << "SlotAddHeaderList called " << mailbox
- // << " msg: " << values.count() << endl;
+ // kdDebug() << "SlotAddHeaderList called " << mailbox
+ // << " msg: " << values.count()
+ // << " time" << QDateTime::currentDateTime() << endl;
MailBoxListViewItem* mbi =
static_cast<MailBoxListViewItem*>(m_mailboxList->currentItem());
@@ -503,6 +504,9 @@
QString headers = (*it);
++it;
+ QString flags = (*it);
+ ++it;
+
HeaderListViewItem* exists = m_headerMap[uid];
if (!exists || mbi->fullName() == "All")
{
@@ -514,7 +518,7 @@
{
exists = new HeaderListViewItem(threadTo, r);
// if this is a new item, make the parents open....
- if (r->isNew())
+ if (!flags.contains("\\Seen"))
{
while (threadTo)
{
@@ -532,6 +536,8 @@
if (!m_headerList->selectedItems().count())
m_headerList->ensureItemVisible( m_headerList->lastItem());
+ // kdDebug() << "done time" << QDateTime::currentDateTime() << endl;
+
m_searchLine->searchLine()->updateSearch();
slotClearStatusBar();
}
@@ -572,6 +578,7 @@
QListViewItem* item = m_mailboxList->currentItem();
//kdDebug() << "slotCheckMailBox:" << item->text(0) << endl;
slotOpenMailBox( item );
+ m_tooltip->addToBlockList( ((MailBoxListViewItem*)item)->fullName() );
if (item != m_searchMailBox)
m_connection->checkMailBox( retrieveMailboxName(item) );
@@ -956,7 +963,7 @@
if (KNotifyClient::getPresentation("newmail") &
KNotifyClient::PassivePopup)
- m_tooltip->setText(t);
+ m_tooltip->setText(mb->fullName(), t);
else
KNotifyClient::event(winId(), "newmail", t);
}
@@ -1119,6 +1126,7 @@
{
m_connection->addFlag(mb->fullName(), "\\Seen");
m_headerList->triggerUpdate();
+ mb->updateUnseen(0);
}
}
@@ -1138,8 +1146,7 @@
QString destbox = i->fullName();
QString text;
- if ( QTextDrag::decode( e, text ) )
- kdDebug() << text << " dropped on " << destbox << endl;
+ QTextDrag::decode( e, text );
QStringList movable = QStringList::split("\n", text);
QStringList::Iterator it = movable.begin();
QMap<QString, bool> origBoxesUsed;
--- trunk/playground/pim/mailody/src/messagedata.h #604700:604701
@@ -150,7 +150,7 @@
/** Returns a QString with the date, which you can use to
present to the user */
QString vDate() const {
- return KGlobal::locale()->formatDateTime(m_date, false); }
+ return KGlobal::locale()->formatDateTime(m_date, true); }
/**
* Returns the name of the sender, including the emailaddress
--- trunk/playground/pim/mailody/src/tooltip.cpp #604700:604701
@@ -22,6 +22,7 @@
#include <qlabel.h>
#include <qpixmap.h>
#include <qvbox.h>
+#include <qtimer.h>
#include <qapplication.h>
#include <kapplication.h>
@@ -55,14 +56,31 @@
mText = new QLabel( vbox );
setView( hbox );
+
+ m_clearTimer = new QTimer( this );
+ connect( m_clearTimer , SIGNAL(timeout()), SLOT(clearBlockList()) );
}
ToolTip::~ToolTip()
{
}
-void ToolTip::setText( const QString &text )
+void ToolTip::addToBlockList(const QString& mb)
{
+ m_blockList[mb] = true;
+ m_clearTimer->start(10000, true);
+}
+
+void ToolTip::clearBlockList()
+{
+ m_blockList.clear();
+}
+
+void ToolTip::setText( const QString &mb, const QString& text)
+{
+ if (m_blockList[mb])
+ return;
+
if (isVisible())
mText->setText( mText->text() + " \n" + text );
else
--- trunk/playground/pim/mailody/src/tooltip.h #604700:604701
@@ -34,17 +34,37 @@
*/
class ToolTip : public KPassivePopup
{
- Q_OBJECT
- public:
- ToolTip( QWidget *parent = 0, const char *name = 0 );
- ~ToolTip();
+ Q_OBJECT
+ public:
+ /**
+ * Constructor
+ */
+ ToolTip( QWidget *parent = 0, const char *name = 0 );
- public slots:
- /** Sets the tooltip to @param text */
- void setText( const QString &text);
+ /**
+ * Destruction
+ */
+ ~ToolTip();
- private:
- QLabel *mText;
+ /**
+ * Adds this mb to the blocklist. It will not popup for 10 seconds.
+ */
+ void addToBlockList(const QString& mb);
+
+ public slots:
+ /**
+ * Sets the tooltip to display @p text text
+ * But not when @p mb is on the block list
+ */
+ void setText( const QString &mb, const QString &text);
+
+ private:
+ QLabel *mText;
+ QTimer* m_clearTimer;
+ QMap<QString, bool> m_blockList;
+
+ private slots:
+ void clearBlockList();
};
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic