[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/pim/mailody/src
From: Tom Albers <tomalbers () kde ! nl>
Date: 2007-02-28 23:15:50
Message-ID: 1172704550.983371.28200.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 638141 by toma:
A disconnect was commented out and one was wrong, resulting in to multiple redraws of \
the message, when switching 10 times between two messages, you would actually start \
to notice the delay. Fixed that. Also fixed the ugly, ugly, ugly draw error on the \
first few messages!!!
M +4 -8 messagedata.cpp
M +81 -76 messageview.cpp
--- trunk/playground/pim/mailody/src/messagedata.cpp #638140:638141
@@ -89,8 +89,6 @@
void MessageData::initialise_rest()
{
- //kdDebug() << k_funcinfo << endl;
-
m_initialized_all = true;
if (m_headers.isEmpty())
@@ -163,16 +161,14 @@
void MessageData::slotBodyReady(const QString& mb, int uid, const QString& body)
{
+ disconnect(m_datamanager,
+ SIGNAL(message(const QString&, int, const QString&)),
+ this, SLOT(slotBodyReady(const QString&, int, const QString&)));
+
if (m_mb != mb || uid != m_uid)
return;
m_attachments.clear();
-
- /*
- Imap* t = Imap::instance();
- disconnect(t, SIGNAL(bodyAvailable(const QString&, int)),
- this, SLOT(slotBodyReady(const QString&, int)));
-*/
m_datamanager->addFlag(m_mb, m_uid, "\\Seen");
Message* m = new Message();
--- trunk/playground/pim/mailody/src/messageview.cpp #638140:638141
@@ -155,6 +155,7 @@
: QScrollView( parent ),
m_currentMessage(0)
{
+ hide();
QHBox* big_box = new QHBox(viewport());
addChild(big_box);
@@ -163,7 +164,6 @@
setHScrollBarMode(QScrollView::AlwaysOff);
m_label = new AddressLabel(big_box);
m_foto = new KActiveLabel(big_box);
- clearView();
connect(m_label, SIGNAL(leftClicked(const QString&)),
SLOT(slotLeftMouseClick(const QString&)));
@@ -184,15 +184,8 @@
m_currentMessage = msg;
setContentsPos(0,0);
- if (msg)
- {
+ if (msg && isHidden())
show(); // can be hidden by favorite website / middle click.
- m_label->setDefaultWidth(viewport()->width());
- m_label->setText("<table width=\"100%\" height=\"100%\">"
- "<tr height=\"100%\"><td width=\"100%\"> </td></tr></table>");
-
- }
-
}
}
@@ -391,6 +384,7 @@
m_label->setDefaultWidth(viewport()->width()-60);
// find out the height
+ m_label->adjustSize(); // this call is crucial to get the correct height
int h = m_label->height()+1;
if (h > 100)
h = 100;
@@ -560,12 +554,23 @@
{
if (msg != m_currentMessage)
{
+ // disconnect to prevent multiple connections!
+ if (m_currentMessage)
+ {
+ disconnect(m_currentMessage, SIGNAL(messageData(const MessageData*)),
+ this, SLOT(slotShowMsg(const MessageData*)));
+ disconnect(m_currentMessage, SIGNAL(addContent(const MessageData*,
+ const QString&, const QString&)),
+ this, SLOT(slotAddContent(const MessageData*, const QString&,
+ const QString&)));
+ }
+
m_currentMessage = msg;
+
connect(m_currentMessage, SIGNAL(messageData(const MessageData*)),
this, SLOT(slotShowMsg(const MessageData*)));
- connect(m_currentMessage,
- SIGNAL(addContent(const MessageData*, const QString&,
- const QString&)),
+ connect(m_currentMessage, SIGNAL(addContent(const MessageData*,
+ const QString&, const QString&)),
this, SLOT(slotAddContent(const MessageData*, const QString&,
const QString&)));
@@ -681,79 +686,79 @@
void MessageView::slotPopupMenu(const QString& url, const QPoint& point)
{
- QPopupMenu* p = new QPopupMenu(0);
+ QPopupMenu* p = new QPopupMenu(0);
- int add = -2;
- int copy = -2;
- int newmsg = -2;
- int newurl = -2;
- int newtab = -2;
+ int add = -2;
+ int copy = -2;
+ int newmsg = -2;
+ int newurl = -2;
+ int newtab = -2;
- if (url.startsWith("mailto:"))
- {
- newmsg = p->insertItem(KGlobal::iconLoader()->loadIcon(
- "email",KIcon::Small),
- i18n("New Message to") + "...");
- add = p->insertItem(KGlobal::iconLoader()->loadIcon(
- "kaddressbook",KIcon::Small),
- i18n("Add to KDE Addressbook") + "...");
- }
- else if (!url.isNull())
- {
- newurl = p->insertItem(i18n("Open"));
- newtab = p->insertItem(i18n("Open in New Tab"));
- }
+ if (url.startsWith("mailto:"))
+ {
+ newmsg = p->insertItem(KGlobal::iconLoader()->loadIcon(
+ "email",KIcon::Small),
+ i18n("New Message to") + "...");
+ add = p->insertItem(KGlobal::iconLoader()->loadIcon(
+ "kaddressbook",KIcon::Small),
+ i18n("Add to KDE Addressbook") + "...");
+ }
+ else if (!url.isNull())
+ {
+ newurl = p->insertItem(i18n("Open"));
+ newtab = p->insertItem(i18n("Open in New Tab"));
+ }
+ p->insertSeparator();
+
+ if ( hasSelection() || !url.isNull() )
+ {
+ copy = p->insertItem(KGlobal::iconLoader()->loadIcon(
+ "editcopy",KIcon::Small), i18n("Copy"));
p->insertSeparator();
+ }
+ int zoomin = p->insertItem(KGlobal::iconLoader()->loadIcon(
+ "viewmag+",KIcon::Small),i18n("Zoom in"));
+ int zoomout = p->insertItem(KGlobal::iconLoader()->loadIcon(
+ "viewmag-",KIcon::Small),i18n("Zoom out"));
+ int choice = p->exec(point);
- if ( hasSelection() || !url.isNull() )
- {
- copy = p->insertItem(KGlobal::iconLoader()->loadIcon(
- "editcopy",KIcon::Small), i18n("Copy"));
- p->insertSeparator();
- }
- int zoomin = p->insertItem(KGlobal::iconLoader()->loadIcon(
- "viewmag+",KIcon::Small),i18n("Zoom in"));
- int zoomout = p->insertItem(KGlobal::iconLoader()->loadIcon(
- "viewmag-",KIcon::Small),i18n("Zoom out"));
- int choice = p->exec(point);
+ if (choice == copy)
+ {
+ QClipboard *cb = QApplication::clipboard();
- if (choice == copy)
+ if (hasSelection())
{
- QClipboard *cb = QApplication::clipboard();
-
- if (hasSelection())
- {
- cb->setText(selectedText(), QClipboard::Clipboard);
- }
- else if (url.startsWith("mailto:"))
- cb->setText(url.mid(7), QClipboard::Clipboard);
- else
- cb->setText(url, QClipboard::Clipboard);
+ cb->setText(selectedText(), QClipboard::Clipboard);
}
- else if (choice == newmsg)
- {
- QString box;
- if (m_currentMessage)
- box = m_currentMessage->mb();
- else
- box = "INBOX";
- emit openComposer(url.mid(7), box);
- }
- else if (choice == newurl)
- kapp->invokeBrowser(url);
- else if (choice == add)
- {
- Addressbook::instance()->add(url.mid(7));
- }
- else if (choice == newtab)
- emit openInTab(url);
- else if (choice == zoomin)
- setZoomFactor(zoomFactor()+10);
- else if (choice == zoomout)
- setZoomFactor(zoomFactor()-10);
+ else if (url.startsWith("mailto:"))
+ cb->setText(url.mid(7), QClipboard::Clipboard);
+ else
+ cb->setText(url, QClipboard::Clipboard);
+ }
+ else if (choice == newmsg)
+ {
+ QString box;
+ if (m_currentMessage)
+ box = m_currentMessage->mb();
+ else
+ box = "INBOX";
+ emit openComposer(url.mid(7), box);
+ }
+ else if (choice == newurl)
+ kapp->invokeBrowser(url);
+ else if (choice == add)
+ {
+ Addressbook::instance()->add(url.mid(7));
+ }
+ else if (choice == newtab)
+ emit openInTab(url);
+ else if (choice == zoomin)
+ setZoomFactor(zoomFactor()+10);
+ else if (choice == zoomout)
+ setZoomFactor(zoomFactor()-10);
- delete p;
+ delete p;
}
void MessageView::clearView()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic