Commit fd89942e authored by Guy Maurel's avatar Guy Maurel

Coding Style

REVIEWS: 120321 120322
parent d9878600
......@@ -24,13 +24,11 @@
#include <QWidget>
namespace KABC
{
namespace KABC {
class Addressee;
}
namespace Akonadi
{
namespace Akonadi {
class ContactMetaData;
......@@ -50,7 +48,9 @@ public:
/**
* Destroys the abstract contact editor widget.
*/
~AbstractContactEditorWidget() { }
~AbstractContactEditorWidget()
{
}
/**
* @param contact loads the given contact into the editor widget
......
......@@ -45,14 +45,14 @@ class Item;
*/
class AKONADI_CONTACT_EXPORT AbstractContactFormatter
{
public:
public:
/**
* Describes the form of the HTML that is created.
*/
enum HtmlForm {
SelfcontainedForm, ///< Creates a complete HTML document
EmbeddableForm, ///< Creates a div HTML element that can be embedded.
UserForm = SelfcontainedForm + 42 ///< Point for extension
SelfcontainedForm, ///< Creates a complete HTML document
EmbeddableForm, ///< Creates a div HTML element that can be embedded.
UserForm = SelfcontainedForm + 42 ///< Point for extension
};
/**
......@@ -69,7 +69,7 @@ class AKONADI_CONTACT_EXPORT AbstractContactFormatter
* Sets the @p contact that will be formatted.
* @param contact contact to be formatted
*/
void setContact( const KABC::Addressee &contact );
void setContact(const KABC::Addressee &contact);
/**
* Returns the contact that will be formatted.
......@@ -82,7 +82,7 @@ class AKONADI_CONTACT_EXPORT AbstractContactFormatter
* @note The payload must be a valid KABC::Addressee object.
* @param item item, who's payload will be formatted.
*/
void setItem( const Akonadi::Item &item );
void setItem(const Akonadi::Item &item);
/**
* Returns the item who's payload will be formatted.
......@@ -107,7 +107,7 @@ class AKONADI_CONTACT_EXPORT AbstractContactFormatter
*
* @param descriptions list with field descriptions
*/
void setCustomFieldDescriptions( const QList<QVariantMap> &descriptions );
void setCustomFieldDescriptions(const QList<QVariantMap> &descriptions);
/**
* Returns the custom field descriptions that will be used.
......@@ -119,14 +119,14 @@ class AKONADI_CONTACT_EXPORT AbstractContactFormatter
* according to the requested @p form.
* @param form how to render the contact into HTML
*/
virtual QString toHtml( HtmlForm form = SelfcontainedForm ) const = 0;
virtual QString toHtml(HtmlForm form = SelfcontainedForm) const = 0;
private:
private:
//@cond PRIVATE
Q_DISABLE_COPY( AbstractContactFormatter )
Q_DISABLE_COPY(AbstractContactFormatter)
class Private;
Private* const d;
Private *const d;
//@endcond
};
......
......@@ -45,14 +45,14 @@ class Item;
*/
class AKONADI_CONTACT_EXPORT AbstractContactGroupFormatter
{
public:
public:
/**
* Describes the form of the HTML that is created.
*/
enum HtmlForm {
SelfcontainedForm, ///< Creates a complete HTML document
EmbeddableForm, ///< Creates a div HTML element that can be embedded.
UserForm = SelfcontainedForm + 42 ///< Point for extension
SelfcontainedForm, ///< Creates a complete HTML document
EmbeddableForm, ///< Creates a div HTML element that can be embedded.
UserForm = SelfcontainedForm + 42 ///< Point for extension
};
/**
......@@ -68,7 +68,7 @@ class AKONADI_CONTACT_EXPORT AbstractContactGroupFormatter
/**
* Sets the contact @p group that will be formatted.
*/
void setContactGroup( const KABC::ContactGroup &group );
void setContactGroup(const KABC::ContactGroup &group);
/**
* Returns the contact group that will be formatted.
......@@ -82,7 +82,7 @@ class AKONADI_CONTACT_EXPORT AbstractContactGroupFormatter
*
* @param item item, who's payload will be formatted.
*/
void setItem( const Akonadi::Item &item );
void setItem(const Akonadi::Item &item);
/**
* Returns the item who's payload will be formatted.
......@@ -100,7 +100,7 @@ class AKONADI_CONTACT_EXPORT AbstractContactGroupFormatter
*
* @param fields additional fields that will be shown
*/
void setAdditionalFields( const QList<QVariantMap> &fields );
void setAdditionalFields(const QList<QVariantMap> &fields);
/**
* Returns the additional fields that will be shown.
......@@ -111,14 +111,14 @@ class AKONADI_CONTACT_EXPORT AbstractContactGroupFormatter
* This method must be reimplemented to return the contact group formatted as HTML
* according to the requested @p form.
*/
virtual QString toHtml( HtmlForm form = SelfcontainedForm ) const = 0;
virtual QString toHtml(HtmlForm form = SelfcontainedForm) const = 0;
private:
private:
//@cond PRIVATE
Q_DISABLE_COPY( AbstractContactGroupFormatter )
Q_DISABLE_COPY(AbstractContactGroupFormatter)
class Private;
Private* const d;
Private *const d;
//@endcond
};
......
......@@ -125,4 +125,3 @@ bool QEkigaDialer::sendSms(const QString &number, const QString &text)
mErrorMessage = i18n("Sending an SMS is currently not supported on Ekiga.");
return false;
}
......@@ -66,11 +66,11 @@ void SmsDialog::initUI()
connect(mSmsTextEdit, &KTextEdit::textChanged, this, &SmsDialog::updateCounter);
mLengthLabel = new QLabel(QStringLiteral("-") , this);
mLengthLabel = new QLabel(QStringLiteral("-"), this);
topLayout->addWidget(mLengthLabel);
mSmsTextEdit->setFocus();
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
......
......@@ -33,13 +33,33 @@
template <class T>
class AutoQPointer : public QPointer<T>
{
public:
inline AutoQPointer() : QPointer<T>() {}
inline AutoQPointer(T* p) : QPointer<T>(p) {}
inline AutoQPointer(const QPointer<T>& p) : QPointer<T>(p) {}
inline ~AutoQPointer() { delete this->data(); }
inline AutoQPointer<T>& operator=(const AutoQPointer<T>& p) { QPointer<T>::operator=(p); return *this; }
inline AutoQPointer<T>& operator=(T* p) { QPointer<T>::operator=(p); return *this; }
public:
inline AutoQPointer()
: QPointer<T>()
{
}
inline AutoQPointer(T *p)
: QPointer<T>(p)
{
}
inline AutoQPointer(const QPointer<T> &p)
: QPointer<T>(p)
{
}
inline ~AutoQPointer()
{
delete this->data();
}
inline AutoQPointer<T> &operator=(const AutoQPointer<T> &p)
{
QPointer<T>::operator=(p);
return *this;
}
inline AutoQPointer<T> &operator=(T *p)
{
QPointer<T>::operator=(p);
return *this;
}
};
#endif // AUTOQPOINTER_H
......@@ -38,15 +38,15 @@
*/
class CollectionFilterModel : public QSortFilterProxyModel
{
Q_OBJECT
Q_OBJECT
public:
public:
/**
* Creates a new collection filter model.
*
* @param parent The parent object.
*/
explicit CollectionFilterModel( QObject *parent );
explicit CollectionFilterModel(QObject *parent);
/**
* Adds a mime type to the content mime type filter list.
......@@ -57,7 +57,7 @@ class CollectionFilterModel : public QSortFilterProxyModel
*
* @param mimeType mime type content filter
*/
void addContentMimeTypeFilter( const QString &mimeType );
void addContentMimeTypeFilter(const QString &mimeType);
/**
* Sets the collection @p rights filter.
......@@ -67,12 +67,12 @@ class CollectionFilterModel : public QSortFilterProxyModel
*
* @param rights collection rights filter
*/
void setRightsFilter( Akonadi::Collection::Rights rights );
void setRightsFilter(Akonadi::Collection::Rights rights);
protected:
virtual bool filterAcceptsRow( int row, const QModelIndex &parent ) const;
protected:
virtual bool filterAcceptsRow(int row, const QModelIndex &parent) const;
private:
private:
QSet<QString> mContentMimeTypes;
Akonadi::Collection::Rights mRights;
};
......
......@@ -28,27 +28,27 @@ namespace Akonadi {
class ContactCompletionModel : public EntityTreeModel
{
Q_OBJECT
Q_OBJECT
public:
public:
enum Columns {
NameColumn, ///< The name of the contact.
NameAndEmailColumn, ///< The name and the email of the contact.
EmailColumn ///< The preferred email of the contact.
NameColumn, ///< The name of the contact.
NameAndEmailColumn, ///< The name and the email of the contact.
EmailColumn ///< The preferred email of the contact.
};
explicit ContactCompletionModel( ChangeRecorder *monitor, QObject *parent = 0 );
explicit ContactCompletionModel(ChangeRecorder *monitor, QObject *parent = 0);
virtual ~ContactCompletionModel();
virtual QVariant entityData( const Item &item, int column, int role = Qt::DisplayRole ) const;
virtual QVariant entityData( const Collection &collection, int column, int role = Qt::DisplayRole ) const;
virtual int columnCount( const QModelIndex &parent ) const;
virtual int entityColumnCount( HeaderGroup ) const;
virtual QVariant entityData(const Item &item, int column, int role = Qt::DisplayRole) const;
virtual QVariant entityData(const Collection &collection, int column, int role = Qt::DisplayRole) const;
virtual int columnCount(const QModelIndex &parent) const;
virtual int entityColumnCount(HeaderGroup) const;
static QAbstractItemModel* self();
static QAbstractItemModel *self();
private:
static QAbstractItemModel* mSelf;
private:
static QAbstractItemModel *mSelf;
};
}
......
......@@ -71,12 +71,12 @@ namespace Akonadi {
* actions->connectToView( viewer );
*
* // then remove the signle/slot connection you want to overwrite
* disconnect( viewer, SIGNAL( emailClicked( const QString&, const QString& ) ),
* actions, SLOT( sendEmail( const QString&, const QString& ) ) );
* disconnect( viewer, SIGNAL(emailClicked(QString,QString)),
* actions, SLOT(sendEmail(QString,QString)) );
*
* // connect to your custom implementation
* connect( viewer, SIGNAL( emailClicked( const QString&, const QString& ) ),
* this, SLOT( handleSpecial( const QString&, const QString& ) ) );
* connect( viewer, SIGNAL(emailClicked(QString,QString)),
* this, SLOT(handleSpecial(QString,QString)) );
*
* @endcode
*
......@@ -85,15 +85,15 @@ namespace Akonadi {
*/
class AKONADI_CONTACT_EXPORT ContactDefaultActions : public QObject
{
Q_OBJECT
Q_OBJECT
public:
public:
/**
* Creates a new contact default actions object.
*
* @param parent The parent object.
*/
ContactDefaultActions( QObject *parent = 0 );
ContactDefaultActions(QObject *parent = 0);
/**
* Destroys the contact default actions object.
......@@ -104,43 +104,43 @@ class AKONADI_CONTACT_EXPORT ContactDefaultActions : public QObject
* Tries to connect the well known signals of the @p view
* to the well known slots of this object.
*/
void connectToView( QObject *view );
void connectToView(QObject *view);
public Q_SLOTS:
public Q_SLOTS:
/**
* Shows the given @p url in the users preferred webbrowser.
*/
void showUrl( const QUrl &url );
void showUrl(const QUrl &url);
/**
* Opens the users preferred mail composer and does the setup
* to send a mail to the contact with the given @p name and
* email @p address.
*/
void sendEmail( const QString &name, const QString &address );
void sendEmail(const QString &name, const QString &address);
/**
* Dials the given phone @p number with the application as
* configured by the user in the general settings dialog.
*/
void dialPhoneNumber( const KABC::PhoneNumber &number );
void dialPhoneNumber(const KABC::PhoneNumber &number);
/**
* Sends a sms to @p number with the application as
* configured by the user in the general settings dialog.
*/
void sendSms( const KABC::PhoneNumber &number );
void sendSms(const KABC::PhoneNumber &number);
/**
* Shows the @p address of a contact in a webbrowser or application
* as configured by the user in the general settings dialog.
*/
void showAddress( const KABC::Address &address );
void showAddress(const KABC::Address &address);
private:
private:
//@cond PRIVATE
class Private;
Private* const d;
Private *const d;
//@endcond PRIVATE
};
......
......@@ -79,20 +79,20 @@ class Item;
*/
class AKONADI_CONTACT_EXPORT ContactEditor : public QWidget
{
Q_OBJECT
Q_OBJECT
public:
public:
/**
* Describes the mode of the editor.
*/
enum Mode {
CreateMode, ///< Creates a new contact
EditMode ///< Edits an existing contact
CreateMode, ///< Creates a new contact
EditMode ///< Edits an existing contact
};
enum DisplayMode {
FullMode, ///< Show all pages
VCardMode ///< Show just pages with elements stored in vcard.
FullMode, ///< Show all pages
VCardMode ///< Show just pages with elements stored in vcard.
};
/**
......@@ -101,7 +101,7 @@ class AKONADI_CONTACT_EXPORT ContactEditor : public QWidget
* @param mode The mode of the editor.
* @param parent The parent widget of the editor.
*/
explicit ContactEditor( Mode mode, QWidget *parent = 0 );
explicit ContactEditor(Mode mode, QWidget *parent = 0);
/**
* Creates a new contact editor with a custom editor widget.
......@@ -110,7 +110,7 @@ class AKONADI_CONTACT_EXPORT ContactEditor : public QWidget
* @param editorWidget The contact editor widget that shall be used for editing.
* @param parent The parent widget of the editor.
*/
ContactEditor( Mode mode, AbstractContactEditorWidget *editorWidget, QWidget *parent = 0 );
ContactEditor(Mode mode, AbstractContactEditorWidget *editorWidget, QWidget *parent = 0);
/**
* Creates a new contact editor dialog with a custom editor widget.
......@@ -120,7 +120,7 @@ class AKONADI_CONTACT_EXPORT ContactEditor : public QWidget
* @param parent The parent widget of the dialog.
* @since 4.10
*/
ContactEditor( Mode mode, DisplayMode displayMode, QWidget *parent = 0 );
ContactEditor(Mode mode, DisplayMode displayMode, QWidget *parent = 0);
/**
* Destroys the contact editor.
......@@ -132,13 +132,13 @@ class AKONADI_CONTACT_EXPORT ContactEditor : public QWidget
* The fields of the editor will be prefilled with the content of the contact.
* @param contact the contact to use as template content
*/
void setContactTemplate( const KABC::Addressee &contact );
void setContactTemplate(const KABC::Addressee &contact);
/**
* Sets the @p addressbook which shall be used to store new
* contacts.
*/
void setDefaultAddressBook( const Akonadi::Collection &addressbook );
void setDefaultAddressBook(const Akonadi::Collection &addressbook);
/**
* @since 4.10
......@@ -146,11 +146,11 @@ class AKONADI_CONTACT_EXPORT ContactEditor : public QWidget
* @return
*/
KABC::Addressee contact();
public Q_SLOTS:
public Q_SLOTS:
/**
* Loads the @p contact into the editor.
*/
void loadContact( const Akonadi::Item &contact );
void loadContact(const Akonadi::Item &contact);
/**
* Save the contact from the editor back to the storage. And return error.
......@@ -159,34 +159,34 @@ class AKONADI_CONTACT_EXPORT ContactEditor : public QWidget
*/
void saveContactInAddressBook();
Q_SIGNALS:
Q_SIGNALS:
/**
* This signal is emitted when the @p contact has been saved back
* to the storage.
*/
void contactStored( const Akonadi::Item &contact );
void contactStored(const Akonadi::Item &contact);
/**
* This signal is emitted when an error occurred during the save.
* @param errorMsg The error message.
* @since 4.11
*/
void error( const QString &errorMsg );
void error(const QString &errorMsg);
/**
* @brief finished
* @since 4.11
*/
void finished();
private:
private:
//@cond PRIVATE
class Private;
Private* const d;
Private *const d;
Q_PRIVATE_SLOT( d, void itemFetchDone( KJob* ) )
Q_PRIVATE_SLOT( d, void parentCollectionFetchDone( KJob* ) )
Q_PRIVATE_SLOT( d, void storeDone( KJob* ) )
Q_PRIVATE_SLOT( d, void itemChanged( const Akonadi::Item&, const QSet<QByteArray>& ) )
Q_PRIVATE_SLOT(d, void itemFetchDone(KJob *))
Q_PRIVATE_SLOT(d, void parentCollectionFetchDone(KJob *))
Q_PRIVATE_SLOT(d, void storeDone(KJob *))
Q_PRIVATE_SLOT(d, void itemChanged(const Akonadi::Item &, const QSet<QByteArray> &))
//@endcond
};
......
......@@ -26,7 +26,6 @@
#include <QDialog>
namespace Akonadi {
class AbstractContactEditorWidget;
......@@ -47,8 +46,8 @@ class Item;
* using namespace Akonadi;
*
* ContactEditorDialog *dlg = new ContactEditorDialog( ContactEditorDialog::CreateMode, this );
* connect( dlg, SIGNAL( contactStored( const Akonadi::Item& ) ),
* this, SLOT( contactStored( const Akonadi::Item& ) ) );
* connect( dlg, SIGNAL(contactStored(Akonadi::Item)),
* this, SLOT(contactStored(Akonadi::Item)) );
* dlg->show();
*
*
......@@ -63,8 +62,8 @@ class Item;
* const Item contact = ...;
*
* ContactEditorDialog *dlg = new ContactEditorDialog( ContactEditorDialog::EditMode, this );
* connect( dlg, SIGNAL( contactStored( const Akonadi::Item& ) ),
* this, SLOT( contactStored( const Akonadi::Item& ) ) );
* connect( dlg, SIGNAL(contactStored(Akonadi::Item)),
* this, SLOT(contactStored(Akonadi::Item)) );
* dlg->setContact( contact );
* dlg->show();
*
......@@ -75,20 +74,20 @@ class Item;
*/
class AKONADI_CONTACT_EXPORT ContactEditorDialog : public QDialog
{
Q_OBJECT
Q_OBJECT
public:
public:
/**
* Describes the mode of the editor dialog.
*/
enum Mode {
CreateMode, ///< Creates a new contact
EditMode ///< Edits an existing contact
CreateMode, ///< Creates a new contact
EditMode ///< Edits an existing contact
};
enum DisplayMode {
FullMode, //Show all pages
VCardMode //Show just pages with elements stored in vcard.
FullMode, //Show all pages
VCardMode //Show just pages with elements stored in vcard.
};
/**
......@@ -97,7 +96,7 @@ class AKONADI_CONTACT_EXPORT ContactEditorDialog : public QDialog
* @param mode The mode of the dialog.
* @param parent The parent widget of the dialog.
*/
explicit ContactEditorDialog( Mode mode, QWidget *parent = 0 );
explicit ContactEditorDialog(Mode mode, QWidget *parent = 0);
/**
* Creates a new contact editor dialog with a custom editor widget.
......@@ -106,7 +105,7 @@ class AKONADI_CONTACT_EXPORT ContactEditorDialog : public QDialog
* @param editorWidget The contact editor widget that shall be used for editing.
* @param parent The parent widget of the dialog.
*/
ContactEditorDialog( Mode mode, AbstractContactEditorWidget *editorWidget, QWidget *parent = 0 );
ContactEditorDialog(Mode mode, AbstractContactEditorWidget *editorWidget, QWidget *parent = 0);
/**
* Creates a new contact editor dialog with a custom editor widget.
......@@ -116,7 +115,7 @@ class AKONADI_CONTACT_EXPORT ContactEditorDialog : public QDialog
* @param parent The parent widget of the dialog.
* @since 4.10
*/
ContactEditorDialog( Mode mode, DisplayMode displayMode, QWidget *parent = 0 );
ContactEditorDialog(Mode mode, DisplayMode displayMode, QWidget *parent = 0);
/**
* Destroys the contact editor dialog.
......@@ -129,44 +128,44 @@ class AKONADI_CONTACT_EXPORT ContactEditorDialog : public QDialog
* @note The contact item just must have a uid set, all
* other data are fetched by the dialog automatically.
*/
void setContact( const Akonadi::Item &contact );
void setContact(const Akonadi::Item &contact);
/**
* Sets the @p addressbook that shall be selected as default in create mode.
*/
void setDefaultAddressBook( const Akonadi::Collection &addressbook );
void setDefaultAddressBook(const Akonadi::Collection &addressbook);
/**
* Returns the ContactEditor that is used by this dialog.
*/
ContactEditor* editor() const;
ContactEditor *editor() const;
Q_SIGNALS:
Q_SIGNALS:
/**
* This signal is emitted whenever a contact was updated or stored.
*