Commit 6ee36d99 authored by Daniel Molkentin's avatar Daniel Molkentin
Browse files

- first attempt towards statusbar support for summary widgets

- set focus policy for summary widget

svn path=/trunk/kdepim/; revision=260887
parent ce835907
......@@ -59,3 +59,5 @@ QWidget* Summary::createHeader(QWidget *parent, const QPixmap& icon, const QStri
return hbox;
}
#include "summary.moc"
......@@ -24,6 +24,8 @@
#include <qwidget.h>
#include <qpixmap.h>
class KStatusBar;
namespace Kontact
{
......@@ -32,6 +34,7 @@ namespace Kontact
*/
class Summary : public QWidget
{
Q_OBJECT
public:
Summary( QWidget *parent, const char *name = 0 );
......@@ -49,7 +52,11 @@ class Summary : public QWidget
*/
QWidget* createHeader(QWidget* parent, const QPixmap& icon, const QString& heading);
signals:
void message(const QString& message);
private:
KStatusBar *mStatusBar;
class Private;
Private *d;
};
......
......@@ -189,6 +189,7 @@ void KABSummaryWidget::updateView()
mLabels.append( label );
KURLLabel *urlLabel = new KURLLabel( this );
urlLabel->installEventFilter(this);
urlLabel->setURL( (*addrIt).addressee.uid() );
urlLabel->setText( (*addrIt).addressee.formattedName() );
mLayout->addWidget( urlLabel, counter, 3 );
......@@ -274,4 +275,18 @@ void KABSummaryWidget::popupMenu( const QString &uid )
}
}
bool KABSummaryWidget::eventFilter(QObject *obj, QEvent* e)
{
if (obj->inherits("KURLLabel"))
{
KURLLabel* label = static_cast<KURLLabel*>(obj);
if (e->type() == QEvent::Enter)
emit message(i18n("Mail to %1").arg(label->text()));
if (e->type() == QEvent::Leave)
emit message(QString::null);
}
return Kontact::Summary::eventFilter(obj, e);
}
#include "kabsummarywidget.moc"
......@@ -44,6 +44,9 @@ class KABSummaryWidget : public Kontact::Summary
KABSummaryWidget( Kontact::Plugin *plugin, QWidget *parent,
const char *name = 0 );
protected:
virtual bool eventFilter(QObject *obj, QEvent* e);
private slots:
void updateView();
void popupMenu( const QString &uid );
......
......@@ -45,7 +45,7 @@ SummaryWidget::SummaryWidget( Kontact::Plugin *plugin, QWidget *parent, const ch
QPixmap icon = KGlobal::iconLoader()->loadIcon( "kmail", KIcon::Desktop, KIcon::SizeMedium);
QWidget *header = createHeader(this, icon, i18n("Messages"));
mLayout = new QGridLayout( 6, 3, 3 );
mLayout = new QGridLayout( 1, 3, 3 );
mainLayout->addWidget(header);
mainLayout->addLayout(mLayout);
......
......@@ -44,7 +44,7 @@ class SummaryWidget : public Kontact::Summary
public:
SummaryWidget( Kontact::Plugin *plugin, QWidget *parent, const char *name = 0 );
int summaryHeight() const { return 3; }
int summaryHeight() const { return 1; }
private slots:
void timeout();
......
......@@ -32,9 +32,13 @@
#include <kdialog.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kparts/componentfactory.h>
#include <kservice.h>
#include <ktrader.h>
#include <kstandarddirs.h>
#include <kstatusbar.h>
#include <kparts/componentfactory.h>
#include <kparts/statusbarextension.h>
#include <infoextension.h>
#include <sidebarextension.h>
......@@ -54,9 +58,11 @@ SummaryViewPart::SummaryViewPart( Kontact::Core *core, const char *widgetName,
: KParts::ReadOnlyPart( parent, name ),
mCore( core )
{
mStatusExt = new KParts::StatusBarExtension( this );
setInstance( new KInstance( "kontactsummary" ) ); // ## memleak
mFrame = new QFrame( core, widgetName );
mFrame->setFocusPolicy( QWidget::StrongFocus );
mFrame->setFrameStyle( QFrame::Panel | QFrame::Sunken );
connect(kapp, SIGNAL(kdisplayPaletteChanged()), SLOT(slotAdjustPalette()));
slotAdjustPalette();
......@@ -103,6 +109,8 @@ void SummaryViewPart::getWidgets()
<< endl;
if ( h ) {
totalHeight += s->summaryHeight();
connect(s, SIGNAL(message(const QString&)),
mStatusExt->statusBar(), SLOT(message(const QString&)));
summaries.append( s );
} else {
s->hide();
......
......@@ -2,6 +2,7 @@
This file is part of KDE Kontact.
Copyright (C) 2003 Sven Lppken <sven@kde.org>
Copyright (C) 2003 Daniel Molkentin <molkentin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
......@@ -31,6 +32,11 @@ namespace Kontact
class Plugin;
}
namespace KParts
{
class StatusBarExtension;
}
class QFrame;
class QGridLayout;
......@@ -55,6 +61,7 @@ class SummaryViewPart : public KParts::ReadOnlyPart
void getWidgets();
private:
KParts::StatusBarExtension *mStatusExt;
QGridLayout *mLayout;
QFrame *mFrame;
Kontact::Core *mCore;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment