summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/qtopia/resourceqtopiaconfig.cpp
Unidiff
Diffstat (limited to 'kabc/plugins/qtopia/resourceqtopiaconfig.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kabc/plugins/qtopia/resourceqtopiaconfig.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/kabc/plugins/qtopia/resourceqtopiaconfig.cpp b/kabc/plugins/qtopia/resourceqtopiaconfig.cpp
index 8cb8505..b2310c4 100644
--- a/kabc/plugins/qtopia/resourceqtopiaconfig.cpp
+++ b/kabc/plugins/qtopia/resourceqtopiaconfig.cpp
@@ -43,62 +43,65 @@ $Id$
43//US #include "stdaddressbook.h" 43//US #include "stdaddressbook.h"
44 44
45#include "resourceqtopiaconfig.h" 45#include "resourceqtopiaconfig.h"
46 46
47using namespace KABC; 47using namespace KABC;
48 48
49ResourceOpieConfig::ResourceOpieConfig( QWidget* parent, const char* name ) 49ResourceQtopiaConfig::ResourceQtopiaConfig( QWidget* parent, const char* name )
50 : ConfigWidget( parent, name ) 50 : ConfigWidget( parent, name )
51{ 51{
52//qDebug("ResourceFileConfig::ResourceFileConfig");
53
54 QGridLayout *mainLayout = new QGridLayout( this, 1, 2, 0, 52 QGridLayout *mainLayout = new QGridLayout( this, 1, 2, 0,
55 KDialog::spacingHint() ); 53 KDialog::spacingHint() );
56 54
57 QLabel *label = new QLabel( i18n( "Location:" ), this ); 55 QLabel *label = new QLabel( i18n( "Location:" ), this );
58 mFileNameEdit = new KURLRequester( this ); 56 mFileNameEdit = new KURLRequester( this );
59 57
60 connect( mFileNameEdit, SIGNAL( textChanged( const QString & ) ), 58 connect( mFileNameEdit, SIGNAL( textChanged( const QString & ) ),
61 SLOT( checkFilePermissions( const QString & ) ) ); 59 SLOT( checkFilePermissions( const QString & ) ) );
62 60
63 mainLayout->addWidget( label, 0, 0 ); 61 mainLayout->addWidget( label, 0, 0 );
64 mainLayout->addWidget( mFileNameEdit, 0, 1 ); 62 mainLayout->addWidget( mFileNameEdit, 0, 1 );
63
65} 64}
66 65
67void ResourceOpieConfig::loadSettings( KRES::Resource *res ) 66void ResourceQtopiaConfig::loadSettings( KRES::Resource *res )
68{ 67{
69//US ResourceFile *resource = dynamic_cast<ResourceFile*>( res ); 68//US ResourceFile *resource = dynamic_cast<ResourceFile*>( res );
70 ResourceOpie *resource = (ResourceOpie*)( res ); 69 ResourceQtopia *resource = (ResourceQtopia*)( res );
71 70
72 if ( !resource ) { 71 if ( !resource ) {
73 kdDebug(5700) << "ResourceOpieConfig::loadSettings(): cast failed" << endl; 72 kdDebug(5700) << "ResourceQtopiaConfig::loadSettings(): cast failed" << endl;
74 return; 73 return;
75 } 74 }
76 75
77 mFileNameEdit->setURL( resource->fileName() ); 76 mFileNameEdit->setURL( resource->fileName() );
78 if ( mFileNameEdit->url().isEmpty() ) 77 if ( mFileNameEdit->url().isEmpty() )
79 mFileNameEdit->setURL( QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml" ); 78 mFileNameEdit->setURL( QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml" );
80 79
81 //US Opie resources are ReadOnly by definition 80 //US Qtopia resources are ReadOnly by definition
82 emit setPersistentReadOnly( true ); 81 emit setPersistentReadOnly( true );
82
83 //US we can not choose the filename for the qtopia backend => make it readonly.
84 mFileNameEdit->setEnabled( false );
85
83} 86}
84 87
85void ResourceOpieConfig::saveSettings( KRES::Resource *res ) 88void ResourceQtopiaConfig::saveSettings( KRES::Resource *res )
86{ 89{
87//US ResourceFile *resource = dynamic_cast<ResourceFile*>( res ); 90//US ResourceFile *resource = dynamic_cast<ResourceFile*>( res );
88 ResourceOpie *resource = (ResourceOpie*)( res ); 91 ResourceQtopia *resource = (ResourceQtopia*)( res );
89 92
90 if ( !resource ) { 93 if ( !resource ) {
91 kdDebug(5700) << "ResourceOpieConfig::saveSettings(): cast failed" << endl; 94 kdDebug(5700) << "ResourceQtopiaConfig::saveSettings(): cast failed" << endl;
92 return; 95 return;
93 } 96 }
94 97
95 resource->setFileName( mFileNameEdit->url() ); 98 resource->setFileName( mFileNameEdit->url() );
96} 99}
97 100
98void ResourceOpieConfig::checkFilePermissions( const QString& fileName ) 101void ResourceQtopiaConfig::checkFilePermissions( const QString& fileName )
99{ 102{
100 // If file exist but is not writeable... 103 // If file exist but is not writeable...
101/*US 104/*US
102 if ( access( QFile::encodeName( fileName ), F_OK ) == 0 ) 105 if ( access( QFile::encodeName( fileName ), F_OK ) == 0 )
103 emit setReadOnly( access( QFile::encodeName( fileName ), W_OK ) < 0 ); 106 emit setReadOnly( access( QFile::encodeName( fileName ), W_OK ) < 0 );
104*/ 107*/