Commit 28a74d17 authored by Ahmad Samir's avatar Ahmad Samir
Browse files

Use cmakedefine01

This way we get a build time warning if the var isn't defined at all, e.g.
a missing check_include_files() CMake call.
parent 8a0003bf
#cmakedefine HAVE_BALOO
#cmakedefine HAVE_KACTIVITIES
#cmakedefine HAVE_KUSERFEEDBACK
#cmakedefine HAVE_PACKAGEKIT
#cmakedefine HAVE_TERMINAL
#cmakedefine01 HAVE_BALOO
#cmakedefine01 HAVE_KACTIVITIES
#cmakedefine01 HAVE_KUSERFEEDBACK
#cmakedefine01 HAVE_PACKAGEKIT
#cmakedefine01 HAVE_TERMINAL
......@@ -267,7 +267,7 @@ bool DolphinMainWindow::isFoldersPanelEnabled() const
bool DolphinMainWindow::isInformationPanelEnabled() const
{
#ifdef HAVE_BALOO
#if HAVE_BALOO
return actionCollection()->action(QStringLiteral("show_information_panel"))->isChecked();
#else
return false;
......@@ -1770,7 +1770,7 @@ void DolphinMainWindow::setupActions()
actionCollection()->setDefaultShortcut(openTerminalHere, Qt::SHIFT | Qt::ALT | Qt::Key_F4);
connect(openTerminalHere, &QAction::triggered, this, &DolphinMainWindow::openTerminalHere);
#ifdef HAVE_TERMINAL
#if HAVE_TERMINAL
QAction* focusTerminalPanel = actionCollection()->addAction(QStringLiteral("focus_terminal_panel"));
focusTerminalPanel->setText(i18nc("@action:inmenu Tools", "Focus Terminal Panel"));
focusTerminalPanel->setIcon(QIcon::fromTheme(QStringLiteral("swap-panels")));
......@@ -1897,7 +1897,7 @@ void DolphinMainWindow::setupDockWidgets()
infoDock->setObjectName(QStringLiteral("infoDock"));
infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
#ifdef HAVE_BALOO
#if HAVE_BALOO
InformationPanel* infoPanel = new InformationPanel(infoDock);
infoPanel->setCustomContextMenuActions({lockLayoutAction});
connect(infoPanel, &InformationPanel::urlActivated, this, &DolphinMainWindow::handleUrl);
......@@ -1921,7 +1921,7 @@ void DolphinMainWindow::setupDockWidgets()
const QString panelWhatsThis = xi18nc("@info:whatsthis", "<para>To show or "
"hide panels like this go to <interface>Control|Panels</interface> "
"or <interface>View|Panels</interface>.</para>");
#ifdef HAVE_BALOO
#if HAVE_BALOO
actionCollection()->action(QStringLiteral("show_information_panel"))
->setWhatsThis(xi18nc("@info:whatsthis", "<para> This toggles the "
"<emphasis>information</emphasis> panel at the right side of the "
......@@ -1973,7 +1973,7 @@ void DolphinMainWindow::setupDockWidgets()
"This allows quick switching between any folders.</para>") + panelWhatsThis);
// Setup "Terminal"
#ifdef HAVE_TERMINAL
#if HAVE_TERMINAL
if (KAuthorized::authorize(QStringLiteral("shell_access"))) {
DolphinDockWidget* terminalDock = new DolphinDockWidget(i18nc("@title:window Shell terminal", "Terminal"));
terminalDock->setLocked(lock);
......@@ -2098,7 +2098,7 @@ void DolphinMainWindow::setupDockWidgets()
panelsMenu->setPopupMode(QToolButton::InstantPopup);
const KActionCollection* ac = actionCollection();
panelsMenu->addAction(ac->action(QStringLiteral("show_places_panel")));
#ifdef HAVE_BALOO
#if HAVE_BALOO
panelsMenu->addAction(ac->action(QStringLiteral("show_information_panel")));
#endif
panelsMenu->addAction(ac->action(QStringLiteral("show_folders_panel")));
......
......@@ -15,7 +15,7 @@
#include <kio/fileundomanager.h>
#include <kxmlguiwindow.h>
#ifdef HAVE_BALOO
#if HAVE_BALOO
#include "panels/information/informationpanel.h"
#endif
......
......@@ -17,7 +17,7 @@
#include "views/viewproperties.h"
#include "dolphin_detailsmodesettings.h"
#ifdef HAVE_KACTIVITIES
#if HAVE_KACTIVITIES
#include <KActivities/ResourceInstance>
#endif
#include <KFileItemActions>
......@@ -54,7 +54,7 @@ DolphinViewContainer::DolphinViewContainer(const QUrl& url, QWidget* parent) :
m_statusBarTimer(nullptr),
m_statusBarTimestamp(),
m_autoGrabFocus(true)
#ifdef HAVE_KACTIVITIES
#if HAVE_KACTIVITIES
, m_activityResourceInstance(nullptr)
#endif
{
......@@ -214,7 +214,7 @@ DolphinViewContainer::DolphinViewContainer(const QUrl& url, QWidget* parent) :
// Initialize kactivities resource instance
#ifdef HAVE_KACTIVITIES
#if HAVE_KACTIVITIES
m_activityResourceInstance = new KActivities::ResourceInstance(window()->winId(), url);
m_activityResourceInstance->setParent(this);
#endif
......@@ -237,7 +237,7 @@ void DolphinViewContainer::setActive(bool active)
}
m_view->setActive(active);
#ifdef HAVE_KACTIVITIES
#if HAVE_KACTIVITIES
if (active) {
m_activityResourceInstance->notifyFocusedIn();
} else {
......@@ -530,7 +530,7 @@ void DolphinViewContainer::setUrl(const QUrl& newUrl)
m_urlNavigator->setLocationUrl(newUrl);
}
#ifdef HAVE_KACTIVITIES
#if HAVE_KACTIVITIES
m_activityResourceInstance->setUri(newUrl);
#endif
}
......
......@@ -19,7 +19,7 @@
#include <QPushButton>
#include <QWidget>
#ifdef HAVE_KACTIVITIES
#if HAVE_KACTIVITIES
namespace KActivities {
class ResourceInstance;
}
......@@ -428,7 +428,7 @@ private:
*/
std::unique_ptr<DolphinUrlNavigator::VisualState> m_urlNavigatorVisualState;
#ifdef HAVE_KACTIVITIES
#if HAVE_KACTIVITIES
private:
KActivities::ResourceInstance * m_activityResourceInstance;
#endif
......
......@@ -21,7 +21,7 @@
#include <KPluginMetaData>
#include <KSharedConfig>
#ifdef HAVE_BALOO
#if HAVE_BALOO
#include "private/kbaloorolesprovider.h"
#include <Baloo/File>
#include <Baloo/FileMonitor>
......@@ -83,7 +83,7 @@ KFileItemModelRolesUpdater::KFileItemModelRolesUpdater(KFileItemModel* model, QO
m_recentlyChangedItems(),
m_changedItems(),
m_directoryContentsCounter(nullptr)
#ifdef HAVE_BALOO
#if HAVE_BALOO
, m_balooFileMonitor(nullptr)
#endif
{
......@@ -114,7 +114,7 @@ KFileItemModelRolesUpdater::KFileItemModelRolesUpdater(KFileItemModel* model, QO
m_resolvableRoles.insert("size");
m_resolvableRoles.insert("type");
m_resolvableRoles.insert("isExpandable");
#ifdef HAVE_BALOO
#if HAVE_BALOO
m_resolvableRoles += KBalooRolesProvider::instance().roles();
#endif
......@@ -267,7 +267,7 @@ void KFileItemModelRolesUpdater::setRoles(const QSet<QByteArray>& roles)
if (m_roles != roles) {
m_roles = roles;
#ifdef HAVE_BALOO
#if HAVE_BALOO
// Check whether there is at least one role that must be resolved
// with the help of Baloo. If this is the case, a (quite expensive)
// resolving will be done in KFileItemModelRolesUpdater::rolesData() and
......@@ -397,7 +397,7 @@ void KFileItemModelRolesUpdater::slotItemsRemoved(const KItemRangeList& itemRang
const bool allItemsRemoved = (m_model->count() == 0);
#ifdef HAVE_BALOO
#if HAVE_BALOO
if (m_balooFileMonitor) {
// Don't let the FileWatcher watch for removed items
if (allItemsRemoved) {
......@@ -826,7 +826,7 @@ void KFileItemModelRolesUpdater::resolveRecentlyChangedItems()
void KFileItemModelRolesUpdater::applyChangedBalooRoles(const QString& file)
{
#ifdef HAVE_BALOO
#if HAVE_BALOO
const KFileItem item = m_model->fileItem(QUrl::fromLocalFile(file));
if (item.isNull()) {
......@@ -842,7 +842,7 @@ void KFileItemModelRolesUpdater::applyChangedBalooRoles(const QString& file)
void KFileItemModelRolesUpdater::applyChangedBalooRolesForItem(const KFileItem &item)
{
#ifdef HAVE_BALOO
#if HAVE_BALOO
Baloo::File file(item.localPath());
file.load();
......@@ -1352,7 +1352,7 @@ QHash<QByteArray, QVariant> KFileItemModelRolesUpdater::rolesData(const KFileIte
}
data.insert("iconOverlays", overlays);
#ifdef HAVE_BALOO
#if HAVE_BALOO
if (m_balooFileMonitor) {
m_balooFileMonitor->addFile(item.localPath());
applyChangedBalooRolesForItem(item);
......
......@@ -30,7 +30,7 @@ namespace KIO {
class PreviewJob;
}
#ifdef HAVE_BALOO
#if HAVE_BALOO
namespace Baloo
{
class FileMonitor;
......@@ -416,7 +416,7 @@ private:
QList<KOverlayIconPlugin*> m_overlayIconsPlugin;
#ifdef HAVE_BALOO
#if HAVE_BALOO
Baloo::FileMonitor* m_balooFileMonitor;
Baloo::IndexerConfig m_balooConfig;
#endif
......
......@@ -13,7 +13,7 @@
#include "dolphinmainwindow.h"
#include "global.h"
#include "config-dolphin.h"
#ifdef HAVE_KUSERFEEDBACK
#if HAVE_KUSERFEEDBACK
#include "userfeedback/dolphinfeedbackprovider.h"
#endif
......@@ -238,7 +238,7 @@ int main(int argc, char **argv)
}
}
#ifdef HAVE_KUSERFEEDBACK
#if HAVE_KUSERFEEDBACK
auto feedbackProvider = DolphinFeedbackProvider::instance();
Q_UNUSED(feedbackProvider)
#endif
......
......@@ -9,12 +9,12 @@
#include <QRegularExpression>
#include <config-dolphin.h>
#ifdef HAVE_BALOO
#if HAVE_BALOO
#include <Baloo/Query>
#endif
namespace {
#ifdef HAVE_BALOO
#if HAVE_BALOO
/** Checks if a given term in the Baloo::Query::searchString() is a special search term
* @return: the specific search token of the term, or an empty QString() if none is found
*/
......@@ -99,7 +99,7 @@ bool DolphinQuery::supportsScheme(const QString& urlScheme)
void DolphinQuery::parseBalooQuery()
{
#ifdef HAVE_BALOO
#if HAVE_BALOO
const Baloo::Query query = Baloo::Query::fromSearchUrl(m_searchUrl);
m_includeFolder = query.includeFolder();
......
......@@ -16,7 +16,7 @@
#include <KMoreToolsMenuFactory>
#include <KSeparator>
#include <config-dolphin.h>
#ifdef HAVE_BALOO
#if HAVE_BALOO
#include <Baloo/Query>
#include <Baloo/IndexerConfig>
#endif
......@@ -464,7 +464,7 @@ QString DolphinSearchBox::queryTitle(const QString& text) const
QUrl DolphinSearchBox::balooUrlForSearching() const
{
#ifdef HAVE_BALOO
#if HAVE_BALOO
const QString text = m_searchInput->text();
Baloo::Query query;
......@@ -534,7 +534,7 @@ void DolphinSearchBox::updateFacetsVisible()
bool DolphinSearchBox::isIndexingEnabled() const
{
#ifdef HAVE_BALOO
#if HAVE_BALOO
const Baloo::IndexerConfig searchInfo;
return searchInfo.fileIndexingEnabled() && !searchPath().isEmpty() && searchInfo.shouldBeIndexed(searchPath().toLocalFile());
#else
......
......@@ -29,7 +29,7 @@ enum PackageOperation {
Uninstall
};
#ifdef HAVE_PACKAGEKIT
#if HAVE_PACKAGEKIT
#include <PackageKit/Daemon>
#include <PackageKit/Details>
#include <PackageKit/Transaction>
......@@ -53,7 +53,7 @@ QString getServiceMenusDir()
return QDir(dataLocation).absoluteFilePath("kio/servicemenus");
}
#ifdef HAVE_PACKAGEKIT
#if HAVE_PACKAGEKIT
void packageKitInstall(const QString &fileName)
{
PackageKit::Transaction *transaction = PackageKit::Daemon::installFile(fileName, PackageKit::Transaction::TransactionFlagNone);
......@@ -111,7 +111,7 @@ void packageKitUninstall(const QString &fileName)
Q_NORETURN void packageKit(PackageOperation operation, const QString &fileName)
{
#ifdef HAVE_PACKAGEKIT
#if HAVE_PACKAGEKIT
QFileInfo fileInfo(fileName);
if (!fileInfo.exists()) {
fail(i18n("The file does not exist!"));
......
......@@ -15,7 +15,7 @@
#include "trash/trashsettingspage.h"
#include "viewmodes/viewsettingspage.h"
#include "config-dolphin.h"
#ifdef HAVE_KUSERFEEDBACK
#if HAVE_KUSERFEEDBACK
#include "userfeedback/dolphinfeedbackprovider.h"
#include "userfeedback/userfeedbacksettingspage.h"
#endif
......@@ -105,7 +105,7 @@ DolphinSettingsDialog::DolphinSettingsDialog(const QUrl& url, QWidget* parent, K
connect(trashSettingsPage, &TrashSettingsPage::changed, this, &DolphinSettingsDialog::enableApply);
}
#ifdef HAVE_KUSERFEEDBACK
#if HAVE_KUSERFEEDBACK
// User Feedback
UserFeedbackSettingsPage* feedbackSettingsPage = nullptr;
if (DolphinFeedbackProvider::instance()->isEnabled()) {
......@@ -124,7 +124,7 @@ DolphinSettingsDialog::DolphinSettingsDialog(const QUrl& url, QWidget* parent, K
if (trashSettingsPage) {
m_pages.append(trashSettingsPage);
}
#ifdef HAVE_KUSERFEEDBACK
#if HAVE_KUSERFEEDBACK
if (feedbackSettingsPage) {
m_pages.append(feedbackSettingsPage);
}
......
......@@ -65,7 +65,7 @@ BehaviorSettingsPage::BehaviorSettingsPage(const QUrl& url, QWidget* parent) :
topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed));
#ifdef HAVE_BALOO
#if HAVE_BALOO
// 'Show tooltips'
m_showToolTips = new QCheckBox(i18nc("@option:check", "Show tooltips"));
topLayout->addRow(i18nc("@title:group", "Miscellaneous: "), m_showToolTips);
......@@ -73,7 +73,7 @@ BehaviorSettingsPage::BehaviorSettingsPage(const QUrl& url, QWidget* parent) :
// 'Show selection marker'
m_showSelectionToggle = new QCheckBox(i18nc("@option:check", "Show selection marker"));
#ifdef HAVE_BALOO
#if HAVE_BALOO
topLayout->addRow(QString(), m_showSelectionToggle);
#else
topLayout->addRow(i18nc("@title:group", "Miscellaneous: "), m_showSelectionToggle);
......@@ -96,7 +96,7 @@ BehaviorSettingsPage::BehaviorSettingsPage(const QUrl& url, QWidget* parent) :
connect(m_localViewProps, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
connect(m_globalViewProps, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
#ifdef HAVE_BALOO
#if HAVE_BALOO
connect(m_showToolTips, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
#endif
connect(m_showSelectionToggle, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
......@@ -119,7 +119,7 @@ void BehaviorSettingsPage::applySettings()
const bool useGlobalViewProps = m_globalViewProps->isChecked();
settings->setGlobalViewProps(useGlobalViewProps);
#ifdef HAVE_BALOO
#if HAVE_BALOO
settings->setShowToolTips(m_showToolTips->isChecked());
#endif
settings->setShowSelectionToggle(m_showSelectionToggle->isChecked());
......@@ -153,7 +153,7 @@ void BehaviorSettingsPage::loadSettings()
m_localViewProps->setChecked(!useGlobalViewProps);
m_globalViewProps->setChecked(useGlobalViewProps);
#ifdef HAVE_BALOO
#if HAVE_BALOO
m_showToolTips->setChecked(GeneralSettings::showToolTips());
#endif
m_showSelectionToggle->setChecked(GeneralSettings::showSelectionToggle());
......
......@@ -37,7 +37,7 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget* parent) :
m_confirmEmptyTrash(nullptr),
m_confirmDelete(nullptr),
#ifdef HAVE_TERMINAL
#if HAVE_TERMINAL
m_confirmClosingTerminalRunningProgram(nullptr),
#endif
......@@ -61,7 +61,7 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget* parent) :
m_confirmClosingMultipleTabs = new QCheckBox(i18nc("@option:check Ask for confirmation in Dolphin when",
"Closing windows with multiple tabs"), this);
#ifdef HAVE_TERMINAL
#if 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
......@@ -83,7 +83,7 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget* parent) :
topLayout->addWidget(confirmLabelDolphin);
topLayout->addWidget(m_confirmClosingMultipleTabs);
#ifdef HAVE_TERMINAL
#if HAVE_TERMINAL
topLayout->addWidget(m_confirmClosingTerminalRunningProgram);
#endif
......@@ -100,7 +100,7 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget* parent) :
connect(m_confirmScriptExecution, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ConfirmationsSettingsPage::changed);
connect(m_confirmClosingMultipleTabs, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed);
#ifdef HAVE_TERMINAL
#if HAVE_TERMINAL
connect(m_confirmClosingTerminalRunningProgram, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed);
#endif
}
......@@ -135,7 +135,7 @@ void ConfirmationsSettingsPage::applySettings()
GeneralSettings* settings = GeneralSettings::self();
settings->setConfirmClosingMultipleTabs(m_confirmClosingMultipleTabs->isChecked());
#ifdef HAVE_TERMINAL
#if HAVE_TERMINAL
settings->setConfirmClosingTerminalRunningProgram(m_confirmClosingTerminalRunningProgram->isChecked());
#endif
......@@ -175,7 +175,7 @@ void ConfirmationsSettingsPage::loadSettings()
m_confirmClosingMultipleTabs->setChecked(GeneralSettings::confirmClosingMultipleTabs());
#ifdef HAVE_TERMINAL
#if HAVE_TERMINAL
m_confirmClosingTerminalRunningProgram->setChecked(GeneralSettings::confirmClosingTerminalRunningProgram());
#endif
}
......
......@@ -37,7 +37,7 @@ private:
QCheckBox* m_confirmEmptyTrash;
QCheckBox* m_confirmDelete;
#ifdef HAVE_TERMINAL
#if HAVE_TERMINAL
QCheckBox* m_confirmClosingTerminalRunningProgram;
#endif
......
......@@ -19,7 +19,7 @@
#include <KMessageBox>
#include <KWindowConfig>
#ifdef HAVE_BALOO
#if HAVE_BALOO
#include <Baloo/IndexerConfig>
#endif
......@@ -108,7 +108,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
// Add checkboxes
bool indexingEnabled = false;
#ifdef HAVE_BALOO
#if HAVE_BALOO
Baloo::IndexerConfig config;
indexingEnabled = config.fileIndexingEnabled();
#endif
......
......@@ -25,7 +25,7 @@
#include "views/tooltips/tooltipmanager.h"
#include "zoomlevelinfo.h"
#ifdef HAVE_BALOO
#if HAVE_BALOO
#include <Baloo/IndexerConfig>
#endif
#include <KColorScheme>
......@@ -209,7 +209,7 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
connect(selectionManager, &KItemListSelectionManager::selectionChanged,
this, &DolphinView::slotSelectionChanged);
#ifdef HAVE_BALOO
#if HAVE_BALOO
m_toolTipManager = new ToolTipManager(this);
connect(m_toolTipManager, &ToolTipManager::urlActivated, this, &DolphinView::urlActivated);
#endif
......@@ -1076,7 +1076,7 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos)
const QList<QByteArray> visibleRolesSet = view->visibleRoles();
bool indexingEnabled = false;
#ifdef HAVE_BALOO
#if HAVE_BALOO
Baloo::IndexerConfig config;
indexingEnabled = config.fileIndexingEnabled();
#endif
......@@ -1224,7 +1224,7 @@ void DolphinView::slotItemHovered(int index)
const QPoint pos = m_container->mapToGlobal(itemRect.topLeft().toPoint());
itemRect.moveTo(pos);
#ifdef HAVE_BALOO
#if HAVE_BALOO
auto nativeParent = nativeParentWidget();
if (nativeParent) {
m_toolTipManager->showToolTip(item, itemRect, nativeParent->windowHandle());
......@@ -1666,7 +1666,7 @@ void DolphinView::updateViewState()
void DolphinView::hideToolTip(const ToolTipManager::HideBehavior behavior)
{
if (GeneralSettings::showToolTips()) {
#ifdef HAVE_BALOO
#if HAVE_BALOO
m_toolTipManager->hideToolTip(behavior);
#else
Q_UNUSED(behavior)
......
......@@ -14,7 +14,7 @@
#include "views/zoomlevelinfo.h"
#include "kconfig_version.h"
#ifdef HAVE_BALOO
#if HAVE_BALOO
#include <Baloo/IndexerConfig>
#endif
#include <KActionCollection>
......@@ -355,7 +355,7 @@ QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QSt
QActionGroup* groupMenuGroup = nullptr;
bool indexingEnabled = false;
#ifdef HAVE_BALOO
#if HAVE_BALOO
Baloo::IndexerConfig config;
indexingEnabled = config.fileIndexingEnabled();
#endif
......
Supports Markdown
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