From eb3410550480a1c474bbcc387cea8fb75257ad52 Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Sun, 1 Jun 2008 14:31:37 +0000 Subject: [PATCH] This is the same changes made to the head to fix being able to use the restore class from both unix and windows type file systems. (ie c:/ preceeding) git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@7085 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/console/console.cpp | 2 +- bacula/src/qt-console/pages.cpp | 10 +++++- bacula/src/qt-console/restore/restore.cpp | 42 ++++++++++++----------- 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index 77106b2bb8..58f175e5ba 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -617,7 +617,7 @@ int Console::read() break; } app->processEvents(); - if (m_api_set && m_messages_pending) { + if (m_api_set && m_messages_pending && m_notifier->isEnabled()) { write_dir(".messages"); m_messages_pending = false; } diff --git a/bacula/src/qt-console/pages.cpp b/bacula/src/qt-console/pages.cpp index 59c5143e59..051e5873a7 100644 --- a/bacula/src/qt-console/pages.cpp +++ b/bacula/src/qt-console/pages.cpp @@ -39,7 +39,15 @@ bool isWin32Path(QString &fullPath) { char *buf = fullPath.left(2).toUtf8().data(); - return buf[1] == ':' && B_ISALPHA(buf[0]); + //bool toret = B_ISALPHA(buf[1]); + bool toret = buf[1] == ':' && B_ISALPHA(buf[0]); + if (mainWin->m_miscDebug) { + if (toret) + Pmsg1(000, "returning from isWin32Path true %s\n", fullPath.toUtf8().data()); + else + Pmsg1(000, "returning from isWin32Path false %s\n", fullPath.toUtf8().data()); + } + return toret; } diff --git a/bacula/src/qt-console/restore/restore.cpp b/bacula/src/qt-console/restore/restore.cpp index 73661b4e06..542b2a9881 100644 --- a/bacula/src/qt-console/restore/restore.cpp +++ b/bacula/src/qt-console/restore/restore.cpp @@ -185,34 +185,36 @@ void restorePage::addDirectory(QString &newdirr) bool windrive = false; if (mainWin->m_miscDebug) { - QString msg = QString("In addDirectory cwd \"%1\" newdir \"%2\"\n") + QString msg = QString(tr("In addDirectory cwd \"%1\" newdir \"%2\" fullpath \"%3\"\n")) .arg(m_cwd) - .arg(newdir); + .arg(newdir) + .arg(fullpath); Pmsg0(000, msg.toUtf8().data()); } /* add unix '/' directory first */ - if (m_dirPaths.empty() && !isWin32Path(fullpath)) { - QTreeWidgetItem *item = new QTreeWidgetItem(directoryWidget); - item->setIcon(0,QIcon(QString::fromUtf8(":images/folder.png"))); - - QString text("/"); - item->setText(0, text.toUtf8().data()); - if (mainWin->m_miscDebug) { - Pmsg1(000, "Pre Inserting %s\n",text.toUtf8().data()); - } - m_dirPaths.insert(text, item); - m_dirTreeItems.insert(item, text); - } + if (m_dirPaths.empty()) { + if (isWin32Path(newdir)) { + /* this is a windows drive */ + if (mainWin->m_miscDebug) { + Pmsg0(000, "Need to do windows \"letter\":/\n"); + } + fullpath.replace(0,1,""); + windrive = true; + } else { + QTreeWidgetItem *item = new QTreeWidgetItem(directoryWidget); + item->setIcon(0,QIcon(QString::fromUtf8(":images/folder.png"))); - if (isWin32Path(fullpath)) { - /* this is a windows drive */ - if (mainWin->m_miscDebug) { - Pmsg0(000, "Need to do windows \"letter\":/\n"); + QString text("/"); + item->setText(0, text.toUtf8().data()); + if (mainWin->m_miscDebug) { + Pmsg1(000, "Pre Inserting %s\n",text.toUtf8().data()); + } + m_dirPaths.insert(text, item); + m_dirTreeItems.insert(item, text); } - windrive = true; } - + /* is it already existent ?? */ if (!m_dirPaths.contains(fullpath)) { QTreeWidgetItem *item = NULL; -- 2.39.2