summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/launcher.cpp1
-rw-r--r--core/launcher/mediummountgui.cpp1
-rw-r--r--libopie/oconfig.h2
3 files changed, 3 insertions, 1 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index dcc3ba1..1c38a05 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -452,192 +452,193 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl )
updateTabs();
preloadApps();
in_lnk_props = FALSE;
got_lnk_change = FALSE;
}
Launcher::~Launcher()
{
}
static bool isVisibleWindow(int wid)
{
const QList<QWSWindow> &list = qwsServer->clientWindows();
QWSWindow* w;
for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
if ( w->winId() == wid )
return !w->isFullyObscured();
}
return FALSE;
}
void Launcher::showMaximized()
{
if ( isVisibleWindow( winId() ) )
doMaximize();
else
QTimer::singleShot( 20, this, SLOT(doMaximize()) );
}
void Launcher::doMaximize()
{
QMainWindow::showMaximized();
}
void Launcher::updateMimeTypes()
{
MimeType::clear();
updateMimeTypes(rootFolder);
}
void Launcher::updateMimeTypes(AppLnkSet* folder)
{
for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) {
AppLnk *app = it.current();
if ( app->type() == "Folder" )
updateMimeTypes((AppLnkSet *)app);
else {
MimeType::registerApp(*app);
}
}
}
void Launcher::loadDocs() // ok here comes a hack belonging to Global::
{
qWarning("loading Documents" );
qWarning("The currentTimeStamp is: %s", m_timeStamp.latin1() );
delete docsFolder;
docsFolder = new DocLnkSet;
qWarning("new DocLnkSet" );
// find out wich filesystems are new in this round
// We will do this by having a timestamp inside each mountpoint
// if the current timestamp doesn't match this is a new file system and
// come up with our MediumMountGui :) let the hacking begin
int stamp = uidgen.generate();
QString newStamp = QString::number( stamp );
qWarning("new time stamp is: %s", newStamp.latin1() );
StorageInfo storage;
const QList<FileSystem> &fileSystems = storage.fileSystems();
qWarning("QList<FileSystem>" );
QListIterator<FileSystem> it ( fileSystems );
qWarning("iterator initiliazed" );
for ( ; it.current(); ++it ) {
qWarning("inside for loop" );
qWarning("checking device %s", (*it)->path().latin1() );
if ( (*it)->isRemovable() ) { // let's find out if we should search on it
qWarning("%s is removeable", (*it)->path().latin1() );
OConfig cfg( (*it)->path() + "/.opiestorage.cf");
cfg.setGroup("main");
QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() );
if( stamp == m_timeStamp ){ // ok we know this card
qWarning("time stamp match" );
cfg.writeEntry("timestamp", newStamp );
// we need to scan the list now. Hopefully the cache will be there
}else{ // come up with the gui
qWarning("time stamp doesn't match" );
MediumMountGui medium((*it)->path() );
qWarning("medium mount gui created" );
if( medium.check() ){
qWarning("need to check this device" );
if( medium.exec() ){ //ok
// speicher
qWarning("execed" );
+ cfg.read();
cfg.writeEntry("timestamp", newStamp );
}
}else{
qWarning("wrong :(" );
// do something different see what we need to do
}
}
}
}
qWarning("findDocuments" );
Global::findDocuments(docsFolder); // get rid of this call later
qWarning("done" );
m_timeStamp = newStamp;
}
void Launcher::updateTabs()
{
MimeType::updateApplications(); // ### reads all applnks twice
delete rootFolder;
rootFolder = new AppLnkSet( MimeType::appsFolderName() );
loadDocs();
tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems());
}
void Launcher::updateDocs()
{
loadDocs();
tabs->updateDocs(docsFolder,storage->fileSystems());
}
void Launcher::viewSelected(const QString& s)
{
setCaption( s + tr(" - Launcher") );
}
void Launcher::nextView()
{
tabs->nextTab();
}
void Launcher::select( const AppLnk *appLnk )
{
if ( appLnk->type() == "Folder" ) {
// Not supported: flat is simpler for the user
} else {
if ( appLnk->exec().isNull() ) {
QMessageBox::information(this,tr("No application"),
tr("<p>No application is defined for this document."
"<p>Type is %1.").arg(appLnk->type()));
return;
}
tabs->setBusy(TRUE);
emit executing( appLnk );
appLnk->execute();
}
}
void Launcher::externalSelected(const AppLnk *appLnk)
{
tabs->setBusy(TRUE);
emit executing( appLnk );
}
void Launcher::properties( AppLnk *appLnk )
{
if ( appLnk->type() == "Folder" ) {
// Not supported: flat is simpler for the user
} else {
in_lnk_props = TRUE;
got_lnk_change = FALSE;
LnkProperties prop(appLnk);
connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
prop.showMaximized();
prop.exec();
in_lnk_props = FALSE;
if ( got_lnk_change ) {
updateLink(lnk_change);
}
}
}
void Launcher::updateLink(const QString& link)
{
if (link.isNull())
updateTabs();
else if (link.isEmpty())
updateDocs();
else
tabs->updateLink(link);
}
void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
diff --git a/core/launcher/mediummountgui.cpp b/core/launcher/mediummountgui.cpp
index 5225711..e3fa5bd 100644
--- a/core/launcher/mediummountgui.cpp
+++ b/core/launcher/mediummountgui.cpp
@@ -7,192 +7,193 @@
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qpe/resource.h>
#include <opie/oconfig.h>
#include <qapplication.h>
MediumMountGui::MediumMountGui( const QString &path ,QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, true ) {
QWidget *d = QApplication::desktop();
int w=d->width();
int h=d->height();
resize( w , h );
setCaption( tr( "Medium inserted" ) );
mediumPath = path;
readConfig();
startGui();
}
void MediumMountGui::readConfig(){
OConfig cfg (mediumPath +"/.opiestorage.cf");
cfg.setGroup("main");
checkagain = cfg.readBoolEntry("check", false);
cfg.setGroup("mimetypes");
checkmimeaudio = cfg.readBoolEntry("audio", true);
checkmimeimage = cfg.readBoolEntry("image", true);
checkmimetext = cfg.readBoolEntry("text", true);
checkmimevideo = cfg.readBoolEntry("video", true);
checkmimeall = cfg.readBoolEntry("all", true);
cfg.setGroup("dirs");
limittodirs = cfg.readEntry("dirs", "");
}
bool MediumMountGui::check() {
return !checkagain;
}
QStringList MediumMountGui::dirs() {
QStringList list = QStringList::split(",", limittodirs );
return list;
}
void MediumMountGui::writeConfig(bool autocheck) {
OConfig cfg (mediumPath +"/.opiestorage.cf");
cfg.setGroup("main");
cfg.writeEntry("check", AskBox->isChecked() );
cfg.writeEntry("autocheck", autocheck );
cfg.setGroup("mimetypes");
cfg.writeEntry("audio", CheckBoxAudio->isChecked() );
cfg.writeEntry("image",CheckBoxImage->isChecked() );
cfg.writeEntry("text",CheckBoxImage->isChecked() );
cfg.writeEntry("video",CheckBoxVideo->isChecked() );
cfg.writeEntry("all",CheckBoxAll->isChecked() );
cfg.setGroup("dirs");
cfg.writeEntry("dirs", "");
// if all is checked then add only "null" to the list.
if (checkmimeall) {
mimeTypeList += ("null");
} else {
if (checkmimeaudio) {
mimeTypeList += ("audio//*");
}
if (checkmimetext) {
mimeTypeList += ("text//*");
}
if (checkmimevideo) {
mimeTypeList += ("video//*");
}
if (checkmimeimage) {
mimeTypeList += ("image//*");
}
if (checkmimeall) {
mimeTypeList << ("null");
}
}
+ cfg.write();
}
void MediumMountGui::startGui() {
QPixmap image = Resource::loadPixmap( "HelpBrowser");
Text_2 = new QLabel( this );
Text_2->setGeometry( QRect( 10, 15, 40, 40 ) );
Text_2->setPixmap( image );
Text = new QLabel( this, "Text" );
Text->setGeometry( QRect( 55, 11, this->width()-50, 50 ) );
Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) );
// media box
GroupBox1 = new QGroupBox( this, "GroupBox1" );
GroupBox1->setGeometry( QRect( 10, 80, (this->width())-25, 80 ) );
GroupBox1->setTitle( tr( "Which media files" ) );
CheckBoxAudio = new QCheckBox( GroupBox1, "CheckBoxAudio" );
CheckBoxAudio->setGeometry( QRect( 10, 15, (GroupBox1->width()/2)-15 , 15 ) );
CheckBoxAudio->setText( tr( "Audio" ) );
CheckBoxImage = new QCheckBox( GroupBox1, "CheckBoxImage" );
CheckBoxImage->setGeometry( QRect( 10, 35,(GroupBox1->width()/2)-15, 15 ) );
CheckBoxImage->setText( tr( "Image" ) );
CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" );
CheckBoxText->setGeometry( QRect((GroupBox1->width()/2) , 15, (GroupBox1->width()/2)-15, 15 ) );
CheckBoxText->setText( tr( "Text" ) );
CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" );
CheckBoxVideo->setGeometry( QRect( (GroupBox1->width()/2), 35, (GroupBox1->width()/2)-15, 15 ) );
CheckBoxVideo->setText( tr( "Video" ) );
CheckBoxAll = new QCheckBox ( GroupBox1);
CheckBoxAll->setGeometry( QRect( 10, 55, (GroupBox1->width()/2)-15, 15 ) );
CheckBoxAll->setText( tr( "All" ) );
QObject::connect( (QObject*)CheckBoxAll, SIGNAL( clicked() ), this, SLOT( deactivateOthers()) );
CheckBoxLink = new QCheckBox ( GroupBox1);
CheckBoxLink->setGeometry( QRect( (GroupBox1->width()/2), 55, (GroupBox1->width()/2)-15, 15 ) );
CheckBoxLink->setText( tr( "Link apps" ) );
// as long as the feature is not supported
CheckBoxLink->setEnabled(false);
// select dirs
DirSelectText = new QLabel( this, "DirSelectText" );
DirSelectText->setGeometry( QRect( 10, 160,this->width() , 20 ) );
DirSelectText->setText( tr( "Limit search to dir: (not used yet)" ) );
LineEdit1 = new QLineEdit( this );
LineEdit1->setGeometry( QRect( 10, 180, (this->width())-60, 20 ) );
PushButton3 = new QPushButton( this );
PushButton3->setGeometry( QRect( (this->width())-40, 180, 30, 20 ) );
PushButton3->setText( tr( "Add" ) );
// decision
DirSelectText_2 = new QLabel( this );
DirSelectText_2->setGeometry( QRect( 10,240,this->width(), 15 ) );
DirSelectText_2->setText( tr( "Your decision will be stored on the medium." ) );
// ask again
AskBox = new QCheckBox( this );
AskBox->setGeometry( QRect( 10, 215, (this->width())-15 , 15 ) );
AskBox->setText( tr( "Do not ask again for this medium" ) );
AskBox->setChecked(checkagain);
CheckBoxAudio->setChecked(checkmimeaudio);
CheckBoxImage->setChecked(checkmimeimage);
CheckBoxText->setChecked(checkmimetext);
CheckBoxVideo->setChecked(checkmimevideo);
// buttons
quit = new QPushButton( this );
quit->setGeometry( QRect( (this->width()/2)- 90 , 260, 80, 22 ) );
quit->setFocus();
quit->setText( tr( "Yes" ) );
quit_2 = new QPushButton( this );
quit_2->setGeometry( QRect((this->width()/2) , 260, 80, 22 ) );
quit_2->setText( tr( "No" ) );
QObject::connect( (QObject*)quit, SIGNAL( clicked() ), this, SLOT(yesPressed() ) );
QObject::connect( (QObject*)quit_2, SIGNAL( clicked() ), this, SLOT(noPressed() ) );
}
diff --git a/libopie/oconfig.h b/libopie/oconfig.h
index c97fb6a..f6227d1 100644
--- a/libopie/oconfig.h
+++ b/libopie/oconfig.h
@@ -1,48 +1,48 @@
/*
               =. This file is part of the OPIE Project
             .=l. Copyright (c) 2002 Holger 'zecke' Freyther<freyther@kde.org>
           .>+-=
 _;:,     .>    :=|. This library is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This library is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qpe/config.h>
#ifndef opieconfig_h
#define opieconfig_h
/** It supports all Config items + it lets you decide
* which file to use.
*/
class OConfig : public Config {
public:
OConfig( const QString &filename );
~OConfig();
QString fileName() const;
-
+ void read( ) { Config::read(); };
};
#endif