summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-08-02 22:23:36 (UTC)
committer ulf69 <ulf69>2004-08-02 22:23:36 (UTC)
commitcaccbdef7506ed596669c35009bd6d5634ee6ee1 (patch) (side-by-side diff)
treec45c1ff5cc2dd236dfe96ef087c1eaeb28d7b382
parent5a7175ae22a89b28699983e8f97b7896d45f26e1 (diff)
downloadkdepimpi-caccbdef7506ed596669c35009bd6d5634ee6ee1.zip
kdepimpi-caccbdef7506ed596669c35009bd6d5634ee6ee1.tar.gz
kdepimpi-caccbdef7506ed596669c35009bd6d5634ee6ee1.tar.bz2
optimized layout for SL5500
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--microkde/kresources/configpage.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/microkde/kresources/configpage.cpp b/microkde/kresources/configpage.cpp
index 912c62e..2fe021d 100644
--- a/microkde/kresources/configpage.cpp
+++ b/microkde/kresources/configpage.cpp
@@ -9,217 +9,227 @@
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 library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qgroupbox.h>
#include <qinputdialog.h>
#include <qlabel.h>
#include <qlayout.h>
#include <kapplication.h>
#include <kcombobox.h>
#include <kdebug.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <ksimpleconfig.h>
#include <kstandarddirs.h>
#include <kurlrequester.h>
#include <klistview.h>
#include <kbuttonbox.h>
//US #include <ktrader.h>
#include "resource.h"
#include "configdialog.h"
#include "configpage.h"
//US
#include <qpushbutton.h>
#include <qfile.h>
#include <kglobal.h>
using namespace KRES;
const QString ConfigPage::syncfamily = "syncprofiles";
class ConfigViewItem : public QCheckListItem
{
public:
ConfigViewItem( QListView *parent, Resource* resource ) :
QCheckListItem( parent, resource->resourceName(), CheckBox ),
mResource( resource ),
mIsStandard( false )
{
setText( 1, mResource->type() );
setOn( mResource->isActive() );
}
void setStandard( bool value )
{
setText( 2, ( value ? i18n( "Yes" ) : QString::null ) );
mIsStandard = value;
}
bool standard() const { return mIsStandard; }
bool readOnly() const { return mResource->readOnly(); }
Resource *resource() { return mResource; }
private:
Resource* mResource;
bool mIsStandard;
};
ConfigPage::ConfigPage( QWidget *parent, const char *name )
: QWidget( parent, name ),
mCurrentManager( 0 ),
mCurrentConfig( 0 )
{
setCaption( i18n( "Resource Configuration" ) );
QVBoxLayout *mainLayout = new QVBoxLayout( this );
QGroupBox *groupBox = new QGroupBox( i18n( "Resources" ), this );
groupBox->setColumnLayout(0, Qt::Vertical );
groupBox->layout()->setSpacing( 6 );
groupBox->layout()->setMargin( 11 );
- QGridLayout *groupBoxLayout = new QGridLayout( groupBox->layout(), 2, 2 );
+ QGridLayout *groupBoxLayout = new QGridLayout( groupBox->layout(), 4, 2 );
//US mFamilyCombo = new KComboBox( false, groupBox );
mFamilyCombo = new KComboBox( groupBox );
groupBoxLayout->addMultiCellWidget( mFamilyCombo, 0, 0, 0, 1 );
mListView = new KListView( groupBox );
mListView->setAllColumnsShowFocus( true );
mListView->addColumn( i18n( "Name" ) );
mListView->addColumn( i18n( "Type" ) );
mListView->addColumn( i18n( "Standard" ) );
- groupBoxLayout->addWidget( mListView, 1, 0 );
+//US groupBoxLayout->addWidget( mListView, 1, 0 );
+ groupBoxLayout->addMultiCellWidget( mListView, 1, 1, 0, 1 );
+
+
+ mAddButton = new QPushButton( i18n( "&Add..." ), this );
+ groupBoxLayout->addWidget( mAddButton, 2, 0 );
+ mRemoveButton = new QPushButton( i18n( "&Remove" ), this );
+ groupBoxLayout->addWidget( mRemoveButton, 2, 1 );
+ mEditButton = new QPushButton( i18n( "&Edit..." ), this );
+ groupBoxLayout->addWidget( mEditButton, 3, 0 );
+ mStandardButton = new QPushButton( i18n( "&Use as Standard" ), this );
+ groupBoxLayout->addWidget( mStandardButton, 3, 1 );
- KButtonBox *buttonBox = new KButtonBox( groupBox, Vertical );
- mAddButton = buttonBox->addButton( i18n( "&Add..." ), this, SLOT(slotAdd()) );
- mRemoveButton = buttonBox->addButton( i18n( "&Remove" ), this, SLOT(slotRemove()) );
mRemoveButton->setEnabled( false );
- mEditButton = buttonBox->addButton( i18n( "&Edit..." ), this, SLOT(slotEdit()) );
mEditButton->setEnabled( false );
- mStandardButton = buttonBox->addButton( i18n( "&Use as Standard" ), this, SLOT(slotStandard()) );
mStandardButton->setEnabled( false );
- buttonBox->layout();
- groupBoxLayout->addWidget( buttonBox, 1, 1 );
+
+ connect( mAddButton, SIGNAL( clicked() ), SLOT(slotAdd()) );
+ connect( mRemoveButton, SIGNAL( clicked() ), SLOT(slotRemove()) );
+ connect( mEditButton, SIGNAL( clicked() ), SLOT(slotEdit()) );
+ connect( mStandardButton, SIGNAL( clicked() ), SLOT(slotStandard()) );
+
mainLayout->addWidget( groupBox );
connect( mFamilyCombo, SIGNAL( activated( int ) ),
SLOT( slotFamilyChanged( int ) ) );
connect( mListView, SIGNAL( selectionChanged() ),
SLOT( slotSelectionChanged() ) );
connect( mListView, SIGNAL( clicked( QListViewItem * ) ),
SLOT( slotItemClicked( QListViewItem * ) ) );
mLastItem = 0;
//US mConfig = new KConfig( "kcmkresourcesrc" );
mConfig = new KConfig( locateLocal( "config", "kcmkresourcesrc") );
mConfig->setGroup( "General" );
load();
}
ConfigPage::~ConfigPage()
{
QValueList<ResourcePageInfo>::Iterator it;
for ( it = mInfoMap.begin(); it != mInfoMap.end(); ++it ) {
(*it).mManager->removeListener( this );
delete (*it).mManager;
delete (*it).mConfig;
}
mConfig->writeEntry( "CurrentFamily", mFamilyCombo->currentItem() );
delete mConfig;
mConfig = 0;
}
void ConfigPage::load()
{
kdDebug(5650) << "ConfigPage::load()" << endl;
mListView->clear();
//US we remove the dynamic pluginloader, and set the one family we need (contact) manually.
//US KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin" );
//US KTrader::OfferList::ConstIterator it;
//US for ( it = plugins.begin(); it != plugins.end(); ++it ) {
//US QVariant tmp = (*it)->property( "X-KDE-ResourceFamily" );
//US QString family = tmp.toString();
QStringList families;
families << "contact" << syncfamily;
for ( QStringList::Iterator it = families.begin(); it != families.end(); ++it )
{
QString family = (*it);
if ( !family.isEmpty() ) {
if ( !mFamilyMap.contains( family ) ) {
mCurrentManager = new Manager<Resource>( family, (family == syncfamily) );
if ( mCurrentManager ) {
mFamilyMap.append( family );
mCurrentManager->addListener( this );
ResourcePageInfo info;
info.mManager = mCurrentManager;
QString configDir = KGlobal::dirs()->saveLocation( "config" );
//QString configDir = KStandardDirs::appDir() + "/config";
if ( family == "contact" && QFile::exists( configDir + "/kabcrc" ) ) {
info.mConfig = new KConfig( locateLocal( "config", "kabcrc" ) );
} else if ( family == "calendar" && QFile::exists( configDir + "/kcalrc" ) ) {
info.mConfig = new KConfig( locateLocal( "config", "kcalrc" ) );
} else {
QString configFile = locateLocal( "config", QString( "kresources/%1/stdrc" ).arg( family ) );
info.mConfig = new KConfig( configFile );
}
info.mManager->readConfig( info.mConfig );
mInfoMap.append( info );
}
}
}
}
mCurrentManager = 0;
mFamilyCombo->insertStringList( mFamilyMap );
int currentFamily = mConfig->readNumEntry( "CurrentFamily", 0 );
mFamilyCombo->setCurrentItem( currentFamily );
slotFamilyChanged( currentFamily );
}
void ConfigPage::save()
{
saveResourceSettings();
QValueList<ResourcePageInfo>::Iterator it;
for ( it = mInfoMap.begin(); it != mInfoMap.end(); ++it )
(*it).mManager->writeConfig( (*it).mConfig );