Commit 6a744448 authored by Àlex Fiestas's avatar Àlex Fiestas

Moved solid-actions-kcm out of solid folder and remove everything else.

The actions KCM is the only piece of software in this folder that makes
sense without Solid::Control, everything else is either not working or
not compiling.
parent c852b248
......@@ -230,7 +230,7 @@ if(${KDE_PLATFORM_PROFILE} STREQUAL "Desktop")
macro_optional_add_subdirectory(klipper)
macro_optional_add_subdirectory(kmenuedit)
macro_optional_add_subdirectory(krunner)
macro_optional_add_subdirectory(solid)
macro_optional_add_subdirectory(solid-actions-kcm)
macro_optional_add_subdirectory(kstartupconfig)
macro_optional_add_subdirectory(freespacenotifier)
macro_optional_add_subdirectory(kscreensaver)
......
include(MacroEnsureVersion)
macro_optional_find_package(NetworkManager 0.7.0)
set_package_properties(NetworkManager PROPERTIES DESCRIPTION "A daemon for user controlled networking"
URL "http://www.gnome.org/projects/NetworkManager"
TYPE OPTIONAL
PURPOSE "Needed for building Network Management support in Solid. Max version supported is 0.8.10"
)
add_subdirectory(kcm)
add_subdirectory(solid-actions-kcm)
add_subdirectory(icons)
IF("${CMAKE_SYSTEM}" MATCHES "Linux")
add_subdirectory(solidshell)
ENDIF("${CMAKE_SYSTEM}" MATCHES "Linux")
set(HAVE_NETWORKMANAGER FALSE)
if(NETWORKMANAGER_FOUND)
if(${NETWORKMANAGER_VERSION} VERSION_GREATER "0.6.9999" AND
${NETWORKMANAGER_VERSION} VERSION_LESS "0.8.1001")
set(HAVE_NETWORKMANAGER TRUE)
add_feature_info("NetworkManager 0.7" HAVE_NETWORKMANAGER "Network Manager 0.7 will be built")
add_subdirectory(networkmanager-0.7)
else()
message(STATUS "Sorry, networkmanager-0.7 will not be built since your NetworkManager version (${NETWORKMANAGER_VERSION}) is not currently supported")
if (${NETWORKMANAGER_VERSION} VERSION_GREATER "0.8.999")
set(HAVE_NETWORKMANAGER TRUE)
add_feature_info("Fake NetworkManager 0.9" HAVE_NETWORKMANAGER "networkmanager_fake-0.9 will be built")
add_subdirectory(networkmanager_fake-0.9)
endif ()
endif()
endif (NETWORKMANAGER_FOUND)
set(HAVE_MODEMMANAGER FALSE)
if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
set(HAVE_MODEMMANAGER TRUE)
add_feature_info("modemmanager-0.4" HAVE_MODEMMANAGER "Will build modemmanager-0.4")
add_subdirectory(modemmanager-0.4)
endif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
if(NOT WIN32)
macro_optional_add_subdirectory(wicd)
endif(NOT WIN32)
/** @mainpage Solid Modules
*/
// DOXYGEN_SET_PROJECT_NAME = Solid Modules
// DOXYGEN_SET_RECURSIVE = YES
// vim:ts=4:sw=4:expandtab:filetype=doxygen
kde4_install_icons( ${ICON_INSTALL_DIR} )
set(kcmsolid_SRCS kcmsolid.cpp backendchooser.cpp)
kde4_add_ui_files(kcmsolid_SRCS backendchooser.ui)
kde4_add_plugin(kcm_solid ${kcmsolid_SRCS})
target_link_libraries(kcm_solid ${KDE4_KDEUI_LIBS} ${KDE4_SOLID_LIBS} )
install(TARGETS kcm_solid DESTINATION ${PLUGIN_INSTALL_DIR} )
########### install files ###############
install( FILES kcm_solid.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
#! /usr/bin/env bash
$EXTRACTRC *.ui >> rc.cpp
$XGETTEXT *.cpp -o $podir/kcm_solid.pot
rm -f rc.cpp
/* This file is part of the KDE project
Copyright (C) 2006 Kevin Ottens <ervin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "backendchooser.h"
#include <kservicetypeprofile.h>
#include <kservicetype.h>
#include <kservicetypetrader.h>
#include <kconfig.h>
#include <QStringList>
#include <QListWidgetItem>
#include <kapplication.h>
#include <kicon.h>
#include <QList>
static bool equals(const KService::List &list1, const KService::List &list2)
{
if (list1.size()!=list2.size())
{
return false;
}
for (int i=0; i<list1.size(); ++i)
{
if (list1[i]->name()!=list2[i]->name())
{
return false;
}
}
return true;
}
BackendChooser::BackendChooser(QWidget *parent, const QString &backendType)
: QWidget(parent), m_backendType(backendType)
{
m_ui.setupUi(this);
connect(m_ui.listView, SIGNAL(itemSelectionChanged()),
this, SLOT(slotSelectionChanged()));
connect(m_ui.upButton, SIGNAL(clicked()),
this, SLOT(slotUpClicked()));
connect(m_ui.downButton, SIGNAL(clicked()),
this, SLOT(slotDownClicked()));
KServiceType::Ptr service_type = KServiceType::serviceType(backendType);
QString title;
if (service_type) {
title = service_type->comment();
}
if (title.isEmpty())
{
title = backendType;
}
m_ui.groupBox->setTitle(title);
}
void BackendChooser::load()
{
m_initServices = KServiceTypeTrader::self()->query(m_backendType, "Type == 'Service'");
loadServicesInView(m_initServices);
}
void BackendChooser::loadServicesInView(const KService::List &services)
{
m_services.clear();
m_ui.listView->clear();
foreach (KService::Ptr service, services)
{
m_ui.listView->addItem(service->name());
m_services[service->name()] = service;
}
m_ui.listView->setItemSelected(m_ui.listView->item(0), true);
}
KService::List BackendChooser::servicesFromView()
{
KService::List services;
int count = m_ui.listView->count();
for (int i=0; i<count; ++i)
{
QListWidgetItem *item = m_ui.listView->item(i);
KService::Ptr service = m_services[item->text()];
services.append(service);
}
return services;
}
void BackendChooser::save()
{
if (!equals(m_initServices, servicesFromView()))
{
m_initServices = servicesFromView();
KServiceTypeProfile::writeServiceTypeProfile(m_backendType, m_initServices);
emit changed(false);
}
}
void BackendChooser::defaults()
{
KService::List currentServices = servicesFromView();
KService::List defaultServices = KServiceTypeTrader::self()->defaultOffers(m_backendType, "Type == 'Service'");
if (!equals(currentServices, defaultServices))
{
loadServicesInView(KServiceTypeTrader::self()->defaultOffers(m_backendType, "Type == 'Service'"));
emit changed(!equals(m_initServices, servicesFromView()));
}
}
void BackendChooser::slotSelectionChanged()
{
KService::Ptr service;
for (int i=0; i<m_ui.listView->count(); ++i)
{
QListWidgetItem *item = m_ui.listView->item(i);
if (m_ui.listView->isItemSelected(item))
{
service = m_services[item->text()];
break;
}
}
if (service)
{
m_ui.iconLabel->setPixmap(KIcon(service->icon()).pixmap(32));
m_ui.nameLabel->setText(service->name());
m_ui.commentLabel->setText(service->comment());
m_ui.versionLabel->setText(service->property("X-KDE-SolidBackendInfo-Version").toString());
}
}
void BackendChooser::slotUpClicked()
{
QList<QListWidgetItem *> selectedList = m_ui.listView->selectedItems();
foreach (QListWidgetItem *selected, selectedList)
{
int row = m_ui.listView->row(selected);
if (row > 0)
{
QListWidgetItem *taken = m_ui.listView->takeItem(row - 1);
m_ui.listView->insertItem(row, taken);
emit changed(!equals(m_initServices, servicesFromView()));
return;
}
}
}
void BackendChooser::slotDownClicked()
{
QList<QListWidgetItem *> selectedList = m_ui.listView->selectedItems();
foreach (QListWidgetItem *selected, selectedList)
{
int row = m_ui.listView->row(selected);
if (row + 1 < m_ui.listView->count())
{
QListWidgetItem *taken = m_ui.listView->takeItem(row + 1);
m_ui.listView->insertItem(row, taken);
emit changed(!equals(m_initServices, servicesFromView()));
return;
}
}
}
#include "backendchooser.moc"
/* This file is part of the KDE project
Copyright (C) 2006 Kevin Ottens <ervin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef BACKENDCHOOSER_H
#define BACKENDCHOOSER_H
#include "ui_backendchooser.h"
#include <QWidget>
#include <QHash>
#include <QString>
#include <kservice.h>
class BackendChooser : public QWidget
{
Q_OBJECT
public:
BackendChooser(QWidget *parent, const QString &backendType);
void load();
void save();
void defaults();
private Q_SLOTS:
void slotSelectionChanged();
void slotUpClicked();
void slotDownClicked();
Q_SIGNALS:
void changed(bool state);
private:
void loadServicesInView(const KService::List &offers);
KService::List servicesFromView();
Ui::BackendChooser m_ui;
KService::List m_initServices;
QString m_backendType;
QHash<QString, KService::Ptr> m_services;
};
#endif
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author>Kevin Ottens &lt;ervin@kde.org&gt;</author>
<class>BackendChooser</class>
<widget class="QWidget" name="BackendChooser">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>582</width>
<height>216</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string/>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QHBoxLayout">
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="MyQListWidget" name="listView">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>List of backends, in order of preference.</string>
</property>
<property name="whatsThis">
<string>A list of the backends for a Solid function, in order of preference.</string>
</property>
<property name="dragEnabled">
<bool>false</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::NoDragDrop</enum>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="upButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Prefer the selected backend.</string>
</property>
<property name="whatsThis">
<string>Moves the selected backend up by one in the preference list.</string>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
<property name="arrowType">
<enum>Qt::UpArrow</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="downButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>No preference for the selected backend.</string>
</property>
<property name="whatsThis">
<string>Moves the selected backend down by one in the preference list.</string>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
<property name="arrowType">
<enum>Qt::DownArrow</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout">
<item>
<layout class="QHBoxLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="iconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="whatsThis">
<string>Icon for the currently selected backend</string>
</property>
<property name="text">