TDE personal information management applications
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

69 lines
2.3 KiB

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