author | zautrix <zautrix> | 2005-10-27 10:34:56 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-27 10:34:56 (UTC) |
commit | 29c7448b3c54e8d579732d10f144e12f7167c3c3 (patch) (unidiff) | |
tree | ae613037eaa897d2f7bc084d0b9e6954c630d985 /kabc/plugins/olaccess/resourceolaccessconfig.cpp | |
parent | eb83d8b5542de9ca0c421ad6aca2913b502bbe78 (diff) | |
download | kdepimpi-29c7448b3c54e8d579732d10f144e12f7167c3c3.zip kdepimpi-29c7448b3c54e8d579732d10f144e12f7167c3c3.tar.gz kdepimpi-29c7448b3c54e8d579732d10f144e12f7167c3c3.tar.bz2 |
commit
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 | |||
@@ -1,108 +1,106 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
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 | ||