Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 8bc93b56 authored by Elvis Angelaccio's avatar Elvis Angelaccio

Introduce HAVE_TERMINAL

Source code should check for features detected during configure-time,
rather than checking for a specific OS.

See also commit 87e8d0ba.
parent 52c019c9
......@@ -98,6 +98,13 @@ else()
message(WARNING "Baloo packages not found. They are needed for the metadata features of Dolphin (including the information panel).")
endif()
# TODO: drop HAVE_TERMINAL once we are sure the terminal panel works on Windows too.
if(WIN32)
set(HAVE_TERMINAL FALSE)
else()
set(HAVE_TERMINAL TRUE)
endif()
add_subdirectory(src)
add_subdirectory(doc)
......
......@@ -4,6 +4,8 @@ configure_file(config-baloo.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-baloo.h)
configure_file(config-dolphin.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-dolphin.h)
configure_file(config-terminal.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-terminal.h)
add_definitions(
-DTRANSLATION_DOMAIN=\"dolphin\"
)
......
#cmakedefine HAVE_TERMINAL
......@@ -21,6 +21,7 @@
#include "dolphinmainwindow.h"
#include "config-terminal.h"
#include "global.h"
#include "dolphindockwidget.h"
#include "dolphincontextmenu.h"
......@@ -1213,7 +1214,7 @@ void DolphinMainWindow::setupActions()
compareFiles->setEnabled(false);
connect(compareFiles, &QAction::triggered, this, &DolphinMainWindow::compareFiles);
#ifndef Q_OS_WIN
#ifdef HAVE_TERMINAL
if (KAuthorized::authorize(QStringLiteral("shell_access"))) {
QAction* openTerminal = actionCollection()->addAction(QStringLiteral("open_terminal"));
openTerminal->setText(i18nc("@action:inmenu Tools", "Open Terminal"));
......@@ -1332,7 +1333,7 @@ void DolphinMainWindow::setupDockWidgets()
this, &DolphinMainWindow::showErrorMessage);
// Setup "Terminal"
#ifndef Q_OS_WIN
#ifdef HAVE_TERMINAL
if (KAuthorized::authorize(QStringLiteral("shell_access"))) {
DolphinDockWidget* terminalDock = new DolphinDockWidget(i18nc("@title:window Shell terminal", "Terminal"));
terminalDock->setLocked(lock);
......
......@@ -41,9 +41,9 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget* parent) :
m_confirmEmptyTrash(nullptr),
m_confirmDelete(nullptr),
#ifndef Q_OS_WIN
#ifdef HAVE_TERMINAL
m_confirmClosingTerminalRunningProgram(nullptr),
#endif
#endif
m_confirmClosingMultipleTabs(nullptr)
{
......@@ -67,10 +67,10 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget* parent) :
m_confirmClosingMultipleTabs = new QCheckBox(i18nc("@option:check Ask for confirmation in Dolphin when",
"Closing windows with multiple tabs"), this);
#ifndef Q_OS_WIN
#ifdef HAVE_TERMINAL
m_confirmClosingTerminalRunningProgram = new QCheckBox(i18nc("@option:check Ask for confirmation when",
"Closing windows with a program running in the Terminal panel"), this);
#endif
#endif
topLayout->addWidget(confirmLabelKde);
topLayout->addWidget(m_confirmMoveToTrash);
......@@ -81,9 +81,9 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget* parent) :
topLayout->addWidget(confirmLabelDolphin);
topLayout->addWidget(m_confirmClosingMultipleTabs);
#ifndef Q_OS_WIN
#ifdef HAVE_TERMINAL
topLayout->addWidget(m_confirmClosingTerminalRunningProgram);
#endif
#endif
topLayout->addStretch();
......@@ -95,9 +95,9 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget* parent) :
connect(m_confirmScriptExecution, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed);
connect(m_confirmClosingMultipleTabs, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed);
#ifndef Q_OS_WIN
#ifdef HAVE_TERMINAL
connect(m_confirmClosingTerminalRunningProgram, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed);
#endif
#endif
}
ConfirmationsSettingsPage::~ConfirmationsSettingsPage()
......@@ -123,9 +123,9 @@ void ConfirmationsSettingsPage::applySettings()
GeneralSettings* settings = GeneralSettings::self();
settings->setConfirmClosingMultipleTabs(m_confirmClosingMultipleTabs->isChecked());
#ifndef Q_OS_WIN
#ifdef HAVE_TERMINAL
settings->setConfirmClosingTerminalRunningProgram(m_confirmClosingTerminalRunningProgram->isChecked());
#endif
#endif
settings->save();
}
......@@ -157,8 +157,8 @@ void ConfirmationsSettingsPage::loadSettings()
m_confirmClosingMultipleTabs->setChecked(GeneralSettings::confirmClosingMultipleTabs());
#ifndef Q_OS_WIN
#ifdef HAVE_TERMINAL
m_confirmClosingTerminalRunningProgram->setChecked(GeneralSettings::confirmClosingTerminalRunningProgram());
#endif
#endif
}
......@@ -19,6 +19,7 @@
#ifndef CONFIRMATIONSSETTINGSPAGE_H
#define CONFIRMATIONSSETTINGSPAGE_H
#include "config-terminal.h"
#include "settings/settingspagebase.h"
class QCheckBox;
......@@ -48,9 +49,9 @@ private:
QCheckBox* m_confirmEmptyTrash;
QCheckBox* m_confirmDelete;
#ifndef Q_OS_WIN
#ifdef HAVE_TERMINAL
QCheckBox* m_confirmClosingTerminalRunningProgram;
#endif
#endif
QCheckBox* m_confirmClosingMultipleTabs;
QCheckBox* m_confirmScriptExecution;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment