-rw-r--r-- | library/lnkproperties.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/library/lnkproperties.cpp b/library/lnkproperties.cpp index e8baca6..c020328 100644 --- a/library/lnkproperties.cpp +++ b/library/lnkproperties.cpp | |||
@@ -128,105 +128,106 @@ void LnkProperties::unlinkLnk() | |||
128 | { | 128 | { |
129 | if ( QPEMessageBox::confirmDelete( this, tr("Delete"), lnk->name() ) ) { | 129 | if ( QPEMessageBox::confirmDelete( this, tr("Delete"), lnk->name() ) ) { |
130 | if ( QFile::exists(lnk->file()) ) | 130 | if ( QFile::exists(lnk->file()) ) |
131 | lnk->removeFiles(); | 131 | lnk->removeFiles(); |
132 | else | 132 | else |
133 | QMessageBox::warning( this, tr("Delete"), tr("File does not exist.") ); | 133 | QMessageBox::warning( this, tr("Delete"), tr("File does not exist.") ); |
134 | if ( QFile::exists(lnk->file()) ) { | 134 | if ( QFile::exists(lnk->file()) ) { |
135 | QMessageBox::warning( this, tr("Delete"), tr("File deletion failed.") ); | 135 | QMessageBox::warning( this, tr("Delete"), tr("File deletion failed.") ); |
136 | } else { | 136 | } else { |
137 | reject(); | 137 | reject(); |
138 | } | 138 | } |
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | 142 | ||
143 | /* | 143 | /* |
144 | * remove only the link from documents, not also the file | 144 | * remove only the link from documents, not also the file |
145 | */ | 145 | */ |
146 | void LnkProperties::unlinkIcon() | 146 | void LnkProperties::unlinkIcon() |
147 | { | 147 | { |
148 | if ( QPEMessageBox::confirmDelete( this, tr("Delete Icon and leave file"), lnk->name() ) ) { | 148 | if ( QPEMessageBox::confirmDelete( this, tr("Delete Icon and leave file"), lnk->name() ) ) { |
149 | lnk->removeLinkFile(); | 149 | lnk->removeLinkFile(); |
150 | if ( QFile::exists(lnk->linkFile()) ) { | 150 | if ( QFile::exists(lnk->linkFile()) ) { |
151 | QMessageBox::warning( this, tr("Delete"), tr("Icon deletion failed.") ); | 151 | QMessageBox::warning( this, tr("Delete"), tr("Icon deletion failed.") ); |
152 | } else { | 152 | } else { |
153 | reject(); | 153 | reject(); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | } | 156 | } |
157 | 157 | ||
158 | void LnkProperties::setupLocations() | 158 | void LnkProperties::setupLocations() |
159 | { | 159 | { |
160 | QFileInfo fi( lnk->file() ); | 160 | QFileInfo fi( lnk->file() ); |
161 | fileSize = fi.size(); | 161 | fileSize = fi.size(); |
162 | StorageInfo storage; | 162 | StorageInfo storage; |
163 | const QList<FileSystem> &fs = storage.fileSystems(); | 163 | const QList<FileSystem> &fs = storage.fileSystems(); |
164 | QListIterator<FileSystem> it ( fs ); | 164 | QListIterator<FileSystem> it ( fs ); |
165 | QString s; | 165 | QString s; |
166 | QString homeDir = getenv("HOME"); | 166 | QString homeDir = getenv("HOME"); |
167 | QString hardDiskHome; | 167 | QString hardDiskHome; |
168 | QString hardDiskPath; | 168 | QString hardDiskPath; |
169 | int index = 0; | 169 | int index = 0; |
170 | currentLocation = -1; | 170 | currentLocation = -1; |
171 | for ( ; it.current(); ++it ) { | 171 | for ( ; it.current(); ++it ) { |
172 | // we add 10k to the file size so we are sure we can also save the desktop file | 172 | // we add 10k to the file size so we are sure we can also save the desktop file |
173 | if ( (*it)->availBlocks() * (*it)->blockSize() > fileSize + 10000 ) { | 173 | if ( (*it)->availBlocks() * (*it)->blockSize() > fileSize + 10000 ) { |
174 | if ( (*it)->isRemovable() || | 174 | if ( (*it)->isRemovable() || |
175 | (*it)->disk() == "/dev/mtdblock1" || | 175 | (*it)->disk() == "/dev/mtdblock1" || |
176 | (*it)->disk() == "/dev/mtdblock/1" || (*it)->disk().left(13) == "/dev/mtdblock" ) { | 176 | (*it)->disk() == "/dev/mtdblock/1" || (*it)->disk().left(13) == "/dev/mtdblock" || |
177 | (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { | ||
177 | d->locationCombo->insertItem( (*it)->name(), index ); | 178 | d->locationCombo->insertItem( (*it)->name(), index ); |
178 | locations.append( ((*it)->isRemovable() ? (*it)->path() : homeDir) ); | 179 | locations.append( ((*it)->isRemovable() || (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ? (*it)->path() : homeDir) ); |
179 | if ( lnk->file().contains( (*it)->path() ) ) { | 180 | if ( lnk->file().contains( (*it)->path() ) ) { |
180 | d->locationCombo->setCurrentItem( index ); | 181 | d->locationCombo->setCurrentItem( index ); |
181 | currentLocation = index; | 182 | currentLocation = index; |
182 | } | 183 | } |
183 | index++; | 184 | index++; |
184 | } else if ( (*it)->name().contains( "Hard Disk") && | 185 | } else if ( (*it)->name().contains( tr("Hard Disk") ) && |
185 | homeDir.contains( (*it)->path() ) && | 186 | homeDir.contains( (*it)->path() ) && |
186 | (*it)->path().length() > hardDiskHome.length() ) { | 187 | (*it)->path().length() > hardDiskHome.length() ) { |
187 | hardDiskHome = (*it)->name(); | 188 | hardDiskHome = (*it)->name(); |
188 | hardDiskPath = (*it)->path(); | 189 | hardDiskPath = (*it)->path(); |
189 | } | 190 | } |
190 | } | 191 | } |
191 | } | 192 | } |
192 | if ( !hardDiskHome.isEmpty() ) { | 193 | if ( !hardDiskHome.isEmpty() ) { |
193 | d->locationCombo->insertItem( hardDiskHome ); | 194 | d->locationCombo->insertItem( hardDiskHome ); |
194 | locations.append( hardDiskPath ); | 195 | locations.append( hardDiskPath ); |
195 | if ( currentLocation == -1 ) { // assume it's the hard disk | 196 | if ( currentLocation == -1 ) { // assume it's the hard disk |
196 | d->locationCombo->setCurrentItem( index ); | 197 | d->locationCombo->setCurrentItem( index ); |
197 | currentLocation = index; | 198 | currentLocation = index; |
198 | } | 199 | } |
199 | } | 200 | } |
200 | } | 201 | } |
201 | 202 | ||
202 | void LnkProperties::duplicateLnk() | 203 | void LnkProperties::duplicateLnk() |
203 | { | 204 | { |
204 | // The duplicate takes the new properties. | 205 | // The duplicate takes the new properties. |
205 | DocLnk newdoc( *((DocLnk *)lnk) ); | 206 | DocLnk newdoc( *((DocLnk *)lnk) ); |
206 | if ( d->docname->text() == lnk->name() ) | 207 | if ( d->docname->text() == lnk->name() ) |
207 | newdoc.setName(tr("Copy of ")+d->docname->text()); | 208 | newdoc.setName(tr("Copy of ")+d->docname->text()); |
208 | else | 209 | else |
209 | newdoc.setName(d->docname->text()); | 210 | newdoc.setName(d->docname->text()); |
210 | 211 | ||
211 | if ( !copyFile( newdoc ) ) { | 212 | if ( !copyFile( newdoc ) ) { |
212 | QMessageBox::warning( this, tr("Duplicate"), tr("File copy failed.") ); | 213 | QMessageBox::warning( this, tr("Duplicate"), tr("File copy failed.") ); |
213 | return; | 214 | return; |
214 | } | 215 | } |
215 | reject(); | 216 | reject(); |
216 | } | 217 | } |
217 | 218 | ||
218 | bool LnkProperties::moveLnk() | 219 | bool LnkProperties::moveLnk() |
219 | { | 220 | { |
220 | DocLnk newdoc( *((DocLnk *)lnk) ); | 221 | DocLnk newdoc( *((DocLnk *)lnk) ); |
221 | newdoc.setName(d->docname->text()); | 222 | newdoc.setName(d->docname->text()); |
222 | 223 | ||
223 | if ( !copyFile( newdoc ) ) { | 224 | if ( !copyFile( newdoc ) ) { |
224 | QMessageBox::warning( this, tr("Details"), tr("Moving Document failed.") ); | 225 | QMessageBox::warning( this, tr("Details"), tr("Moving Document failed.") ); |
225 | return FALSE; | 226 | return FALSE; |
226 | } | 227 | } |
227 | // remove old lnk | 228 | // remove old lnk |
228 | lnk->removeFiles(); | 229 | lnk->removeFiles(); |
229 | 230 | ||
230 | return TRUE; | 231 | return TRUE; |
231 | } | 232 | } |
232 | 233 | ||