summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp13
-rw-r--r--library/applnk.cpp24
-rw-r--r--library/applnk.h1
-rw-r--r--library/lnkproperties.cpp31
-rw-r--r--library/lnkpropertiesbase_p.ui366
5 files changed, 370 insertions, 65 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index fa46543..6e63fca 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -301,399 +301,398 @@ public:
protected:
void styleChange( QStyle &old )
{
QIconView::styleChange( old );
calculateGrid( itemTextPos() );
}
void calculateGrid( ItemTextPos pos )
{
int dw = QApplication::desktop()->width();
int viewerWidth = dw-style().scrollBarExtent().width();
if ( pos == Bottom ) {
int cols = 3;
if ( viewerWidth <= 200 )
cols = 2;
else if ( viewerWidth >= 400 )
cols = viewerWidth/96;
setSpacing( 4 );
setGridX( (viewerWidth-(cols+1)*spacing())/cols );
setGridY( fontMetrics().height()*2+24 );
} else {
int cols = 2;
if ( viewerWidth < 150 )
cols = 1;
else if ( viewerWidth >= 400 )
cols = viewerWidth/150;
setSpacing( 2 );
setGridX( (viewerWidth-(cols+1)*spacing())/cols );
setGridY( fontMetrics().height()+2 );
}
}
private:
QList<AppLnk> hidden;
QDict<void> mimes;
QDict<void> cats;
SortMethod sortmeth;
QRegExp tf;
int cf;
QIconViewItem* bsy;
bool ike;
bool bigIcns;
QPixmap bgPixmap;
QPixmap bpm [6];
QColor bgColor;
int busytimer;
int busystate;
BusyIndicatorType busyType;
};
bool LauncherView::bsy=FALSE;
void LauncherView::setBusy(bool on)
{
icons->setBusy(on);
}
class LauncherItem : public QIconViewItem
{
public:
LauncherItem( QIconView *parent, AppLnk* applnk, bool bigIcon=TRUE );
~LauncherItem()
{
LauncherIconView* liv = (LauncherIconView*)iconView();
if ( liv->busyItem() == this )
liv->setBusy(FALSE);
delete app;
}
AppLnk* appLnk() const { return app; }
AppLnk* takeAppLnk() { AppLnk* r=app; app=0; return r; }
virtual int compare ( QIconViewItem * i ) const;
void paintItem( QPainter *p, const QColorGroup &cg )
{
LauncherIconView* liv = (LauncherIconView*)iconView();
QBrush oldBrush( liv->itemTextBackground() );
QColorGroup mycg( cg );
if ( liv->currentItem() == this ) {
liv->setItemTextBackground( cg.brush( QColorGroup::Highlight ) );
mycg.setColor( QColorGroup::Text, cg.color( QColorGroup::HighlightedText ) );
}
QIconViewItem::paintItem(p,mycg);
if ( liv->currentItem() == this )
liv->setItemTextBackground( oldBrush );
}
virtual QPixmap* pixmap () const
{
const LauncherIconView* liv = (LauncherIconView*)iconView();
if ( (const LauncherItem *)liv->busyItem() == this )
return liv->busyPixmap();
return QIconViewItem::pixmap();
}
protected:
AppLnk* app;
};
LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon )
: QIconViewItem( parent, applnk->name(),
bigIcon ? applnk->bigPixmap() :applnk->pixmap() ),
app(applnk) // Takes ownership
{
}
int LauncherItem::compare ( QIconViewItem * i ) const
{
LauncherIconView* view = (LauncherIconView*)iconView();
return view->compare(app,((LauncherItem *)i)->appLnk());
}
QStringList LauncherIconView::mimeTypes() const
{
QStringList r;
QDictIterator<void> it(mimes);
while (it.current()) {
r.append(it.currentKey());
++it;
}
r.sort();
return r;
}
void LauncherIconView::addItem(AppLnk* app, bool resort)
{
addCatsAndMimes(app);
if ( (tf.isEmpty() || tf.match(app->type()) >= 0)
&& (cf == 0 || app->categories().contains(cf)
|| cf == -1 && app->categories().count() == 0 ) )
(void) new LauncherItem( this, app, bigIcns );
else
hidden.append(app);
if ( resort )
sort();
}
void LauncherIconView::updateCategoriesAndMimeTypes()
{
mimes.clear();
cats.clear();
LauncherItem* item = (LauncherItem*)firstItem();
while (item) {
addCatsAndMimes(item->appLnk());
item = (LauncherItem*)item->nextItem();
}
QListIterator<AppLnk> it(hidden);
AppLnk* l;
while ((l=it.current())) {
addCatsAndMimes(l);
++it;
}
}
void LauncherIconView::hideOrShowItems(bool resort)
{
hidden.setAutoDelete(FALSE);
QList<AppLnk> links=hidden;
hidden.clear();
hidden.setAutoDelete(TRUE);
LauncherItem* item = (LauncherItem*)firstItem();
while (item) {
links.append(item->takeAppLnk());
item = (LauncherItem*)item->nextItem();
}
viewport()->setUpdatesEnabled( FALSE );
clear();
QListIterator<AppLnk> it(links);
AppLnk* l;
while ((l=it.current())) {
addItem(l,FALSE);
++it;
}
viewport()->setUpdatesEnabled( TRUE );
if ( resort && !autoArrange() )
sort();
}
bool LauncherIconView::removeLink(const QString& linkfile)
{
LauncherItem* item = (LauncherItem*)firstItem();
AppLnk* l;
bool did = FALSE;
DocLnk dl(linkfile);
while (item) {
l = item->appLnk();
- if ( l->linkFileKnown() && l->linkFile() == linkfile
- || l->fileKnown() && (
- l->file() == linkfile
- || dl.isValid() && dl.file() == l->file() ) ) {
+ if ( ( l->linkFileKnown() && ( l->linkFile() == linkfile ))
+ || ( l->fileKnown() && ( l->file() == linkfile ))
+ || ( dl.fileKnown() && l->fileKnown() && ( dl.file() == l->file() )) ) {
delete item;
did = TRUE;
}
item = (LauncherItem*)item->nextItem();
}
QListIterator<AppLnk> it(hidden);
while ((l=it.current())) {
++it;
- if ( l->linkFileKnown() && l->linkFile() == linkfile
- || l->file() == linkfile
- || dl.isValid() && dl.file() == l->file() ) {
+ if ( ( l->linkFileKnown() && ( l->linkFile() == linkfile ))
+ || ( l->file() == linkfile )
+ || ( dl.fileKnown() && ( dl.file() == l->file() )) ) {
hidden.removeRef(l);
did = TRUE;
}
}
return did;
}
static QString docLinkInfo(const Categories& cats, DocLnk* doc)
{
QString contents;
QFileInfo fi( doc->file() );
if ( !fi.exists() )
return contents;
if ( doc->linkFileKnown() ) {
QString lfn = doc->linkFile();
QFile f( lfn );
if ( f.open( IO_ReadOnly ) ) {
QTextStream ts( &f );
ts.setEncoding( QTextStream::UnicodeUTF8 );
contents += ts.read();
f.close();
goto calcsize;
}
}
contents += "[Desktop Entry]\n";
contents += "Categories = " // No tr
+ cats.labels("Document View", doc->categories()).join(";") + "\n"; // No tr
contents += "File = "+doc->file()+"\n"; // No tr
contents += "Name = "+doc->name()+"\n"; // No tr
contents += "Type = "+doc->type()+"\n"; // No tr
calcsize:
contents += QString("Size = %1\n").arg( fi.size() ); // No tr
return contents;
}
QString LauncherIconView::getAllDocLinkInfo() const
{
QString contents;
LauncherItem* item = (LauncherItem*)firstItem();
Categories cats;
while (item) {
DocLnk* doc = (DocLnk*)item->appLnk();
contents += docLinkInfo(cats,doc);
item = (LauncherItem*)item->nextItem();
}
QListIterator<AppLnk> it(hidden);
DocLnk* doc;
while ((doc=(DocLnk*)it.current())) {
contents += docLinkInfo(cats,doc);
++it;
}
return contents;
}
//===========================================================================
LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl )
: QVBox( parent, name, fl )
{
icons = new LauncherIconView( this );
setFocusProxy(icons);
QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold );
icons->setItemsMovable( FALSE );
icons->setAutoArrange( TRUE );
icons->setSorting( TRUE );
icons->setFrameStyle( QFrame::NoFrame );
icons->setMargin( 0 );
icons->setSelectionMode( QIconView::NoSelection );
icons->setBackgroundMode( PaletteBase );
icons->setResizeMode( QIconView::Fixed );
vmode = (ViewMode)-1;
setViewMode( Icon );
connect( icons, SIGNAL(mouseButtonClicked(int, QIconViewItem *, const QPoint&)),
SLOT(itemClicked(int, QIconViewItem *)) );
connect( icons, SIGNAL(selectionChanged()),
SLOT(selectionChanged()) );
connect( icons, SIGNAL(returnPressed(QIconViewItem *)),
SLOT(returnPressed(QIconViewItem *)) );
connect( icons, SIGNAL(mouseButtonPressed(int, QIconViewItem *, const QPoint&)),
SLOT(itemPressed(int, QIconViewItem *)) );
tools = 0;
setBackgroundType( Ruled, QString::null );
}
LauncherView::~LauncherView()
{
}
void LauncherView::setToolsEnabled(bool y)
{
if ( !y != !tools ) {
if ( y ) {
tools = new QHBox(this);
// Type filter
typemb = new QComboBox(tools);
// Category filter
catmb = new CategorySelect(tools);
updateTools();
tools->show();
} else {
delete tools;
tools = 0;
}
}
}
void LauncherView::updateTools()
{
disconnect( typemb, SIGNAL(activated(int)),
this, SLOT(showType(int)) );
disconnect( catmb, SIGNAL(signalSelected(int)),
this, SLOT(showCategory(int)) );
icons->updateCategoriesAndMimeTypes();
QString prev;
// Type filter
QStringList types;
typelist = icons->mimeTypes();
for (QStringList::ConstIterator it = typelist.begin(); it!=typelist.end(); ++it) {
QString t = *it;
if ( t.left(12) == "application/" ) {
MimeType mt(t);
const AppLnk* app = mt.application();
if ( app )
t = app->name();
else
t = t.mid(12);
} else {
t[0] = t[0].upper();
}
types += tr("%1 files").arg(t);
}
types << tr("All types of file");
prev = typemb->currentText();
typemb->clear();
typemb->insertStringList(types);
for (int i=0; i<typemb->count(); i++) {
if ( typemb->text(i) == prev ) {
typemb->setCurrentItem(i);
break;
}
}
if ( prev.isNull() )
typemb->setCurrentItem(typemb->count()-1);
Categories cats( 0 );
cats.load( categoryFileName() );
QArray<int> vl( 0 );
catmb->setCategories( vl, "Document View", // No tr
tr("Document View") );
catmb->setRemoveCategoryEdit( TRUE );
catmb->setAllCategories( TRUE );
connect(typemb, SIGNAL(activated(int)), this, SLOT(showType(int)));
connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int)));
}
void LauncherView::sortBy(int s)
{
icons->setSortMethod((LauncherIconView::SortMethod)s);
}
void LauncherView::showType(int t)
{
if ( t >= (int)typelist.count() ) {
icons->setTypeFilter("",TRUE);
} else {
QString ty = typelist[t];
if ( !ty.contains('/') )
ty += "/*";
icons->setTypeFilter(ty,TRUE);
}
}
void LauncherView::showCategory( int c )
{
icons->setCategoryFilter( c, TRUE );
}
void LauncherView::setViewMode( ViewMode m )
diff --git a/library/applnk.cpp b/library/applnk.cpp
index 44f3f58..a56da5d 100644
--- a/library/applnk.cpp
+++ b/library/applnk.cpp
@@ -183,847 +183,867 @@ public:
using isValid().
The following functions are used to set or retrieve information
about the application:
\table
\header \i Get Function \i Set Function \i Short Description
\row \i \l name() \i \l setName() \i application's name
\row \i \l pixmap() \i \e none \i application's icon
\row \i \l bigPixmap() \i \e none \i application's large icon
\row \i \e none \i setIcon() \i sets the icon's filename
\row \i \l type() \i \l setType() \i see \link #Types Types\endlink above
\row \i \l rotation() \i \e none \i 0, 90, 180 or 270 degrees
\row \i \l comment() \i \l setComment() \i text for the Details dialog
\row \i \l exec() \i \l setExec() \i executable's filename
\row \i \l file() \i \e none \i document's filename
\row \i \l linkFile() \i \l setLinkFile() \i \e .desktop filename
\row \i \l mimeTypes() \i \e none \i the mime types the application can view or edit
\row \i \l categories() \i \l setCategories() \i \e{see the function descriptions}
\row \i \l fileKnown() \i \e none \i see \link
#files-and-links Files and Links\endlink above
\row \i \l linkFileKnown() \i \e none \i see \link
#files-and-links Files and Links\endlink above
\row \i \l property() \i \l setProperty() \i any AppLnk property
can be retrieved or set (if writeable) using these
\endtable
To save an AppLnk to disk use writeLink(). To execute the
application that the AppLnk object refers to, use execute().
AppLnk's can be deleted from disk using removeLinkFile(). To
remove both the link and the application's executable use
removeFiles().
Icon sizes can be globally changed (but only for AppLnk objects
created after the calls) with setSmallIconSize() and
setBigIconSize().
\ingroup qtopiaemb
*/
/*!
Sets the size used for small icons to \a small pixels.
Only affects AppLnk objects created after the call.
\sa smallIconSize() setIcon()
*/
void AppLnk::setSmallIconSize(int small)
{
smallSize = small;
}
/*!
Returns the size used for small icons.
\sa setSmallIconSize() setIcon()
*/
int AppLnk::smallIconSize()
{
return smallSize;
}
/*!
Sets the size used for large icons to \a big pixels.
Only affects AppLnk objects created after the call.
\sa bigIconSize() setIcon()
*/
void AppLnk::setBigIconSize(int big)
{
bigSize = big;
}
/*!
Returns the size used for large icons.
\sa setBigIconSize() setIcon()
*/
int AppLnk::bigIconSize()
{
return bigSize;
}
/*!
\fn QString AppLnk::name() const
Returns the Name property. This is the user-visible name for the
document or application, not the filename.
See \link #files-and-links Files and Links\endlink.
\sa setName()
*/
/*!
\fn QString AppLnk::exec() const
Returns the Exec property. This is the name of the executable
program associated with the AppLnk.
\sa setExec()
*/
/*!
\fn QString AppLnk::rotation() const
Returns the Rotation property. The value is 0, 90, 180 or 270
degrees.
*/
/*!
\fn QString AppLnk::comment() const
Returns the Comment property.
\sa setComment()
*/
/*!
\fn QStringList AppLnk::mimeTypes() const
Returns the MimeTypes property. This is the list of MIME types
that the application can view or edit.
*/
/*!
\fn const QArray<int>& AppLnk::categories() const
Returns the Categories property.
See the CategoryWidget for more details.
\sa setCategories()
*/
const QArray<int>& AppLnk::categories() const
{
d->ensureCatArray();
return d->mCat;
}
/*!
\fn int AppLnk::id() const
Returns the id of the AppLnk. If the AppLnk is not in an AppLnkSet,
this value is 0, otherwise it is a value that is unique for the
duration of the current process.
\sa AppLnkSet::find()
*/
/*!
\fn bool AppLnk::isValid() const
Returns TRUE if this AppLnk is valid; otherwise returns FALSE.
*/
/*!
Creates an invalid AppLnk.
\sa isValid()
*/
AppLnk::AppLnk()
{
mId = 0;
d = new AppLnkPrivate();
}
/*!
Loads \a file (e.g. \e app.desktop) as an AppLnk.
\sa writeLink()
*/
AppLnk::AppLnk( const QString &file )
{
QStringList sl;
d = new AppLnkPrivate();
if ( !file.isNull() ) {
Config config( file, Config::File );
if ( config.isValid() ) {
config.setGroup( "Desktop Entry" );
mName = config.readEntry( "Name", file );
mExec = config.readEntry( "Exec" );
mType = config.readEntry( "Type", QString::null );
mIconFile = config.readEntry( "Icon", QString::null );
mRotation = config.readEntry( "Rotation", "" );
mComment = config.readEntry( "Comment", QString::null );
// MIME types are case-insensitive.
mMimeTypes = config.readListEntry( "MimeType", ';' );
for (QStringList::Iterator it=mMimeTypes.begin(); it!=mMimeTypes.end(); ++it)
*it = (*it).lower();
mMimeTypeIcons = config.readListEntry( "MimeTypeIcons", ';' );
mLinkFile = file;
mFile = config.readEntry("File", QString::null);
- if ( mFile[0] != '/' ) {
+ if ( !mExec. isEmpty ( )) {
+ mFile = QString::null;
+ }
+ else if ( mFile[0] != '/' ) {
int slash = file.findRev('/');
if ( slash >= 0 ) {
mFile = file.left(slash) + '/' + mFile;
}
}
d->mCatList = config.readListEntry("Categories", ';');
if ( d->mCatList[0].toInt() < -1 ) {
// numeric cats in file! convert to text
Categories cat( 0 );
cat.load( categoryFileName() );
d->mCat.resize( d->mCatList.count() );
int i;
QStringList::ConstIterator it;
for ( i = 0, it = d->mCatList.begin(); it != d->mCatList.end();
++it, i++ ) {
bool number;
int id = (*it).toInt( &number );
if ( !number ) {
// convert from text
id = cat.id( "Document View", *it );
if ( id == 0 )
id = cat.addCategory( "Document View", *it );
}
d->mCat[i] = id;
}
d->updateCatListFromArray();
}
}
}
mId = 0;
}
AppLnk& AppLnk::operator=(const AppLnk &copy)
{
if ( mId )
qWarning("Deleting AppLnk that is in an AppLnkSet");
if ( d )
delete d;
mName = copy.mName;
/* remove for Qtopia 3.0 -zecke */
mPixmap = copy.mPixmap;
mBigPixmap = copy.mBigPixmap;
mExec = copy.mExec;
mType = copy.mType;
mRotation = copy.mRotation;
mComment = copy.mComment;
mFile = copy.mFile;
mLinkFile = copy.mLinkFile;
mIconFile = copy.mIconFile;
mMimeTypes = copy.mMimeTypes;
mMimeTypeIcons = copy.mMimeTypeIcons;
mId = 0;
d = new AppLnkPrivate();
d->mCat = copy.d->mCat;
d->mCatList = copy.d->mCatList;
d->mPixmaps = copy.d->mPixmaps;
return *this;
}
/*!
protected internally to share code
should I document that at all?
I don't know the TT style for that
*/
const QPixmap& AppLnk::pixmap( int pos, int size ) const {
if ( d->mPixmaps[pos].isNull() ) {
AppLnk* that = (AppLnk*)this;
if ( mIconFile.isEmpty() ) {
MimeType mt(type());
that->d->mPixmaps[pos] = mt.pixmap();
if ( that->d->mPixmaps[pos].isNull() )
that->d->mPixmaps[pos].convertFromImage(
Resource::loadImage("UnknownDocument")
.smoothScale( size, size ) );
return that->d->mPixmaps[pos];
}
QImage unscaledIcon = Resource::loadImage( that->mIconFile );
if ( unscaledIcon.isNull() ) {
qDebug( "Cannot find icon: %s", that->mIconFile.latin1() );
that->d->mPixmaps[pos].convertFromImage(
Resource::loadImage("UnknownDocument")
.smoothScale( size, size ) );
} else {
that->d->mPixmaps[0].convertFromImage( unscaledIcon.smoothScale( smallSize, smallSize ) );
that->d->mPixmaps[1].convertFromImage( unscaledIcon.smoothScale( bigSize, bigSize ) );
}
return that->d->mPixmaps[pos];
}
return d->mPixmaps[pos];
}
/*!
Returns a small pixmap associated with the application.
\sa bigPixmap() setIcon()
*/
const QPixmap& AppLnk::pixmap() const
{
if ( d->mPixmaps[0].isNull() ) {
return pixmap(AppLnkPrivate::Normal, smallSize );
}
return d->mPixmaps[0];
}
/*!
Returns a large pixmap associated with the application.
\sa pixmap() setIcon()
*/
const QPixmap& AppLnk::bigPixmap() const
{
if ( d->mPixmaps[1].isNull() ) {
return pixmap( AppLnkPrivate::Big, bigSize );
}
return d->mPixmaps[1];
}
/*!
Returns the type of the AppLnk. For applications, games and
settings the type is \c Application; for documents the type is the
document's MIME type.
*/
QString AppLnk::type() const
{
if ( mType.isNull() ) {
AppLnk* that = (AppLnk*)this;
QString f = file();
if ( !f.isNull() ) {
MimeType mt(f);
that->mType = mt.id();
return that->mType;
}
}
return mType;
}
/*!
Returns the file associated with the AppLnk.
\sa exec() name()
*/
QString AppLnk::file() const
{
- if ( mFile.isNull() ) {
+ if ( mExec.isEmpty ( ) && mFile.isNull() ) {
AppLnk* that = (AppLnk*)this;
QString ext = MimeType(mType).extension();
if ( !ext.isEmpty() )
ext = "." + ext;
if ( !mLinkFile.isEmpty() ) {
that->mFile =
mLinkFile.right(8)==".desktop" // 8 = strlen(".desktop")
? mLinkFile.left(mLinkFile.length()-8) : mLinkFile;
+ qDebug("mFile now == %s", mFile.latin1());
} else if ( mType.contains('/') ) {
that->mFile =
QString(getenv("HOME"))+"/Documents/"+mType+"/"+safeFileName(that->mName);
/*
* A file with the same name or a .desktop file already exists
*/
if ( QFile::exists(that->mFile+ext) || QFile::exists(that->mFile+".desktop") ) {
int n=1;
QString nn;
while (QFile::exists((nn=(that->mFile+"_"+QString::number(n)))+ext)
|| QFile::exists(nn+".desktop"))
n++;
that->mFile = nn;
}
that->mLinkFile = that->mFile+".desktop";
that->mFile += ext;
}
prepareDirectories(that->mFile);
if ( !that->mFile.isEmpty() ) {
QFile f(that->mFile);
if ( !f.open(IO_WriteOnly) )
that->mFile = QString::null;
return that->mFile;
}
}
return mFile;
}
/*!
Returns the desktop file corresponding to this AppLnk.
\sa file() exec() name()
*/
QString AppLnk::linkFile() const
{
if ( mLinkFile.isNull() ) {
AppLnk* that = (AppLnk*)this;
if ( type().contains('/') ) {
StorageInfo storage;
const FileSystem *fs = storage.fileSystemOf( that->mFile );
/* tmpfs + and ramfs are available too but not removable
* either we fix storage or add this
*/
if ( fs && ( fs->isRemovable() || fs->disk() == "/dev/mtdblock6" || fs->disk() == "tmpfs") ) {
that->mLinkFile = fs->path();
} else
that->mLinkFile = getenv( "HOME" );
that->mLinkFile += "/Documents/"+type()+"/"+safeFileName(that->mName);
/* the desktop file exists make sure we don't point to the same file */
if ( QFile::exists(that->mLinkFile+".desktop") ) {
AppLnk lnk( that->mLinkFile + ".desktop" );
/* the linked is different */
if(that->file() != lnk.file() ) {
int n = 1;
QString nn;
while (QFile::exists((nn=that->mLinkFile+"_"+QString::number(n))+".desktop")) {
n++;
/* just to be sure */
AppLnk lnk(nn );
if (lnk.file() == that->file() )
break;
}
that->mLinkFile = nn;
}
}
that->mLinkFile += ".desktop";
storeLink();
}
return that->mLinkFile;
}
return mLinkFile;
}
/*!
Copies \a copy.
*/
AppLnk::AppLnk( const AppLnk &copy )
{
mName = copy.mName;
mPixmap = copy.mPixmap;
mBigPixmap = copy.mBigPixmap;
mExec = copy.mExec;
mType = copy.mType;
mRotation = copy.mRotation;
mComment = copy.mComment;
mFile = copy.mFile;
mLinkFile = copy.mLinkFile;
mIconFile = copy.mIconFile;
mMimeTypes = copy.mMimeTypes;
mMimeTypeIcons = copy.mMimeTypeIcons;
mId = 0;
d = new AppLnkPrivate();
d->mCat = copy.d->mCat;
d->mCatList = copy.d->mCatList;
d->mPixmaps = copy.d->mPixmaps;
}
/*!
Destroys the AppLnk. Note that if the AppLnk is currently a member
of an AppLnkSet, this will produce a run-time warning.
\sa AppLnkSet::add() AppLnkSet::remove()
*/
AppLnk::~AppLnk()
{
if ( mId )
qWarning("Deleting AppLnk that is in an AppLnkSet");
if ( d )
delete d;
}
/*!
\overload
Executes the application associated with this AppLnk.
\sa exec()
*/
void AppLnk::execute() const
{
execute(QStringList());
}
/*!
Executes the application associated with this AppLnk, with
\a args as arguments.
\sa exec()
*/
void AppLnk::execute(const QStringList& args) const
{
#ifdef Q_WS_QWS
if ( !mRotation.isEmpty() ) {
// ######## this will only work in the server
int rot = QPEApplication::defaultRotation();
rot = (rot+mRotation.toInt())%360;
QCString old = getenv("QWS_DISPLAY");
setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1);
invoke(args);
setenv("QWS_DISPLAY", old.data(), 1);
} else
#endif
invoke(args);
}
/*!
Invokes the application associated with this AppLnk, with
\a args as arguments. Rotation is not taken into account by
this function, so you should not call it directly.
\sa execute()
*/
void AppLnk::invoke(const QStringList& args) const
{
Global::execute( exec(), args[0] );
}
/*!
Sets the Exec property to \a exec.
\sa exec() name()
*/
void AppLnk::setExec( const QString& exec )
{
mExec = exec;
}
+#if 0 // this was inlined for better BC
+/*!
+ Sets the Rotation property to \a rot.
+
+ \sa rotation()
+*/
+void AppLnk::setRotation ( const QString &rot )
+{
+ mRotation = rot;
+}
+#endif
+
/*!
Sets the Name property to \a docname.
\sa name()
*/
void AppLnk::setName( const QString& docname )
{
mName = docname;
}
/*!
Sets the File property to \a filename.
\sa file() name()
*/
void AppLnk::setFile( const QString& filename )
{
mFile = filename;
}
/*!
Sets the LinkFile property to \a filename.
\sa linkFile()
*/
void AppLnk::setLinkFile( const QString& filename )
{
mLinkFile = filename;
}
/*!
Sets the Comment property to \a comment.
This text is displayed in the 'Details Dialog', for example if the
user uses the 'press-and-hold' gesture.
\sa comment()
*/
void AppLnk::setComment( const QString& comment )
{
mComment = comment;
}
/*!
Sets the Type property to \a type.
For applications, games and settings the type should be \c
Application; for documents the type should be the document's MIME
type.
\sa type()
*/
void AppLnk::setType( const QString& type )
{
mType = type;
}
/*!
\fn QString AppLnk::icon() const
Returns the Icon property.
\sa setIcon()
*/
/*!
Sets the Icon property to \a iconname. This is the filename from
which the pixmap() and bigPixmap() are obtained.
\sa icon() setSmallIconSize() setBigIconSize()
*/
void AppLnk::setIcon( const QString& iconname )
{
mIconFile = iconname;
QImage unscaledIcon = Resource::loadImage( mIconFile );
d->mPixmaps[0].convertFromImage( unscaledIcon.smoothScale( smallSize, smallSize ) );
d->mPixmaps[1].convertFromImage( unscaledIcon.smoothScale( bigSize, bigSize ) );
}
/*!
Sets the Categories property to \a c.
See the CategoryWidget for more details.
\sa categories()
*/
void AppLnk::setCategories( const QArray<int>& c )
{
d->mCat = c;
d->updateCatListFromArray();
}
/*!
\fn QStringList AppLnk::mimeTypeIcons() const
Returns the MimeTypeIcons property of the AppLnk.
*/
/*!
Attempts to ensure that the link file for this AppLnk exists,
including creating any required directories. Returns TRUE if
successful; otherwise returns FALSE.
You should not need to use this function.
*/
bool AppLnk::ensureLinkExists() const
{
QString lf = linkFile();
return prepareDirectories(lf);
}
/*!
Commits the AppLnk to disk. Returns TRUE if the operation succeeded;
otherwise returns FALSE.
In addition, the "linkChanged(QString)" message is sent to the
"QPE/System" \link qcop.html QCop\endlink channel.
*/
bool AppLnk::writeLink() const
{
// Only re-writes settable parts
QString lf = linkFile();
if ( !ensureLinkExists() )
return FALSE;
storeLink();
return TRUE;
}
/*!
\internal
*/
void AppLnk::storeLink() const
{
Config config( mLinkFile, Config::File );
config.setGroup("Desktop Entry");
config.writeEntry("Name",mName);
if ( !mIconFile.isNull() ) config.writeEntry("Icon",mIconFile);
config.writeEntry("Type",type());
+ if(!rotation().isEmpty())
+ config.writeEntry("Rotation",rotation());
+ else
+ config.removeEntry("Rotation");
if ( !mComment.isNull() ) config.writeEntry("Comment",mComment);
QString f = file();
int i = 0;
while ( i < (int)f.length() && i < (int)mLinkFile.length() && f[i] == mLinkFile[i] )
i++;
while ( i && f[i] != '/' )
i--;
// simple case where in the same directory
if ( mLinkFile.find( '/', i + 1 ) < 0 )
f = f.mid(i+1);
// ### could do relative ie ../../otherDocs/file.doc
config.writeEntry("File",f);
config.writeEntry( "Categories", d->mCatList, ';' );
#ifndef QT_NO_COP
QCopEnvelope e("QPE/System", "linkChanged(QString)");
e << mLinkFile;
#endif
}
/*!
Sets the property named \a key to \a value.
\sa property()
*/
void AppLnk::setProperty(const QString& key, const QString& value)
{
if ( ensureLinkExists() ) {
Config cfg(linkFile(), Config::File);
cfg.writeEntry(key,value);
}
}
/*!
Returns the property named \a key.
\sa setProperty()
*/
QString AppLnk::property(const QString& key) const
{
QString lf = linkFile();
if ( !QFile::exists(lf) )
return QString::null;
Config cfg(lf, Config::File);
return cfg.readEntry(key);
}
bool AppLnk::isPreloaded() const {
// Preload information is stored in the Launcher config in v1.5.
Config cfg("Launcher");
cfg.setGroup("Preload");
QStringList apps = cfg.readListEntry("Apps",',');
if (apps.contains(exec()))
return true;
return false;
}
void AppLnk::setPreloaded(bool yesNo) {
// Preload information is stored in the Launcher config in v1.5.
Config cfg("Launcher");
cfg.setGroup("Preload");
QStringList apps = cfg.readListEntry("Apps", ',');
if (apps.contains(exec()) && !yesNo)
apps.remove(exec());
else if (yesNo && !apps.contains(exec()))
apps.append(exec());
cfg.writeEntry("Apps", apps, ',');
}
/*!
Deletes both the linkFile() and the file() associated with this AppLnk.
\sa removeLinkFile()
*/
void AppLnk::removeFiles()
{
bool valid = isValid();
if ( !valid || !linkFileKnown() || QFile::remove(linkFile()) ) {
if ( QFile::remove(file()) ) {
#ifndef QT_NO_COP
QCopEnvelope e("QPE/System", "linkChanged(QString)");
if ( linkFileKnown() )
e << linkFile();
else
e << file();
#endif
} else if ( valid ) {
// restore link
writeLink();
}
}
}
/*!
Deletes the linkFile(), leaving any file() untouched.
\sa removeFiles()
*/
void AppLnk::removeLinkFile()
{
if ( isValid() && linkFileKnown() && QFile::remove(linkFile()) ) {
#ifndef QT_NO_COP
QCopEnvelope e("QPE/System", "linkChanged(QString)");
e << linkFile();
#endif
}
}
class AppLnkSetPrivate {
public:
AppLnkSetPrivate()
{
typPix.setAutoDelete(TRUE);
typPixBig.setAutoDelete(TRUE);
typName.setAutoDelete(TRUE);
}
QDict<QPixmap> typPix;
QDict<QPixmap> typPixBig;
QDict<QString> typName;
};
/*!
\class AppLnkSet applnk.h
\brief The AppLnkSet class is a set of AppLnk objects.
*/
/*!
\fn QStringList AppLnkSet::types() const
Returns the list of \link applnk.html#Types types\endlink in the set.
For applications, games and settings the type is \c Application;
for documents the type is the document's MIME type.
\sa AppLnk::type(), typeName(), typePixmap(), typeBigPixmap()
*/
/*!
\fn const QList<AppLnk>& AppLnkSet::children() const
Returns the members of the set.
*/
/*!
Constructs an empty AppLnkSet.
*/
AppLnkSet::AppLnkSet() :
d(new AppLnkSetPrivate)
{
}
/*!
Constructs an AppLnkSet that contains AppLnk objects representing
all the files in the given \a directory (and any subdirectories
recursively).
\omit
The directories may contain ".directory" files which override
any AppLnk::type() values for AppLnk objects found in the directory.
This allows simple localization of application types.
\endomit
*/
AppLnkSet::AppLnkSet( const QString &directory ) :
d(new AppLnkSetPrivate)
{
QDir dir( directory );
mFile = directory;
findChildren(directory,QString::null,QString::null);
}
/*!
Detaches all AppLnk objects from the set. The set become empty and
the caller becomes responsible for deleting the AppLnk objects.
*/
void AppLnkSet::detachChildren()
{
QListIterator<AppLnk> it( mApps );
for ( ; it.current(); ) {
AppLnk* a = *it;
++it;
a->mId = 0;
}
mApps.clear();
}
/*!
Destroys the set, deleting all the AppLnk objects it contains.
\sa detachChildren()
*/
diff --git a/library/applnk.h b/library/applnk.h
index 71b62ef..b92ddba 100644
--- a/library/applnk.h
+++ b/library/applnk.h
@@ -1,207 +1,208 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef __APPLNK_H__
#define __APPLNK_H__
#include <qobject.h>
#include <qiconset.h>
#include <qlist.h>
#include <qdict.h>
#include <qstringlist.h>
class AppLnkSetPrivate;
class AppLnkPrivate;
class AppLnk
{
public:
AppLnk();
AppLnk( const QString &file );
AppLnk( const AppLnk &copy ); // copy constructor
virtual ~AppLnk();
bool isValid() const { return !mLinkFile.isNull(); }
static void setSmallIconSize(int);
static void setBigIconSize(int);
static int smallIconSize();
static int bigIconSize();
QString name() const { return mName; }
const QPixmap& pixmap() const;
const QPixmap& bigPixmap() const;
QString icon() const { return mIconFile; }
virtual QString exec() const { return mExec; }
QString type() const;
QString rotation() const { return mRotation; }
QString comment() const { return mComment; }
QString file() const;
QString linkFile() const;
QStringList mimeTypes() const { return mMimeTypes; }
QStringList mimeTypeIcons() const { return mMimeTypeIcons; }
const QArray<int> &categories() const;
int id() const { return mId; }
bool fileKnown() const { return !mFile.isNull(); }
bool linkFileKnown() const { return !mLinkFile.isNull(); }
void execute() const;
void execute(const QStringList& args) const;
void removeFiles();
void removeLinkFile();
void setName( const QString& docname );
void setExec( const QString& exec );
void setFile( const QString& filename );
void setLinkFile( const QString& filename );
void setComment( const QString& comment );
void setType( const QString& mimetype );
+ inline void setRotation ( const QString &rotation ) { mRotation = rot; } // inline for BC
void setIcon( const QString& iconname );
void setCategories( const QArray<int> &v );
bool writeLink() const;
void setProperty(const QString& key, const QString& value);
QString property(const QString& key) const;
#ifdef QTOPIA_INTERNAL_PRELOADACCESS
bool isPreloaded() const;
void setPreloaded(bool yesNo);
#endif
#ifdef QTOPIA_INTERNAL_APPLNKASSIGN
AppLnk &operator=(const AppLnk &other);
#endif
protected:
QString mName;
/* remove for Qtopia 3.0 -zecke */
QPixmap mPixmap;
/* remove for Qtopia 3.0 -zecke */
QPixmap mBigPixmap;
QString mExec;
QString mType;
QString mRotation;
QString mComment;
QString mFile;
QString mLinkFile;
QString mIconFile;
QStringList mMimeTypes;
QStringList mMimeTypeIcons;
int mId;
static int lastId;
AppLnkPrivate *d;
friend class AppLnkSet;
virtual void invoke(const QStringList& args) const;
bool ensureLinkExists() const;
void storeLink() const;
private:
const QPixmap& pixmap(int pos, int size) const;
};
class DocLnk : public AppLnk
{
public:
DocLnk();
DocLnk( const DocLnk &o ) : AppLnk(o) { }
DocLnk( const QString &file );
DocLnk( const QString &file, bool may_be_desktopfile );
virtual ~DocLnk();
#ifdef QTOPIA_INTERNAL_APPLNKASSIGN
DocLnk &operator=(const DocLnk &other) { AppLnk::operator=(other); return *this; }
#endif
QString exec() const;
protected:
void invoke(const QStringList& args) const;
private:
void init(const QString &file);
};
class AppLnkSet
{
public:
AppLnkSet();
AppLnkSet( const QString &dir );
~AppLnkSet();
const AppLnk *find( int id ) const;
const AppLnk *findExec( const QString& execname ) const;
QStringList types() const { return typs; }
QString typeName( const QString& ) const;
QPixmap typePixmap( const QString& ) const;
QPixmap typeBigPixmap( const QString& ) const;
void add(AppLnk*);
bool remove(AppLnk*);
void clear() {
QListIterator<AppLnk> it( mApps );
for ( ; it.current(); ) {
AppLnk* a = *it;
++it;
a->mId = 0;
delete a;
}
mApps.clear();
typs.clear();
}
const QList<AppLnk> &children() const { return mApps; }
void detachChildren();
protected:
friend class AppLnk;
QList<AppLnk> mApps;
QString mFile;
QStringList typs;
AppLnkSetPrivate *d;
private:
AppLnkSet( const AppLnkSet & ); // no copying!
void findChildren(const QString &, const QString& t, const QString& lt, int depth = 0);
};
class DocLnkSet : public AppLnkSet
{
public:
DocLnkSet();
DocLnkSet( const QString &dir, const QString &mimefilter=QString::null );
const QList<DocLnk> &children() const { return (const QList<DocLnk> &)mApps; }
void appendFrom( DocLnkSet& other );
private:
DocLnkSet( const DocLnkSet & ); // no copying!
void findChildren(const QString &dr, const QValueList<QRegExp> &mimeFilters, QDict<void> &reference, int depth=0);
};
#endif // __APPLNK_H__
diff --git a/library/lnkproperties.cpp b/library/lnkproperties.cpp
index 983c677..0b30a9a 100644
--- a/library/lnkproperties.cpp
+++ b/library/lnkproperties.cpp
@@ -1,309 +1,336 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT
// have this class.
#define QTOPIA_INTERNAL_FSLP
#include "lnkproperties.h"
#include "lnkproperties.h"
#include "lnkpropertiesbase_p.h"
#include "ir.h"
+#include <qpe/qpeapplication.h>
#include <qpe/applnk.h>
#include <qpe/global.h>
#include <qpe/categorywidget.h>
#ifdef QWS
#include <qpe/qcopenvelope_qws.h>
#endif
#include <qpe/filemanager.h>
#include <qpe/config.h>
#include <qpe/storage.h>
#include <qpe/qpemessagebox.h>
#include <qlineedit.h>
#include <qtoolbutton.h>
#include <qpushbutton.h>
#include <qgroupbox.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qmessagebox.h>
#include <qsize.h>
#include <qcombobox.h>
#include <qregexp.h>
+#include <qbuttongroup.h>
#include <stdlib.h>
LnkProperties::LnkProperties( AppLnk* l, QWidget* parent )
: QDialog( parent, 0, TRUE ), lnk(l), fileSize( 0 )
{
setCaption( tr("Properties") );
QVBoxLayout *vbox = new QVBoxLayout( this );
d = new LnkPropertiesBase( this );
vbox->add( d );
d->docname->setText(l->name());
QString inf;
if ( l->type().isEmpty() ) {
d->type->hide();
d->typeLabel->hide();
} else {
d->type->setText( l->type() );
}
if ( l->comment().isEmpty() ) {
d->comment->hide();
d->commentLabel->hide();
} else {
d->comment->setText( l->comment() );
}
connect(d->beam,SIGNAL(clicked()),this,SLOT(beamLnk()));
if ( lnk->type().contains('/') ) { // A document? (#### better predicate needed)
connect(d->unlink,SIGNAL(clicked()),this,SLOT(unlinkLnk()));
connect(d->duplicate,SIGNAL(clicked()),this,SLOT(duplicateLnk()));
d->docname->setReadOnly( FALSE );
d->preload->hide();
- d->spacer->hide();
+ d->rotate->hide();
+ d->rotateButtons->hide();
+ d->labelspacer->hide();
// ### THIS MUST GO, FIX WIERD BUG in QLAYOUT
d->categoryEdit->kludge();
d->categoryEdit->setCategories( lnk->categories(),
"Document View",
tr("Document View") );
setupLocations();
} else {
d->unlink->hide();
d->duplicate->hide();
d->beam->hide();
d->hline->hide();
d->locationLabel->hide();
d->locationCombo->hide();
// Can't edit categories, since the app .desktop files are global,
// possibly read-only.
d->categoryEdit->hide();
d->docname->setReadOnly( TRUE );
if ( l->property("CanFastload") == "0" )
d->preload->hide();
+ if ( !l->property("Rotation"). isEmpty ()) {
+ d->rotate->setChecked ( true );
+ d->rotateButtons->setButton(((QPEApplication::defaultRotation()+l->rotation().toInt())%360)/90);
+ }
+ else {
+ d->rotateButtons->setEnabled(false);
+ }
Config cfg("Launcher");
cfg.setGroup("Preload");
QStringList apps = cfg.readListEntry("Apps",',');
d->preload->setChecked( apps.contains(l->exec()) );
if ( Global::isBuiltinCommand(lnk->exec()) )
d->preload->hide(); // builtins are always fast
currentLocation = 0; // apps not movable (yet)
}
}
LnkProperties::~LnkProperties()
{
}
void LnkProperties::unlinkLnk()
{
if ( QPEMessageBox::confirmDelete( this, tr("Delete"), lnk->name() ) ) {
lnk->removeFiles();
if ( QFile::exists(lnk->file()) ) {
QMessageBox::warning( this, tr("Delete"), tr("File deletion failed.") );
} else {
reject();
}
}
}
void LnkProperties::setupLocations()
{
QFileInfo fi( lnk->file() );
fileSize = fi.size();
StorageInfo storage;
const QList<FileSystem> &fs = storage.fileSystems();
QListIterator<FileSystem> it ( fs );
QString s;
QString homeDir = getenv("HOME");
QString hardDiskHome;
QString hardDiskPath;
int index = 0;
currentLocation = -1;
for ( ; it.current(); ++it ) {
// we add 10k to the file size so we are sure we can also save the desktop file
if ( (ulong)(*it)->availBlocks() * (ulong)(*it)->blockSize() > (ulong)fileSize + 10000 ) {
if ( (*it)->isRemovable() ||
(*it)->disk() == "/dev/mtdblock1" ||
(*it)->disk() == "/dev/mtdblock/1" ||
(*it)->disk().left(13) == "/dev/mtdblock" ||
(*it)->disk() == "/dev/mtdblock6" ||
(*it)->disk() == "tmpfs" ) {
d->locationCombo->insertItem( (*it)->name(), index );
locations.append( ( ((*it)->isRemovable() ||
(*it)->disk() == "/dev/mtdblock6" ||
(*it)->disk() == "tmpfs" )
? (*it)->path() : homeDir) );
if ( lnk->file().contains( (*it)->path() ) ) {
d->locationCombo->setCurrentItem( index );
currentLocation = index;
}
index++;
} else if ( (*it)->name().contains( tr("Hard Disk") ) &&
homeDir.contains( (*it)->path() ) &&
(*it)->path().length() > hardDiskHome.length() ) {
hardDiskHome = (*it)->name();
hardDiskPath = (*it)->path();
}
}
}
if ( !hardDiskHome.isEmpty() ) {
d->locationCombo->insertItem( hardDiskHome );
locations.append( hardDiskPath );
if ( currentLocation == -1 ) { // assume it's the hard disk
d->locationCombo->setCurrentItem( index );
currentLocation = index;
}
}
}
void LnkProperties::duplicateLnk()
{
// The duplicate takes the new properties.
DocLnk newdoc( *((DocLnk *)lnk) );
if ( d->docname->text() == lnk->name() )
newdoc.setName(tr("Copy of ")+d->docname->text());
else
newdoc.setName(d->docname->text());
if ( !copyFile( newdoc ) ) {
QMessageBox::warning( this, tr("Duplicate"), tr("File copy failed.") );
return;
}
reject();
}
bool LnkProperties::moveLnk()
{
DocLnk newdoc( *((DocLnk *)lnk) );
newdoc.setName(d->docname->text());
if ( !copyFile( newdoc ) ) {
QMessageBox::warning( this, tr("Details"), tr("Moving Document failed.") );
return FALSE;
}
// remove old lnk
lnk->removeFiles();
return TRUE;
}
void LnkProperties::beamLnk()
{
Ir ir;
DocLnk doc( *((DocLnk *)lnk) );
doc.setName(d->docname->text());
reject();
ir.send( doc, doc.comment() );
}
bool LnkProperties::copyFile( DocLnk &newdoc )
{
const char *linkExtn = ".desktop";
QString fileExtn;
int extnPos = lnk->file().findRev( '.' );
if ( extnPos > 0 )
fileExtn = lnk->file().mid( extnPos );
QString safename = newdoc.name();
safename.replace(QRegExp("/"),"_");
QString fn = locations[ d->locationCombo->currentItem() ]
+ "/Documents/" + newdoc.type() + "/" + safename;
if ( QFile::exists(fn + fileExtn) || QFile::exists(fn + linkExtn) ) {
int n=1;
QString nn = fn + "_" + QString::number(n);
while ( QFile::exists(nn+fileExtn) || QFile::exists(nn+linkExtn) ) {
n++;
nn = fn + "_" + QString::number(n);
}
fn = nn;
}
newdoc.setFile( fn + fileExtn );
newdoc.setLinkFile( fn + linkExtn );
// Copy file
FileManager fm;
if ( !fm.copyFile( *lnk, newdoc ) )
return FALSE;
return TRUE;
}
void LnkProperties::done(int ok)
{
if ( ok ) {
bool changed=FALSE;
if ( lnk->name() != d->docname->text() ) {
lnk->setName(d->docname->text());
changed=TRUE;
}
if ( d->categoryEdit->isVisible() ) {
QArray<int> tmp = d->categoryEdit->newCategories();
if ( lnk->categories() != tmp ) {
lnk->setCategories( tmp );
changed = TRUE;
}
}
+ if ( !d->rotate->isHidden()) {
+ QString newrot;
+
+ if (d->rotate->isChecked()) {
+ int rot=0;
+ for(; rot<4; rot++) {
+ if (d->rotateButtons->find(rot)->isOn())
+ break;
+ }
+ newrot = QString::number((QPEApplication::defaultRotation()+rot*90)%360);
+ }
+ if (newrot !=lnk->rotation()) {
+ lnk->setRotation(newrot);
+ changed = TRUE;
+ }
+ }
if ( d->preload->isHidden() && d->locationCombo->currentItem() != currentLocation ) {
moveLnk();
} else if ( changed ) {
lnk->writeLink();
}
-
+
if ( !d->preload->isHidden() ) {
Config cfg("Launcher");
cfg.setGroup("Preload");
QStringList apps = cfg.readListEntry("Apps",',');
QString exe = lnk->exec();
if ( apps.contains(exe) != d->preload->isChecked() ) {
if ( d->preload->isChecked() ) {
apps.append(exe);
#ifndef QT_NO_COP
QCopEnvelope e("QPE/Application/"+exe.local8Bit(),
"enablePreload()");
#endif
} else {
apps.remove(exe);
#ifndef QT_NO_COP
QCopEnvelope e("QPE/Application/"+exe.local8Bit(),
"quitIfInvisible()");
#endif
}
cfg.writeEntry("Apps",apps,',');
}
}
}
QDialog::done( ok );
}
diff --git a/library/lnkpropertiesbase_p.ui b/library/lnkpropertiesbase_p.ui
index e7139e7..c2271f1 100644
--- a/library/lnkpropertiesbase_p.ui
+++ b/library/lnkpropertiesbase_p.ui
@@ -1,423 +1,681 @@
<!DOCTYPE UI><UI>
<class>LnkPropertiesBase</class>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Form1</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>289</width>
- <height>449</height>
+ <width>267</width>
+ <height>450</height>
</rect>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>font</name>
<font>
</font>
</property>
<property stdset="1">
<name>caption</name>
<string>Details</string>
</property>
+ <property stdset="1">
+ <name>icon</name>
+ <pixmap>image0</pixmap>
+ </property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>0</number>
</property>
<widget>
<class>QFrame</class>
<property stdset="1">
<name>name</name>
<cstring>Frame8</cstring>
</property>
<property stdset="1">
<name>focusPolicy</name>
<enum>NoFocus</enum>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>NoFrame</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Plain</enum>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>3</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>3</number>
</property>
- <widget row="6" column="0" rowspan="1" colspan="2" >
+ <widget row="8" column="0" rowspan="1" colspan="2" >
<class>CategoryWidget</class>
<property stdset="1">
<name>name</name>
<cstring>categoryEdit</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>7</vsizetype>
</sizepolicy>
</property>
</widget>
<widget row="5" column="0" rowspan="1" colspan="2" >
- <class>QLabel</class>
+ <class>QCheckBox</class>
<property stdset="1">
<name>name</name>
- <cstring>spacer</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>7</vsizetype>
- </sizepolicy>
+ <cstring>rotate</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string></string>
+ <string>Use custom rotation</string>
</property>
- </widget>
- <widget row="3" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>commentLabel</cstring>
+ <property>
+ <name>layoutMargin</name>
</property>
- <property stdset="1">
- <name>text</name>
- <string>Comment:</string>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <property>
+ <name>whatsThis</name>
+ <string>Preload this application so that it is available instantly.</string>
</property>
</widget>
- <widget row="2" column="0" >
- <class>QLabel</class>
+ <widget row="0" column="1" >
+ <class>QLineEdit</class>
<property stdset="1">
<name>name</name>
- <cstring>typeLabel</cstring>
+ <cstring>docname</cstring>
</property>
<property stdset="1">
- <name>focusPolicy</name>
- <enum>NoFocus</enum>
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
</property>
<property stdset="1">
<name>text</name>
- <string>Type:</string>
- </property>
- <property>
- <name>layoutMargin</name>
+ <string></string>
</property>
<property>
- <name>layoutSpacing</name>
+ <name>whatsThis</name>
+ <string>The name of this document.</string>
</property>
</widget>
<widget row="1" column="1" >
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
<cstring>locationCombo</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
<property>
<name>whatsThis</name>
<string>The media the document resides on.</string>
</property>
</widget>
- <widget row="0" column="1" >
- <class>QLineEdit</class>
+ <widget row="2" column="0" >
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>docname</cstring>
+ <cstring>typeLabel</cstring>
</property>
<property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>0</vsizetype>
- </sizepolicy>
+ <name>focusPolicy</name>
+ <enum>NoFocus</enum>
</property>
<property stdset="1">
<name>text</name>
- <string></string>
+ <string>Type:</string>
</property>
<property>
- <name>whatsThis</name>
- <string>The name of this document.</string>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
</property>
</widget>
- <widget row="0" column="0" >
+ <widget row="2" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel1</cstring>
- </property>
- <property stdset="1">
- <name>frameShadow</name>
- <enum>MShadow</enum>
+ <cstring>type</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Name:</string>
+ <string></string>
</property>
</widget>
<widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>locationLabel</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>1</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>caption</name>
<string></string>
</property>
<property stdset="1">
<name>text</name>
<string>Location:</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
</widget>
- <widget row="2" column="1" >
+ <widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>type</cstring>
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property stdset="1">
+ <name>frameShadow</name>
+ <enum>MShadow</enum>
</property>
<property stdset="1">
<name>text</name>
- <string></string>
+ <string>Name:</string>
</property>
</widget>
<widget row="3" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>comment</cstring>
</property>
<property stdset="1">
<name>text</name>
<string></string>
</property>
</widget>
+ <widget row="6" column="0" rowspan="1" colspan="2" >
+ <class>QButtonGroup</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>rotateButtons</cstring>
+ </property>
+ <property stdset="1">
+ <name>frameShape</name>
+ <enum>NoFrame</enum>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string></string>
+ </property>
+ <property stdset="1">
+ <name>exclusive</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>3</number>
+ </property>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>s1</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Fixed</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>28</height>
+ </size>
+ </property>
+ </spacer>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ToolButton1</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ <property stdset="1">
+ <name>pixmap</name>
+ <pixmap>image0</pixmap>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>on</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>usesBigPixmap</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>on</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>buttonGroupId</name>
+ <number>0</number>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ToolButton2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ <property stdset="1">
+ <name>pixmap</name>
+ <pixmap>image1</pixmap>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>usesBigPixmap</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>buttonGroupId</name>
+ <number>1</number>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ToolButton3</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ <property stdset="1">
+ <name>pixmap</name>
+ <pixmap>image2</pixmap>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>usesBigPixmap</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>buttonGroupId</name>
+ <number>2</number>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ToolButton4</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ <property stdset="1">
+ <name>pixmap</name>
+ <pixmap>image3</pixmap>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>usesBigPixmap</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>buttonGroupId</name>
+ <number>3</number>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>s4</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>MinimumExpanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget row="7" column="0" rowspan="1" colspan="2" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>labelspacer</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>7</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ </widget>
<widget row="4" column="0" rowspan="1" colspan="2" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>preload</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Fast load (consumes memory)</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<property>
<name>whatsThis</name>
<string>Preload this application so that it is available instantly.</string>
</property>
</widget>
+ <widget row="3" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>commentLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Comment:</string>
+ </property>
+ </widget>
</grid>
</widget>
<widget>
<class>Line</class>
<property stdset="1">
<name>name</name>
<cstring>hline</cstring>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Sunken</enum>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
</widget>
<widget>
<class>QFrame</class>
<property stdset="1">
<name>name</name>
<cstring>Frame9</cstring>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>NoFrame</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Plain</enum>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>3</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>5</number>
</property>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>unlink</cstring>
</property>
<property stdset="1">
<name>focusPolicy</name>
<enum>TabFocus</enum>
</property>
<property stdset="1">
<name>text</name>
<string>Delete</string>
</property>
<property stdset="1">
<name>autoDefault</name>
<bool>false</bool>
</property>
<property>
<name>whatsThis</name>
<string>Delete this document.</string>
</property>
</widget>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>duplicate</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Copy</string>
</property>
<property stdset="1">
<name>autoDefault</name>
<bool>false</bool>
</property>
<property>
<name>whatsThis</name>
<string>Make a copy of this document.</string>
</property>
</widget>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>beam</cstring>
</property>
<property stdset="1">
<name>focusPolicy</name>
<enum>TabFocus</enum>
</property>
<property stdset="1">
<name>text</name>
<string>Beam</string>
</property>
<property stdset="1">
<name>autoDefault</name>
<bool>false</bool>
</property>
<property>
<name>whatsThis</name>
<string>Beam this document to another device.</string>
</property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
<customwidgets>
<customwidget>
<class>CategoryWidget</class>
<header location="global">qpe/categorywidget.h</header>
<sizehint>
<width>-1</width>
<height>-1</height>
</sizehint>
<container>0</container>
<sizepolicy>
<hordata>7</hordata>
<verdata>7</verdata>
</sizepolicy>
- <pixmap>image0</pixmap>
+ <pixmap>image4</pixmap>
</customwidget>
</customwidgets>
<images>
<image>
<name>image0</name>
+ <data format="XPM.GZ" length="1226">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523236520022230543251d2e253d856405bffcbc54105b19c856360003b014013032d4282b2b13366708a951067908240fa6a00a95612cb01a6528d04362e92158e0a40213830510c4546598dd103570b72098482ea3ae1ac2eec1ef2f6565d4f051c6123e3035f8c1a81a2aa8a9b5e60200f6abd263</data>
+ </image>
+ <image>
+ <name>image1</name>
+ <data format="XPM.GZ" length="1226">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523236520022230543251d2e253d856405bffcbc54105b19c856360003b01416a0ac8c6053a2061960aa019b806c0ca61a65a81a7c764125e9a486b07b40d2cacaf8fd0555a4875f0d0620cf1c22dc33d8c2197fda504605e4ab41b5129f7b3001b630c46317f16a88cb17c814add5d02ecdd75a730100b509d263</data>
+ </image>
+ <image>
+ <name>image2</name>
+ <data format="XPM.GZ" length="1226">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523236520022230543251d2e253d856405bffcbc54105b19c856360003b0140130aa863a6a9495f5f49441002c02664030840d53a3ac0c53a40c67c25950bb60d27a70857a08268a7b20164059082695d510e31e62fc85193e7aa8e1832568a1eaf1c6c5e053a34c500d0a18b66a6aadb9001be4d263</data>
+ </image>
+ <image>
+ <name>image3</name>
+ <data format="XPM.GZ" length="1226">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523236520022230543251d2e253d856405bffcbc54105b19c856360003b014125006013d5480a64659198b22543510697445e86a9029daaad183ba87809bb1788c7435d8019a392872cad8d5a002b2d510e777648ad66a08a70d62d2185169152b1819699ec870c634869cf48c1e7cc4aba9b5e602005d86d263</data>
+ </image>
+ <image>
+ <name>image4</name>
<data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
</image>
</images>
+<connections>
+ <connection>
+ <sender>rotate</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>rotateButtons</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+</connections>
<tabstops>
<tabstop>docname</tabstop>
<tabstop>preload</tabstop>
<tabstop>locationCombo</tabstop>
<tabstop>unlink</tabstop>
<tabstop>duplicate</tabstop>
<tabstop>beam</tabstop>
</tabstops>
</UI>