From 9886abc6549ddae968d42a53b355e33040726cb9 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Tue, 18 Nov 2014 16:02:12 +0000 Subject: [PATCH] removed classics systemsettings view --- systemsettings/CMakeLists.txt | 3 +- systemsettings/classic/CMakeLists.txt | 14 - systemsettings/classic/CategoryList.cpp | 136 --------- systemsettings/classic/CategoryList.h | 53 ---- systemsettings/classic/ClassicMode.cpp | 265 ------------------ systemsettings/classic/ClassicMode.h | 65 ----- systemsettings/classic/configClassic.ui | 38 --- systemsettings/classic/main.html | 59 ---- .../classic/settings-classic-view.desktop | 194 ------------- .../classic/systemsettings-classic.css | 42 --- 10 files changed, 1 insertion(+), 868 deletions(-) delete mode 100644 systemsettings/classic/CMakeLists.txt delete mode 100644 systemsettings/classic/CategoryList.cpp delete mode 100644 systemsettings/classic/CategoryList.h delete mode 100644 systemsettings/classic/ClassicMode.cpp delete mode 100644 systemsettings/classic/ClassicMode.h delete mode 100644 systemsettings/classic/configClassic.ui delete mode 100644 systemsettings/classic/main.html delete mode 100644 systemsettings/classic/settings-classic-view.desktop delete mode 100644 systemsettings/classic/systemsettings-classic.css diff --git a/systemsettings/CMakeLists.txt b/systemsettings/CMakeLists.txt index f448eb63..ba0eb2ad 100644 --- a/systemsettings/CMakeLists.txt +++ b/systemsettings/CMakeLists.txt @@ -3,7 +3,7 @@ PROJECT(systemsettings) IF(CMAKE_SOURCE_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") FIND_PACKAGE(KDE4 REQUIRED) - INCLUDE(KDE4Defaults) + INCLUDE(KDE4Defaults) ADD_DEFINITIONS(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) ENDIF(CMAKE_SOURCE_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") @@ -13,5 +13,4 @@ INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR}/core ${CMAKE_BINARY_DIR} ${KDE4 ADD_SUBDIRECTORY(core) ADD_SUBDIRECTORY(app) ADD_SUBDIRECTORY(categories) -ADD_SUBDIRECTORY(classic) ADD_SUBDIRECTORY(icons) diff --git a/systemsettings/classic/CMakeLists.txt b/systemsettings/classic/CMakeLists.txt deleted file mode 100644 index 3fab1c6c..00000000 --- a/systemsettings/classic/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -SET(classic_mode_srcs - ClassicMode.cpp - CategoryList.cpp -) - -KDE4_ADD_UI_FILES( classic_mode_srcs configClassic.ui ) -KDE4_ADD_PLUGIN(classic_mode ${classic_mode_srcs}) - -TARGET_LINK_LIBRARIES(classic_mode ${KDE4_KCMUTILS_LIBS} ${KDE4_KHTML_LIBS} systemsettingsview ) - -INSTALL( TARGETS classic_mode DESTINATION ${PLUGIN_INSTALL_DIR} ) -INSTALL( FILES settings-classic-view.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) -INSTALL( FILES main.html systemsettings-classic.css DESTINATION ${DATA_INSTALL_DIR}/systemsettings/classic/ ) - diff --git a/systemsettings/classic/CategoryList.cpp b/systemsettings/classic/CategoryList.cpp deleted file mode 100644 index 2e9e3e03..00000000 --- a/systemsettings/classic/CategoryList.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - Copyright (c) 2000,2001 Matthias Elter - Copyright (c) 2009 Ben Cooksley - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU 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 "CategoryList.h" - -#include "MenuItem.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static const char kcc_infotext[]= I18N_NOOP("System Settings"); -static const char title_infotext[]= I18N_NOOP("Configure your system"); -static const char intro_infotext[]= I18N_NOOP("Welcome to \"System Settings\", " - "a central place to configure your computer system."); - -class CategoryList::Private { -public: - Private() {} - - KHTMLPart * categoryView; - QModelIndex categoryMenu; - QAbstractItemModel * itemModel; - QMap itemMap; -}; - -CategoryList::CategoryList( QWidget *parent, QAbstractItemModel *model ) - : KHBox(parent), d( new Private() ) -{ - setMinimumSize( 400, 400 ); - d->itemModel = model; - - // set what's this help - this->setWhatsThis( i18n( intro_infotext ) ); - d->categoryView = new KHTMLPart( this ); - d->categoryView->view()->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); - d->categoryView->widget()->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored ); - connect( d->categoryView->browserExtension(), - SIGNAL( openUrlRequest( const KUrl&, - const KParts::OpenUrlArguments&, - const KParts::BrowserArguments& ) ), - this, SLOT(slotModuleLinkClicked(KUrl)) ); -} - -CategoryList::~CategoryList() -{ - delete d; -} - -void CategoryList::updatePixmap() -{ - QString content; - QString moduleName; - KIconLoader * iconL = KIconLoader::global(); - d->itemMap.clear(); - - const QString templatePath = KStandardDirs::locate( "data", "systemsettings/classic/main.html" ); - QFile templateFile( templatePath ); - templateFile.open( QIODevice::ReadOnly ); - QTextStream templateText( &templateFile ); - QString templateString = templateText.readAll(); - templateString = templateString.arg( KStandardDirs::locate( "data", "kdeui/about/kde_infopage.css" ) ); - if ( kapp->layoutDirection() == Qt::RightToLeft ) { - templateString = templateString.arg( "@import \"%1\";" ).arg( KStandardDirs::locate( "data", "kdeui/about/kde_infopage_rtl.css" ) ); - } else { - templateString = templateString.arg( QString() ); - } - templateString = templateString.arg( i18n( kcc_infotext ) ); - templateString = templateString.arg( i18n( title_infotext ) ); - templateString = templateString.arg( i18n( intro_infotext ) ); - if ( d->categoryMenu.isValid() ) { - moduleName = d->itemModel->data( d->categoryMenu, Qt::DisplayRole ).toString(); - } - content += "
" + moduleName + "
"; - content += "\n"; - for( int done = 0; d->itemModel->rowCount( d->categoryMenu ) > done; ++done ) { - QModelIndex childIndex = d->itemModel->index( done, 0, d->categoryMenu ); - MenuItem *childItem = d->itemModel->data( childIndex, Qt::UserRole ).value(); - KUrl link( "kcm://" ); - link.setFileName( childItem->item().fileName() ); - kDebug() << childItem->name() << childItem->item().fileName() << link.url(); - const QString szLink = ""; - content += "\n"; - } - content += "
" + szLink + ""; - const QString szName = childItem->name(); - const QString szComment = childItem->service()->comment(); - content += szLink + szName + "" + szLink + szComment + ""; - content = content.arg( iconL->iconPath(childItem->service()->icon(), - KIconLoader::SizeSmallMedium ) ); - d->itemMap.insert( link.url(), childIndex ); - content += "
"; - d->categoryView->begin( KUrl( templatePath ) ); - d->categoryView->write( templateString.arg( content ) ); - d->categoryView->end(); -} - -void CategoryList::changeModule( QModelIndex newItem ) -{ - d->categoryMenu = newItem; - updatePixmap(); -} - -void CategoryList::slotModuleLinkClicked( const KUrl& moduleName ) -{ - QModelIndex module = d->itemMap.value( moduleName.url() ); - kDebug() << "Link name: " + moduleName.url(); - emit moduleSelected( module ); -} - -#include "CategoryList.moc" diff --git a/systemsettings/classic/CategoryList.h b/systemsettings/classic/CategoryList.h deleted file mode 100644 index 9891819d..00000000 --- a/systemsettings/classic/CategoryList.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (c) 2000,2001 Matthias Elter - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU 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 CATEGORYLIST_H -#define CATEGORYLIST_H - -#include - -class QModelIndex; -class QAbstractItemModel; - -class KUrl; - -class CategoryList : public KHBox -{ - Q_OBJECT - -public: - explicit CategoryList( QWidget *parent, QAbstractItemModel *model ); - virtual ~CategoryList(); - - void changeModule( QModelIndex newItem); - -Q_SIGNALS: - void moduleSelected( QModelIndex itemSelected ); - -private Q_SLOTS: - void slotModuleLinkClicked( const KUrl& ); - -private: - void updatePixmap(); - -private: - class Private; - Private *const d; -}; - -#endif diff --git a/systemsettings/classic/ClassicMode.cpp b/systemsettings/classic/ClassicMode.cpp deleted file mode 100644 index d9e85608..00000000 --- a/systemsettings/classic/ClassicMode.cpp +++ /dev/null @@ -1,265 +0,0 @@ -/************************************************************************** - * Copyright (C) 2009 Ben Cooksley * - * Copyright (C) 2008 Mathias Soeken * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU 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 "ClassicMode.h" -#include "ui_configClassic.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "MenuItem.h" -#include "MenuModel.h" -#include "ModuleView.h" -#include "CategoryList.h" -#include "MenuProxyModel.h" - -K_PLUGIN_FACTORY(ClassicModeFactory, registerPlugin();) -K_EXPORT_PLUGIN(ClassicModeFactory("classic_mode")) - -class ClassicMode::Private { -public: - Private() : moduleView( 0 ) {} - virtual ~Private() { - delete aboutClassic; - } - - QSplitter * classicWidget; - QTreeView * classicTree; - Ui::ConfigClassic classicConfig; - CategoryList * classicCategory; - QStackedWidget * stackedWidget; - ModuleView * moduleView; - QModelIndex currentItem; - - MenuProxyModel * proxyModel; - MenuModel * model; - KAboutData * aboutClassic; -}; - -ClassicMode::ClassicMode( QObject * parent, const QVariantList& ) - : BaseMode( parent ), d( new Private() ) -{ - d->aboutClassic = new KAboutData( "TreeView", 0, ki18n("Tree View"), - "1.0", ki18n("Provides a classic tree-based view of control modules."), - KAboutData::License_GPL, ki18n("(c) 2009, Ben Cooksley")); - d->aboutClassic->addAuthor(ki18n("Ben Cooksley"), ki18n("Author"), "bcooksley@kde.org"); - d->aboutClassic->addAuthor(ki18n("Mathias Soeken"), ki18n("Developer"), "msoeken@informatik.uni-bremen.de"); - d->aboutClassic->setProgramIconName("view-list-tree"); -} - -ClassicMode::~ClassicMode() -{ - if( !d->classicTree ) { - delete d->classicWidget; - } - delete d; -} - -void ClassicMode::initEvent() -{ - // Create the model - d->model = new MenuModel( rootItem(), this ); - - // Move items that are the sole child of a category up.... - moveUp( rootItem() ); - - // Create the proxy model - d->proxyModel = new MenuProxyModel( this ); - d->proxyModel->setSourceModel( d->model ); - d->proxyModel->sort( 0 ); - d->classicWidget = new QSplitter( Qt::Horizontal, 0 ); - d->classicWidget->setChildrenCollapsible( false ); - d->moduleView = new ModuleView( d->classicWidget ); - d->classicTree = 0; -} - -QWidget * ClassicMode::mainWidget() -{ - if( !d->classicTree ) { - initWidget(); - } - return d->classicWidget; -} - -KAboutData * ClassicMode::aboutData() -{ - return d->aboutClassic; -} - -ModuleView * ClassicMode::moduleView() const -{ - return d->moduleView; -} - -QList ClassicMode::views() const -{ - QList theViews; - theViews << d->classicTree; - return theViews; -} - -void ClassicMode::saveState() -{ - config().writeEntry( "viewLayout", d->classicWidget->sizes() ); - config().sync(); -} - -void ClassicMode::expandColumns() -{ - d->classicTree->resizeColumnToContents(0); -} - -void ClassicMode::searchChanged( const QString& text ) -{ - d->proxyModel->setFilterRegExp(text); - if( d->classicTree ) { - d->classicCategory->changeModule( d->classicTree->currentIndex() ); - } -} - -void ClassicMode::selectModule( const QModelIndex& selectedModule ) -{ - d->classicTree->setCurrentIndex( selectedModule ); - if( d->proxyModel->rowCount(selectedModule) > 0 ) { - d->classicTree->setExpanded(selectedModule, true); - } - changeModule( selectedModule ); -} - -void ClassicMode::changeModule( const QModelIndex& activeModule ) -{ - if( activeModule == d->currentItem ) { - return; - } - if( !d->moduleView->resolveChanges() ) { - return; - } - d->moduleView->closeModules(); - d->currentItem = activeModule; - if( d->proxyModel->rowCount(activeModule) > 0 ) { - d->stackedWidget->setCurrentWidget( d->classicCategory ); - d->classicCategory->changeModule(activeModule); - emit viewChanged( false ); - } else { - d->moduleView->loadModule( activeModule ); - } -} - -void ClassicMode::moduleLoaded() -{ - d->stackedWidget->setCurrentWidget( d->moduleView ); -} - -void ClassicMode::initWidget() -{ - // Create the widget - d->classicTree = new QTreeView( d->classicWidget ); - d->classicCategory = new CategoryList( d->classicWidget, d->proxyModel ); - - d->stackedWidget = new QStackedWidget( d->classicWidget ); - d->stackedWidget->layout()->setMargin(0); - d->stackedWidget->addWidget( d->classicCategory ); - d->stackedWidget->addWidget( d->moduleView ); - - d->classicWidget->addWidget( d->classicTree ); - d->classicWidget->addWidget( d->stackedWidget ); - - d->classicTree->setModel( d->proxyModel ); - d->classicTree->setHeaderHidden( true ); - d->classicTree->setIconSize( QSize( 24, 24 ) ); - d->classicTree->setSortingEnabled( true ); - d->classicTree->setMouseTracking( true ); - d->classicTree->setMinimumWidth( 200 ); - d->classicTree->setSelectionMode( QAbstractItemView::SingleSelection ); - d->classicTree->sortByColumn( 0, Qt::AscendingOrder ); - - d->classicCategory->changeModule( d->classicTree->rootIndex() ); - - connect( d->classicCategory, SIGNAL(moduleSelected(QModelIndex)), this, SLOT(selectModule(QModelIndex)) ); - connect( d->classicTree, SIGNAL(activated(QModelIndex)), this, SLOT(changeModule(QModelIndex)) ); - connect( d->classicTree, SIGNAL(collapsed(QModelIndex)), this, SLOT(expandColumns()) ); - connect( d->classicTree, SIGNAL(expanded(QModelIndex)), this, SLOT(expandColumns()) ); - connect( d->moduleView, SIGNAL(moduleChanged(bool)), this, SLOT(moduleLoaded()) ); - - if( !KGlobalSettings::singleClick() ) { - // Needed because otherwise activated() is not fired with single click, which is apparently expected for tree views - connect( d->classicTree, SIGNAL(clicked(QModelIndex)), this, SLOT(changeModule(QModelIndex)) ); - } - - if( config().readEntry( "autoExpandOneLevel", false ) ) { - for( int processed = 0; d->proxyModel->rowCount() > processed; processed++ ) { - d->classicTree->setExpanded( d->proxyModel->index( processed, 0 ), true ); - } - } - - expandColumns(); - QList defaultSizes; - defaultSizes << 250 << 500; - d->classicWidget->setSizes( config().readEntry( "viewLayout", defaultSizes ) ); -} - -void ClassicMode::leaveModuleView() -{ - d->moduleView->closeModules(); - d->stackedWidget->setCurrentWidget( d->classicCategory ); -} - -void ClassicMode::giveFocus() -{ - d->classicTree->setFocus(); -} - -void ClassicMode::addConfiguration( KConfigDialog * config ) -{ - QWidget * configWidget = new QWidget( config ); - d->classicConfig.setupUi( configWidget ); - config->addPage( configWidget, i18n("Tree View"), aboutData()->programIconName() ); -} - -void ClassicMode::loadConfiguration() -{ - d->classicConfig.CbExpand->setChecked( config().readEntry( "autoExpandOneLevel", false ) ); -} - -void ClassicMode::saveConfiguration() -{ - config().writeEntry("autoExpandOneLevel", d->classicConfig.CbExpand->isChecked()); -} - -void ClassicMode::moveUp( MenuItem * item ) -{ - foreach( MenuItem * child, item->children() ) { - if( child->children().count() == 1 ) { - d->model->addException( child ); - } - moveUp( child ); - } -} - -#include "ClassicMode.moc" diff --git a/systemsettings/classic/ClassicMode.h b/systemsettings/classic/ClassicMode.h deleted file mode 100644 index 23ba91da..00000000 --- a/systemsettings/classic/ClassicMode.h +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************** - * Copyright (C) 2009 Ben Cooksley * - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU 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 CLASSICMODE_H -#define CLASSICMODE_H - -#include "BaseMode.h" - -class MenuItem; -class ModuleView; -class QModelIndex; - -class ClassicMode : public BaseMode -{ - Q_OBJECT - -public: - ClassicMode(QObject * parent, const QVariantList& ); - ~ClassicMode(); - void initEvent(); - void leaveModuleView(); - QWidget * mainWidget(); - KAboutData * aboutData(); - ModuleView * moduleView() const; - -protected: - QList views() const; - -public Q_SLOTS: - void expandColumns(); - void searchChanged( const QString& text ); - void selectModule( const QModelIndex& selectedModule ); - void changeModule( const QModelIndex& activeModule ); - void saveState(); - void giveFocus(); - void addConfiguration( KConfigDialog * config ); - void loadConfiguration(); - void saveConfiguration(); - -private Q_SLOTS: - void moduleLoaded(); - void initWidget(); - void moveUp( MenuItem * item ); - -private: - class Private; - Private *const d; -}; - -#endif diff --git a/systemsettings/classic/configClassic.ui b/systemsettings/classic/configClassic.ui deleted file mode 100644 index 3a00b412..00000000 --- a/systemsettings/classic/configClassic.ui +++ /dev/null @@ -1,38 +0,0 @@ - - - ConfigClassic - - - - 0 - 0 - 400 - 66 - - - - - - - Expand the first level automatically - - - - - - - Qt::Vertical - - - - 20 - 28 - - - - - - - - - diff --git a/systemsettings/classic/main.html b/systemsettings/classic/main.html deleted file mode 100644 index 2d80b192..00000000 --- a/systemsettings/classic/main.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - -