[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepimlibs/kpimidentities
From: Allen Winter <winter () kde ! org>
Date: 2007-06-30 21:49:21
Message-ID: 1183240161.777894.28140.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 681933 by winterz:
add a dpointer (which is unused)
cleanup some code style
add a bit of apidox
M +50 -22 identitycombo.cpp
M +71 -59 identitycombo.h
--- trunk/KDE/kdepimlibs/kpimidentities/identitycombo.cpp #681932:681933
@@ -1,23 +1,32 @@
/*
- Copyright (c) 2002 Marc Mutz <mutz@kde.org>
+ Copyright (c) 2002 Marc Mutz <mutz@kde.org>
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published by
- the Free Software Foundation; either version 2 of the License, or (at your
- option) any later version.
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
- This library is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
- License for more details.
+ This library is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+ License for more details.
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
*/
+/**
+ @file
+ This file is part of the API for handling user identities and defines the
+ IdentityCombo class.
+ @brief
+ A combo box that always shows the up-to-date identity list.
+ @author Marc Mutz \<mutz@kde.org\>
+ */
+
#include "identitycombo.h"
#include "identity.h"
#include "identitymanager.h"
@@ -28,16 +37,31 @@
using namespace KPIMIdentities;
+/**
+ Private class that helps to provide binary compatibility between releases.
+ @internal
+*/
+//@cond PRIVATE
+class KPIMIdentities::IdentityCombo::Private
+{
+};
+//@endcond
+
IdentityCombo::IdentityCombo( IdentityManager* manager, QWidget * parent )
- : QComboBox( parent ), mIdentityManager( manager )
+ : QComboBox( parent ), mIdentityManager( manager ), d( 0 )
{
reloadCombo();
reloadUoidList();
connect( this, SIGNAL(activated(int)), SLOT(slotEmitChanged(int)) );
connect( manager, SIGNAL(changed()),
- SLOT(slotIdentityManagerChanged()) );
+ SLOT(slotIdentityManagerChanged()) );
}
+IdentityCombo::~IdentityCombo()
+{
+ delete d;
+}
+
QString IdentityCombo::currentIdentityName() const
{
return mIdentityManager->identities()[ currentIndex() ];
@@ -56,8 +80,9 @@
void IdentityCombo::setCurrentIdentity( const QString & name )
{
int idx = mIdentityManager->identities().indexOf( name );
- if ( idx < 0 ) return;
- if ( idx == currentIndex() ) return;
+ if ( ( idx < 0 ) || ( idx == currentIndex() ) ) {
+ return;
+ }
blockSignals( true ); // just in case Qt gets fixed to emit activated() here
setCurrentIndex( idx );
@@ -69,8 +94,9 @@
void IdentityCombo::setCurrentIdentity( uint uoid )
{
int idx = mUoidList.indexOf( uoid );
- if ( idx < 0 ) return;
- if ( idx == currentIndex() ) return;
+ if ( ( idx < 0 ) || ( idx == currentIndex() ) ) {
+ return;
+ }
blockSignals( true ); // just in case Qt gets fixed to emit activated() here
setCurrentIndex( idx );
@@ -84,7 +110,7 @@
QStringList identities = mIdentityManager->identities();
// the IM should prevent this from happening:
assert( !identities.isEmpty() );
- identities.first() = i18n("%1 (Default)", identities.first() );
+ identities.first() = i18n( "%1 (Default)", identities.first() );
clear();
addItems( identities );
}
@@ -93,8 +119,9 @@
{
mUoidList.clear();
IdentityManager::ConstIterator it;
- for ( it = mIdentityManager->begin() ; it != mIdentityManager->end() ; ++it )
+ for ( it = mIdentityManager->begin(); it != mIdentityManager->end(); ++it ) {
mUoidList << (*it).uoid();
+ }
}
void IdentityCombo::slotIdentityManagerChanged()
@@ -109,9 +136,10 @@
setCurrentIndex( idx < 0 ? 0 : idx );
blockSignals( false );
- if ( idx < 0 )
+ if ( idx < 0 ) {
// apparently our oldIdentity got deleted:
slotEmitChanged( currentIndex() );
+ }
}
void IdentityCombo::slotEmitChanged( int idx )
--- trunk/KDE/kdepimlibs/kpimidentities/identitycombo.h #681932:681933
@@ -1,28 +1,38 @@
/*
- Copyright (c) 2002 Marc Mutz <mutz@kde.org>
+ Copyright (c) 2002 Marc Mutz <mutz@kde.org>
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published by
- the Free Software Foundation; either version 2 of the License, or (at your
- option) any later version.
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
- This library is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
- License for more details.
+ This library is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+ License for more details.
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
*/
+/**
+ @file
+ This file is part of the API for handling user identities and defines the
+ IdentityCombo class.
-#ifndef _KPIM_IDENTITYCOMBO_H_
-#define _KPIM_IDENTITYCOMBO_H_
+ @brief
+ A combo box that always shows the up-to-date identity list.
-#include <QComboBox>
-#include <kpimidentities/libkpimidentities_export.h>
+ @author Marc Mutz \<mutz@kde.org\>
+ */
+#ifndef KPIMIDENTITIES_IDENTITYCOMBO_H
+#define KPIMIDENTITIES_IDENTITYCOMBO_H
+
+#include "libkpimidentities_export.h"
+#include <QtGui/QComboBox>
+
class QString;
namespace KPIMIdentities {
@@ -30,57 +40,59 @@
class IdentityManager;
class Identity;
-/**
- * @short A combo box that always shows the up-to-date identity list.
- * @author Marc Mutz <mutz@kde.org>
- **/
-
class KPIMIDENTITIES_EXPORT IdentityCombo : public QComboBox {
Q_OBJECT
-public:
- explicit IdentityCombo( IdentityManager* manager, QWidget * parent=0 );
+ public:
+ explicit IdentityCombo( IdentityManager *manager, QWidget *parent=0 );
- QString currentIdentityName() const;
- uint currentIdentity() const;
- void setCurrentIdentity( const QString & identityName );
- void setCurrentIdentity( const Identity & identity );
- void setCurrentIdentity( uint uoid );
+ ~IdentityCombo();
+ QString currentIdentityName() const;
+ uint currentIdentity() const;
+ void setCurrentIdentity( const QString &identityName );
+ void setCurrentIdentity( const Identity &identity );
+ void setCurrentIdentity( uint uoid );
-signals:
- /** @deprecated
- * @em Really emitted whenever the current identity changes. Either
- * by user intervention or on setCurrentIdentity() or if the
- * current identity disappears.
- **/
- void identityChanged( const QString & identityName );
+ Q_SIGNALS:
+ /**
+ @deprecated
+ @em Really emitted whenever the current identity changes. Either
+ by user intervention or on setCurrentIdentity() or if the
+ current identity disappears.
+ */
+ void identityChanged( const QString &identityName );
- /** @em Really emitted whenever the current identity changes. Either
- * by user intervention or on setCurrentIdentity() or if the
- * current identity disappears.
- *
- * You might also want to listen to IdentityManager::changed,
- * IdentityManager::deleted and IdentityManager::added.
- **/
- void identityChanged( uint uoid );
+ /**
+ @em Really emitted whenever the current identity changes. Either
+ by user intervention or on setCurrentIdentity() or if the
+ current identity disappears.
-public slots:
- /** Connected to IdentityManager::changed(). Reloads the list
- * of identities.
- **/
- void slotIdentityManagerChanged();
+ You might also want to listen to IdentityManager::changed,
+ IdentityManager::deleted and IdentityManager::added.
+ */
+ void identityChanged( uint uoid );
-protected slots:
- void slotEmitChanged(int);
+ public Q_SLOTS:
+ /**
+ Connected to IdentityManager::changed(). Reloads the list of identities.
+ */
+ void slotIdentityManagerChanged();
-protected:
- void reloadCombo();
- void reloadUoidList();
+ protected Q_SLOTS:
+ void slotEmitChanged(int);
-protected:
- QList<uint> mUoidList;
- IdentityManager* mIdentityManager;
+ protected:
+ void reloadCombo();
+ void reloadUoidList();
+ QList<uint> mUoidList;
+ IdentityManager *mIdentityManager;
+
+ private:
+ //@cond PRIVATE
+ class Private;
+ Private *const d;
+ //@endcond
};
-} // namespace
+}
-#endif // _KPIM_IDENTITYCOMBO_H_
+#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic