Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package k4dirstat for openSUSE:Factory checked in at 2021-10-08 00:05:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/k4dirstat (Old) and /work/SRC/openSUSE:Factory/.k4dirstat.new.2443 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "k4dirstat" Fri Oct 8 00:05:49 2021 rev:7 rq:923565 version:3.3.0 Changes: -------- --- /work/SRC/openSUSE:Factory/k4dirstat/k4dirstat.changes 2021-04-22 18:05:59.894698284 +0200 +++ /work/SRC/openSUSE:Factory/.k4dirstat.new.2443/k4dirstat.changes 2021-10-08 00:06:49.069831369 +0200 @@ -1,0 +2,10 @@ +Wed Oct 6 17:30:03 UTC 2021 - Christophe Giboudeaux <[email protected]> + +- Update to 3.3.0 + * Show free space in the status bar + * Refresh tree after deleting a file + * Fix a crash when clicking on the name column + * Quote %-escapes strings in the .desktop Exec key + * Fix all compilation warnings with Qt 5.15 and KDE 5.85 + +------------------------------------------------------------------- Old: ---- k4dirstat-3.2.2.tar.gz New: ---- k4dirstat-3.3.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ k4dirstat.spec ++++++ --- /var/tmp/diff_new_pack.Xw0Ete/_old 2021-10-08 00:06:49.473832054 +0200 +++ /var/tmp/diff_new_pack.Xw0Ete/_new 2021-10-08 00:06:49.477832060 +0200 @@ -17,7 +17,7 @@ Name: k4dirstat -Version: 3.2.2 +Version: 3.3.0 Release: 0 Summary: Graphical Disk Usage Utility License: GPL-2.0-only AND LGPL-2.0-only ++++++ k4dirstat-3.2.2.tar.gz -> k4dirstat-3.3.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k4dirstat-3.2.2/CMakeLists.txt new/k4dirstat-3.3.0/CMakeLists.txt --- old/k4dirstat-3.2.2/CMakeLists.txt 2020-12-23 19:08:25.000000000 +0100 +++ new/k4dirstat-3.3.0/CMakeLists.txt 2021-09-10 09:19:38.000000000 +0200 @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.16.0) project(k4dirstat) function(git_version output_variable default_version strip_string) @@ -46,8 +46,9 @@ ADD_DEFINITIONS(-D_LARGE_FILES -D_FILE_OFFSET_BITS=64) add_definitions(-DQT_NO_URL_CAST_FROM_STRING) +add_definitions(-DQT_USE_QSTRINGBUILDER) -git_version(K4DIRSTAT_VERSION 3.2.2 k4dirstat-) +git_version(K4DIRSTAT_VERSION 3.3.0 k4dirstat-) add_subdirectory( doc ) add_subdirectory( src ) add_subdirectory( icons ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k4dirstat-3.2.2/README.md new/k4dirstat-3.3.0/README.md --- old/k4dirstat-3.2.2/README.md 2020-12-23 19:08:25.000000000 +0100 +++ new/k4dirstat-3.3.0/README.md 2021-09-10 09:19:38.000000000 +0200 @@ -1,5 +1,7 @@ # Overview + + See the [wiki](https://github.com/jeromerobert/k4dirstat/wiki/Overview). # Building Binary files old/k4dirstat-3.2.2/doc/screenshot.png and new/k4dirstat-3.3.0/doc/screenshot.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k4dirstat-3.2.2/src/k4dirstat.cpp new/k4dirstat-3.3.0/src/k4dirstat.cpp --- old/k4dirstat-3.2.2/src/k4dirstat.cpp 2020-12-23 19:08:25.000000000 +0100 +++ new/k4dirstat-3.3.0/src/k4dirstat.cpp 2021-09-10 09:19:38.000000000 +0200 @@ -27,7 +27,6 @@ #include <QFileDialog> #include <QGuiApplication> #include <kmessagebox.h> -#include <krun.h> #include <ktoggleaction.h> #include <ktoolbar.h> #include <ktoolinvocation.h> @@ -43,6 +42,8 @@ #include "kexcluderules.h" #include "ktreemaptile.h" #include "ktreemapview.h" +#include <KIO/ApplicationLauncherJob> +#include <KIO/JobUiDelegate> #include <KHelpClient> #include <KIconEngine> #include <KIconLoader> @@ -51,6 +52,8 @@ #include <QList> #include <QMenu> #include <QSplitter> +#include <QStorageInfo> +#include <QLabel> #include "settings.h" @@ -141,6 +144,8 @@ // setup the cleanup actions initCleanups(); + _freeSpaceLabel = new QLabel(); + statusBar()->addPermanentWidget(_freeSpaceLabel); // add a status bar statusBar()->show(); @@ -382,11 +387,11 @@ it != excludeRules.end(); ++it) { QString ruleText = *it; KExcludeRules::excludeRules()->add(new KExcludeRule(QRegExp(ruleText))); - qDebug() << "Adding exclude rule: " << ruleText << endl; + qDebug() << "Adding exclude rule: " << ruleText << Qt::endl; } if (excludeRules.size() == 0) - qDebug() << "No exclude rules defined" << endl; + qDebug() << "No exclude rules defined" << Qt::endl; } void k4dirstat::saveMainWinConfig() { @@ -533,7 +538,10 @@ QList<QUrl> urlList; urlList.append(QUrl::fromUserInput(sel->url(), QDir::currentPath(), QUrl::AssumeLocalFile)); - KRun::displayOpenWithDialog(urlList, this, false); + auto *job = new KIO::ApplicationLauncherJob(); + job->setUrls(urlList); + job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this)); + job->start(); } bool atLeastOneNotDotEntry(KDirTree * tree) { @@ -563,6 +571,9 @@ _fileContinueReadingAtMountPoint->setEnabled(false); statusMsg(selection->url()); + QStorageInfo i(selection->url()); + if(i.isValid()) + _freeSpaceLabel->setText(formatSize(i.bytesFree()) + " free"); } else { _editCopy->setEnabled(false); _reportMailToOwner->setEnabled(false); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k4dirstat-3.2.2/src/k4dirstat.desktop new/k4dirstat-3.3.0/src/k4dirstat.desktop --- old/k4dirstat-3.2.2/src/k4dirstat.desktop 2020-12-23 19:08:25.000000000 +0100 +++ new/k4dirstat-3.3.0/src/k4dirstat.desktop 2021-09-10 09:19:38.000000000 +0200 @@ -1,6 +1,6 @@ [Desktop Entry] Name=K4DirStat -Exec=k4dirstat %i -qwindowtitle "%c" "%u" +Exec=k4dirstat %i -qwindowtitle %c %u Icon=k4dirstat Type=Application X-DocPath=k4dirstat/index.html diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k4dirstat-3.2.2/src/k4dirstat.h new/k4dirstat-3.3.0/src/k4dirstat.h --- old/k4dirstat-3.2.2/src/k4dirstat.h 2020-12-23 19:08:25.000000000 +0100 +++ new/k4dirstat-3.3.0/src/k4dirstat.h 2021-09-10 09:19:38.000000000 +0200 @@ -17,6 +17,7 @@ class QPrinter; class KUrl; +class QLabel; class QSplitter; class KActivityTracker; @@ -304,6 +305,7 @@ KDirStat::KSettingsDialog *_settingsDialog; KFeedbackDialog *_feedbackDialog; KActivityTracker *_activityTracker; + QLabel * _freeSpaceLabel; QAction *_fileAskOpenDir; QAction *_fileAskOpenUrl; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k4dirstat-3.2.2/src/kcleanupcollection.cpp new/k4dirstat-3.3.0/src/kcleanupcollection.cpp --- old/k4dirstat-3.2.2/src/kcleanupcollection.cpp 2020-12-23 19:08:25.000000000 +0100 +++ new/k4dirstat-3.3.0/src/kcleanupcollection.cpp 2021-09-10 09:19:38.000000000 +0200 @@ -87,8 +87,7 @@ void KCleanupCollection::addUserCleanups(int number) { for (int i = 0; i < number; i++) { - QString id; - id.sprintf("cleanup_user_defined_%d", _nextUserCleanupNo); + QString id = QString("cleanup_user_defined_%1").arg(_nextUserCleanupNo); QString title; if (_nextUserCleanupNo <= 9) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k4dirstat-3.2.2/src/kdirinfo.cpp new/k4dirstat-3.3.0/src/kdirinfo.cpp --- old/k4dirstat-3.2.2/src/kdirinfo.cpp 2020-12-23 19:08:25.000000000 +0100 +++ new/k4dirstat-3.3.0/src/kdirinfo.cpp 2021-09-10 09:19:38.000000000 +0200 @@ -267,13 +267,13 @@ **/ if (deletedChild->parent() != this) { qCritical() << deletedChild << " is not a child of " << this - << " - cannot unlink from children list!" << endl; + << " - cannot unlink from children list!" << Qt::endl; return; } auto it = std::find(children_.begin(), children_.end(), deletedChild); if(it == children_.end()) { qCritical() << "Couldn't unlink " << deletedChild << " from " << this - << " children list" << endl; + << " children list" << Qt::endl; } else { children_.erase(it); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k4dirstat-3.2.2/src/kdirreadjob.cpp new/k4dirstat-3.3.0/src/kdirreadjob.cpp --- old/k4dirstat-3.2.2/src/kdirreadjob.cpp 2020-12-23 19:08:25.000000000 +0100 +++ new/k4dirstat-3.3.0/src/kdirreadjob.cpp 2021-09-10 09:19:38.000000000 +0200 @@ -56,7 +56,7 @@ if (_queue) _queue->jobFinishedNotify(this); else - qCritical() << "No job queue for " << _dir << endl; + qCritical() << "No job queue for " << _dir << Qt::endl; } void KDirReadJob::childAdded(KFileInfo *newChild) { @@ -138,7 +138,7 @@ dirName) // Does this cache file match this directory? { qDebug() << "Using cache file " << fullName << " for " - << dirName << endl; + << dirName << Qt::endl; cacheReadJob->reader() ->rewind(); // Read offset was moved by firstDir() @@ -161,7 +161,7 @@ return; } else { qDebug() << "NOT using cache file " << fullName << " with dir " - << firstDirInCache << " for " << dirName << endl; + << firstDirInCache << " for " << dirName << Qt::endl; delete cacheReadJob; } @@ -174,13 +174,13 @@ } else // lstat() error { qWarning() << "lstat(" << fullName << ") failed: " << strerror(errno) - << endl; + << Qt::endl; /* * Not much we can do when lstat() didn't work; let's at * least create an (almost empty) entry as a placeholder. */ - KDirInfo *child = new KDirInfo(_dir, entry->d_name); + KDirInfo *child = new KDirInfo(_dir); child->setReadState(KDirError); _dir->insertChild(child); childAdded(child); @@ -242,7 +242,7 @@ QUrl url = QUrl::fromUserInput(_dir->url(), QDir::currentPath(), QUrl::AssumeLocalFile); if (!url.isValid()) { - qWarning() << Q_FUNC_INFO << "URL malformed: " << _dir->url() << endl; + qWarning() << Q_FUNC_INFO << "URL malformed: " << _dir->url() << Qt::endl; } _job = KIO::listDir(url); @@ -260,7 +260,7 @@ QUrl url(_dir->url()); // Cache this - it's expensive! if (!url.isValid()) { - qWarning() << Q_FUNC_INFO << "URL malformed: " << _dir->url() << endl; + qWarning() << Q_FUNC_INFO << "URL malformed: " << _dir->url() << Qt::endl; } KIO::UDSEntryList::ConstIterator it = entryList.begin(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k4dirstat-3.2.2/src/kdirstatsettings.cpp new/k4dirstat-3.3.0/src/kdirstatsettings.cpp --- old/k4dirstat-3.2.2/src/kdirstatsettings.cpp 2020-12-23 19:08:25.000000000 +0100 +++ new/k4dirstat-3.3.0/src/kdirstatsettings.cpp 2021-09-10 09:19:38.000000000 +0200 @@ -679,7 +679,7 @@ QString text = QInputDialog::getText(this, i18n("New exclude rule"), i18n("Regular expression for new exclude rule:"), - QLineEdit::Normal, QString::null, &ok); + QLineEdit::Normal, QString(), &ok); if (ok && !text.isEmpty()) { QListWidgetItem *l = new QListWidgetItem(_excludeRulesListView); l->setText(text); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k4dirstat-3.2.2/src/kdirtree.cpp new/k4dirstat-3.3.0/src/kdirtree.cpp --- old/k4dirstat-3.2.2/src/kdirtree.cpp 2020-12-23 19:08:25.000000000 +0100 +++ new/k4dirstat-3.3.0/src/kdirtree.cpp 2021-09-10 09:19:38.000000000 +0200 @@ -273,7 +273,7 @@ } else // no parent - this should never happen (?) { qCritical() << "Internal error: Killing dot entry without parent " - << parent << endl; + << parent << Qt::endl; // Better leave that dot entry alone - we shouldn't have come // here in the first place. Who knows what will happen if this diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k4dirstat-3.2.2/src/kdirtreecache.cpp new/k4dirstat-3.3.0/src/kdirtreecache.cpp --- old/k4dirstat-3.2.2/src/kdirtreecache.cpp 2020-12-23 19:08:25.000000000 +0100 +++ new/k4dirstat-3.3.0/src/kdirtreecache.cpp 2021-09-10 09:19:38.000000000 +0200 @@ -35,7 +35,7 @@ gzFile cache = gzopen(fileName.toLocal8Bit(), "w"); if (cache == 0) { - qCritical() << "Can't open " << fileName << ": " << strerror(errno) << endl; + qCritical() << "Can't open " << fileName << ": " << strerror(errno) << Qt::endl; return false; } @@ -128,25 +128,19 @@ } QString KCacheWriter::formatSize(KFileSize size) { - QString str; - if (size >= GB && size % GB == 0) { - str.sprintf("%lldG", size / GB); - return str; + return QString("%1G").arg(size / GB); } if (size >= MB && size % MB == 0) { - str.sprintf("%lldM", size / MB); - return str; + return QString("%1M").arg(size / MB); } if (size >= KB && size % KB == 0) { - str.sprintf("%lldK", size / KB); - return str; + return QString("%1K").arg(size / KB); } - str.sprintf("%lld", size); - return str; + return QString::number(size); } KCacheReader::KCacheReader(const QString &fileName, KDirTree *tree, @@ -179,7 +173,7 @@ // Once the whole cache file is read set the state of each KDirInfo to // finished so the tree view can start fetching the tree root->setReadState(KDirFinished); - for(int i = 0; i < root->numChildren(); i++) { + for(size_t i = 0; i < root->numChildren(); i++) { KFileInfo * f = root->child(i); if(f->isDirInfo()) { setStateRecursive(static_cast<KDirInfo*>(f)); @@ -388,7 +382,7 @@ _tree->childAddedNotify(item); } else { qCritical() << _fileName << ":" << _lineNo << ": " - << "No parent for item " << name << endl; + << "No parent for item " << name << Qt::endl; } } } @@ -439,7 +433,7 @@ strcmp(field(3), "file]") != 0) { _ok = false; qCritical() << _fileName << ":" << _lineNo << ": Unknown file format" - << endl; + << Qt::endl; } } @@ -451,7 +445,7 @@ if (!_ok) qCritical() << _fileName << ":" << _lineNo - << ": Incompatible cache file version" << endl; + << ": Incompatible cache file version" << Qt::endl; } // qDebug() << "Cache file header check OK: " << _ok << endl; @@ -477,7 +471,7 @@ if (!gzeof(_cache)) { _ok = false; - qCritical() << _fileName << ":" << _lineNo << ": Read error" << endl; + qCritical() << _fileName << ":" << _lineNo << ": Read error" << Qt::endl; emit error(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k4dirstat-3.2.2/src/kdirtreeview.cpp new/k4dirstat-3.3.0/src/kdirtreeview.cpp --- old/k4dirstat-3.2.2/src/kdirtreeview.cpp 2020-12-23 19:08:25.000000000 +0100 +++ new/k4dirstat-3.3.0/src/kdirtreeview.cpp 2021-09-10 09:19:38.000000000 +0200 @@ -15,6 +15,7 @@ #include <QStyledItemDelegate> #include <QSortFilterProxyModel> #include <QStandardItemModel> +#include <QTextStream> #include <qcolor.h> #include <qmenu.h> #include <qtimer.h> @@ -95,7 +96,16 @@ void removeFile(KFileInfo* file) { QModelIndex tr = fileToIndex(file, false); - removeRow(tr.row(), parent(tr)); + QModelIndex parentIdx = parent(tr); + removeRow(tr.row(), parentIdx); + // Refresh parents + QStandardItem * si = itemFromIndex(parentIdx); + while(si != nullptr) { + QModelIndex begin = si->index(); + QModelIndex end = begin.siblingAtColumn(columnCount() - 1); + emit dataChanged(begin, end); + si = si->parent(); + } } void updateData(QModelIndex r = QModelIndex()) { @@ -167,7 +177,7 @@ } else if(column == view_.percentBarCol() && _orig->isDir() && _orig->isExcluded()) { return i18n("[excluded]"); } else if(column == view_.totalSubDirsCol() && _orig->isDir()) { - return " " + formatCount(_orig->totalSubDirs()); + return QVariant(" " + formatCount(_orig->totalSubDirs())); } else if(column == view_.readJobsCol() && multi) { #if SEPARATE_READ_JOBS_COL return " " + formatCount(_orig->pendingReadJobs(), true); @@ -177,11 +187,11 @@ formatCount(_orig->pendingReadJobs(), true)) : ""; #endif } else if(column == view_.totalSizeCol() && multi) { - return prefix + formatSize(_orig->totalSize()); + return QVariant(prefix + formatSize(_orig->totalSize())); } else if(column == view_.totalItemsCol() && multi) { - return prefix + formatSizeLong(_orig->totalItems()); + return QVariant(prefix + formatSizeLong(_orig->totalItems())); } else if(column == view_.totalFilesCol() && multi) { - return prefix + formatSizeLong(_orig->totalFiles()); + return QVariant(prefix + formatSizeLong(_orig->totalFiles())); } else if(column == view_.nameCol()) return _orig->isDotEntry() ? i18n("<Files>") : _orig->name(); else if(column == view_.latestMtimeCol()) { @@ -284,6 +294,8 @@ if (column == _view->totalSizeCol() || column == _view->percentNumCol() || column == _view->percentBarCol()) return _orig->totalSize() > otherOrig->totalSize(); + else if (column == _view->nameCol()) + return _orig->name() > otherOrig->name(); else if (column == _view->ownSizeCol()) return _orig->size() > otherOrig->size(); else if (column == _view->totalItemsCol()) @@ -511,7 +523,7 @@ // semantics like the percentage bar column (that had doubled as the // read job column while reading) now has. - sortByColumn(_percentNumCol); + sortByColumn(_percentNumCol, Qt::AscendingOrder); } #endif _readJobsCol = -1; @@ -578,7 +590,7 @@ // Change display to busy state - sortByColumn(_totalSizeCol); + sortByColumn(_totalSizeCol, Qt::AscendingOrder); busyDisplay(); emit startingReading(); @@ -792,7 +804,7 @@ const QColor &KDirTreeView::fillColor(int level) const { if (level < 0) { - qWarning() << Q_FUNC_INFO << "Invalid argument: " << level << endl; + qWarning() << Q_FUNC_INFO << "Invalid argument: " << level << Qt::endl; level = 0; } @@ -802,7 +814,7 @@ const QColor &KDirTreeView::rawFillColor(int level) const { if (level < 0 || level > KDirTreeViewMaxFillColor) { level = 0; - qWarning() << Q_FUNC_INFO << "Invalid argument: " << level << endl; + qWarning() << Q_FUNC_INFO << "Invalid argument: " << level << Qt::endl; } return _fillColor[level % KDirTreeViewMaxFillColor]; @@ -815,11 +827,11 @@ void KDirTreeView::setUsedFillColors(int usedFillColors) { if (usedFillColors < 1) { - qWarning() << Q_FUNC_INFO << "Invalid argument: " << usedFillColors << endl; + qWarning() << Q_FUNC_INFO << "Invalid argument: " << usedFillColors << Qt::endl; usedFillColors = 1; } else if (usedFillColors >= KDirTreeViewMaxFillColor) { qWarning() << Q_FUNC_INFO << "Invalid argument: " << usedFillColors - << " (max: " << KDirTreeViewMaxFillColor - 1 << ")" << endl; + << " (max: " << KDirTreeViewMaxFillColor - 1 << ")" << Qt::endl; usedFillColors = KDirTreeViewMaxFillColor - 1; } @@ -852,7 +864,7 @@ void KDirTreeView::setTreeBackground(const QColor &color) { _treeBackground = color; - _percentageBarBackground = _treeBackground.dark(115); + _percentageBarBackground = _treeBackground.darker(115); QGuiApplication *app = dynamic_cast<QGuiApplication *>(QCoreApplication::instance()); @@ -880,7 +892,7 @@ KFileInfo *orig = model()->indexToFile(proxyModel()->mapToSource(idx)); if (!orig) { - qCritical() << "NULL item->orig()" << endl; + qCritical() << "NULL item->orig()" << Qt::endl; return; } @@ -972,6 +984,11 @@ _contextInfo->popup(pos); } +/** Convert an int to a QString using the "%02d" printf format */ +static QString intToStr(int value) { + return QStringLiteral("%1").arg(value, 2, 10, QLatin1Char('0')); +} + void KDirTreeView::readConfig() { KConfigGroup config = KSharedConfig::openConfig()->group("Tree Colors"); _usedFillColors = config.readEntry("usedFillColors", -1); @@ -989,9 +1006,7 @@ QColor defaultColor(Qt::blue); for (int i = 0; i < KDirTreeViewMaxFillColor; i++) { - QString name; - name.sprintf("fillColor_%02d", i); - _fillColor[i] = config.readEntry(name, defaultColor); + _fillColor[i] = config.readEntry("fillColor_" + intToStr(i), defaultColor); } } @@ -1005,9 +1020,7 @@ config.writeEntry("usedFillColors", _usedFillColors); for (int i = 0; i < KDirTreeViewMaxFillColor; i++) { - QString name; - name.sprintf("fillColor_%02d", i); - config.writeEntry(name, _fillColor[i]); + config.writeEntry("fillColor_" + intToStr(i), _fillColor[i]); } } @@ -1032,7 +1045,7 @@ void KDirTreeView::sendMailToOwner() { QModelIndexList indices = selectedIndexes(); if (indices.empty()) { - qCritical() << Q_FUNC_INFO << "Nothing selected!" << endl; + qCritical() << Q_FUNC_INFO << "Nothing selected!" << Qt::endl; return; } QModelIndex idx = indices.at(0); @@ -1052,8 +1065,8 @@ QUrl mail; mail.setScheme("mailto"); mail.setPath(owner); - mail.setQuery("?subject=" + QUrl::toPercentEncoding(subject) + - "&body=" + QUrl::toPercentEncoding(body)); + mail.setQuery(QString("?subject=" + QUrl::toPercentEncoding(subject) + + "&body=" + QUrl::toPercentEncoding(body))); // TODO: Check for maximum command line length. // @@ -1097,7 +1110,6 @@ } QString formatTime(long millisec, bool showMilliSeconds) { - QString formattedTime; int hours; int min; int sec; @@ -1110,13 +1122,10 @@ sec = millisec / 1000L; millisec %= 1000L; - + QString formattedTime = intToStr(hours) + ":" + intToStr(min) + ":" + intToStr(sec); if (showMilliSeconds) { - formattedTime.sprintf("%02d:%02d:%02d.%03ld", hours, min, sec, millisec); - } else { - formattedTime.sprintf("%02d:%02d:%02d", hours, min, sec); + formattedTime += QStringLiteral(".%1").arg(millisec, 3, 10, QLatin1Char('0')); } - return formattedTime; } @@ -1131,11 +1140,7 @@ } QString formatPercent(float percent) { - QString percentString; - - percentString.sprintf("%.1f%%", percent); - - return percentString; + return QString::number(percent, 'f', 1) + "%"; } QString formatTimeDate(time_t rawTime) { @@ -1178,11 +1183,11 @@ * Stefan Hundhammer <[email protected]> 2001-05-28 * (in quite some fit of frustration) */ - timeDateString.sprintf("%4d-%02d-%02d %02d:%02d:%02d", t->tm_year + 1900, - t->tm_mon + - 1, // another brain-dead common pitfall - 0..11 - t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); - + QTextStream s(&timeDateString); + s << qSetFieldWidth(4) << (t->tm_year + 1900) << qSetFieldWidth(0) << "-" + << intToStr(t->tm_mon + 1) << "-" << intToStr(t->tm_mday) << " " + << intToStr(t->tm_hour) << ":" << intToStr(t->tm_min) << ":" + << intToStr(t->tm_sec); return timeDateString; } @@ -1198,12 +1203,12 @@ return desiredColor; } - if (contrastColor != contrastColor.light()) { + if (contrastColor != contrastColor.lighter()) { // try a little lighter - return contrastColor.light(); + return contrastColor.lighter(); } else { // try a little darker - return contrastColor.dark(); + return contrastColor.darker(); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k4dirstat-3.2.2/src/kdirtreeview.h new/k4dirstat-3.3.0/src/kdirtreeview.h --- old/k4dirstat-3.2.2/src/kdirtreeview.h 2020-12-23 19:08:25.000000000 +0100 +++ new/k4dirstat-3.3.0/src/kdirtreeview.h 2021-09-10 09:19:38.000000000 +0200 @@ -10,6 +10,7 @@ #include <QTreeView> #include <qdatetime.h> #include <qpixmap.h> +#include <QElapsedTimer> #define DEBUG_COUNTERS 10 @@ -430,7 +431,7 @@ KDirTree *_tree; QTimer *_updateTimer; - QTime _stopWatch; + QElapsedTimer _stopWatch; QString _currentDir; QMenu *_contextInfo; QAction *infoAction; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k4dirstat-3.2.2/src/kexcluderules.cpp new/k4dirstat-3.3.0/src/kexcluderules.cpp --- old/k4dirstat-3.2.2/src/kexcluderules.cpp 2020-12-23 19:08:25.000000000 +0100 +++ new/k4dirstat-3.3.0/src/kexcluderules.cpp 2021-09-10 09:19:38.000000000 +0200 @@ -56,7 +56,7 @@ #if VERBOSE_EXCLUDE_MATCHES qDebug() << text << " matches exclude rule " << rule->regexp().pattern() - << endl; + << Qt::endl; #endif return true; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k4dirstat-3.2.2/src/kfileinfo.cpp new/k4dirstat-3.3.0/src/kfileinfo.cpp --- old/k4dirstat-3.2.2/src/kfileinfo.cpp 2020-12-23 19:08:25.000000000 +0100 +++ new/k4dirstat-3.3.0/src/kfileinfo.cpp 2021-09-10 09:19:38.000000000 +0200 @@ -61,7 +61,7 @@ qDebug() << "Found sparse file: " << this << " Byte size: " << formatSize(byteSize()) << " Allocated: " << formatSize(allocatedSize()) << " (" - << (int)_blocks << " blocks)" << endl; + << (int)_blocks << " blocks)" << Qt::endl; } #if 0 @@ -173,7 +173,7 @@ if (level < targetLevel) { qCritical() << Q_FUNC_INFO << "URL level " << targetLevel - << " requested, this is level " << level << endl; + << " requested, this is level " << level << Qt::endl; return ""; } @@ -272,7 +272,6 @@ QString KDirStat::formatSize(KFileSize lSize) { QString sizeString; - double size; QString unit; if (lSize < 1024) { @@ -280,21 +279,21 @@ unit = i18n("Bytes"); } else { - size = lSize / 1024.0; // kB + double size = lSize / 1024.0; // kB if (size < 1024.0) { - sizeString.sprintf("%.1f", size); + sizeString = QString::number(size, 'f', 1); unit = i18n("kB"); } else { size /= 1024.0; // MB if (size < 1024.0) { - sizeString.sprintf("%.1f", size); + sizeString = QString::number(size, 'f', 1); unit = i18n("MB"); } else { size /= 1024.0; // GB - we won't go any further... - sizeString.sprintf("%.2f", size); + sizeString = QString::number(size, 'f', 2); unit = i18n("GB"); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k4dirstat-3.2.2/src/ktreemaptile.cpp new/k4dirstat-3.3.0/src/ktreemaptile.cpp --- old/k4dirstat-3.2.2/src/ktreemaptile.cpp 2020-12-23 19:08:25.000000000 +0100 +++ new/k4dirstat-3.3.0/src/ktreemaptile.cpp 2021-09-10 09:19:38.000000000 +0200 @@ -143,7 +143,7 @@ void KTreemapTile::createSquarifiedChildren(const QRectF &rect) { if (_orig->totalSize() == 0) { - qCritical() << Q_FUNC_INFO << "Zero totalSize()" << endl; + qCritical() << Q_FUNC_INFO << "Zero totalSize()" << Qt::endl; return; }
