summaryrefslogtreecommitdiff
authorzecke <zecke>2002-09-30 15:39:19 (UTC)
committer zecke <zecke>2002-09-30 15:39:19 (UTC)
commitd2a7ac3311bda821ee07ff070c24f17958657129 (patch) (side-by-side diff)
treed616be7f21e75c0a7f27f2155fbb5bb5a0855266
parentda273e4780502b8819118c5e31c9d565fc1a1b49 (diff)
downloadopie-d2a7ac3311bda821ee07ff070c24f17958657129.zip
opie-d2a7ac3311bda821ee07ff070c24f17958657129.tar.gz
opie-d2a7ac3311bda821ee07ff070c24f17958657129.tar.bz2
Make QtopiaDesktop1.6 work with Opie again
it did rely on the counter part to send a version number starting with 1
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 1bd1156..6948976 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -559,97 +559,97 @@ void CategoryTabBar::paintLabel( QPainter* p, const QRect&,
if ( mode == QIconSet::Normal && has_focus )
mode = QIconSet::Active;
QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode );
int pixw = pixmap.width();
int pixh = pixmap.height();
p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap );
r.setLeft( r.left() + pixw + 5 );
}
QRect tr = r;
if ( r.width() < 20 )
return;
if ( t->isEnabled() && isEnabled() ) {
#if defined(_WS_WIN32_)
if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) )
p->setPen( colorGroup().buttonText() );
else
p->setPen( colorGroup().foreground() );
#else
p->setPen( colorGroup().foreground() );
#endif
p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() );
} else {
p->setPen( palette().disabled().foreground() );
p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() );
}
}
//---------------------------------------------------------------------------
Launcher::Launcher( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, fl )
{
setCaption( tr("Launcher") );
syncDialog = 0;
// we have a pretty good idea how big we'll be
setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() );
tabs = 0;
rootFolder = 0;
docsFolder = 0;
int stamp = uidgen.generate(); // this is our timestamp to see which devices we know
//uidgen.store( stamp );
- m_timeStamp = QString::number( stamp );
+ m_timeStamp = QString::number( stamp );
tabs = new CategoryTabWidget( this );
tabs->setMaximumWidth( qApp->desktop()->width() );
setCentralWidget( tabs );
connect( tabs, SIGNAL(selected(const QString&)),
this, SLOT(viewSelected(const QString&)) );
connect( tabs, SIGNAL(clicked(const AppLnk*)),
this, SLOT(select(const AppLnk*)));
connect( tabs, SIGNAL(rightPressed(AppLnk*)),
this, SLOT(properties(AppLnk*)));
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)),
this, SLOT(systemMessage( const QCString &, const QByteArray &)) );
QCopChannel *channel = new QCopChannel( "QPE/Launcher", this );
connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
this, SLOT(launcherMessage(const QCString&, const QByteArray&)) );
#endif
storage = new StorageInfo( this );
connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) );
updateTabs();
preloadApps();
in_lnk_props = FALSE;
got_lnk_change = FALSE;
}
Launcher::~Launcher()
{
delete rootFolder;
delete docsFolder;
}
static bool isVisibleWindow(int wid)
{
#ifdef QWS
const QList<QWSWindow> &list = qwsServer->clientWindows();
QWSWindow* w;
for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
if ( w->winId() == wid )
return !w->isFullyObscured();
}
#endif
@@ -934,211 +934,216 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" );
e << home;
int locked = (int) Desktop::screenLocked();
e << locked;
#endif
} else if ( msg == "autoStart(QString)" ) {
QString appName;
stream >> appName;
Config cfg( "autostart" );
cfg.setGroup( "AutoStart" );
if ( appName.compare("clear") == 0){
cfg.writeEntry("Apps", "");
}
} else if ( msg == "autoStart(QString,QString)" ) {
QString modifier, appName;
stream >> modifier >> appName;
Config cfg( "autostart" );
cfg.setGroup( "AutoStart" );
if ( modifier.compare("add") == 0 ){
// only add if appname is entered
if (!appName.isEmpty()) {
cfg.writeEntry("Apps", appName);
}
} else if (modifier.compare("remove") == 0 ) {
// need to change for multiple entries
// actually remove is right now simular to clear, but in future there
// should be multiple apps in autostart possible.
QString checkName;
checkName = cfg.readEntry("Apps", "");
if (checkName == appName) {
cfg.writeEntry("Apps", "");
}
}
// case the autostart feature should be delayed
} else if ( msg == "autoStart(QString,QString,QString)") {
QString modifier, appName, delay;
stream >> modifier >> appName >> delay;
Config cfg( "autostart" );
cfg.setGroup( "AutoStart" );
if ( modifier.compare("add") == 0 ){
// only add it appname is entered
if (!appName.isEmpty()) {
cfg.writeEntry("Apps", appName);
cfg.writeEntry("Delay", delay);
}
} else {
}
- } else if ( msg == "sendVersionInfo()" ) {
+ }
+ /*
+ * QtopiaDesktop relies on the major number
+ * to start with 1. We're at 0.9
+ * so wee need to fake at least 1.4 to be able
+ * to sync with QtopiaDesktop1.6
+ */
+ else if ( msg == "sendVersionInfo()" ) {
QCopEnvelope e( "QPE/Desktop", "versionInfo(QString)" );
- QString v = QPE_VERSION;
- QStringList l = QStringList::split( '.', v );
- QString v2 = l[0] + '.' + l[1];
+ QString v2 = QString::fromLatin1("1.4");
e << v2;
//qDebug("version %s\n", line.latin1());
} else if ( msg == "sendCardInfo()" ) {
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" );
#endif
const QList<FileSystem> &fs = storage->fileSystems();
QListIterator<FileSystem> it ( fs );
QString s;
QString homeDir = getenv("HOME");
QString hardDiskHome, hardDiskHomePath;
for ( ; it.current(); ++it ) {
int k4 = (*it)->blockSize()/256;
if ( (*it)->isRemovable() || (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs") {
s += (*it)->name() + "=" + (*it)->path() + "/Documents "
+ QString::number( (*it)->availBlocks() * k4/4 )
+ "K " + (*it)->options() + ";";
} else if ( (*it)->disk() == "/dev/mtdblock1" ||
(*it)->disk() == "/dev/mtdblock/1" ) {
s += (*it)->name() + "=" + homeDir + "/Documents "
+ QString::number( (*it)->availBlocks() * k4/4 )
+ "K " + (*it)->options() + ";";
} else if ( (*it)->name().contains( "Hard Disk") &&
homeDir.contains( (*it)->path() ) &&
(*it)->path().length() > hardDiskHomePath.length() ) {
hardDiskHomePath = (*it)->path();
hardDiskHome =
(*it)->name() + "=" + homeDir + "/Documents "
+ QString::number( (*it)->availBlocks() * k4/4 )
+ "K " + (*it)->options() + ";";
}
}
if ( !hardDiskHome.isEmpty() )
s += hardDiskHome;
#ifndef QT_NO_COP
e << s;
#endif
} else if ( msg == "sendSyncDate(QString)" ) {
QString app;
stream >> app;
Config cfg( "qpe" );
cfg.setGroup("SyncDate");
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" );
e << app << cfg.readEntry( app );
#endif
//qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(),
//cfg.readEntry( app ).latin1() );
} else if ( msg == "setSyncDate(QString,QString)" ) {
QString app, date;
stream >> app >> date;
Config cfg( "qpe" );
cfg.setGroup("SyncDate");
cfg.writeEntry( app, date );
//qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1());
} else if ( msg == "startSync(QString)" ) {
QString what;
stream >> what;
delete syncDialog; syncDialog = 0;
syncDialog = new SyncDialog( this, "syncProgress", FALSE,
WStyle_Tool | WStyle_Customize |
Qt::WStyle_StaysOnTop );
syncDialog->showMaximized();
syncDialog->whatLabel->setText( "<b>" + what + "</b>" );
connect( syncDialog->buttonCancel, SIGNAL( clicked() ),
- SLOT( cancelSync() ) );
+ SLOT( cancelSync() ) );
} else if ( msg == "stopSync()") {
delete syncDialog; syncDialog = 0;
} else if ( msg == "getAllDocLinks()" ) {
loadDocs();
QString contents;
// Categories cats;
for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) {
DocLnk *doc = it.current();
QFileInfo fi( doc->file() );
if ( !fi.exists() )
continue;
bool fake = !doc->linkFileKnown();
if ( !fake ) {
QFile f( doc->linkFile() );
if ( f.open( IO_ReadOnly ) ) {
QTextStream ts( &f );
ts.setEncoding( QTextStream::UnicodeUTF8 );
contents += ts.read();
f.close();
} else
fake = TRUE;
}
if (fake) {
contents += "[Desktop Entry]\n";
contents += "Categories = " + // No tr
// cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr
Qtopia::Record::idsToString( doc->categories() ) + "\n";
contents += "Name = "+doc->name()+"\n"; // No tr
contents += "Type = "+doc->type()+"\n"; // No tr
}
contents += "File = "+doc->file()+"\n"; // No tr // (resolves path)
contents += QString("Size = %1\n").arg( fi.size() ); // No tr
}
//qDebug( "sending length %d", contents.length() );
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" );
e << contents;
#endif
-
+
//qDebug( "================ \n\n%s\n\n===============",
//contents.latin1() );
delete docsFolder;
docsFolder = 0;
#ifdef QWS
} else if ( msg == "setMouseProto(QString)" ) {
QString mice;
stream >> mice;
setenv("QWS_MOUSE_PROTO",mice.latin1(),1);
qwsServer->openMouse();
} else if ( msg == "setKeyboard(QString)" ) {
QString kb;
stream >> kb;
setenv("QWS_KEYBOARD",kb.latin1(),1);
qwsServer->openKeyboard();
#endif
}
}
void Launcher::cancelSync()
{
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", "cancelSync()" );
#endif
}
void Launcher::launcherMessage( const QCString &msg, const QByteArray &data)
{
QDataStream stream( data, IO_ReadOnly );
if ( msg == "setTabView(QString,int)" ) {
QString id;
stream >> id;
int mode;
stream >> mode;
if ( tabs->view(id) )
tabs->view(id)->setViewMode( (LauncherView::ViewMode)mode );
} else if ( msg == "setTabBackground(QString,int,QString)" ) {
QString id;
stream >> id;
int mode;
stream >> mode;
QString pixmapOrColor;
stream >> pixmapOrColor;
if ( tabs->view(id) )
tabs->view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
} else if ( msg == "setTextColor(QString,QString)" ) {
QString id;