Diffstat (limited to 'kabc/plugins/olaccess/resourceolaccessconfig.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kabc/plugins/olaccess/resourceolaccessconfig.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/kabc/plugins/olaccess/resourceolaccessconfig.cpp b/kabc/plugins/olaccess/resourceolaccessconfig.cpp index 240f1d7..1fcf1b8 100644 --- a/kabc/plugins/olaccess/resourceolaccessconfig.cpp +++ b/kabc/plugins/olaccess/resourceolaccessconfig.cpp | |||
@@ -28,81 +28,79 @@ $Id$ | |||
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | 30 | ||
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <klocale.h> | 32 | #include <klocale.h> |
33 | #include <kstandarddirs.h> | 33 | #include <kstandarddirs.h> |
34 | #include <kdialog.h> | 34 | #include <kdialog.h> |
35 | 35 | ||
36 | #include <unistd.h> | ||
37 | 36 | ||
38 | #include <qdir.h> | 37 | #include <qdir.h> |
39 | #include <qfile.h> | 38 | #include <qfile.h> |
40 | #include "resourcesharpdtm.h" | 39 | #include "resourceolaccess.h" |
41 | 40 | ||
42 | #include "resourcesharpdtmconfig.h" | 41 | #include "resourceolaccessconfig.h" |
43 | 42 | ||
44 | #include <sl/slzdb.h> | ||
45 | 43 | ||
46 | using namespace KABC; | 44 | using namespace KABC; |
47 | 45 | ||
48 | ResourceSharpDTMConfig::ResourceSharpDTMConfig( QWidget* parent, const char* name ) | 46 | ResourceolaccessConfig::ResourceolaccessConfig( QWidget* parent, const char* name ) |
49 | : ConfigWidget( parent, name ) | 47 | : ConfigWidget( parent, name ) |
50 | { | 48 | { |
51 | QGridLayout *mainLayout = new QGridLayout( this, 1, 2, 0, | 49 | QGridLayout *mainLayout = new QGridLayout( this, 1, 2, 0, |
52 | KDialog::spacingHint() ); | 50 | KDialog::spacingHint() ); |
53 | 51 | ||
54 | QLabel *label = new QLabel( i18n( "Location:" ), this ); | 52 | QLabel *label = new QLabel( i18n( "Location:" ), this ); |
55 | mFileNameEdit = new KURLRequester( this ); | 53 | mFileNameEdit = new KURLRequester( this ); |
56 | 54 | ||
57 | connect( mFileNameEdit, SIGNAL( textChanged( const QString & ) ), | 55 | connect( mFileNameEdit, SIGNAL( textChanged( const QString & ) ), |
58 | SLOT( checkFilePermissions( const QString & ) ) ); | 56 | SLOT( checkFilePermissions( const QString & ) ) ); |
59 | 57 | ||
60 | mainLayout->addWidget( label, 0, 0 ); | 58 | mainLayout->addWidget( label, 0, 0 ); |
61 | mainLayout->addWidget( mFileNameEdit, 0, 1 ); | 59 | mainLayout->addWidget( mFileNameEdit, 0, 1 ); |
62 | 60 | ||
63 | } | 61 | } |
64 | 62 | ||
65 | void ResourceSharpDTMConfig::loadSettings( KRES::Resource *res ) | 63 | void ResourceolaccessConfig::loadSettings( KRES::Resource *res ) |
66 | { | 64 | { |
67 | //US ResourceFile *resource = dynamic_cast<ResourceFile*>( res ); | 65 | //US ResourceFile *resource = dynamic_cast<ResourceFile*>( res ); |
68 | ResourceSharpDTM *resource = (ResourceSharpDTM*)( res ); | 66 | Resourceolaccess *resource = (Resourceolaccess*)( res ); |
69 | 67 | ||
70 | if ( !resource ) { | 68 | if ( !resource ) { |
71 | kdDebug(5700) << "ResourceSharpDTMConfig::loadSettings(): cast failed" << endl; | 69 | kdDebug(5700) << "ResourceolaccessConfig::loadSettings(): cast failed" << endl; |
72 | return; | 70 | return; |
73 | } | 71 | } |
74 | 72 | ||
75 | mFileNameEdit->setURL( resource->fileName() ); | 73 | mFileNameEdit->setURL( resource->fileName() ); |
76 | if ( mFileNameEdit->url().isEmpty() ) | 74 | if ( mFileNameEdit->url().isEmpty() ) |
77 | mFileNameEdit->setURL( SlZDataBase::addressbookFileName() ); | 75 | ;//mFileNameEdit->setURL( SlZDataBase::addressbookFileName() ); |
78 | 76 | ||
79 | //US Sharp DTM resources are ReadOnly by definition | 77 | //US Sharp DTM resources are ReadOnly by definition |
80 | emit setPersistentReadOnly( true ); | 78 | emit setPersistentReadOnly( true ); |
81 | 79 | ||
82 | //US we can not choose the filename for the sharp backend => make it readonly. | 80 | //US we can not choose the filename for the sharp backend => make it readonly. |
83 | mFileNameEdit->setEnabled( false ); | 81 | mFileNameEdit->setEnabled( false ); |
84 | 82 | ||
85 | } | 83 | } |
86 | 84 | ||
87 | void ResourceSharpDTMConfig::saveSettings( KRES::Resource *res ) | 85 | void ResourceolaccessConfig::saveSettings( KRES::Resource *res ) |
88 | { | 86 | { |
89 | //US ResourceFile *resource = dynamic_cast<ResourceFile*>( res ); | 87 | //US ResourceFile *resource = dynamic_cast<ResourceFile*>( res ); |
90 | ResourceSharpDTM *resource = (ResourceSharpDTM*)( res ); | 88 | Resourceolaccess *resource = (Resourceolaccess*)( res ); |
91 | 89 | ||
92 | if ( !resource ) { | 90 | if ( !resource ) { |
93 | kdDebug(5700) << "ResourceSharpDTMConfig::saveSettings(): cast failed" << endl; | 91 | kdDebug(5700) << "ResourceolaccessConfig::saveSettings(): cast failed" << endl; |
94 | return; | 92 | return; |
95 | } | 93 | } |
96 | 94 | ||
97 | resource->setFileName( mFileNameEdit->url() ); | 95 | resource->setFileName( mFileNameEdit->url() ); |
98 | } | 96 | } |
99 | 97 | ||
100 | void ResourceSharpDTMConfig::checkFilePermissions( const QString& fileName ) | 98 | void ResourceolaccessConfig::checkFilePermissions( const QString& fileName ) |
101 | { | 99 | { |
102 | // If file exist but is not writeable... | 100 | // If file exist but is not writeable... |
103 | /*US | 101 | /*US |
104 | if ( access( QFile::encodeName( fileName ), F_OK ) == 0 ) | 102 | if ( access( QFile::encodeName( fileName ), F_OK ) == 0 ) |
105 | emit setReadOnly( access( QFile::encodeName( fileName ), W_OK ) < 0 ); | 103 | emit setReadOnly( access( QFile::encodeName( fileName ), W_OK ) < 0 ); |
106 | */ | 104 | */ |
107 | } | 105 | } |
108 | 106 | ||