From 4bbf56fe1140f2dfa79e6a4a9f717e65375be412 Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Sat, 31 May 2008 21:21:28 +0000 Subject: [PATCH] A bug was introduced in with commit 5727. Restoretree and restore were after that commit using a subroutine in pages to determine if a path was a win32 path. The restore class was sending "/c:/" and restoretree was sending "c:/". The subroutine was working for "c:/" This should fix it and should also resolve the performance issue. I'm a little concerned because I love regexes that maybe a regex would be better, but I'll try this for a bit to see if all works correctly. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7076 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/pages.cpp | 10 +++++- bacula/src/qt-console/restore/restore.cpp | 41 ++++++++++++----------- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/bacula/src/qt-console/pages.cpp b/bacula/src/qt-console/pages.cpp index d8da0986ca..173f7fbf3c 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 25187d9193..4da3efde3f 100644 --- a/bacula/src/qt-console/restore/restore.cpp +++ b/bacula/src/qt-console/restore/restore.cpp @@ -186,33 +186,36 @@ void restorePage::addDirectory(QString &newdirr) bool windrive = false; if (mainWin->m_miscDebug) { - QString msg = QString(tr("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()); + 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"))); + + 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); } - m_dirPaths.insert(text, item); - m_dirTreeItems.insert(item, text); } - if (isWin32Path(fullpath)) { - /* this is a windows drive */ - if (mainWin->m_miscDebug) { - Pmsg0(000, "Need to do windows \"letter\":/\n"); - } - windrive = true; - } /* is it already existent ?? */ if (!m_dirPaths.contains(fullpath)) { -- 2.39.5