Commit 59a64e3c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use nullptr/override

parent ccded73f
......@@ -98,10 +98,7 @@ kconfig_add_kcfg_files(khelpcenter_KDEINIT_SRCS prefs.kcfgc )
kf5_add_kdeinit_executable( khelpcenter ${khelpcenter_KDEINIT_SRCS})
target_compile_definitions(kdeinit_khelpcenter PRIVATE -DPROJECT_VERSION="${PROJECT_VERSION}")
target_link_libraries(kdeinit_khelpcenter KF5::KHtml KF5::Service KF5::DBusAddons KF5::ConfigGui KF5::WindowSystem KF5::Bookmarks Qt5::Xml Grantlee5::Templates)
if (${KF5_VERSION} VERSION_GREATER 5.35.0)
# practically means >=5.36
target_link_libraries(kdeinit_khelpcenter KF5::DocTools)
endif()
target_link_libraries(kdeinit_khelpcenter KF5::DocTools)
install(TARGETS kdeinit_khelpcenter ${INSTALL_TARGETS_DEFAULT_ARGS} )
install(TARGETS khelpcenter ${INSTALL_TARGETS_DEFAULT_ARGS})
......
......@@ -36,7 +36,7 @@ Q_DECLARE_METATYPE(const QTreeWidgetItem *)
using namespace KHC;
Application::Application(int& argc, char** argv)
: QApplication(argc, argv), mMainWindow( 0 )
: QApplication(argc, argv), mMainWindow( nullptr )
{
setAttribute(Qt::AA_UseHighDpiPixmaps);
......
......@@ -33,12 +33,12 @@ class BookmarkOwner : public QObject, public KBookmarkOwner
{
Q_OBJECT
public:
BookmarkOwner( View *view, QObject *parent = 0 );
virtual ~BookmarkOwner();
explicit BookmarkOwner( View *view, QObject *parent = nullptr );
~BookmarkOwner() override;
QString currentTitle() const Q_DECL_OVERRIDE;
QUrl currentUrl() const Q_DECL_OVERRIDE;
void openBookmark( const KBookmark& bm, Qt::MouseButtons mb, Qt::KeyboardModifiers km ) Q_DECL_OVERRIDE;
QString currentTitle() const override;
QUrl currentUrl() const override;
void openBookmark( const KBookmark& bm, Qt::MouseButtons mb, Qt::KeyboardModifiers km ) override;
Q_SIGNALS:
void openUrl( const QUrl& url );
......
......@@ -31,8 +31,8 @@ void DocEntry::init()
mWeight = 0;
mSearchEnabled = false;
mDirectory = false;
mParent = 0;
mNextSibling = 0;
mParent = nullptr;
mNextSibling = nullptr;
}
void DocEntry::setName( const QString &name )
......
......@@ -38,7 +38,7 @@ DocEntryTraverser *DocEntryTraverser::childTraverser( DocEntry *parentEntry )
{
DocEntryTraverser *child = createChild( parentEntry );
if (!child)
return 0;
return nullptr;
if ( child != this )
{
child->mParent = this;
......
......@@ -29,7 +29,7 @@ namespace KHC {
class DocEntryTraverser
{
public:
DocEntryTraverser() : mNotifyee( 0 ), mParent( 0 ), mParentEntry( 0 ) {}
DocEntryTraverser(){}
virtual ~DocEntryTraverser() {}
void setNotifyee( DocMetaInfo * );
......@@ -51,11 +51,11 @@ namespace KHC {
DocEntry *parentEntry();
protected:
DocMetaInfo *mNotifyee;
DocEntryTraverser *mParent;
DocMetaInfo *mNotifyee = nullptr;
DocEntryTraverser *mParent = nullptr;
private:
DocEntry *mParentEntry;
DocEntry *mParentEntry = nullptr;
};
}
......
......@@ -35,7 +35,7 @@ using namespace KHC;
bool DocMetaInfo::mLoaded = false;
DocMetaInfo *DocMetaInfo::mSelf = 0;
DocMetaInfo *DocMetaInfo::mSelf = nullptr;
DocMetaInfo *DocMetaInfo::self()
{
......@@ -62,12 +62,12 @@ DocMetaInfo::~DocMetaInfo()
mLoaded = false;
mSelf = 0;
mSelf = nullptr;
}
DocEntry *DocMetaInfo::addDocEntry( const QFileInfo &fi )
{
if ( !fi.exists() ) return 0;
if ( !fi.exists() ) return nullptr;
QString extension = fi.completeSuffix();
QStringList extensions = extension.split( '.');
......@@ -79,7 +79,7 @@ DocEntry *DocMetaInfo::addDocEntry( const QFileInfo &fi )
if ( !lang.isEmpty() && !mLanguages.contains( lang ) )
{
return 0;
return nullptr;
}
DocEntry *entry = new DocEntry();
......@@ -108,7 +108,7 @@ DocEntry *DocMetaInfo::addDocEntry( const QFileInfo &fi )
else
{
delete entry;
return 0;
return nullptr;
}
}
......@@ -171,11 +171,11 @@ DocEntry *DocMetaInfo::scanMetaInfoDir( const QString &dirName,
DocEntry *parent )
{
QDir dir( dirName );
if ( !dir.exists() ) return 0;
if ( !dir.exists() ) return nullptr;
foreach( const QFileInfo &fi, dir.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot) )
{
DocEntry *entry = 0;
DocEntry *entry = nullptr;
if ( fi.isDir() )
{
DocEntry *dirEntry = addDirEntry( QDir( fi.absoluteFilePath() ), parent );
......@@ -188,7 +188,7 @@ DocEntry *DocMetaInfo::scanMetaInfoDir( const QString &dirName,
}
}
return 0;
return nullptr;
}
DocEntry *DocMetaInfo::addDirEntry( const QDir &dir, DocEntry *parent )
......@@ -278,7 +278,7 @@ void DocMetaInfo::endProcess( DocEntry *entry, DocEntryTraverser *traverser )
} else
{
DocEntry *parent = entry->parent();
DocEntryTraverser *parentTraverser = 0;
DocEntryTraverser *parentTraverser = nullptr;
while ( parent ) {
parentTraverser = traverser->parentTraverser();
traverser->deleteTraverser();
......
......@@ -176,7 +176,7 @@ void FontDialog::load()
{
KConfigGroup configGroup( cfg, "HTML Settings" );
m_minFontSize->setValue( configGroup.readEntry( "MinimumFontSize", (int)HTML_DEFAULT_MIN_FONT_SIZE ) );
m_minFontSize->setValue( configGroup.readEntry( "MinimumFontSize", static_cast<int>(HTML_DEFAULT_MIN_FONT_SIZE) ) );
m_medFontSize->setValue( configGroup.readEntry( "MediumFontSize", 10 ) );
QStringList fonts = configGroup.readEntry( "Fonts" , QStringList() );
......
......@@ -34,7 +34,7 @@ namespace KHC {
Q_OBJECT
public:
FontDialog( QWidget *parent );
explicit FontDialog( QWidget *parent );
protected Q_SLOTS:
virtual void slotOk();
......
......@@ -301,7 +301,7 @@ void Glossary::slotSelectGlossEntry( const QString &id )
EntryItem *newItem = m_idDict.value( id );
EntryItem *curItem = dynamic_cast<EntryItem *>( currentItem() );
if ( curItem != 0 )
if ( curItem != nullptr )
{
if ( curItem->id() == id ) {
return;
......
......@@ -95,7 +95,7 @@ namespace KHC {
void treeItemSelected( QTreeWidgetItem *item );
protected:
void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
void showEvent(QShowEvent *event) override;
private:
enum CacheStatus { NeedRebuild, CacheOk };
......
......@@ -44,12 +44,12 @@ class PlainOutputStream : public Grantlee::OutputStream
{
}
QString escape( const QString& input ) const Q_DECL_OVERRIDE
QString escape( const QString& input ) const override
{
return input;
}
QSharedPointer<OutputStream> clone( QTextStream *stream ) const Q_DECL_OVERRIDE
QSharedPointer<OutputStream> clone( QTextStream *stream ) const override
{
return QSharedPointer<OutputStream>( new PlainOutputStream( stream ) );
}
......
......@@ -40,7 +40,7 @@ using namespace KHC;
// TODO: Needs complete redo!
// TODO: oh yeah
History *History::m_instance = 0;
History *History::m_instance = nullptr;
History &History::self()
{
......
......@@ -41,13 +41,13 @@ class History : public QObject
friend class foo; // to make gcc shut up
struct Entry
{
Entry() : view( 0 ), search( false ) {}
Entry() {}
View *view;
View *view = nullptr;
QUrl url;
QString title;
QByteArray buffer;
bool search;
bool search = false;
};
static History &self();
......
......@@ -39,7 +39,7 @@ class InfoCategoryItem : public NavigatorItem
public:
InfoCategoryItem( NavigatorItem *parent, const QString &text );
void itemExpanded( bool open ) Q_DECL_OVERRIDE;
void itemExpanded( bool open ) override;
};
class InfoNodeItem : public NavigatorItem
......@@ -75,7 +75,7 @@ InfoNodeItem::InfoNodeItem( InfoCategoryItem *parent, const QString &text )
InfoTree::InfoTree( QObject *parent )
: TreeBuilder( parent ),
m_parentItem( 0 )
m_parentItem( nullptr )
{
}
......@@ -154,7 +154,7 @@ void InfoTree::parseInfoDirFile( const QString &infoDirFileName )
const QChar first = appName.at( 0 ).toUpper();
InfoCategoryItem *alphabSection = alphabSections.value( first );
if ( alphabSection == 0 ) {
if ( alphabSection == nullptr ) {
alphabSection = new InfoCategoryItem( m_alphabItem, QString( first ) );
alphabSections.insert( first, alphabSection );
}
......
......@@ -29,9 +29,9 @@ namespace KHC
{
Q_OBJECT
public:
InfoTree( QObject *parent );
explicit InfoTree( QObject *parent );
void build( NavigatorItem *parentItem ) Q_DECL_OVERRIDE;
void build( NavigatorItem *parentItem ) override;
private:
void parseInfoDirFile( const QString &fileName );
......
......@@ -106,8 +106,8 @@ class LogDialog : public QDialog
MainWindow::MainWindow()
: KXmlGuiWindow(0),
mLogDialog( 0 )
: KXmlGuiWindow(nullptr),
mLogDialog( nullptr )
{
setObjectName( QLatin1String( "MainWindow" ) );
......
......@@ -29,7 +29,7 @@ class MainWindow : public KXmlGuiWindow
Q_CLASSINFO("D-Bus Interface", "org.kde.khelpcenter.khelpcenter")
public:
MainWindow();
~MainWindow();
~MainWindow() override;
public Q_SLOTS:
Q_SCRIPTABLE void openUrl( const QString &url );
......@@ -65,8 +65,8 @@ class MainWindow : public KXmlGuiWindow
const KParts::OpenUrlArguments &args = KParts::OpenUrlArguments(),
const KParts::BrowserArguments &browserArgs = KParts::BrowserArguments() );
void saveProperties( KConfigGroup &config ) Q_DECL_OVERRIDE;
void readProperties( const KConfigGroup &config ) Q_DECL_OVERRIDE;
void saveProperties( KConfigGroup &config ) override;
void readProperties( const KConfigGroup &config ) override;
void readConfig();
void writeConfig();
......
......@@ -67,7 +67,7 @@ using namespace KHC;
Navigator::Navigator( View *view, QWidget *parent )
: QWidget( parent ),
mView( view ), mSelected( false ), mIndexingProc( 0 )
mView( view ), mSelected( false ), mIndexingProc( nullptr )
{
mSearchEngine = new SearchEngine( view );
connect(mSearchEngine, &SearchEngine::searchFinished, this, &Navigator::slotSearchFinished);
......@@ -245,7 +245,7 @@ void Navigator::insertIOSlaveDocs( const QString &name, NavigatorItem *topItem )
QStringList list = KProtocolInfo::protocols();
list.sort();
NavigatorItem *prevItem = 0;
NavigatorItem *prevItem = nullptr;
for ( QStringList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it )
{
QString docPath = KProtocolInfo::docPath(*it);
......@@ -402,7 +402,7 @@ void Navigator::openInternalUrl( const QUrl &url )
{
if ( url.url() == "khelpcenter:home" ) {
clearSelection();
showOverview( 0, url );
showOverview( nullptr, url );
return;
}
......@@ -666,7 +666,7 @@ void Navigator::slotDoIndexWork()
if ( !mIndexingProc->waitForStarted() ) {
khcWarning() << "Unable to start command" << indexer;
delete mIndexingProc;
mIndexingProc = 0;
mIndexingProc = nullptr;
return slotDoIndexWork();
}
}
......@@ -683,7 +683,7 @@ void Navigator::slotProcessExited( int exitCode, QProcess::ExitStatus exitStatus
khcWarning() << "stderr output:" << mIndexingProc->readAllStandardError();
}
delete mIndexingProc;
mIndexingProc = 0;
mIndexingProc = nullptr;
slotDoIndexWork();
}
......
......@@ -48,7 +48,7 @@ class Navigator : public QWidget
{
Q_OBJECT
public:
explicit Navigator(View *, QWidget *parent=0);
explicit Navigator(View *, QWidget *parent= nullptr);
virtual ~Navigator();
QUrl homeURL();
......
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