knotes

resourcelocalconfig.cpp
1/*******************************************************************
2 Copyright (c) 2005, The KNotes Developers
3
4 This file is part of KNotes.
5
6 KNotes is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 KNotes is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with KNotes; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19*******************************************************************/
20
21#include <tqlabel.h>
22#include <tqlayout.h>
23
24#include <kdebug.h>
25#include <tdelocale.h>
26#include <tderesources/configwidget.h>
27#include <kurlrequester.h>
28
29#include "resourcelocal.h"
30#include "resourcelocalconfig.h"
31
32ResourceLocalConfig::ResourceLocalConfig( TQWidget *parent, const char *name )
33 : KRES::ConfigWidget( parent, name )
34{
35 TQHBoxLayout *layout = new TQHBoxLayout( this );
36
37 TQLabel *label = new TQLabel( i18n( "Location:" ), this );
38 mURL = new KURLRequester( this );
39 KFile::Mode mode = static_cast<KFile::Mode>( KFile::File |
40 KFile::LocalOnly );
41 mURL->setMode( mode );
42 layout->addWidget( label );
43 layout->addWidget( mURL );
44}
45
46ResourceLocalConfig::~ResourceLocalConfig()
47{
48}
49
50void ResourceLocalConfig::loadSettings( KRES::Resource *resource )
51{
52 ResourceLocal *res = dynamic_cast<ResourceLocal *>( resource );
53 if ( res )
54 mURL->setURL( res->url().prettyURL() );
55 else
56 kdDebug() << "ERROR: ResourceLocalConfig::loadSettings(): no ResourceLocal, cast failed" << endl;
57}
58
59void ResourceLocalConfig::saveSettings( KRES::Resource *resource )
60{
61 ResourceLocal *res = dynamic_cast<ResourceLocal *>( resource );
62 if ( res )
63 res->setURL( mURL->url() );
64 else
65 kdDebug() << "ERROR: ResourceLocalConfig::saveSettings(): no ResourceLocal, cast failed" << endl;
66}
67
68#include "resourcelocalconfig.moc"