28 #include "formatfactory.h"
29 #include "resourcenet.h"
30 #include "stdaddressbook.h"
32 #include "resourcenetconfig.h"
36 ResourceNetConfig::ResourceNetConfig( TQWidget* parent,
const char* name )
37 : ConfigWidget( parent,
name ), mInEditMode( false )
39 TQGridLayout *mainLayout =
new TQGridLayout(
this, 2, 2, 0,
42 TQLabel *
label =
new TQLabel( i18n(
"Format:" ),
this );
45 mainLayout->addWidget( label, 0, 0 );
46 mainLayout->addWidget( mFormatBox, 0, 1 );
48 label =
new TQLabel( i18n(
"Location:" ),
this );
49 mUrlEdit =
new KURLRequester(
this );
50 mUrlEdit->setMode( KFile::File );
52 mainLayout->addWidget( label, 1, 0 );
53 mainLayout->addWidget( mUrlEdit, 1, 1 );
56 TQStringList formats = factory->
formats();
57 TQStringList::Iterator it;
58 for ( it = formats.begin(); it != formats.end(); ++it ) {
59 FormatInfo *info = factory->
info( *it );
61 mFormatTypes << (*it);
62 mFormatBox->insertItem( info->nameLabel );
67 void ResourceNetConfig::setEditMode(
bool value )
69 mFormatBox->setEnabled( !value );
73 void ResourceNetConfig::loadSettings( KRES::Resource *res )
75 ResourceNet *resource =
dynamic_cast<ResourceNet*
>( res );
78 kdDebug(5700) <<
"ResourceNetConfig::loadSettings(): cast failed" <<
endl;
82 mFormatBox->setCurrentItem( mFormatTypes.findIndex( resource->format() ) );
84 mUrlEdit->setURL( resource->url().url() );
87 void ResourceNetConfig::saveSettings( KRES::Resource *res )
89 ResourceNet *resource =
dynamic_cast<ResourceNet*
>( res );
92 kdDebug(5700) <<
"ResourceNetConfig::saveSettings(): cast failed" <<
endl;
97 resource->setFormat( mFormatTypes[ mFormatBox->currentItem() ] );
99 resource->setUrl(
KURL( mUrlEdit->url() ) );
102 #include "resourcenetconfig.moc"
kndbgstream & endl(kndbgstream &s)
kdbgstream kdDebug(int area=0)
static data, shared by ALL addressee objects
TQString name(StdAccel id)
TQString label(StdAccel id)