summaryrefslogtreecommitdiff
path: root/library/lnkproperties.cpp
authorzecke <zecke>2002-09-10 12:09:49 (UTC)
committer zecke <zecke>2002-09-10 12:09:49 (UTC)
commit6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4 (patch) (unidiff)
tree6ebc93c6432f4ed9d00ef1448b6a047ef522a79a /library/lnkproperties.cpp
parentd10cddb3c9ce75bc90b14add14bc133737fe35aa (diff)
downloadopie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.zip
opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.tar.gz
opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.tar.bz2
Qtopia1-6 merge
still to test bic changes to be resolved more changes to be made?
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,7 +1,7 @@
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
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
@@ -29,7 +29,9 @@
29#include <qpe/applnk.h> 29#include <qpe/applnk.h>
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>
35#include <qpe/storage.h> 37#include <qpe/storage.h>
@@ -54,6 +56,8 @@
54LnkProperties::LnkProperties( AppLnk* l, QWidget* parent ) 56LnkProperties::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 );
59 vbox->add( d ); 63 vbox->add( d );
@@ -78,7 +82,6 @@ LnkProperties::LnkProperties( AppLnk* l, QWidget* parent )
78 if ( lnk->type().contains('/') ) { // A document? (#### better predicate needed) 82 if ( lnk->type().contains('/') ) { // A document? (#### better predicate needed)
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 );
84 d->preload->hide(); 87 d->preload->hide();
@@ -117,7 +120,6 @@ LnkProperties::LnkProperties( AppLnk* l, QWidget* parent )
117 120
118 currentLocation = 0; // apps not movable (yet) 121 currentLocation = 0; // apps not movable (yet)
119 } 122 }
120 setCaption( l->file());
121} 123}
122 124
123LnkProperties::~LnkProperties() 125LnkProperties::~LnkProperties()
@@ -127,10 +129,7 @@ LnkProperties::~LnkProperties()
127void LnkProperties::unlinkLnk() 129void 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.") );
136 } else { 135 } else {
@@ -139,22 +138,6 @@ void LnkProperties::unlinkLnk()
139 } 138 }
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{
160 QFileInfo fi( lnk->file() ); 143 QFileInfo fi( lnk->file() );
@@ -170,13 +153,18 @@ void LnkProperties::setupLocations()
170 currentLocation = -1; 153 currentLocation = -1;
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 );
182 currentLocation = index; 170 currentLocation = index;
@@ -235,6 +223,8 @@ void LnkProperties::beamLnk()
235{ 223{
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}
240 230
@@ -299,12 +289,16 @@ void LnkProperties::done(int ok)
299 if ( apps.contains(exe) != d->preload->isChecked() ) { 289 if ( apps.contains(exe) != d->preload->isChecked() ) {
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,',');
310 } 304 }