Commit e8858d2c authored by Laurent Montel's avatar Laurent Montel 😁

Use Q_DECL_OVERRIDE/Q_NULLPTR

parent fa45f890
......@@ -104,7 +104,7 @@ public:
return QVariant();
}
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE
{
if (role != Qt::DisplayRole && role != Qt::ToolTipRole) {
return QVariant();
......
......@@ -45,14 +45,14 @@ class AddEditBlog::Private
{
public:
Private()
: mainW(0),
: mainW(Q_NULLPTR),
isNewBlog(false),
bBlog(0),
mBlog(0),
mFetchProfileIdTimer(0),
mFetchBlogIdTimer(0),
mFetchAPITimer(0),
wait(0)
bBlog(Q_NULLPTR),
mBlog(Q_NULLPTR),
mFetchProfileIdTimer(Q_NULLPTR),
mFetchBlogIdTimer(Q_NULLPTR),
mFetchAPITimer(Q_NULLPTR),
wait(Q_NULLPTR)
{}
Ui::AddEditBlogBase ui;
QTabWidget *mainW;
......@@ -75,7 +75,7 @@ AddEditBlog::AddEditBlog(int blog_id, QWidget *parent, Qt::WindowFlags flags)
setMainWidget(d->mainW);
d->isNewBlog = true;
d->mFetchAPITimer = d->mFetchBlogIdTimer = d->mFetchProfileIdTimer = 0;
d->mFetchAPITimer = d->mFetchBlogIdTimer = d->mFetchProfileIdTimer = Q_NULLPTR;
connect(d->ui.txtId, &KLineEdit::textChanged, this, &AddEditBlog::enableOkButton);
connect(d->ui.txtUrl, &KLineEdit::textChanged, this, &AddEditBlog::enableAutoConfBtn);
......@@ -330,7 +330,7 @@ void AddEditBlog::handleFetchAPITimeout()
{
qCDebug(BLOGILO_LOG);
d->mFetchAPITimer->deleteLater();
d->mFetchAPITimer = 0;
d->mFetchAPITimer = Q_NULLPTR;
hideWaitWidget();
d->ui.txtId->setEnabled(true);
d->ui.txtId->setText(QString());
......@@ -352,7 +352,7 @@ void AddEditBlog::fetchedBlogId(const QList< QMap < QString , QString > > &list)
{
if (d->mFetchBlogIdTimer) {
d->mFetchBlogIdTimer->deleteLater();
d->mFetchBlogIdTimer = 0;
d->mFetchBlogIdTimer = Q_NULLPTR;
}
hideWaitWidget();
QString blogId, blogName, blogUrl, apiUrl;
......@@ -611,7 +611,7 @@ void AddEditBlog::hideWaitWidget()
if (d->wait) {
d->wait->deleteLater();
}
d->wait = 0;
d->wait = Q_NULLPTR;
}
void AddEditBlog::bloggerAuthenticated(const QMap< QString, QString > &authData)
......
......@@ -48,11 +48,11 @@ public:
* @param blog_id id of blog we will edit it, for adding a blog this should be "-1"
* @param parent Parent
*/
explicit AddEditBlog(int blog_id, QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = 0);
explicit AddEditBlog(int blog_id, QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Q_NULLPTR);
~AddEditBlog();
protected Q_SLOTS:
virtual void slotButtonClicked(int button);
void slotButtonClicked(int button) Q_DECL_OVERRIDE;
void enableAutoConfBtn();
void enableOkButton(const QString &);
void autoConfigure();
......
......@@ -47,7 +47,7 @@ class Backend::Private
{
public:
Private()
: kBlog(0), bBlog(0), categoryListNotSet(false)
: kBlog(Q_NULLPTR), bBlog(Q_NULLPTR), categoryListNotSet(false)
{}
KBlog::Blog *kBlog;
BilboBlog *bBlog;
......@@ -200,7 +200,7 @@ void Backend::uploadMedia(BilboMedia *media)
QByteArray data;
KIO::TransferJob *job = KIO::get(media->localUrl(), KIO::Reload, KIO::HideProgressInfo);
if (!KIO::NetAccess::synchronousRun(job, 0, &data)) {
if (!KIO::NetAccess::synchronousRun(job, Q_NULLPTR, &data)) {
qCritical() << "Job error: " << job->errorString();
tmp = i18n("Uploading media failed: Cannot read the media file, please check if it exists. Path: %1", media->localUrl().toDisplayString());
qCDebug(BLOGILO_LOG) << "Emitting sigError...";
......
......@@ -32,7 +32,7 @@ class BilboBlog::Private
{
public:
Private()
: kblog(0)
: kblog(Q_NULLPTR)
{}
QUrl mUrl;
QString mBlogUrl;
......
......@@ -32,7 +32,7 @@ class BlogPrivate
{
public:
BlogPrivate():
q_ptr(0)
q_ptr(nullptr)
{
}
......
......@@ -79,7 +79,7 @@ public:
/**
Returns name of the service.
*/
QString interfaceName() const;
QString interfaceName() const Q_DECL_OVERRIDE;
/**
Authenticate this instance of Blogger against Google account.
......@@ -124,7 +124,7 @@ public:
@see void fetchPost( KBlog::BlogPost* )
@see BlogPost::Status
*/
void listRecentPosts(int number);
void listRecentPosts(int number) Q_DECL_OVERRIDE;
/**
Fetch the Post with a specific id.
......@@ -133,7 +133,7 @@ public:
@see BlogPost::setPostId( const QString& )
@see fetchedPost( KBlog::BlogPost *post )
*/
void fetchPost(KBlog::BlogPost *post);
void fetchPost(KBlog::BlogPost *post) Q_DECL_OVERRIDE;
/**
Remove a post from the server.
......@@ -142,7 +142,7 @@ public:
@see BlogPost::setPostId( const QString& )
@see removedPost( KBlog::BlogPost* )
*/
void removePost(KBlog::BlogPost *post);
void removePost(KBlog::BlogPost *post) Q_DECL_OVERRIDE;
/**
Create a new post on server.
......@@ -150,13 +150,13 @@ public:
@see createdPost( KBlog::BlogPost *post )
*/
void createPost(KBlog::BlogPost *post);
void createPost(KBlog::BlogPost *post) Q_DECL_OVERRIDE;
/**
Modify a post on server.
@param post This is used to send the modified post including the correct id.
*/
void modifyPost(KBlog::BlogPost *post);
void modifyPost(KBlog::BlogPost *post) Q_DECL_OVERRIDE;
/**
List the comments available for this post on the server.
......
......@@ -29,7 +29,7 @@
BlogiloComposerView::BlogiloComposerView(QWidget *parent)
: ComposerEditorNG::ComposerView(parent),
mCustomTools(0)
mCustomTools(Q_NULLPTR)
{
settings()->setFontSize(QWebSettings::DefaultFontSize, 14);
}
......
......@@ -34,7 +34,7 @@ public:
~BlogiloComposerView();
void startEditing();
virtual void addExtraAction(QMenu *menu);
void addExtraAction(QMenu *menu) Q_DECL_OVERRIDE;
void setCustomTools(PimCommon::CustomToolsWidget *customTool);
......
......@@ -99,7 +99,7 @@ QWidget *HtmlEditor::configPage(int number, QWidget *parent)
{
KTextEditor::ConfigPage *page = mEditor->configPage(number, parent);
if (!page) {
return NULL;
return Q_NULLPTR;
} else {
return page;
}
......
......@@ -234,7 +234,7 @@ void StyleGetter::slotTempPostRemoved(int blog_id, const BilboPost &post)
void StyleGetter::generateRandomPostStrings()
{
qCDebug(BLOGILO_LOG);
srand(time(0));
srand(time(Q_NULLPTR));
int postRandomNumber = rand();
mPostTitle = QStringLiteral("%1%2").arg(QLatin1String(POST_TITLE)).arg(postRandomNumber);
mPostContent = QStringLiteral("%1%2").arg(QLatin1String(POST_CONTENT)).arg(postRandomNumber);
......
......@@ -42,7 +42,7 @@ Q_SIGNALS:
void settingsChanged();
protected:
bool hasChanged();
bool hasChanged() Q_DECL_OVERRIDE;
private Q_SLOTS:
void slotApplySettingsClicked();
......
......@@ -28,8 +28,8 @@ class StorageServiceConfigureWidget : public PimCommon::StorageServiceConfigureW
public:
explicit StorageServiceConfigureWidget(QWidget *parent = Q_NULLPTR);
~StorageServiceConfigureWidget();
virtual void loadSettings();
virtual void writeSettings();
void loadSettings() Q_DECL_OVERRIDE;
void writeSettings() Q_DECL_OVERRIDE;
};
namespace PimCommon
......
......@@ -44,7 +44,7 @@ class DBMan::Private
{
public:
Private()
: mWallet(0),
: mWallet(Q_NULLPTR),
useWallet(false)
{
}
......@@ -75,7 +75,7 @@ DBMan::DBMan()
if (!QFile::exists(CONF_DB)) {
if (!this->createDB()) {
KMessageBox::detailedError(0, i18n("Cannot create database"),
KMessageBox::detailedError(Q_NULLPTR, i18n("Cannot create database"),
i18n(d->db.lastError().text().toUtf8().data()));
qCDebug(BLOGILO_LOG) << "Cannot create database, SQL error: " << d->db.lastError().text() << endl;
exit(1);
......@@ -99,7 +99,7 @@ DBMan::~DBMan()
d->db.close();
if (d->useWallet) {
d->mWallet->deleteLater();
d->mWallet = 0;
d->mWallet = Q_NULLPTR;
}
delete d;
mSelf = Q_NULLPTR;
......@@ -145,7 +145,7 @@ bool DBMan::connectDB()
d->db.setDatabaseName(QString(CONF_DB));
if (!d->db.open()) {
KMessageBox::detailedError(0, i18n("Cannot connect to database"),
KMessageBox::detailedError(Q_NULLPTR, i18n("Cannot connect to database"),
i18n(d->db.lastError().text().toUtf8().data()));
qCDebug(BLOGILO_LOG) << "Cannot connect to database, SQL error: " << d->db.lastError().text();
return false;
......
......@@ -77,11 +77,11 @@
MainWindow::MainWindow()
: KXmlGuiWindow(),
activePost(0),
systemTray(0),
activePost(Q_NULLPTR),
systemTray(Q_NULLPTR),
previousActivePostIndex(-1),
busyNumber(0),
progress(0),
progress(Q_NULLPTR),
mCurrentBlogId(__currentBlogId)
{
setWindowTitle(i18n("Blogilo"));
......@@ -432,7 +432,7 @@ void MainWindow::setupSystemTray()
}
} else if (systemTray) {
systemTray->deleteLater();
systemTray = 0;
systemTray = Q_NULLPTR;
}
}
......@@ -461,7 +461,7 @@ void MainWindow::slotActivePostChanged(int index)
int activePostBlogId = -1;
int prevPostBlogId = -1;
if ((prevActivePost != 0) && (index != previousActivePostIndex)) {
if ((prevActivePost != Q_NULLPTR) && (index != previousActivePostIndex)) {
prevPostBlogId = prevActivePost->currentPostBlogId();
toolbox->getFieldsValue(prevActivePost->currentPost());
prevActivePost->setCurrentPostBlogId(mCurrentBlogId);
......@@ -513,7 +513,7 @@ void MainWindow::slotRemoveAllExclude(int pos)
widget->close();
}
if (tabPosts->count() < 1) {
activePost = 0;
activePost = Q_NULLPTR;
toolbox->resetFields();
// actionCollection()->action("publish_post")->setEnabled( false );
}
......@@ -537,7 +537,7 @@ void MainWindow::slotRemovePostEntry(int pos)
widget->close();
if (tabPosts->count() < 1) {
activePost = 0;
activePost = Q_NULLPTR;
toolbox->resetFields();
// actionCollection()->action("publish_post")->setEnabled( false );
}
......@@ -650,7 +650,7 @@ void MainWindow::slotBusy(bool isBusy)
if (progress) {
statusBar()->removeWidget(progress);
progress->deleteLater();
progress = 0;
progress = Q_NULLPTR;
}
// busyNumber = 0;
}
......@@ -686,7 +686,7 @@ void MainWindow::uploadMediaObject()
UploadMediaDialog *uploadDlg = new UploadMediaDialog(this);
connect(uploadDlg, &UploadMediaDialog::sigBusy, this, &MainWindow::slotBusy);
if (mCurrentBlogId == -1) {
uploadDlg->init(0);
uploadDlg->init(Q_NULLPTR);
} else {
uploadDlg->init(DBMan::self()->blog(mCurrentBlogId));
}
......
......@@ -61,7 +61,7 @@ public:
* @param backend A Backend instant to use! will create one if NULL
* @return true on success and false on failure.
*/
bool uploadMediaFiles(Backend *backend = 0);
bool uploadMediaFiles(Backend *backend = Q_NULLPTR);
void submitPost(int blogId, const BilboPost &postData);
......
......@@ -30,19 +30,19 @@ public:
StorageServiceManagerSettingsJob();
~StorageServiceManagerSettingsJob();
QString youSendItApiKey() const;
QString dropboxOauthConsumerKey() const;
QString dropboxOauthSignature() const;
QString boxClientId() const;
QString boxClientSecret() const;
QString hubicClientId() const;
QString hubicClientSecret() const;
QString dropboxRootPath() const;
QString oauth2RedirectUrl() const;
QString hubicScope() const;
QString gdriveClientId() const;
QString gdriveClientSecret() const;
QString defaultUploadFolder() const;
QString youSendItApiKey() const Q_DECL_OVERRIDE;
QString dropboxOauthConsumerKey() const Q_DECL_OVERRIDE;
QString dropboxOauthSignature() const Q_DECL_OVERRIDE;
QString boxClientId() const Q_DECL_OVERRIDE;
QString boxClientSecret() const Q_DECL_OVERRIDE;
QString hubicClientId() const Q_DECL_OVERRIDE;
QString hubicClientSecret() const Q_DECL_OVERRIDE;
QString dropboxRootPath() const Q_DECL_OVERRIDE;
QString oauth2RedirectUrl() const Q_DECL_OVERRIDE;
QString hubicScope() const Q_DECL_OVERRIDE;
QString gdriveClientId() const Q_DECL_OVERRIDE;
QString gdriveClientSecret() const Q_DECL_OVERRIDE;
QString defaultUploadFolder() const Q_DECL_OVERRIDE;
};
#endif // STORAGESERVICEMANAGERSETTINGSJOB_H
......@@ -32,8 +32,8 @@ class SyncUploader::Private
{
public:
Private()
: mCurrentMedia(0),
loop(0),
: mCurrentMedia(Q_NULLPTR),
loop(Q_NULLPTR),
success(false)
{}
BilboMedia *mCurrentMedia;
......
......@@ -303,7 +303,7 @@ void Toolbox::getFieldsValue(BilboPost *currentPost)
void Toolbox::setFieldsValue(BilboPost *post)
{
if (post == 0) {
if (post == Q_NULLPTR) {
resetFields();
qCDebug(BLOGILO_LOG) << "post is NULL";
return;
......@@ -391,7 +391,7 @@ void Toolbox::setCurrentPage(int index)
void Toolbox::slotEntriesCopyUrl()
{
if (lstEntriesList->currentItem() == 0) {
if (lstEntriesList->currentItem() == Q_NULLPTR) {
return;
}
BilboPost post = DBMan::self()->getPostInfo(lstEntriesList->currentItem()->data(BlogEntryID).toInt());
......
......@@ -45,7 +45,7 @@ public:
* @param currentPost input and output of this Function.
*/
void getFieldsValue(BilboPost *currentPost);
void setFieldsValue(BilboPost *post = 0);
void setFieldsValue(BilboPost *post = Q_NULLPTR);
void setCurrentBlogId(int blog_id);
void setCurrentPage(int index);
void clearFields();
......
......@@ -45,7 +45,7 @@
#include <QPushButton>
UploadMediaDialog::UploadMediaDialog(QWidget *parent)
: QDialog(parent), mCurrentBlog(0)
: QDialog(parent), mCurrentBlog(Q_NULLPTR)
{
QWidget *widget = new QWidget;
ui.setupUi(widget);
......
......@@ -68,7 +68,7 @@ public:
public Q_SLOTS:
// Don't update the view when midnight passed, otherwise we'll have data loss (bug 79145)
virtual void dayPassed(const QDate &) Q_DECL_OVERRIDE {}
void dayPassed(const QDate &) Q_DECL_OVERRIDE {}
void updateView() Q_DECL_OVERRIDE;
void flushView() Q_DECL_OVERRIDE;
......
......@@ -359,24 +359,24 @@ public:
bool greaterThanFallback(const MonthItem *other) const Q_DECL_OVERRIDE;
virtual QDate realStartDate() const Q_DECL_OVERRIDE
QDate realStartDate() const Q_DECL_OVERRIDE
{
return mDate;
}
virtual QDate realEndDate() const Q_DECL_OVERRIDE
QDate realEndDate() const Q_DECL_OVERRIDE
{
return mDate;
}
virtual bool allDay() const Q_DECL_OVERRIDE
bool allDay() const Q_DECL_OVERRIDE
{
return true;
}
virtual bool isMoveable() const Q_DECL_OVERRIDE
bool isMoveable() const Q_DECL_OVERRIDE
{
return false;
}
virtual bool isResizable() const Q_DECL_OVERRIDE
bool isResizable() const Q_DECL_OVERRIDE
{
return false;
}
......
......@@ -73,7 +73,7 @@ public:
Akonadi::Item::List selectedIncidences() const Q_DECL_OVERRIDE;
KCalCore::DateList selectedIncidenceDates() const Q_DECL_OVERRIDE;
virtual int currentDateCount() const Q_DECL_OVERRIDE
int currentDateCount() const Q_DECL_OVERRIDE
{
return 0;
}
......
......@@ -37,7 +37,7 @@ public:
mMainWindow(Q_NULLPTR)
{
}
virtual int newInstance() Q_DECL_OVERRIDE;
int newInstance() Q_DECL_OVERRIDE;
private:
MainWindow *mMainWindow;
......
......@@ -25,8 +25,7 @@ using namespace KABMergeContacts;
ResultDuplicateTreeWidget::ResultDuplicateTreeWidget(QWidget *parent)
: QTreeWidget(parent)
{
//kf5 add i18n
setHeaderLabel(QLatin1String("Contacts"));
setHeaderLabel(i18n("Contacts"));
connect(this, &QTreeWidget::itemActivated, this, &ResultDuplicateTreeWidget::slotItemActivated);
}
......
......@@ -61,7 +61,7 @@ public:
/**
* Returns the contact formatted as HTML
*/
virtual QString toHtml(HtmlForm form = SelfcontainedForm) const;
QString toHtml(HtmlForm form = SelfcontainedForm) const Q_DECL_OVERRIDE;
private:
//@cond PRIVATE
......
......@@ -57,7 +57,7 @@ public:
/**
* Returns the contact group formatted as HTML
*/
virtual QString toHtml(HtmlForm form = SelfcontainedForm) const;
QString toHtml(HtmlForm form = SelfcontainedForm) const Q_DECL_OVERRIDE;
private:
//@cond PRIVATE
......
......@@ -36,7 +36,7 @@ void GrantleePrintTest::shouldHaveDefaultValue()
KAddressBookGrantlee::GrantleePrint *grantleePrint = new KAddressBookGrantlee::GrantleePrint;
QVERIFY(grantleePrint);
grantleePrint->deleteLater();
grantleePrint = 0;
grantleePrint = Q_NULLPTR;
}
void GrantleePrintTest::shouldReturnEmptyStringWhenNotContentAndNoContacts()
......@@ -45,7 +45,7 @@ void GrantleePrintTest::shouldReturnEmptyStringWhenNotContentAndNoContacts()
KContacts::Addressee::List lst;
QVERIFY(grantleePrint->contactsToHtml(lst).isEmpty());
grantleePrint->deleteLater();
grantleePrint = 0;
grantleePrint = Q_NULLPTR;
}
void GrantleePrintTest::shouldReturnEmptyStringWhenAddContentWithoutContacts()
......@@ -56,7 +56,7 @@ void GrantleePrintTest::shouldReturnEmptyStringWhenAddContentWithoutContacts()