From f70c9b60b7427ca6855075da4b38b966f10ad377 Mon Sep 17 00:00:00 2001 From: Hamatoma Date: Thu, 7 May 2015 00:24:44 +0200 Subject: [PATCH] win32 corrections --- appl/refind/dialogfileplaceholder.cpp | 2 +- appl/refind/mainwindow.cpp | 1 - appl/refind/utils.cpp | 15 ++++++++++----- appl/refind/utils.hpp | 4 +++- base/ReQStringUtil.cpp | 4 ++-- base/ReQStringUtil.hpp | 2 +- 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/appl/refind/dialogfileplaceholder.cpp b/appl/refind/dialogfileplaceholder.cpp index 5ea4100..959f312 100644 --- a/appl/refind/dialogfileplaceholder.cpp +++ b/appl/refind/dialogfileplaceholder.cpp @@ -7,7 +7,7 @@ */ #include "dialogfileplaceholder.hpp" -#include "ui_dialogfileplaceholders.h" +#include "ui_dialogfileplaceholder.h" DialogFilePlaceholder::DialogFilePlaceholder(QWidget *parent) : QDialog(parent), ui(new Ui::DialogFilePlaceHolders){ diff --git a/appl/refind/mainwindow.cpp b/appl/refind/mainwindow.cpp index 8aa58e1..78d5a77 100644 --- a/appl/refind/mainwindow.cpp +++ b/appl/refind/mainwindow.cpp @@ -498,7 +498,6 @@ void MainWindow::prepareContextMenu(){ connect(ui->tableWidget, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(handleTableContextMenu(const QPoint&))); - ContextHandler* handler = new ContextHandler(); } /** diff --git a/appl/refind/utils.cpp b/appl/refind/utils.cpp index 71a48ce..9a54c42 100644 --- a/appl/refind/utils.cpp +++ b/appl/refind/utils.cpp @@ -108,7 +108,12 @@ ContextHandler* createHandlerIfExists(const QString& file, handler = new ContextHandler; handler->m_text = ReQStringUtil::nodeOf(file); handler->m_program = file; - handler->m_arguments = fileType; + handler->m_arguments = "${full}"; +#if defined WIN32 + if (handler->m_text == "cmd.exe") + handler->m_arguments = ""; +#endif + handler->m_fileType = fileType; handler->m_directoryMode = fileType == ContextHandler::FT_FILE ? ContextHandler::DM_TO_PARENT : ContextHandler::DM_TO_FILE; @@ -162,12 +167,12 @@ void ContextHandlerList::restore(ReStateStorage& storage){ handler = createHandlerIfExists("/usr/bin/gnome-terminal", ContextHandler::FT_DIR); if (handler != NULL) m_list.append(handler); -#elif defined __WIN32__ +#elif defined WIN32 handler = createHandlerIfExists("c:\\windows\\system32\\notepad.exe"); - if (handler == NULL) - m_contextHandlers.list().append(handler); + if (handler != NULL) + m_list.append(handler); handler = createHandlerIfExists("c:\\windows\\system32\\cmd.exe", ContextHandler::FT_DIR); - if (handler == NULL) + if (handler != NULL) m_list.append(handler); #endif diff --git a/appl/refind/utils.hpp b/appl/refind/utils.hpp index c2bea60..1d3ad40 100644 --- a/appl/refind/utils.hpp +++ b/appl/refind/utils.hpp @@ -8,7 +8,9 @@ #ifndef UTILS_HPP #define UTILS_HPP - +#ifndef REBASE_HPP +#include "base/rebase.hpp" +#endif #include #include "gui/ReStateStorage.hpp" enum { diff --git a/base/ReQStringUtil.cpp b/base/ReQStringUtil.cpp index 94c3766..e6160fb 100644 --- a/base/ReQStringUtil.cpp +++ b/base/ReQStringUtil.cpp @@ -48,7 +48,7 @@ ReString ReQStringUtil::extensionOf(const ReString& filename){ if (index > 0){ int index2 = filename.lastIndexOf('/'); if (index2 < index){ -#if defined __WIN32__ +#if defined WIN32 index2 = filename.lastIndexOf('\\'); if (index2 < index) rc = filename.mid(index); @@ -370,7 +370,7 @@ ReString ReQStringUtil::nodeOf(const ReString& filename){ if (index >= 0) rc = filename.mid(index + 1); else{ -#if defined __WIN32__ +#if defined WIN32 index = filename.lastIndexOf('\\'); if (index < 0) rc = filename; diff --git a/base/ReQStringUtil.hpp b/base/ReQStringUtil.hpp index 950163f..2ca9374 100644 --- a/base/ReQStringUtil.hpp +++ b/base/ReQStringUtil.hpp @@ -36,7 +36,7 @@ public: * @return the path with native path separators */ inline static QString nativePath(const QString& path){ -#if defined __WIN32__ +#if defined WIN32 QString rc(path); return rc.replace("/", "\\"); #else return path; -- 2.39.5