26 #include <kstandarddirs.h>
29 #include "formatfactory.h"
30 #include "resourcedir.h"
31 #include "stdaddressbook.h"
33 #include "resourcedirconfig.h"
37 ResourceDirConfig::ResourceDirConfig( TQWidget* parent,
const char* name )
38 : KRES::ConfigWidget( parent,
name )
40 TQGridLayout *mainLayout =
new TQGridLayout(
this, 2, 2, 0,
43 TQLabel *
label =
new TQLabel( i18n(
"Format:" ),
this );
46 mainLayout->addWidget( label, 0, 0 );
47 mainLayout->addWidget( mFormatBox, 0, 1 );
49 label =
new TQLabel( i18n(
"Location:" ),
this );
50 mFileNameEdit =
new KURLRequester(
this );
51 mFileNameEdit->setMode( KFile::Directory );
53 mainLayout->addWidget( label, 1, 0 );
54 mainLayout->addWidget( mFileNameEdit, 1, 1 );
57 TQStringList formats = factory->
formats();
58 TQStringList::Iterator it;
59 for ( it = formats.begin(); it != formats.end(); ++it ) {
60 FormatInfo *info = factory->
info( *it );
62 mFormatTypes << (*it);
63 mFormatBox->insertItem( info->nameLabel );
70 void ResourceDirConfig::setEditMode(
bool value )
72 mFormatBox->setEnabled( !value );
76 void ResourceDirConfig::loadSettings( KRES::Resource *res )
78 ResourceDir *resource =
dynamic_cast<ResourceDir*
>( res );
81 kdDebug(5700) <<
"ResourceDirConfig::loadSettings(): cast failed" <<
endl;
85 mFormatBox->setCurrentItem( mFormatTypes.findIndex( resource->format() ) );
87 mFileNameEdit->setURL( resource->path() );
88 if ( mFileNameEdit->url().isEmpty() )
92 void ResourceDirConfig::saveSettings( KRES::Resource *res )
94 ResourceDir *resource =
dynamic_cast<ResourceDir*
>( res );
97 kdDebug(5700) <<
"ResourceDirConfig::loadSettings(): cast failed" <<
endl;
102 resource->setFormat( mFormatTypes[ mFormatBox->currentItem() ] );
104 resource->setPath( mFileNameEdit->url() );
107 #include "resourcedirconfig.moc"
static TQString directoryName()
Returns the default directory name for vcard-based addressbook.
kndbgstream & endl(kndbgstream &s)
kdbgstream kdDebug(int area=0)
static data, shared by ALL addressee objects
TQString name(StdAccel id)
TQString label(StdAccel id)