summaryrefslogtreecommitdiff
path: root/library/lnkproperties.cpp
Unidiff
Diffstat (limited to 'library/lnkproperties.cpp') (more/less context) (show whitespace changes)
-rw-r--r--library/lnkproperties.cpp48
1 files changed, 21 insertions, 27 deletions
diff --git a/library/lnkproperties.cpp b/library/lnkproperties.cpp
index c020328..983c677 100644
--- a/library/lnkproperties.cpp
+++ b/library/lnkproperties.cpp
@@ -1,6 +1,6 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of 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
@@ -30,5 +30,7 @@
30#include <qpe/global.h> 30#include <qpe/global.h>
31#include <qpe/categorywidget.h> 31#include <qpe/categorywidget.h>
32#ifdef QWS
32#include <qpe/qcopenvelope_qws.h> 33#include <qpe/qcopenvelope_qws.h>
34#endif
33#include <qpe/filemanager.h> 35#include <qpe/filemanager.h>
34#include <qpe/config.h> 36#include <qpe/config.h>
@@ -55,4 +57,6 @@ LnkProperties::LnkProperties( AppLnk* l, QWidget* parent )
55 : QDialog( parent, 0, TRUE ), lnk(l), fileSize( 0 ) 57 : QDialog( parent, 0, TRUE ), lnk(l), fileSize( 0 )
56{ 58{
59 setCaption( tr("Properties") );
60
57 QVBoxLayout *vbox = new QVBoxLayout( this ); 61 QVBoxLayout *vbox = new QVBoxLayout( this );
58 d = new LnkPropertiesBase( this ); 62 d = new LnkPropertiesBase( this );
@@ -79,5 +83,4 @@ LnkProperties::LnkProperties( AppLnk* l, QWidget* parent )
79 connect(d->unlink,SIGNAL(clicked()),this,SLOT(unlinkLnk())); 83 connect(d->unlink,SIGNAL(clicked()),this,SLOT(unlinkLnk()));
80 connect(d->duplicate,SIGNAL(clicked()),this,SLOT(duplicateLnk())); 84 connect(d->duplicate,SIGNAL(clicked()),this,SLOT(duplicateLnk()));
81 connect(d->delicon,SIGNAL(clicked()),this,SLOT(unlinkIcon()));
82 85
83 d->docname->setReadOnly( FALSE ); 86 d->docname->setReadOnly( FALSE );
@@ -118,5 +121,4 @@ LnkProperties::LnkProperties( AppLnk* l, QWidget* parent )
118 currentLocation = 0; // apps not movable (yet) 121 currentLocation = 0; // apps not movable (yet)
119 } 122 }
120 setCaption( l->file());
121} 123}
122 124
@@ -128,8 +130,5 @@ void LnkProperties::unlinkLnk()
128{ 130{
129 if ( QPEMessageBox::confirmDelete( this, tr("Delete"), lnk->name() ) ) { 131 if ( QPEMessageBox::confirmDelete( this, tr("Delete"), lnk->name() ) ) {
130 if ( QFile::exists(lnk->file()) )
131 lnk->removeFiles(); 132 lnk->removeFiles();
132 else
133 QMessageBox::warning( this, tr("Delete"), tr("File does not exist.") );
134 if ( QFile::exists(lnk->file()) ) { 133 if ( QFile::exists(lnk->file()) ) {
135 QMessageBox::warning( this, tr("Delete"), tr("File deletion failed.") ); 134 QMessageBox::warning( this, tr("Delete"), tr("File deletion failed.") );
@@ -140,20 +139,4 @@ void LnkProperties::unlinkLnk()
140} 139}
141 140
142
143/*
144 * remove only the link from documents, not also the file
145 */
146void LnkProperties::unlinkIcon()
147{
148 if ( QPEMessageBox::confirmDelete( this, tr("Delete Icon and leave file"), lnk->name() ) ) {
149 lnk->removeLinkFile();
150 if ( QFile::exists(lnk->linkFile()) ) {
151 QMessageBox::warning( this, tr("Delete"), tr("Icon deletion failed.") );
152 } else {
153 reject();
154 }
155 }
156}
157
158void LnkProperties::setupLocations() 141void LnkProperties::setupLocations()
159{ 142{
@@ -171,11 +154,16 @@ void LnkProperties::setupLocations()
171 for ( ; it.current(); ++it ) { 154 for ( ; it.current(); ++it ) {
172 // we add 10k to the file size so we are sure we can also save the desktop file 155 // 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 ) { 156 if ( (ulong)(*it)->availBlocks() * (ulong)(*it)->blockSize() > (ulong)fileSize + 10000 ) {
174 if ( (*it)->isRemovable() || 157 if ( (*it)->isRemovable() ||
175 (*it)->disk() == "/dev/mtdblock1" || 158 (*it)->disk() == "/dev/mtdblock1" ||
176 (*it)->disk() == "/dev/mtdblock/1" || (*it)->disk().left(13) == "/dev/mtdblock" || 159 (*it)->disk() == "/dev/mtdblock/1" ||
177 (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { 160 (*it)->disk().left(13) == "/dev/mtdblock" ||
161 (*it)->disk() == "/dev/mtdblock6" ||
162 (*it)->disk() == "tmpfs" ) {
178 d->locationCombo->insertItem( (*it)->name(), index ); 163 d->locationCombo->insertItem( (*it)->name(), index );
179 locations.append( ((*it)->isRemovable() || (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ? (*it)->path() : homeDir) ); 164 locations.append( ( ((*it)->isRemovable() ||
165 (*it)->disk() == "/dev/mtdblock6" ||
166 (*it)->disk() == "tmpfs" )
167 ? (*it)->path() : homeDir) );
180 if ( lnk->file().contains( (*it)->path() ) ) { 168 if ( lnk->file().contains( (*it)->path() ) ) {
181 d->locationCombo->setCurrentItem( index ); 169 d->locationCombo->setCurrentItem( index );
@@ -236,4 +224,6 @@ void LnkProperties::beamLnk()
236 Ir ir; 224 Ir ir;
237 DocLnk doc( *((DocLnk *)lnk) ); 225 DocLnk doc( *((DocLnk *)lnk) );
226 doc.setName(d->docname->text());
227 reject();
238 ir.send( doc, doc.comment() ); 228 ir.send( doc, doc.comment() );
239} 229}
@@ -300,10 +290,14 @@ void LnkProperties::done(int ok)
300 if ( d->preload->isChecked() ) { 290 if ( d->preload->isChecked() ) {
301 apps.append(exe); 291 apps.append(exe);
292#ifndef QT_NO_COP
302 QCopEnvelope e("QPE/Application/"+exe.local8Bit(), 293 QCopEnvelope e("QPE/Application/"+exe.local8Bit(),
303 "enablePreload()"); 294 "enablePreload()");
295#endif
304 } else { 296 } else {
305 apps.remove(exe); 297 apps.remove(exe);
298#ifndef QT_NO_COP
306 QCopEnvelope e("QPE/Application/"+exe.local8Bit(), 299 QCopEnvelope e("QPE/Application/"+exe.local8Bit(),
307 "quitIfInvisible()"); 300 "quitIfInvisible()");
301#endif
308 } 302 }
309 cfg.writeEntry("Apps",apps,','); 303 cfg.writeEntry("Apps",apps,',');