author | zecke <zecke> | 2002-10-16 01:09:22 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-16 01:09:22 (UTC) |
commit | 543e54de7170c606b6883ac4152567e7faf13182 (patch) (unidiff) | |
tree | 8a7d623e96cab0135a2f7cb11aa9f7491bfda9a2 /library/lnkproperties.cpp | |
parent | 3e973543b77631d053a9616b5540966dbe51ab47 (diff) | |
download | opie-543e54de7170c606b6883ac4152567e7faf13182.zip opie-543e54de7170c606b6883ac4152567e7faf13182.tar.gz opie-543e54de7170c606b6883ac4152567e7faf13182.tar.bz2 |
Remove #ifdef QWS HELL
a Platform which is not supporting IPC compatible
to QCopChannel/Envelope is not of much use nowadays..
so be sure your platform is supporting it
-rw-r--r-- | library/lnkproperties.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/library/lnkproperties.cpp b/library/lnkproperties.cpp index 0b50bae..50cf5af 100644 --- a/library/lnkproperties.cpp +++ b/library/lnkproperties.cpp | |||
@@ -1,227 +1,225 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT | 21 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT |
22 | // have this class. | 22 | // have this class. |
23 | #define QTOPIA_INTERNAL_FSLP | 23 | #define QTOPIA_INTERNAL_FSLP |
24 | #include "lnkproperties.h" | 24 | #include "lnkproperties.h" |
25 | #include "lnkproperties.h" | 25 | #include "lnkproperties.h" |
26 | #include "lnkpropertiesbase_p.h" | 26 | #include "lnkpropertiesbase_p.h" |
27 | #include "ir.h" | 27 | #include "ir.h" |
28 | 28 | ||
29 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
30 | #include <qpe/applnk.h> | 30 | #include <qpe/applnk.h> |
31 | #include <qpe/global.h> | 31 | #include <qpe/global.h> |
32 | #include <qpe/categorywidget.h> | 32 | #include <qpe/categorywidget.h> |
33 | #ifdef QWS | ||
34 | #include <qpe/qcopenvelope_qws.h> | 33 | #include <qpe/qcopenvelope_qws.h> |
35 | #endif | ||
36 | #include <qpe/filemanager.h> | 34 | #include <qpe/filemanager.h> |
37 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
38 | #include <qpe/storage.h> | 36 | #include <qpe/storage.h> |
39 | #include <qpe/qpemessagebox.h> | 37 | #include <qpe/qpemessagebox.h> |
40 | #include <qpe/mimetype.h> | 38 | #include <qpe/mimetype.h> |
41 | 39 | ||
42 | #include <qlineedit.h> | 40 | #include <qlineedit.h> |
43 | #include <qtoolbutton.h> | 41 | #include <qtoolbutton.h> |
44 | #include <qpushbutton.h> | 42 | #include <qpushbutton.h> |
45 | #include <qgroupbox.h> | 43 | #include <qgroupbox.h> |
46 | #include <qcheckbox.h> | 44 | #include <qcheckbox.h> |
47 | #include <qlabel.h> | 45 | #include <qlabel.h> |
48 | #include <qlayout.h> | 46 | #include <qlayout.h> |
49 | #include <qfile.h> | 47 | #include <qfile.h> |
50 | #include <qfileinfo.h> | 48 | #include <qfileinfo.h> |
51 | #include <qmessagebox.h> | 49 | #include <qmessagebox.h> |
52 | #include <qsize.h> | 50 | #include <qsize.h> |
53 | #include <qcombobox.h> | 51 | #include <qcombobox.h> |
54 | #include <qregexp.h> | 52 | #include <qregexp.h> |
55 | #include <qbuttongroup.h> | 53 | #include <qbuttongroup.h> |
56 | 54 | ||
57 | #include <stdlib.h> | 55 | #include <stdlib.h> |
58 | 56 | ||
59 | LnkProperties::LnkProperties( AppLnk* l, QWidget* parent ) | 57 | LnkProperties::LnkProperties( AppLnk* l, QWidget* parent ) |
60 | : QDialog( parent, 0, TRUE ), lnk(l), fileSize( 0 ) | 58 | : QDialog( parent, 0, TRUE ), lnk(l), fileSize( 0 ) |
61 | { | 59 | { |
62 | setCaption( tr("Properties") ); | 60 | setCaption( tr("Properties") ); |
63 | 61 | ||
64 | QVBoxLayout *vbox = new QVBoxLayout( this ); | 62 | QVBoxLayout *vbox = new QVBoxLayout( this ); |
65 | d = new LnkPropertiesBase( this ); | 63 | d = new LnkPropertiesBase( this ); |
66 | vbox->add( d ); | 64 | vbox->add( d ); |
67 | 65 | ||
68 | d->docname->setText(l->name()); | 66 | d->docname->setText(l->name()); |
69 | QString inf; | 67 | QString inf; |
70 | if ( l->type().isEmpty() ) { | 68 | if ( l->type().isEmpty() ) { |
71 | d->type->hide(); | 69 | d->type->hide(); |
72 | d->typeLabel->hide(); | 70 | d->typeLabel->hide(); |
73 | } else { | 71 | } else { |
74 | d->type->setText( l->type() ); | 72 | d->type->setText( l->type() ); |
75 | } | 73 | } |
76 | 74 | ||
77 | if ( l->comment().isEmpty() ) { | 75 | if ( l->comment().isEmpty() ) { |
78 | d->comment->hide(); | 76 | d->comment->hide(); |
79 | d->commentLabel->hide(); | 77 | d->commentLabel->hide(); |
80 | } else { | 78 | } else { |
81 | d->comment->setText( l->comment() ); | 79 | d->comment->setText( l->comment() ); |
82 | } | 80 | } |
83 | 81 | ||
84 | connect(d->beam,SIGNAL(clicked()),this,SLOT(beamLnk())); | 82 | connect(d->beam,SIGNAL(clicked()),this,SLOT(beamLnk())); |
85 | if ( lnk->type().contains('/') ) { // A document? (#### better predicate needed) | 83 | if ( lnk->type().contains('/') ) { // A document? (#### better predicate needed) |
86 | connect(d->unlink,SIGNAL(clicked()),this,SLOT(unlinkLnk())); | 84 | connect(d->unlink,SIGNAL(clicked()),this,SLOT(unlinkLnk())); |
87 | connect(d->duplicate,SIGNAL(clicked()),this,SLOT(duplicateLnk())); | 85 | connect(d->duplicate,SIGNAL(clicked()),this,SLOT(duplicateLnk())); |
88 | 86 | ||
89 | d->docname->setReadOnly( FALSE ); | 87 | d->docname->setReadOnly( FALSE ); |
90 | d->preload->hide(); | 88 | d->preload->hide(); |
91 | d->rotate->hide(); | 89 | d->rotate->hide(); |
92 | d->rotateButtons->hide(); | 90 | d->rotateButtons->hide(); |
93 | d->labelspacer->hide(); | 91 | d->labelspacer->hide(); |
94 | 92 | ||
95 | // ### THIS MUST GO, FIX WIERD BUG in QLAYOUT | 93 | // ### THIS MUST GO, FIX WIERD BUG in QLAYOUT |
96 | d->categoryEdit->kludge(); | 94 | d->categoryEdit->kludge(); |
97 | 95 | ||
98 | d->categoryEdit->setCategories( lnk->categories(), | 96 | d->categoryEdit->setCategories( lnk->categories(), |
99 | "Document View", | 97 | "Document View", |
100 | tr("Document View") ); | 98 | tr("Document View") ); |
101 | setupLocations(); | 99 | setupLocations(); |
102 | } else { | 100 | } else { |
103 | d->unlink->hide(); | 101 | d->unlink->hide(); |
104 | d->duplicate->hide(); | 102 | d->duplicate->hide(); |
105 | d->beam->hide(); | 103 | d->beam->hide(); |
106 | d->hline->hide(); | 104 | d->hline->hide(); |
107 | d->locationLabel->hide(); | 105 | d->locationLabel->hide(); |
108 | d->locationCombo->hide(); | 106 | d->locationCombo->hide(); |
109 | 107 | ||
110 | // Can't edit categories, since the app .desktop files are global, | 108 | // Can't edit categories, since the app .desktop files are global, |
111 | // possibly read-only. | 109 | // possibly read-only. |
112 | d->categoryEdit->hide(); | 110 | d->categoryEdit->hide(); |
113 | 111 | ||
114 | d->docname->setReadOnly( TRUE ); | 112 | d->docname->setReadOnly( TRUE ); |
115 | 113 | ||
116 | if ( l->property("CanFastload") == "0" ) | 114 | if ( l->property("CanFastload") == "0" ) |
117 | d->preload->hide(); | 115 | d->preload->hide(); |
118 | if ( !l->property("Rotation"). isEmpty ()) { | 116 | if ( !l->property("Rotation"). isEmpty ()) { |
119 | d->rotate->setChecked ( true ); | 117 | d->rotate->setChecked ( true ); |
120 | d->rotateButtons->setButton((l->rotation().toInt()%360)/90); | 118 | d->rotateButtons->setButton((l->rotation().toInt()%360)/90); |
121 | } | 119 | } |
122 | else { | 120 | else { |
123 | d->rotateButtons->setEnabled(false); | 121 | d->rotateButtons->setEnabled(false); |
124 | } | 122 | } |
125 | 123 | ||
126 | Config cfg("Launcher"); | 124 | Config cfg("Launcher"); |
127 | cfg.setGroup("Preload"); | 125 | cfg.setGroup("Preload"); |
128 | QStringList apps = cfg.readListEntry("Apps",','); | 126 | QStringList apps = cfg.readListEntry("Apps",','); |
129 | d->preload->setChecked( apps.contains(l->exec()) ); | 127 | d->preload->setChecked( apps.contains(l->exec()) ); |
130 | if ( Global::isBuiltinCommand(lnk->exec()) ) | 128 | if ( Global::isBuiltinCommand(lnk->exec()) ) |
131 | d->preload->hide(); // builtins are always fast | 129 | d->preload->hide(); // builtins are always fast |
132 | 130 | ||
133 | currentLocation = 0; // apps not movable (yet) | 131 | currentLocation = 0; // apps not movable (yet) |
134 | } | 132 | } |
135 | } | 133 | } |
136 | 134 | ||
137 | LnkProperties::~LnkProperties() | 135 | LnkProperties::~LnkProperties() |
138 | { | 136 | { |
139 | } | 137 | } |
140 | 138 | ||
141 | void LnkProperties::unlinkLnk() | 139 | void LnkProperties::unlinkLnk() |
142 | { | 140 | { |
143 | if ( QPEMessageBox::confirmDelete( this, tr("Delete"), lnk->name() ) ) { | 141 | if ( QPEMessageBox::confirmDelete( this, tr("Delete"), lnk->name() ) ) { |
144 | lnk->removeFiles(); | 142 | lnk->removeFiles(); |
145 | if ( QFile::exists(lnk->file()) ) { | 143 | if ( QFile::exists(lnk->file()) ) { |
146 | QMessageBox::warning( this, tr("Delete"), tr("File deletion failed.") ); | 144 | QMessageBox::warning( this, tr("Delete"), tr("File deletion failed.") ); |
147 | } else { | 145 | } else { |
148 | reject(); | 146 | reject(); |
149 | } | 147 | } |
150 | } | 148 | } |
151 | } | 149 | } |
152 | 150 | ||
153 | void LnkProperties::setupLocations() | 151 | void LnkProperties::setupLocations() |
154 | { | 152 | { |
155 | QFileInfo fi( lnk->file() ); | 153 | QFileInfo fi( lnk->file() ); |
156 | fileSize = fi.size(); | 154 | fileSize = fi.size(); |
157 | StorageInfo storage; | 155 | StorageInfo storage; |
158 | const QList<FileSystem> &fs = storage.fileSystems(); | 156 | const QList<FileSystem> &fs = storage.fileSystems(); |
159 | QListIterator<FileSystem> it ( fs ); | 157 | QListIterator<FileSystem> it ( fs ); |
160 | QString s; | 158 | QString s; |
161 | QString homeDir = getenv("HOME"); | 159 | QString homeDir = getenv("HOME"); |
162 | QString hardDiskHome; | 160 | QString hardDiskHome; |
163 | QString hardDiskPath; | 161 | QString hardDiskPath; |
164 | int index = 0; | 162 | int index = 0; |
165 | currentLocation = -1; | 163 | currentLocation = -1; |
166 | for ( ; it.current(); ++it ) { | 164 | for ( ; it.current(); ++it ) { |
167 | // we add 10k to the file size so we are sure we can also save the desktop file | 165 | // we add 10k to the file size so we are sure we can also save the desktop file |
168 | if ( (ulong)(*it)->availBlocks() * (ulong)(*it)->blockSize() > (ulong)fileSize + 10000 ) { | 166 | if ( (ulong)(*it)->availBlocks() * (ulong)(*it)->blockSize() > (ulong)fileSize + 10000 ) { |
169 | if ( (*it)->isRemovable() || | 167 | if ( (*it)->isRemovable() || |
170 | (*it)->disk() == "/dev/mtdblock1" || | 168 | (*it)->disk() == "/dev/mtdblock1" || |
171 | (*it)->disk() == "/dev/mtdblock/1" || | 169 | (*it)->disk() == "/dev/mtdblock/1" || |
172 | (*it)->disk().left(13) == "/dev/mtdblock" || | 170 | (*it)->disk().left(13) == "/dev/mtdblock" || |
173 | (*it)->disk() == "/dev/mtdblock6" || | 171 | (*it)->disk() == "/dev/mtdblock6" || |
174 | (*it)->disk() == "tmpfs" ) { | 172 | (*it)->disk() == "tmpfs" ) { |
175 | d->locationCombo->insertItem( (*it)->name(), index ); | 173 | d->locationCombo->insertItem( (*it)->name(), index ); |
176 | locations.append( ( ((*it)->isRemovable() || | 174 | locations.append( ( ((*it)->isRemovable() || |
177 | (*it)->disk() == "/dev/mtdblock6" || | 175 | (*it)->disk() == "/dev/mtdblock6" || |
178 | (*it)->disk() == "tmpfs" ) | 176 | (*it)->disk() == "tmpfs" ) |
179 | ? (*it)->path() : homeDir) ); | 177 | ? (*it)->path() : homeDir) ); |
180 | if ( lnk->file().contains( (*it)->path() ) ) { | 178 | if ( lnk->file().contains( (*it)->path() ) ) { |
181 | d->locationCombo->setCurrentItem( index ); | 179 | d->locationCombo->setCurrentItem( index ); |
182 | currentLocation = index; | 180 | currentLocation = index; |
183 | } | 181 | } |
184 | index++; | 182 | index++; |
185 | } else if ( (*it)->name().contains( tr("Hard Disk") ) && | 183 | } else if ( (*it)->name().contains( tr("Hard Disk") ) && |
186 | homeDir.contains( (*it)->path() ) && | 184 | homeDir.contains( (*it)->path() ) && |
187 | (*it)->path().length() > hardDiskHome.length() ) { | 185 | (*it)->path().length() > hardDiskHome.length() ) { |
188 | hardDiskHome = (*it)->name(); | 186 | hardDiskHome = (*it)->name(); |
189 | hardDiskPath = (*it)->path(); | 187 | hardDiskPath = (*it)->path(); |
190 | } | 188 | } |
191 | } | 189 | } |
192 | } | 190 | } |
193 | if ( !hardDiskHome.isEmpty() ) { | 191 | if ( !hardDiskHome.isEmpty() ) { |
194 | d->locationCombo->insertItem( hardDiskHome ); | 192 | d->locationCombo->insertItem( hardDiskHome ); |
195 | locations.append( hardDiskPath ); | 193 | locations.append( hardDiskPath ); |
196 | if ( currentLocation == -1 ) { // assume it's the hard disk | 194 | if ( currentLocation == -1 ) { // assume it's the hard disk |
197 | d->locationCombo->setCurrentItem( index ); | 195 | d->locationCombo->setCurrentItem( index ); |
198 | currentLocation = index; | 196 | currentLocation = index; |
199 | } | 197 | } |
200 | } | 198 | } |
201 | } | 199 | } |
202 | 200 | ||
203 | void LnkProperties::duplicateLnk() | 201 | void LnkProperties::duplicateLnk() |
204 | { | 202 | { |
205 | // The duplicate takes the new properties. | 203 | // The duplicate takes the new properties. |
206 | DocLnk newdoc( *((DocLnk *)lnk) ); | 204 | DocLnk newdoc( *((DocLnk *)lnk) ); |
207 | if ( d->docname->text() == lnk->name() ) | 205 | if ( d->docname->text() == lnk->name() ) |
208 | newdoc.setName(tr("Copy of ")+d->docname->text()); | 206 | newdoc.setName(tr("Copy of ")+d->docname->text()); |
209 | else | 207 | else |
210 | newdoc.setName(d->docname->text()); | 208 | newdoc.setName(d->docname->text()); |
211 | 209 | ||
212 | if ( !copyFile( newdoc ) ) { | 210 | if ( !copyFile( newdoc ) ) { |
213 | QMessageBox::warning( this, tr("Duplicate"), tr("File copy failed.") ); | 211 | QMessageBox::warning( this, tr("Duplicate"), tr("File copy failed.") ); |
214 | return; | 212 | return; |
215 | } | 213 | } |
216 | reject(); | 214 | reject(); |
217 | } | 215 | } |
218 | 216 | ||
219 | bool LnkProperties::moveLnk() | 217 | bool LnkProperties::moveLnk() |
220 | { | 218 | { |
221 | DocLnk newdoc( *((DocLnk *)lnk) ); | 219 | DocLnk newdoc( *((DocLnk *)lnk) ); |
222 | newdoc.setName(d->docname->text()); | 220 | newdoc.setName(d->docname->text()); |
223 | 221 | ||
224 | if ( !copyFile( newdoc ) ) { | 222 | if ( !copyFile( newdoc ) ) { |
225 | QMessageBox::warning( this, tr("Details"), tr("Moving Document failed.") ); | 223 | QMessageBox::warning( this, tr("Details"), tr("Moving Document failed.") ); |
226 | return FALSE; | 224 | return FALSE; |
227 | } | 225 | } |