From b298f1ccba5311cf101ea773b0035165ee13cca8 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Mon, 5 Apr 2021 22:43:05 +0500 Subject: [PATCH] Fix some build warnings Signed-off-by: Waqar Ahmed --- addons/filebrowser/katebookmarkhandler.cpp | 14 +++++++- addons/filebrowser/katefilebrowserconfig.cpp | 2 +- addons/konsole/kateconsole.cpp | 2 +- addons/lspclient/lspclientpluginview.cpp | 2 +- addons/lspclient/lspclientsymbolview.cpp | 1 + addons/project/filehistorywidget.cpp | 34 ++------------------ addons/symbolviewer/ecma_parser.cpp | 6 ++-- 7 files changed, 23 insertions(+), 38 deletions(-) diff --git a/addons/filebrowser/katebookmarkhandler.cpp b/addons/filebrowser/katebookmarkhandler.cpp index 020633543..afb911a28 100644 --- a/addons/filebrowser/katebookmarkhandler.cpp +++ b/addons/filebrowser/katebookmarkhandler.cpp @@ -10,6 +10,7 @@ #include "katebookmarkhandler.h" #include "katefilebrowser.h" +#include #include #include @@ -33,7 +34,18 @@ KateBookmarkHandler::KateBookmarkHandler(KateFileBrowser *parent, QMenu *kpopupm KBookmarkManager *manager = KBookmarkManager::managerForFile(file, QStringLiteral("kate")); manager->setUpdate(true); - m_bookmarkMenu = new KBookmarkMenu(manager, this, m_menu, parent->actionCollection()); + m_bookmarkMenu = new KBookmarkMenu(manager, this, m_menu); + + KActionCollection *ac = parent->actionCollection(); + if (QAction *addBookmarkAction = m_bookmarkMenu->addBookmarkAction()) { + ac->addAction(addBookmarkAction->objectName(), addBookmarkAction); + } + if (QAction *newBookmarkFolderAction = m_bookmarkMenu->newBookmarkFolderAction()) { + ac->addAction(newBookmarkFolderAction->objectName(), newBookmarkFolderAction); + } + if (QAction *editBookmarksAction = m_bookmarkMenu->editBookmarksAction()) { + ac->addAction(editBookmarksAction->objectName(), editBookmarksAction); + } } KateBookmarkHandler::~KateBookmarkHandler() diff --git a/addons/filebrowser/katefilebrowserconfig.cpp b/addons/filebrowser/katefilebrowserconfig.cpp index 5a60866c3..5d938d913 100644 --- a/addons/filebrowser/katefilebrowserconfig.cpp +++ b/addons/filebrowser/katefilebrowserconfig.cpp @@ -55,7 +55,7 @@ KateFileBrowserConfigPage::KateFileBrowserConfigPage(QWidget *parent, KateFileBr , fileBrowser(kfb) { QVBoxLayout *lo = new QVBoxLayout(this); - int spacing = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing); + int spacing = QApplication::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing); lo->setSpacing(spacing); lo->setContentsMargins(0, 0, 0, 0); diff --git a/addons/konsole/kateconsole.cpp b/addons/konsole/kateconsole.cpp index a1354de17..01dfe4ce1 100644 --- a/addons/konsole/kateconsole.cpp +++ b/addons/konsole/kateconsole.cpp @@ -496,7 +496,7 @@ KateKonsoleConfigPage::KateKonsoleConfigPage(QWidget *parent, KateKonsolePlugin , mPlugin(plugin) { QVBoxLayout *lo = new QVBoxLayout(this); - lo->setSpacing(QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing)); + lo->setSpacing(QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing)); lo->setContentsMargins(0, 0, 0, 0); cbAutoSyncronize = new QCheckBox(i18n("&Automatically synchronize the terminal with the current document when possible"), this); diff --git a/addons/lspclient/lspclientpluginview.cpp b/addons/lspclient/lspclientpluginview.cpp index 72c2be719..20cea0c54 100644 --- a/addons/lspclient/lspclientpluginview.cpp +++ b/addons/lspclient/lspclientpluginview.cpp @@ -1893,7 +1893,7 @@ public: auto location = QStringLiteral("%1:%2").arg(basename).arg(related.location.range.start().line()); relatedItemMessage->setText(QStringLiteral("[%1] %2").arg(location).arg(related.message)); relatedItemMessage->setData(diagnosticsIcon(LSPDiagnosticSeverity::Information), Qt::DecorationRole); - item->appendRow({relatedItemMessage}); + item->appendRow(relatedItemMessage); m_diagnosticsTree->setExpanded(item->index(), true); } } diff --git a/addons/lspclient/lspclientsymbolview.cpp b/addons/lspclient/lspclientsymbolview.cpp index 53bc6cf2f..ae7b30905 100644 --- a/addons/lspclient/lspclientsymbolview.cpp +++ b/addons/lspclient/lspclientsymbolview.cpp @@ -49,6 +49,7 @@ public: , m_change(change_ms) , m_motion(motion_ms) { + Q_UNUSED(m_plugin); // get updated m_changeTimer.setSingleShot(true); auto ch = [this]() { diff --git a/addons/project/filehistorywidget.cpp b/addons/project/filehistorywidget.cpp index 4062bc9cf..c9815ed59 100644 --- a/addons/project/filehistorywidget.cpp +++ b/addons/project/filehistorywidget.cpp @@ -146,35 +146,6 @@ public: QRect prect = opt.rect; - // const int ascent = (opt.fontMetrics.ascent() / 2); - - // draw line - // prect.setX(prect.x() + ascent + 2); - // auto sp = painter->pen(); - // auto p = painter->pen(); - // p.setWidth(2); - // painter->setPen(p); - - // auto p1 = prect.bottomLeft(); - // int w = opt.fontMetrics.ascent(); - // int h = opt.rect.height(); - // int r = w / 3; - // p1.ry() -= (h / 2) - r; - - // painter->setRenderHint(QPainter::Antialiasing, true); - - // QPoint pp = p1; - // pp.ry() -= 3 + 1; - // painter->drawLine(prect.topLeft(), pp); - // painter->drawEllipse(p1, r, r); - // auto p2 = p1; - // p2.ry() += r + 1; - // painter->drawLine(p2, prect.bottomLeft()); - - // painter->setRenderHint(QPainter::Antialiasing, false); - - // painter->setPen(sp); - // padding prect.setX(prect.x() + 5); prect.setY(prect.y() + lineHeight); @@ -188,8 +159,9 @@ public: // draw author on right auto dt = QDateTime::fromSecsSinceEpoch(commit.authorDate); - QString timestamp = - (dt.date() == QDate::currentDate()) ? dt.time().toString(Qt::DefaultLocaleShortDate) : dt.date().toString(Qt::DefaultLocaleShortDate); + QLocale l; + const bool isToday = dt.date() == QDate::currentDate(); + QString timestamp = isToday ? l.toString(dt.time(), QLocale::ShortFormat) : l.toString(dt.date(), QLocale::ShortFormat); painter->drawText(prect, Qt::AlignRight, timestamp); // draw commit hash diff --git a/addons/symbolviewer/ecma_parser.cpp b/addons/symbolviewer/ecma_parser.cpp index d9188fb2f..15171c685 100644 --- a/addons/symbolviewer/ecma_parser.cpp +++ b/addons/symbolviewer/ecma_parser.cpp @@ -116,7 +116,7 @@ void KatePluginSymbolViewerView::parseEcmaSymbols(void) if ((current == QLatin1Char('c')) && (stripped.indexOf(QLatin1String("class"), c) == c)) { identifier.clear(); c += 6; - for (c = c; c < stripped.length(); c++) { + for (/*c = c*/; c < stripped.length(); c++) { current = stripped.at(c); // look for the beginning of the class itself if ((current == QLatin1Char('(')) || (current == QLatin1Char('{'))) { @@ -152,7 +152,7 @@ void KatePluginSymbolViewerView::parseEcmaSymbols(void) c += 8; // look for the beginning of the parameters identifier.clear(); - for (c = c; c < stripped.length(); c++) { + for (/*c = c*/; c < stripped.length(); c++) { current = stripped.at(c); // look for the beginning of the function definition if ((current == QLatin1Char('(')) || (current == QLatin1Char('{'))) { @@ -241,7 +241,7 @@ void KatePluginSymbolViewerView::parseEcmaSymbols(void) c += 3; identifier.clear(); // parse the id name - for (c = c; c < stripped.length(); c++) { + for (/*c = c*/; c < stripped.length(); c++) { current = stripped.at(c); // look for the beginning of the id if (current == QLatin1Char(';')) { -- GitLab