Commit 92ea9368 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix some cppcheck warning + initialize pointer

parent e65c077f
......@@ -44,7 +44,6 @@
//--------------------------------------------------------------------------------
MainWindow::MainWindow()
: sysTray(nullptr), autorun(false)
{
new Archiver(this);
......
......@@ -55,16 +55,16 @@ class MainWindow : public KXmlGuiWindow
void setLoadedProfile(const QString &name);
private:
QSplitter *splitter;
Selector *selector;
MainWidget *mainWidget;
KStatusNotifierItem *sysTray;
QSplitter *splitter = nullptr;
Selector *selector = nullptr;
MainWidget *mainWidget = nullptr;
KStatusNotifierItem *sysTray = nullptr;
QString lastLog;
QAction *startBackupAction;
QAction *cancelBackupAction;
QAction *quitAction;
KRecentFilesAction *recentFiles;
bool autorun;
QAction *startBackupAction = nullptr;
QAction *cancelBackupAction = nullptr;
QAction *quitAction = nullptr;
KRecentFilesAction *recentFiles = nullptr;
bool autorun = false;
QString loadedProfile;
};
......
......@@ -38,7 +38,7 @@ using namespace std;
class Model : public QStandardItemModel
{
public:
Model(Selector *parent) : QStandardItemModel(parent), tree(parent)
explicit Model(Selector *parent) : QStandardItemModel(parent), tree(parent)
{
const char *lc_collate = ::getenv("LC_COLLATE");
if ( lc_collate )
......@@ -239,7 +239,7 @@ class ListItem : public QStandardItem
//--------------------------------------------------------------------------------
Selector::Selector(QWidget *parent, KActionCollection *actionCollection)
: QTreeView(parent), showHiddenFiles(true)
: QTreeView(parent)
{
itemModel = new Model(this);
......@@ -266,11 +266,11 @@ Selector::Selector(QWidget *parent, KActionCollection *actionCollection)
const char *home = ::getenv("HOME");
if ( home )
{
QStandardItem *item = findItemByPath(QFile::decodeName(home));
if ( item )
QStandardItem *homeItem = findItemByPath(QFile::decodeName(home));
if ( homeItem )
{
setExpanded(item->index(), true);
scrollTo(item->index());
setExpanded(homeItem->index(), true);
scrollTo(homeItem->index());
}
}
......
......@@ -58,11 +58,11 @@ class Selector : public QTreeView
private:
QSize minSize;
QStandardItemModel *itemModel;
QMenu *menu, *openWithSubMenu;
QAction *deleteFileAction;
QStandardItemModel *itemModel = nullptr;
QMenu *menu = nullptr, *openWithSubMenu = nullptr;
QAction *deleteFileAction = nullptr;
QMap<QString, KService::Ptr> serviceForName;
bool showHiddenFiles;
bool showHiddenFiles = true;
};
#endif
......@@ -149,7 +149,7 @@ int main(int argc, char **argv)
if ( !Archiver::instance->loadProfile(fileName, includes, excludes, error) )
{
std::cerr << i18n("Could not open profile '%1' for reading: %2", fileName, error).toUtf8().constData() << std::endl;
std::cerr << qPrintable(i18n("Could not open profile '%1' for reading: %2", fileName, error)) << std::endl;
return -1;
}
else
......
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