Commit 01833563 authored by Alexander Bikadorov's avatar Alexander Bikadorov
Browse files

unified and extended global debug output

* qWarning() for all warnings
* qDebug() for additional (and optional) debug messages
* krOut macro is deprecated
parent 97dfa1c8
......@@ -245,7 +245,7 @@ bool UserActionListViewItem::operator<(const QTreeWidgetItem &other) const
{
// FIXME some how this only produces bullshit :-/
// if ( i->text( COL_NAME ).isEmpty() ) { // categories only have titles
// //qDebug() << "this->title: " << text(COL_TITLE) << " |=| i->title: " << i->text(COL_TITLE) << endl;
// //qDebug() << "this->title: " << text(COL_TITLE) << " |=| i->title: " << i->text(COL_TITLE);
// return ( ascending ? -1 : 1 ); // <0 means this is smaller then i
// }
// else
......
......@@ -228,7 +228,7 @@ void UserActionPage::slotRemoveAction()
KStandardGuiItem::remove(), //Label for the continue-button
KStandardGuiItem::cancel(),
"Confirm Remove UserAction", //dontAskAgainName (for the config-file)
KMessageBox::Dangerous | KMessageBox::Notify) ;
KMessageBox::Dangerous | KMessageBox::Notify);
if (messageDelete != KMessageBox::Continue)
return;
......
......@@ -118,10 +118,10 @@ QStringList KRarcHandler::supportedPackers()
if (KrServices::cmdExist("dpkg")) packers.append("dpkg");
if (KrServices::cmdExist("7z") || KrServices::cmdExist("7za")) packers.append("7z");
if (KrServices::cmdExist("rpm") && KrServices::cmdExist("rpm2cpio")) packers.append("rpm");
// qDebug() << "Supported Packers:" << endl;
// qDebug() << "Supported Packers:";
//QStringList::Iterator it;
//for( it = packers.begin(); it != packers.end(); ++it )
// qDebug() << *it << endl;
// qDebug() << *it;
return packers;
}
......@@ -263,7 +263,7 @@ bool KRarcHandler::unpack(QString archive, QString type, QString password, QStri
QStringList packer;
// set the right packer to do the job
if (type == "zip") packer << KrServices::fullPathName("unzip") << "-o" ;
if (type == "zip") packer << KrServices::fullPathName("unzip") << "-o";
else if (type == "tar") packer << KrServices::fullPathName("tar") << "-xvf";
else if (type == "tgz") packer << KrServices::fullPathName("tar") << "-xvzf";
else if (type == "tarz") packer << KrServices::fullPathName("tar") << "-xvzf";
......
......@@ -122,7 +122,7 @@ void TestArchiveThread::slotStart()
// test the archive
if (!KRarcHandler::test(path, type, password, observer(), 0)) {
sendError(KIO::ERR_NO_CONTENT, i18nc("%1=archive filename", "%1, test failed.", arcName));
return ;
return;
}
}
......
......@@ -156,6 +156,7 @@ QUrl KUrlRequesterDlgForCopy::selectedURL() const
{
if (result() == QDialog::Accepted) {
QUrl url = urlRequester_->url();
qDebug() << "requester returned URL=" << url.toDisplayString();
if (url.isValid())
KRecentDocument::add(url);
return url;
......
......@@ -126,7 +126,7 @@ void KRPleaseWaitHandler::startWaiting(QString msg, int count , bool cancel)
dlg->setLabelText(msg);
if (count == 0) {
dlg->setMaximum(10);
cycle = true ;
cycle = true;
cycleProgress();
} else {
dlg->setMaximum(count);
......
......@@ -267,7 +267,7 @@ void DiskUsage::load(const QUrl &baseDir)
}
searchFileSystem = FileSystemProvider::instance().getFilesystem(baseDir);
if (searchFileSystem == 0) {
krOut << "diskusage could not get filesystem for directory " << baseDir;
qWarning() << "could not get filesystem for directory=" << baseDir;
loading = abortLoading = clearAfterAbort = false;
emit loadFinished(false);
return;
......
......@@ -80,6 +80,8 @@ void DefaultFileSystem::copyFiles(const QList<QUrl> &urls, const QUrl &destinati
void DefaultFileSystem::dropFiles(const QUrl &destination, QDropEvent *event)
{
qDebug() << "destination=" << destination;
// resolve relative path before resolving symlinks
const QUrl dest = resolveRelativePath(destination);
......@@ -185,6 +187,7 @@ void DefaultFileSystem::updateFilesystemInfo()
bool DefaultFileSystem::refreshInternal(const QUrl &directory, bool onlyScan)
{
qDebug() << "refresh internal to URL=" << directory.toDisplayString();
if (!KProtocolManager::supportsListing(directory)) {
emit error(i18n("Protocol not supported by Krusader:\n%1", directory.url()));
return false;
......@@ -193,6 +196,7 @@ bool DefaultFileSystem::refreshInternal(const QUrl &directory, bool onlyScan)
delete _watcher; // stop watching the old dir
if (directory.isLocalFile()) {
qDebug() << "start local refresh to URL=" << directory.toDisplayString();
// we could read local directories with KIO but using Qt is a lot faster!
return refreshLocal(directory, onlyScan);
}
......@@ -227,9 +231,11 @@ bool DefaultFileSystem::refreshInternal(const QUrl &directory, bool onlyScan)
void DefaultFileSystem::slotListResult(KJob *job)
{
qDebug() << "got list result";
if (job && job->error()) {
// we failed to refresh
_listError = true;
qDebug() << "error=" << job->errorString() << "; text=" << job->errorText();
emit error(job->errorString()); // display error message (in panel)
}
}
......@@ -246,7 +252,7 @@ void DefaultFileSystem::slotAddFiles(KIO::Job *, const KIO::UDSEntryList& entrie
void DefaultFileSystem::slotRedirection(KIO::Job *job, const QUrl &url)
{
krOut << "redirection to " << url;
qDebug() << "redirection to URL=" << url.toDisplayString();
// some protocols (zip, tar) send redirect to local URL without scheme
const QUrl newUrl = preferLocalUrl(url);
......@@ -263,8 +269,14 @@ void DefaultFileSystem::slotRedirection(KIO::Job *job, const QUrl &url)
_currentDirectory = cleanUrl(newUrl);
}
void DefaultFileSystem::slotWatcherCreated(const QString& path)
{
qDebug() << "path created (doing nothing): " << path;
}
void DefaultFileSystem::slotWatcherDirty(const QString& path)
{
qDebug() << "path dirty: " << path;
if (path == realPath()) {
// this happens
// 1. if a directory was created/deleted/renamed inside this directory.
......@@ -279,7 +291,7 @@ void DefaultFileSystem::slotWatcherDirty(const QString& path)
FileItem *fileItem = getFileItem(name);
if (!fileItem) {
krOut << "dirty watcher file not found (unexpected): " << path;
qWarning() << "file not found (unexpected), path=" << path;
// this happens at least for cifs mounted filesystems: when a new file is created, a dirty
// signal with its file path but no other signals are sent (buggy behaviour of KDirWatch)
refresh();
......@@ -296,6 +308,7 @@ void DefaultFileSystem::slotWatcherDirty(const QString& path)
void DefaultFileSystem::slotWatcherDeleted(const QString& path)
{
qDebug() << "path deleted: " << path;
if (path != realPath()) {
// ignore deletion of files here, a 'dirty' signal will be send anyway
return;
......@@ -352,7 +365,7 @@ bool DefaultFileSystem::refreshLocal(const QUrl &directory, bool onlyScan) {
name = QString::fromLocal8Bit(dirEnt->d_name);
// show hidden files?
if (!showHidden && name.left(1) == ".") continue ;
if (!showHidden && name.left(1) == ".") continue;
// we don't need the "." and ".." entries
if (name == "." || name == "..") continue;
......
......@@ -86,6 +86,7 @@ protected slots:
void slotRedirection(KIO::Job *job, const QUrl &url);
// React to filesystem changes nofified by watcher
// NOTE: the path parameter can be the directory itself or files in this directory
void slotWatcherCreated(const QString &path);
void slotWatcherDirty(const QString &path);
void slotWatcherDeleted(const QString &path);
......
......@@ -107,6 +107,8 @@ QUrl FileSystem::preferLocalUrl(const QUrl &url){
bool FileSystem::scanOrRefresh(const QUrl &directory, bool onlyScan)
{
qDebug() << "from current dir=" << _currentDirectory.toDisplayString()
<< "; to=" << directory.toDisplayString();
if (_isRefreshing) {
// NOTE: this does not happen (unless async)";
return false;
......@@ -234,6 +236,7 @@ FileItem *FileSystem::createLocalFileItem(const QString &name, const QString &di
bool brokenLink = false;
if (isLink) {
// find where the link is pointing to
qDebug() << "link name=" << path;
// the path of the symlink target cannot be longer than the file size of the symlink
char buffer[stat_p.st_size];
memset(buffer, 0, sizeof(buffer));
......@@ -246,7 +249,7 @@ FileItem *FileSystem::createLocalFileItem(const QString &name, const QString &di
else if (linkFile.isDir())
isDir = true;
} else {
krOut << "Failed to read link: " << path;
qWarning() << "failed to read link, path=" << path;
}
}
......
......@@ -98,7 +98,7 @@ void SizeCalculator::nextUrl()
// calculate size of all files/directories in this virtual directory
VirtualFileSystem *fs = new VirtualFileSystem();
if (!fs->scanDir(m_currentUrl)) {
krOut << "cannot scan virtual fs, url=" << m_currentUrl;
qWarning() << "cannot scan virtual FS, URL=" << m_currentUrl.toDisplayString();
nextUrl();
return;
}
......@@ -133,7 +133,7 @@ void SizeCalculator::slotStatResult(KJob *job)
return;
if (job->error()) {
krOut << "stat job failed";
qWarning() << "stat job failed, error=" << job->error() << "; error string=" << job->errorString();
nextSubUrl();
return;
}
......
......@@ -464,7 +464,7 @@ void AdvancedFilter::fillList(KComboBox *list, QString filename)
{
QFile data(filename);
if (!data.open(QIODevice::ReadOnly)) {
krOut << "Search: Unable to read " << filename << " !!!" << endl;
qWarning() << "Search: Unable to read " << filename << " !!!";
return;
}
// and read it into the temporary array
......
......@@ -55,7 +55,7 @@ KIO::filesize_t FilterSettings::FileSize::size() const
case GigaByte:
return amount * 1024 * 1024 * 1024;
default:
krOut << "invalid size unit: " << unit;
qWarning() << "invalid size unit: " << unit;
return amount;
}
}
......@@ -80,7 +80,7 @@ int FilterSettings::TimeSpan::days() const
case Year:
return amount * 365;
default:
krOut << "invalid time unit: " << unit;
qWarning() << "invalid time unit: " << unit;
return amount;
}
}
......
......@@ -64,13 +64,13 @@ void DirHistoryButton::showMenu()
/** No descriptions */
void DirHistoryButton::slotPopup()
{
// qDebug() << "History slot" << endl;
// qDebug() << "History slot";
}
/** No descriptions */
void DirHistoryButton::slotAboutToShow()
{
emit aboutToShow();
// qDebug() << "about to show" << endl;
// qDebug() << "about to show";
popupMenu->clear();
for (int i = 0; i < historyQueue->count(); i++) {
......
......@@ -215,7 +215,7 @@ KCMDLine::~KCMDLine()
{
KConfigGroup grpSvr(krConfig, "Private");
QStringList list = cmdLine->historyItems();
//krOut << list[0] << endl;
//qWarning() << list[0];
grpSvr.writeEntry("cmdline history", list);
krConfig->sync();
}
......@@ -243,7 +243,7 @@ void KCMDLine::slotRun()
{
const QString command1(cmdLine->currentText());
if (command1.isEmpty())
return ;
return;
cmdLine->addToHistory(command1);
// bugfix by aardvark: current editline is destroyed by addToHistory() in some cases
......
......@@ -79,7 +79,7 @@ void KrRemoteEncodingMenu::slotAboutToShow()
}
if (!found)
qWarning() << Q_FUNC_INFO << "could not find entry for charset=" << charset << endl;
qWarning() << Q_FUNC_INFO << "could not find entry for charset=" << charset;
} else {
foreach(QAction *act, acts) {
if (act->data().canConvert<int> ()) {
......
......@@ -119,6 +119,7 @@ protected slots:
void slotTerminated()
{
qDebug() << "job description=" << m_krJob->description();
m_pauseResumeButton->setEnabled(false);
m_cancelButton->setIcon(QIcon::fromTheme("edit-clear"));
m_cancelButton->setToolTip(i18n("Clear"));
......@@ -155,7 +156,7 @@ private slots:
connect(job, &KJob::resumed, this, &JobMenuAction::updatePauseResumeButton);
connect(job, &KJob::result, this, &JobMenuAction::slotResult);
connect(job, &KJob::warning, this, [](KJob *, const QString &plain, const QString &) {
krOut << "unexpected job warning: " << plain;
qWarning() << "unexpected job warning: " << plain;
});
updatePauseResumeButton();
......@@ -265,6 +266,7 @@ bool JobMan::waitForJobs(bool waitForUserInput)
void JobMan::manageJob(KrJob *job, StartMode startMode)
{
qDebug() << "new job, startMode=" << startMode;
managePrivate(job);
connect(job, &KrJob::started, this, &JobMan::slotKJobStarted);
......@@ -337,6 +339,8 @@ void JobMan::slotDescription(KJob*,const QString &description, const QPair<QStri
void JobMan::slotTerminated(KrJob *krJob)
{
qDebug() << "terminated, job description: " << krJob->description();
m_jobs.removeAll(krJob);
// NOTE: ignoring queue mode here. We assume that if queue mode is turned off, the user created
......
......@@ -324,7 +324,7 @@ void KrViewer::edit(QUrl url, Mode mode, int new_window, QWidget * parent)
proc << cmdArgs << url.toDisplayString(QUrl::PreferLocalFile);
if (!proc.startDetached())
KMessageBox::sorry(krMainWindow, i18n("Can not open \"%1\"", editor));
return ;
return;
}
KrViewer* viewer = getViewer(new_window);
......
......@@ -52,7 +52,7 @@ bool KrJS::runFile(const QString & filename)
case KJS::Break:
case KJS::Continue:
// TODO: find out what this means
krOut << "JavaScript: " << jsres.value().toString(exec).qstring() << endl;
qWarning() << "JavaScript: " << jsres.value().toString(exec).qstring();
break;
case KJS::ReturnValue:
// that's only needed when a specific function is called
......@@ -69,8 +69,8 @@ bool KrJS::runFile(const QString & filename)
QString type = exception.get(exec, KJS::Identifier("name")).toString(exec).qstring();
QString message = exception.get(exec, KJS::Identifier("message")).toString(exec).qstring();
krOut << "JavaScript: Uncaught " << type << " exception at line " << line << " in " << filename << endl;
krOut << message << endl;
qWarning() << "JavaScript: Uncaught " << type << " exception at line " << line << " in " << filename;
qWarning() << message;
KMessageBox::error(0, //parent
(line < 0 ?
......@@ -78,17 +78,17 @@ bool KrJS::runFile(const QString & filename)
QString(i18n("In %1:\nUncaught JavaScript exception '%2' at line %3\n%4", filename, type, line, message))
), //text
i18n("JavaScript Error"), //caption
KMessageBox::Dangerous) ;
KMessageBox::Dangerous);
break;
}
default:
krOut << "JavaScript: Unknown error." << endl;
qWarning() << "JavaScript: Unknown error.";
break;
} // switch
} // if
krOut << "JS: done" << endl;
qWarning() << "JS: done";
return ok;
}
......
......@@ -98,7 +98,7 @@ public:
Q_UNUSED(supportedActs);
QList<QUrl> urls;
QList<QTreeWidgetItem *> list = selectedItems() ;
QList<QTreeWidgetItem *> list = selectedItems();
QListIterator<QTreeWidgetItem *> it(list);
......
......@@ -390,7 +390,7 @@ void KMountMan::quickList()
{
if (!Operational) {
KMessageBox::error(0, i18n("MountMan is not operational. Sorry"));
return ;
return;
}
// clear the popup menu
......@@ -446,7 +446,7 @@ void KMountMan::delayedPerformAction(QAction * act)
__delayedIdx = idx;
if (idx < 0)
return ;
return;
QTimer::singleShot(0, this, SLOT(performAction()));
}
......
......@@ -231,7 +231,7 @@ void KMountManGUI::getSpaceData()
if (mounted.size() == 0) { // nothing is mounted
addNonMounted();
updateList(); // let's continue
return ;
return;
}
for (KMountPoint::List::iterator it = mounted.begin(); it != mounted.end(); ++it) {
......@@ -416,7 +416,7 @@ void KMountManGUI::clicked(QTreeWidgetItem *item, const QPoint & pos)
#define FORMAT_ID 93
#define EJECT_ID 94
//////////////////////////////////////////////////////////
if (!item) return ;
if (!item) return;
fsData *system = getFsData(item);
// create the menu
......
......@@ -20,6 +20,8 @@
#include "krinterview.h"
#include <QDebug>
#include "krmousehandler.h"
#include "listmodel.h"
#include "krviewitem.h"
......@@ -211,6 +213,7 @@ KrViewItem * KrInterView::getKrViewItem(const QModelIndex & ndx)
void KrInterView::makeCurrentVisible()
{
qDebug() << "scroll to current index=" << _itemView->currentIndex();
_itemView->scrollTo(_itemView->currentIndex());
}
......@@ -221,6 +224,7 @@ void KrInterView::makeItemVisible(const KrViewItem *item)
FileItem* fileitem = (FileItem *)item->getFileItem();
QModelIndex ndx = _model->fileItemIndex(fileitem);
qDebug() << "scroll to item name=" << fileitem->getName();
if (ndx.isValid())
_itemView->scrollTo(ndx);
}
......
......@@ -624,6 +624,7 @@ void KrView::clear()
bool KrView::handleKeyEvent(QKeyEvent *e)
{
qDebug() << "key event=" << e;
switch (e->key()) {
case Qt::Key_Enter :
case Qt::Key_Return : {
......@@ -1104,7 +1105,7 @@ void KrView::customSelection(bool select)
KRQuery query = dialog.getQuery();
// if the user canceled - quit
if (query.isNull())
return ;
return;
includeDirs = dialog.isExtraOptionChecked(i18n("Apply selection to folders"));
changeSelection(query, select, includeDirs);
......
......@@ -87,7 +87,7 @@ QString KrViewItem::description() const
if (_fileitem->isBrokenLink())
text += i18n("(Broken Link)");
else if (mimeTypeComment.isEmpty())
text += i18n("Symbolic Link") ;
text += i18n("Symbolic Link");
else
text += i18n("%1 (Link)", mimeTypeComment);
......
......@@ -219,7 +219,7 @@ bool KrColorSettings::isColorNameValid(const QString & settingName)
bool KrColorSettings::setColorValue(const QString & settingName, const QColor & color)
{
if (!isColorNameValid(settingName)) {
krOut << "Invalid color setting name: " << settingName << endl;
qWarning() << "Invalid color setting name: " << settingName;
return false;
}
m_impl->m_colorValues[settingName] = color;
......@@ -229,7 +229,7 @@ bool KrColorSettings::setColorValue(const QString & settingName, const QColor &
QColor KrColorSettings::getColorValue(const QString & settingName) const
{
if (!isColorNameValid(settingName)) {
krOut << "Invalid color setting name: " << settingName << endl;
qWarning() << "Invalid color setting name: " << settingName;
return QColor();
}
return m_impl->m_colorValues[settingName];
......@@ -238,7 +238,7 @@ QColor KrColorSettings::getColorValue(const QString & settingName) const
bool KrColorSettings::setColorTextValue(const QString & settingName, const QString & colorText)
{
if (!isColorNameValid(settingName)) {
krOut << "Invalid color setting name: " << settingName << endl;
qWarning() << "Invalid color setting name: " << settingName;
return false;
}
m_impl->m_colorTextValues[settingName] = colorText;
......@@ -248,7 +248,7 @@ bool KrColorSettings::setColorTextValue(const QString & settingName, const QStri
QString KrColorSettings::getColorTextValue(const QString & settingName) const
{
if (!isColorNameValid(settingName)) {
krOut << "Invalid color setting name: " << settingName << endl;
qWarning() << "Invalid color setting name: " << settingName;
return QString();
}
return m_impl->m_colorTextValues[settingName];
......@@ -267,7 +267,7 @@ bool KrColorSettings::isNumNameValid(const QString & settingName)
bool KrColorSettings::setNumValue(const QString & settingName, int value)
{
if (!isNumNameValid(settingName)) {
krOut << "Invalid number setting name: " << settingName << endl;
qWarning() << "Invalid number setting name: " << settingName;
return false;
}
m_impl->m_numValues[settingName] = value;
......@@ -277,7 +277,7 @@ bool KrColorSettings::setNumValue(const QString & settingName, int value)
int KrColorSettings::getNumValue(const QString & settingName, int defaultValue) const
{
if (!isNumNameValid(settingName)) {
krOut << "Invalid number setting name: " << settingName << endl;
qWarning() << "Invalid number setting name: " << settingName;
return 0;
}
if (!m_impl->m_numValues.contains(settingName))
......@@ -298,7 +298,7 @@ bool KrColorSettings::isBoolNameValid(const QString & settingName)
bool KrColorSettings::setBoolValue(const QString & settingName, bool value)
{
if (!isBoolNameValid(settingName)) {
krOut << "Invalid bool setting name: " << settingName << endl;
qWarning() << "Invalid bool setting name: " << settingName;
return false;
}
m_impl->m_boolValues[settingName] = value;
......@@ -308,7 +308,7 @@ bool KrColorSettings::setBoolValue(const QString & settingName, bool value)
int KrColorSettings::getBoolValue(const QString & settingName, bool defaultValue) const
{
if (!isBoolNameValid(settingName)) {
krOut << "Invalid bool setting name: " << settingName << endl;
qWarning() << "Invalid bool setting name: " << settingName;
return false;
}
if (!m_impl->m_boolValues.contains(settingName))
......
......@@ -67,7 +67,7 @@ protected:
private:
QUrl urlForProxyIndex(const QModelIndex &index) const;
void dropMimeData(const QList<QUrl> & lst, const QUrl &url) const;
void copyToClipBoard(const KFileItem &fileItem, bool cut) const ;
void copyToClipBoard(const KFileItem &fileItem, bool cut) const;
void deleteFile(const KFileItem &fileItem, bool moveToTrash = true) const;
bool briefMode() const;
void setBriefMode(bool brief); // show only column with directory names
......
......@@ -83,7 +83,7 @@ bool KrLayoutFactory::parseFiles()
if (!mainFilePath.isEmpty())
_parsed = parseFile(mainFilePath, _mainDoc);
else
krOut << "can't locate" << MAIN_FILE << endl;
qWarning() << "can't locate" << MAIN_FILE;
if (!_parsed)
_parsed = parseRessource(MAIN_FILE_RC_PATH, _mainDoc);
......@@ -94,7 +94,7 @@ bool KrLayoutFactory::parseFiles()
QStringList extraFilePaths = QStandardPaths::locateAll(QStandardPaths::DataLocation, EXTRA_FILE_MASK);
foreach(const QString &path, extraFilePaths) {
krOut << "extra file: " << path << endl;
qWarning() << "extra file: " << path;
QDomDocument doc;
if (parseFile(path, doc))
_extraDocs << doc;
......@@ -112,7 +112,7 @@ bool KrLayoutFactory::parseFile(QString path, QDomDocument &doc)
if (file.open(QIODevice::ReadOnly))
return parseContent(file.readAll(), path, doc);
else
krOut << "can't open" << path << endl;
qWarning() << "can't open" << path;
return success;
}
......@@ -128,7 +128,7 @@ bool KrLayoutFactory::parseRessource(QString path, QDomDocument &doc)
data = QByteArray(reinterpret_cast<const char*>(res.data()), res.size());
return parseContent(data, path, doc);
} else {
krOut << "resource does not exist:" << path;
qWarning() << "resource does not exist:" << path;
return false;
}
}
......@@ -145,11 +145,11 @@ bool KrLayoutFactory::parseContent(QByteArray content, QString fileName, QDomDoc
if(version == XMLFILE_VERSION)
success = true;
else
krOut << fileName << "has wrong version" << version << "- required is" << XMLFILE_VERSION << endl;
qWarning() << fileName << "has wrong version" << version << "- required is" <<