typo found by Andrey Cherepanov
[kdepim.git] / akonadiconsole / connectionpage.cpp
blob2cae514adbcb100f11900fa03d1e6c675d00292d
1 /*
2 This file is part of Akonadi.
4 Copyright (c) 2006 Tobias Koenig <tokoe@kde.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19 USA.
22 #include "connectionpage.h"
24 #include <KGlobalSettings>
26 #include <QtGui/QTextEdit>
27 #include <QtGui/QVBoxLayout>
29 #include "tracernotificationinterface.h"
31 ConnectionPage::ConnectionPage( const QString &identifier, QWidget *parent )
32 : QWidget( parent ), mIdentifier( identifier ), mShowAllConnections( false )
34 QVBoxLayout *layout = new QVBoxLayout( this );
36 mDataView = new QTextEdit( this );
37 mDataView->setReadOnly( true );
38 mDataView->setFont( KGlobalSettings::fixedFont() );
40 layout->addWidget( mDataView );
42 org::freedesktop::Akonadi::TracerNotification *iface = new org::freedesktop::Akonadi::TracerNotification( QString(), "/tracing/notifications", QDBusConnection::sessionBus(), this );
44 connect( iface, SIGNAL( connectionDataInput( const QString&, const QString& ) ),
45 this, SLOT( connectionDataInput( const QString&, const QString& ) ) );
46 connect( iface, SIGNAL( connectionDataOutput( const QString&, const QString& ) ),
47 this, SLOT( connectionDataOutput( const QString&, const QString& ) ) );
50 void ConnectionPage::connectionDataInput( const QString &identifier, const QString &msg )
52 QString str;
53 if ( mShowAllConnections ) {
54 str += identifier + ' ';
56 if ( mShowAllConnections || identifier == mIdentifier ) {
57 str += QString( "<font color=\"red\">%1</font>" ).arg( Qt::escape( msg ) );
58 mDataView->append( str );
62 void ConnectionPage::connectionDataOutput( const QString &identifier, const QString &msg )
64 QString str;
65 if ( mShowAllConnections ) {
66 str += identifier + ' ';
68 if ( mShowAllConnections || identifier == mIdentifier ) {
69 str += QString( "<font color=\"blue\">%1</font>" ).arg( Qt::escape( msg ) );
70 mDataView->append( str );
74 void ConnectionPage::showAllConnections( bool show )
76 mShowAllConnections = show;
79 void ConnectionPage::clear()
81 mDataView->clear();
84 #include "connectionpage.moc"