summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-10-31 13:09:13 (UTC)
committer harlekin <harlekin>2002-10-31 13:09:13 (UTC)
commitae467a89591b45a8a190174a0cae0b330de8d89e (patch) (unidiff)
tree2a4799378bdf4ce450955492b66b418214b9fbf4
parentf6ca21ad98c7af99c0ae4c04afe3c2126317d6de (diff)
downloadopie-ae467a89591b45a8a190174a0cae0b330de8d89e.zip
opie-ae467a89591b45a8a190174a0cae0b330de8d89e.tar.gz
opie-ae467a89591b45a8a190174a0cae0b330de8d89e.tar.bz2
excludeFromRefresh() added
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/libopie.pro28
-rw-r--r--libopie/ofileselector/odefaultfactories.cpp8
-rw-r--r--libopie/ofileselector/odefaultfactories.h3
-rw-r--r--libopie/ofileselector/ofiledialog.cpp2
-rw-r--r--libopie/ofileselector/ofiledialog.h3
-rw-r--r--libopie/ofileselector/ofileselector.cpp8
-rw-r--r--libopie/todayplugininterface.h6
7 files changed, 51 insertions, 7 deletions
diff --git a/libopie/libopie.pro b/libopie/libopie.pro
index df9c40a..a216cca 100644
--- a/libopie/libopie.pro
+++ b/libopie/libopie.pro
@@ -1,77 +1,101 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qte warn_on release 2CONFIG += qte warn_on release
3HEADERS = ofontmenu.h \ 3HEADERS = ofontmenu.h \
4 ocolorbutton.h \ 4 ocolorbutton.h \
5 ofiledialog.h ofileselector.h tododb.h \ 5 ofileselector/odefaultfactories.h \
6 ofileselector/ofiledialog.h \
7 ofileselector/ofilelistview.h \
8 ofileselector/ofileiconview.h \
9 ofileselector/ofileselector.h \
10 ofileselector/ofileselectoritem.h \
11 ofileselector/ofileselectoriconitem.h \
12 ofileselector/ofileselectormain.h \
13 ofileselector/ofileview.h \
14 ofileselector/olister.h \
15 ofileselector/olocallister.h \
16 ofileselector/opixmapprovider.h \
17 tododb.h \
6 ocheckitem.h todoevent.h todoresource.h \ 18 ocheckitem.h todoevent.h todoresource.h \
7 todovcalresource.h xmltree.h \ 19 todovcalresource.h xmltree.h \
8 colordialog.h colorpopupmenu.h \ 20 colordialog.h colorpopupmenu.h \
9 oclickablelabel.h oprocctrl.h \ 21 oclickablelabel.h oprocctrl.h \
10 oprocess.h odevice.h \ 22 oprocess.h odevice.h \
11 otimepicker.h otabwidget.h \ 23 otimepicker.h otabwidget.h \
12 otabbar.h otabinfo.h \ 24 otabbar.h otabinfo.h \
13 ofontselector.h \ 25 ofontselector.h \
14 pim/opimrecord.h \ 26 pim/opimrecord.h \
15 pim/otodo.h \ 27 pim/otodo.h \
16 pim/orecordlist.h \ 28 pim/orecordlist.h \
17 pim/opimaccesstemplate.h \ 29 pim/opimaccesstemplate.h \
18 pim/opimaccessbackend.h \ 30 pim/opimaccessbackend.h \
19 pim/otodoaccess.h \ 31 pim/otodoaccess.h \
20 pim/otodacessbackend.h \ 32 pim/otodacessbackend.h \
21 pim/ocontact.h \ 33 pim/ocontact.h \
22 pim/ocontactaccess.h \ 34 pim/ocontactaccess.h \
23 pim/ocontactaccessbackend.h \ 35 pim/ocontactaccessbackend.h \
24 pim/ocontactaccessbackend_xml.h \ 36 pim/ocontactaccessbackend_xml.h \
25 pim/obackendfactory.h \ 37 pim/obackendfactory.h \
26 pim/opimcache.h \ 38 pim/opimcache.h \
27 pim/otodoaccessvcal.h \ 39 pim/otodoaccessvcal.h \
28 pim/orecur.h \ 40 pim/orecur.h \
29 orecurrancewidget.h 41 orecurrancewidget.h
30# pim/otodoaccesssql.h \ 42# pim/otodoaccesssql.h \
31 43
32SOURCES = ofontmenu.cc \ 44SOURCES = ofontmenu.cc \
33 ocolorbutton.cpp \ 45 ocolorbutton.cpp \
46 ofileselector/odefaultfactories.cpp \
47 ofileselector/ofiledialog.cpp \
48 ofileselector/ofilefactory.cpp \
49 ofileselector/ofilelistview.cpp \
50 ofileselector/ofileiconview.cpp \
51 ofileselector/ofileselector.cpp \
52 ofileselector/ofileselectoritem.cpp \
53 ofileselector/ofileselectoriconitem.cpp \
54 ofileselector/ofileselectormain.cpp \
55 ofileselector/ofileview.cpp \
56 ofileselector/olister.cpp \
57 ofileselector/olocallister.cpp \
58 ofileselector/opixmapprovider.cpp \
34 xmltree.cc \ 59 xmltree.cc \
35 ofiledialog.cc ofileselector.cc \
36 ocheckitem.cpp tododb.cpp todoevent.cpp \ 60 ocheckitem.cpp tododb.cpp todoevent.cpp \
37 todovcalresource.cpp colordialog.cpp \ 61 todovcalresource.cpp colordialog.cpp \
38 colorpopupmenu.cpp oclickablelabel.cpp \ 62 colorpopupmenu.cpp oclickablelabel.cpp \
39 oprocctrl.cpp oprocess.cpp \ 63 oprocctrl.cpp oprocess.cpp \
40 odevice.cpp otimepicker.cpp \ 64 odevice.cpp otimepicker.cpp \
41 otabwidget.cpp otabbar.cpp \ 65 otabwidget.cpp otabbar.cpp \
42 ofontselector.cpp \ 66 ofontselector.cpp \
43 pim/otodo.cpp \ 67 pim/otodo.cpp \
44 pim/opimrecord.cpp \ 68 pim/opimrecord.cpp \
45 pim/otodoaccess.cpp \ 69 pim/otodoaccess.cpp \
46 pim/otodoaccessbackend.cpp \ 70 pim/otodoaccessbackend.cpp \
47 pim/otodoaccessxml.cpp \ 71 pim/otodoaccessxml.cpp \
48 pim/ocontact.cpp \ 72 pim/ocontact.cpp \
49 pim/ocontactaccess.cpp \ 73 pim/ocontactaccess.cpp \
50 pim/otodoaccessvcal.cpp \ 74 pim/otodoaccessvcal.cpp \
51 pim/orecur.cpp \ 75 pim/orecur.cpp \
52 orecurrancewidget.cpp 76 orecurrancewidget.cpp
53# pim/otodoaccesssql.cpp \ 77# pim/otodoaccesssql.cpp \
54 78
55TARGET = opie 79TARGET = opie
56INCLUDEPATH += $(OPIEDIR)/include 80INCLUDEPATH += $(OPIEDIR)/include
57DESTDIR = $(QTDIR)/lib$(PROJMAK) 81DESTDIR = $(QTDIR)/lib$(PROJMAK)
58#VERSION = 1.0.0 82#VERSION = 1.0.0
59 83
60# LIBS += -lopiesql 84# LIBS += -lopiesql
61 85
62INTERFACES = otimepickerbase.ui orecurrancebase.ui 86INTERFACES = otimepickerbase.ui orecurrancebase.ui
63 87
64TRANSLATIONS = ../i18n/de/libopie.ts \ 88TRANSLATIONS = ../i18n/de/libopie.ts \
65 ../i18n/en/libopie.ts \ 89 ../i18n/en/libopie.ts \
66 ../i18n/es/libopie.ts \ 90 ../i18n/es/libopie.ts \
67 ../i18n/fr/libopie.ts \ 91 ../i18n/fr/libopie.ts \
68 ../i18n/hu/libopie.ts \ 92 ../i18n/hu/libopie.ts \
69 ../i18n/ja/libopie.ts \ 93 ../i18n/ja/libopie.ts \
70 ../i18n/ko/libopie.ts \ 94 ../i18n/ko/libopie.ts \
71 ../i18n/no/libopie.ts \ 95 ../i18n/no/libopie.ts \
72 ../i18n/pl/libopie.ts \ 96 ../i18n/pl/libopie.ts \
73 ../i18n/pt/libopie.ts \ 97 ../i18n/pt/libopie.ts \
74 ../i18n/pt_BR/libopie.ts \ 98 ../i18n/pt_BR/libopie.ts \
75 ../i18n/sl/libopie.ts \ 99 ../i18n/sl/libopie.ts \
76 ../i18n/zh_CN/libopie.ts \ 100 ../i18n/zh_CN/libopie.ts \
77 ../i18n/zh_TW/libopie.ts 101 ../i18n/zh_TW/libopie.ts
diff --git a/libopie/ofileselector/odefaultfactories.cpp b/libopie/ofileselector/odefaultfactories.cpp
index c41fbca..c8efffb 100644
--- a/libopie/ofileselector/odefaultfactories.cpp
+++ b/libopie/ofileselector/odefaultfactories.cpp
@@ -1,15 +1,23 @@
1#include "ofilelistview.h" 1#include "ofilelistview.h"
2#include "ofileiconview.h"
2#include "olocallister.h" 3#include "olocallister.h"
3 4
5
4#include "odefaultfactories.h" 6#include "odefaultfactories.h"
5 7
6extern "C" { 8extern "C" {
7 9
10
11 OFileView* newFileIconView( OFileSelector* sel, QWidget* parent ) {
12 return new OFileIconView( parent, sel );
13 }
14
8 OFileView* newFileListView( OFileSelector* sel, QWidget* par ) { 15 OFileView* newFileListView( OFileSelector* sel, QWidget* par ) {
9 return new OFileListView(par, sel ); 16 return new OFileListView(par, sel );
10 } 17 }
18
11 OLister* newLocalLister( OFileSelector* sel) { 19 OLister* newLocalLister( OFileSelector* sel) {
12 return new OLocalLister( sel ); 20 return new OLocalLister( sel );
13 } 21 }
14 22
15}; 23};
diff --git a/libopie/ofileselector/odefaultfactories.h b/libopie/ofileselector/odefaultfactories.h
index eb698d3..b4c35af 100644
--- a/libopie/ofileselector/odefaultfactories.h
+++ b/libopie/ofileselector/odefaultfactories.h
@@ -1,14 +1,17 @@
1#ifndef OPIE_DEFAULT_FACTORIES_H 1#ifndef OPIE_DEFAULT_FACTORIES_H
2#define OPIE_DEFAULT_FACTORIES_H 2#define OPIE_DEFAULT_FACTORIES_H
3 3
4#include "ofilefactory.h" 4#include "ofilefactory.h"
5 5
6extern "C" { 6extern "C" {
7 7
8 OFileView* newFileIconView( OFileSelector*, QWidget* parent );
8 OFileView* newFileListView( OFileSelector*, QWidget* parent ); 9 OFileView* newFileListView( OFileSelector*, QWidget* parent );
10
9 OLister* newLocalLister(OFileSelector* ); 11 OLister* newLocalLister(OFileSelector* );
10 12
13
11}; 14};
12 15
13 16
14#endif 17#endif
diff --git a/libopie/ofileselector/ofiledialog.cpp b/libopie/ofileselector/ofiledialog.cpp
index 430def2..d137c66 100644
--- a/libopie/ofileselector/ofiledialog.cpp
+++ b/libopie/ofileselector/ofiledialog.cpp
@@ -1,116 +1,116 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 <> 3             .=l. Copyright (c) 2002 <>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can 5 _;:,     .>    :=|. This library is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that 12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include <qpe/applnk.h> 29#include <qpe/applnk.h>
30#include <qstring.h> 30#include <qstring.h>
31#include <qapplication.h> 31#include <qapplication.h>
32#include <qlayout.h> 32#include <qlayout.h>
33 33
34#include "ofiledialog.h" 34#include "ofiledialog.h"
35 35
36OFileDialog::OFileDialog(const QString &caption, 36OFileDialog::OFileDialog(const QString &caption,
37 QWidget *wid, int mode, int selector, 37 QWidget *wid, int mode, int selector,
38 const QString &dirName, 38 const QString &dirName,
39 const QString &fileName, 39 const QString &fileName,
40 const QMap<QString,QStringList>& mimetypes ) 40 const QMap<QString,QStringList>& mimetypes )
41 : QDialog( wid, "OFileDialog", true ) 41 : QDialog( wid, "OFileDialog", true )
42{ 42{
43 // QVBoxLayout *lay = new QVBoxLayout(this); 43 // QVBoxLayout *lay = new QVBoxLayout(this);
44 //showMaximized(); 44 //showMaximized();
45 QVBoxLayout *lay = new QVBoxLayout(this ); 45 QVBoxLayout *lay = new QVBoxLayout(this );
46 file = new OFileSelector(this , mode, selector, 46 file = new OFileSelector(this , mode, selector,
47 dirName, fileName, 47 dirName, fileName,
48 mimetypes ); 48 mimetypes );
49 lay->addWidget( file ); 49 lay->addWidget( file );
50 50
51 //lay->addWidget( file ); 51 //lay->addWidget( file );
52 //showFullScreen(); 52 //showFullScreen();
53 setCaption( caption.isEmpty() ? tr("FileDialog") : caption ); 53 setCaption( caption.isEmpty() ? tr("FileDialog") : caption );
54 connect(file, SIGNAL(fileSelected(const QString&) ), 54 connect(file, SIGNAL(fileSelected(const QString&) ),
55 this, SLOT(slotFileSelected(const QString&) ) ); 55 this, SLOT(slotFileSelected(const QString&) ) );
56 56
57 connect(file, SIGNAL(dirSelected(const QString &) ), 57 connect(file, SIGNAL(dirSelected(const QString &) ),
58 this, SLOT(slotDirSelected(const QString &) ) ); 58 this, SLOT(slotDirSelected(const QString &) ) );
59 59
60 60
61 file->setYesCancelVisible( false ); // relayout 61 file->setYesCancelVisible( false ); // relayout
62} 62}
63QString OFileDialog::mimetype()const 63QString OFileDialog::mimetype()const
64{ 64{
65 return QString::null; 65 return QString::null;
66} 66}
67QString OFileDialog::fileName()const 67QString OFileDialog::fileName()const
68{ 68{
69 return file->selectedName(); 69 return file->selectedName();
70} 70}
71DocLnk OFileDialog::selectedDocument()const 71DocLnk OFileDialog::selectedDocument()const
72{ 72{
73 return file->selectedDocument(); 73 return file->selectedDocument();
74} 74}
75QString OFileDialog::getOpenFileName(int selector, 75QString OFileDialog::getOpenFileName(int selector,
76 const QString &startDir, 76 const QString &startDir,
77 const QString &file, 77 const QString &file,
78 const MimeTypes &mimes, 78 const MimeTypes &mimes,
79 QWidget *wid, 79 QWidget *wid,
80 const QString &caption ) 80 const QString &caption )
81{ 81{
82 QString ret; 82 QString ret;
83 OFileDialog dlg( caption.isEmpty() ? tr("Open") : caption, 83 OFileDialog dlg( caption.isEmpty() ? tr("Open") : caption,
84 wid, OFileSelector::Open, selector, startDir, file, mimes); 84 wid, OFileSelector::Open, selector, startDir, file, mimes);
85 dlg.showMaximized(); 85 dlg.showMaximized();
86 if( dlg.exec() ) 86 if( dlg.exec() )
87 ret = dlg.fileName(); 87 ret = dlg.fileName();
88 88
89 return ret; 89 return ret;
90} 90}
91QString OFileDialog::getSaveFileName(int selector, 91QString OFileDialog::getSaveFileName(int selector,
92 const QString &startDir, 92 const QString &startDir,
93 const QString &file, 93 const QString &file,
94 const MimeTypes &mimes, 94 const MimeTypes &mimes,
95 QWidget *wid, 95 QWidget *wid,
96 const QString &caption ) 96 const QString &caption )
97{ 97{
98 QString ret; 98 QString ret;
99 OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption, 99 OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption,
100 wid, OFileSelector::Save, selector, startDir, file, mimes); 100 wid, OFileSelector::Save, selector, startDir, file, mimes);
101 dlg.showMaximized(); 101 dlg.showMaximized();
102 if( dlg.exec() ) 102 if( dlg.exec() )
103 ret = dlg.fileName(); 103 ret = dlg.fileName();
104 104
105 return ret; 105 return ret;
106} 106}
107 107
108void OFileDialog::slotFileSelected(const QString & ) 108void OFileDialog::slotFileSelected(const QString & )
109{ 109{
110 accept(); 110 accept();
111} 111}
112void OFileDialog::slotDirSelected(const QString & ) 112void OFileDialog::slotDirSelected(const QString & )
113{ 113{
114 // if mode 114 // if mode
115 //accept(); 115 //accept();
116} 116}
diff --git a/libopie/ofileselector/ofiledialog.h b/libopie/ofileselector/ofiledialog.h
index e14253c..e368e96 100644
--- a/libopie/ofileselector/ofiledialog.h
+++ b/libopie/ofileselector/ofiledialog.h
@@ -1,77 +1,78 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 zecke <zecke@handhelds.org> 3             .=l. Copyright (c) 2002 zecke <zecke@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can 5 _;:,     .>    :=|. This library is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that 12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29 29
30#ifndef OpieFileDialog_h 30#ifndef OpieFileDialog_h
31#define OpieFileDialog_h 31#define OpieFileDialog_h
32 32
33#include <qdialog.h> 33#include <qdialog.h>
34 34
35#include <opie/ofileselector.h> 35//#include <opie/ofileselector.h>
36#include "ofileselector.h"
36 37
37class OFileDialog : public QDialog { 38class OFileDialog : public QDialog {
38 Q_OBJECT 39 Q_OBJECT
39 public: 40 public:
40 OFileDialog(const QString &caption, 41 OFileDialog(const QString &caption,
41 QWidget *, int mode, int selector, 42 QWidget *, int mode, int selector,
42 const QString &dirName, 43 const QString &dirName,
43 const QString &fileName = QString::null, 44 const QString &fileName = QString::null,
44 const MimeTypes &mimetypes = MimeTypes() ); 45 const MimeTypes &mimetypes = MimeTypes() );
45 QString mimetype() const; 46 QString mimetype() const;
46 QString fileName() const; 47 QString fileName() const;
47 DocLnk selectedDocument()const; 48 DocLnk selectedDocument()const;
48 49
49 // static methods 50 // static methods
50 static QString getOpenFileName(int selector, 51 static QString getOpenFileName(int selector,
51 const QString& startDir = QString::null, 52 const QString& startDir = QString::null,
52 const QString &fileName = QString::null, 53 const QString &fileName = QString::null,
53 const MimeTypes& mime = MimeTypes(), 54 const MimeTypes& mime = MimeTypes(),
54 QWidget *wid = 0, 55 QWidget *wid = 0,
55 const QString &caption = QString::null ); 56 const QString &caption = QString::null );
56 57
57 static QString getSaveFileName(int selector, 58 static QString getSaveFileName(int selector,
58 const QString& startDir = QString::null, 59 const QString& startDir = QString::null,
59 const QString& fileName = QString::null, 60 const QString& fileName = QString::null,
60 const MimeTypes& mimefilter = MimeTypes(), 61 const MimeTypes& mimefilter = MimeTypes(),
61 QWidget *wid = 0, 62 QWidget *wid = 0,
62 const QString &caption = QString::null ); 63 const QString &caption = QString::null );
63 64
64 //let's OFileSelector catch up first 65 //let's OFileSelector catch up first
65 //static QString getExistingDirectory(const QString& startDir = QString::null, 66 //static QString getExistingDirectory(const QString& startDir = QString::null,
66 // QWidget *parent = 0, 67 // QWidget *parent = 0,
67 // const QString& caption = QString::null ); 68 // const QString& caption = QString::null );
68 private: 69 private:
69 class OFileDialogPrivate; 70 class OFileDialogPrivate;
70 OFileDialogPrivate *d; 71 OFileDialogPrivate *d;
71 OFileSelector *file; 72 OFileSelector *file;
72 73
73 private slots: 74 private slots:
74 void slotFileSelected( const QString & ); 75 void slotFileSelected( const QString & );
75 void slotDirSelected(const QString & ); 76 void slotDirSelected(const QString & );
76}; 77};
77#endif 78#endif
diff --git a/libopie/ofileselector/ofileselector.cpp b/libopie/ofileselector/ofileselector.cpp
index 9ce07dd..c6e923f 100644
--- a/libopie/ofileselector/ofileselector.cpp
+++ b/libopie/ofileselector/ofileselector.cpp
@@ -232,861 +232,863 @@ void OFileSelector::setShowFiles(bool show )
232 reparse(); 232 reparse();
233} 233}
234/// 234///
235bool OFileSelector::cd(const QString &path ) 235bool OFileSelector::cd(const QString &path )
236{ 236{
237 m_currentDir = path; 237 m_currentDir = path;
238 reparse(); 238 reparse();
239 return true; 239 return true;
240} 240}
241void OFileSelector::setSelector(int mode ) 241void OFileSelector::setSelector(int mode )
242{ 242{
243 QString text; 243 QString text;
244 switch( mode ){ 244 switch( mode ){
245 case Normal: 245 case Normal:
246 text = tr("Documents"); 246 text = tr("Documents");
247 break; 247 break;
248 case Extended: 248 case Extended:
249 text = tr("List View"); 249 text = tr("List View");
250 break; 250 break;
251 case ExtendedAll: 251 case ExtendedAll:
252 text = tr("All List View"); 252 text = tr("All List View");
253 break; 253 break;
254 } 254 }
255 slotViewCheck( text ); 255 slotViewCheck( text );
256} 256}
257 257
258void OFileSelector::setPopupFactory(OPopupMenuFactory */*popup*/ ) 258void OFileSelector::setPopupFactory(OPopupMenuFactory */*popup*/ )
259{ 259{
260/* m_custom = popup; 260/* m_custom = popup;
261 m_showPopup = true; 261 m_showPopup = true;
262*/ 262*/
263} 263}
264 264
265QString OFileSelector::selectedName() const 265QString OFileSelector::selectedName() const
266{ 266{
267 QString name; 267 QString name;
268 if( m_selector == Normal ){ 268 if( m_selector == Normal ){
269 DocLnk lnk = m_select->selectedDocument(); 269 DocLnk lnk = m_select->selectedDocument();
270 name = lnk.file(); 270 name = lnk.file();
271 }else { 271 }else {
272 name = currentLister()->selectedName(); 272 name = currentLister()->selectedName();
273 } 273 }
274 return name; 274 return name;
275} 275}
276QStringList OFileSelector::selectedNames()const 276QStringList OFileSelector::selectedNames()const
277{ 277{
278 QStringList list; 278 QStringList list;
279 if( m_selector == Normal ){ 279 if( m_selector == Normal ){
280 list << selectedName(); 280 list << selectedName();
281 }else { 281 }else {
282 list << selectedName(); // FIXME implement multiple Selections 282 list << selectedName(); // FIXME implement multiple Selections
283 } 283 }
284 return list; 284 return list;
285} 285}
286/** If mode is set to the Dir selection this will return the selected path. 286/** If mode is set to the Dir selection this will return the selected path.
287 * 287 *
288 * 288 *
289 */ 289 */
290QString OFileSelector::selectedPath()const 290QString OFileSelector::selectedPath()const
291{ 291{
292 QString path; 292 QString path;
293 if( m_selector == Normal ){ 293 if( m_selector == Normal ){
294 path = QPEApplication::documentDir(); 294 path = QPEApplication::documentDir();
295 } /* normal case to do */ 295 } /* normal case to do */
296 return path; 296 return path;
297} 297}
298QStringList OFileSelector::selectedPaths() const 298QStringList OFileSelector::selectedPaths() const
299{ 299{
300 QStringList list; 300 QStringList list;
301 list << selectedPath(); 301 list << selectedPath();
302 return list; 302 return list;
303} 303}
304QString OFileSelector::directory()const 304QString OFileSelector::directory()const
305{ 305{
306 if( m_selector == Normal ) 306 if( m_selector == Normal )
307 return QPEApplication::documentDir(); 307 return QPEApplication::documentDir();
308 308
309 return QDir(m_currentDir).absPath(); 309 return QDir(m_currentDir).absPath();
310} 310}
311 311
312int OFileSelector::fileCount() 312int OFileSelector::fileCount()
313{ 313{
314 int count; 314 int count;
315 switch( m_selector ){ 315 switch( m_selector ){
316 case Normal: 316 case Normal:
317 count = m_select->fileCount(); 317 count = m_select->fileCount();
318 break; 318 break;
319 case Extended: 319 case Extended:
320 case ExtendedAll: 320 case ExtendedAll:
321 default: 321 default:
322 count = currentView()->fileCount(); 322 count = currentView()->fileCount();
323 break; 323 break;
324 } 324 }
325 return count; 325 return count;
326} 326}
327DocLnk OFileSelector::selectedDocument() const 327DocLnk OFileSelector::selectedDocument() const
328{ 328{
329 DocLnk lnk; 329 DocLnk lnk;
330 switch( m_selector ){ 330 switch( m_selector ){
331 case Normal:{ 331 case Normal:{
332 lnk = m_select->selectedDocument(); 332 lnk = m_select->selectedDocument();
333 break; 333 break;
334 } 334 }
335 case Extended: 335 case Extended:
336 case ExtendedAll: 336 case ExtendedAll:
337 default: 337 default:
338 lnk = DocLnk( selectedName() ); 338 lnk = DocLnk( selectedName() );
339 break; 339 break;
340 } 340 }
341 return lnk; 341 return lnk;
342} 342}
343QValueList<DocLnk> OFileSelector::selectedDocuments() const 343QValueList<DocLnk> OFileSelector::selectedDocuments() const
344{ 344{
345 QValueList<DocLnk> docs; 345 QValueList<DocLnk> docs;
346 docs.append( selectedDocument() ); 346 docs.append( selectedDocument() );
347 return docs; 347 return docs;
348} 348}
349 349
350 350
351// slots internal 351// slots internal
352 352
353void OFileSelector::slotOk() 353void OFileSelector::slotOk()
354{ 354{
355 emit ok(); 355 emit ok();
356} 356}
357void OFileSelector::slotCancel() 357void OFileSelector::slotCancel()
358{ 358{
359 emit cancel(); 359 emit cancel();
360} 360}
361/* switch the views */ 361/* switch the views */
362void OFileSelector::slotViewCheck(const QString &sel) 362void OFileSelector::slotViewCheck(const QString &sel)
363{ 363{
364 setView( sel ); 364 setView( sel );
365} 365}
366 366
367QString OFileSelector::currentMimeType() const{ 367QString OFileSelector::currentMimeType() const{
368 QString mime; 368 QString mime;
369 QString currentText; 369 QString currentText;
370 if (m_shChooser && m_mimeCheck ) 370 if (m_shChooser && m_mimeCheck )
371 currentText = m_mimeCheck->currentText(); 371 currentText = m_mimeCheck->currentText();
372 372
373 qWarning("CurrentText" + currentText ); 373 qWarning("CurrentText" + currentText );
374 if (tr("All") == currentText ) return QString::null; 374 if (tr("All") == currentText ) return QString::null;
375 else if (currentText.isEmpty() ) { 375 else if (currentText.isEmpty() ) {
376 ; 376 ;
377 }else { 377 }else {
378 QMap<QString, QStringList>::ConstIterator it; 378 QMap<QString, QStringList>::ConstIterator it;
379 it = m_mimetypes.find( currentText ); 379 it = m_mimetypes.find( currentText );
380 if ( it != m_mimetypes.end() ) { 380 if ( it != m_mimetypes.end() ) {
381 mime = it.data().join(";"); 381 mime = it.data().join(";");
382 }else{ 382 }else{
383 mime = currentText; 383 mime = currentText;
384 } 384 }
385 } 385 }
386 return mime; 386 return mime;
387} 387}
388void OFileSelector::slotMimeCheck(const QString &mime) 388void OFileSelector::slotMimeCheck(const QString &mime)
389{ 389{
390 if( m_selector == Normal ){ 390 if( m_selector == Normal ){
391 initializeOldSelector(); 391 initializeOldSelector();
392 392
393 updateMimes(); 393 updateMimes();
394 updateMimeCheck(); 394 updateMimeCheck();
395 m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); 395 m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) );
396 }else{ // others 396 }else{ // others
397 qWarning("Mime %s", mime.latin1() ); 397 qWarning("Mime %s", mime.latin1() );
398 if(m_shChooser ){ 398 if(m_shChooser ){
399 qWarning("Current Text %s", m_mimeCheck->currentText().latin1() ); 399 qWarning("Current Text %s", m_mimeCheck->currentText().latin1() );
400 //m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); 400 //m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) );
401 } 401 }
402 reparse(); 402 reparse();
403 } 403 }
404} 404}
405/* 405/*
406 * Ok if a non dir gets inserted into this combobox 406 * Ok if a non dir gets inserted into this combobox
407 * we need to change it 407 * we need to change it
408 * QFileInfo and dirPath will give us the right Dir 408 * QFileInfo and dirPath will give us the right Dir
409 */ 409 */
410void OFileSelector::slotLocationActivated(const QString &file) 410void OFileSelector::slotLocationActivated(const QString &file)
411{ 411{
412 qWarning("slotLocationActivated"); 412 qWarning("slotLocationActivated");
413 QString name = file.left( file.find("<-", 0, TRUE ) ); 413 QString name = file.left( file.find("<-", 0, TRUE ) );
414 QFileInfo info( name ); 414 QFileInfo info( name );
415 if ( info.isFile() ) 415 if ( info.isFile() )
416 cd(info.dirPath( TRUE ) ); //absolute 416 cd(info.dirPath( TRUE ) ); //absolute
417 else 417 else
418 cd(name ); 418 cd(name );
419} 419}
420void OFileSelector::slotInsertLocationPath(const QString &currentPath, int count) 420void OFileSelector::slotInsertLocationPath(const QString &currentPath, int count)
421{ 421{
422 QStringList pathList; 422 QStringList pathList;
423 bool underDog = FALSE; 423 bool underDog = FALSE;
424 for(int i=0;i<count;i++) { 424 for(int i=0;i<count;i++) {
425 pathList << m_location->text(i); 425 pathList << m_location->text(i);
426 if( m_location->text(i) == currentPath) 426 if( m_location->text(i) == currentPath)
427 underDog = TRUE; 427 underDog = TRUE;
428 } 428 }
429 if( !underDog) { 429 if( !underDog) {
430 m_location->clear(); 430 m_location->clear();
431 if( currentPath.left(2)=="//") 431 if( currentPath.left(2)=="//")
432 pathList.append( currentPath.right(currentPath.length()-1) ); 432 pathList.append( currentPath.right(currentPath.length()-1) );
433 else 433 else
434 pathList.append( currentPath ); 434 pathList.append( currentPath );
435 m_location->insertStringList( pathList,-1); 435 m_location->insertStringList( pathList,-1);
436 } 436 }
437} 437}
438/* 438/*
439 * Do not crash anymore 439 * Do not crash anymore
440 * don't try to change dir to a file 440 * don't try to change dir to a file
441 */ 441 */
442void OFileSelector::locationComboChanged() 442void OFileSelector::locationComboChanged()
443{ 443{
444 QFileInfo info( m_location->lineEdit()->text() ); 444 QFileInfo info( m_location->lineEdit()->text() );
445 qWarning("info %s %s", info.dirPath(true).latin1(), m_location->lineEdit()->text().latin1() ); 445 qWarning("info %s %s", info.dirPath(true).latin1(), m_location->lineEdit()->text().latin1() );
446 if (info.isFile() ) 446 if (info.isFile() )
447 cd(info.dirPath(TRUE) ); //absolute path 447 cd(info.dirPath(TRUE) ); //absolute path
448 else 448 else
449 cd( m_location->lineEdit()->text() ); 449 cd( m_location->lineEdit()->text() );
450} 450}
451void OFileSelector::init() 451void OFileSelector::init()
452{ 452{
453 initFactory(); 453 initFactory();
454 m_lay = new QVBoxLayout( this ); 454 m_lay = new QVBoxLayout( this );
455 m_lay->setSpacing(0 ); 455 m_lay->setSpacing(0 );
456 456
457 /* take care of the main view... */ 457 /* take care of the main view... */
458 initToolbar(); 458 initToolbar();
459 //if( m_shChooser ) // the Chooser for the view and Mimetypes 459 //if( m_shChooser ) // the Chooser for the view and Mimetypes
460 initializeChooser(); 460 initializeChooser();
461 461
462 /* initialize the file lister */ 462 /* initialize the file lister */
463 if( m_selector == Normal ){ 463 if( m_selector == Normal ){
464 QString mime; 464 QString mime;
465 if (!m_autoMime) { 465 if (!m_autoMime) {
466 if (!m_mimetypes.isEmpty() ) { 466 if (!m_mimetypes.isEmpty() ) {
467 QMap<QString, QStringList>::Iterator it; 467 QMap<QString, QStringList>::Iterator it;
468 it = m_mimetypes.begin(); // cause we're in the init 468 it = m_mimetypes.begin(); // cause we're in the init
469 mime = it.data().join(";"); 469 mime = it.data().join(";");
470 } 470 }
471 } 471 }
472 initializeOldSelector(); 472 initializeOldSelector();
473 }else{ 473 }else{
474 initializeView(); 474 initializeView();
475 } 475 }
476 476
477 if( m_shLne ) // the LineEdit with the current FileName 477 if( m_shLne ) // the LineEdit with the current FileName
478 initializeName(); 478 initializeName();
479 479
480 if( m_shPerm ) // the Permission QCheckBox 480 if( m_shPerm ) // the Permission QCheckBox
481 initializePerm(); 481 initializePerm();
482 482
483 if( m_shYesNo ) // the Yes No button row 483 if( m_shYesNo ) // the Yes No button row
484 initializeYes( ); 484 initializeYes( );
485 485
486 if (m_selector != Normal ) 486 if (m_selector != Normal )
487 reparse(); 487 reparse();
488
489 showMaximized();
488} 490}
489void OFileSelector::updateMimes() 491void OFileSelector::updateMimes()
490{ 492{
491 if( m_autoMime ){ 493 if( m_autoMime ){
492 m_mimetypes.clear(); 494 m_mimetypes.clear();
493 m_mimetypes.insert( tr("All"), QString::null ); 495 m_mimetypes.insert( tr("All"), QString::null );
494 if( m_selector == Normal ){ 496 if( m_selector == Normal ){
495 DocLnkSet set; 497 DocLnkSet set;
496 Global::findDocuments(&set, QString::null ); 498 Global::findDocuments(&set, QString::null );
497 QListIterator<DocLnk> dit( set.children() ); 499 QListIterator<DocLnk> dit( set.children() );
498 for( ; dit.current(); ++dit ){ 500 for( ; dit.current(); ++dit ){
499 if( !m_mimetypes.contains( (*dit)->type() ) ) 501 if( !m_mimetypes.contains( (*dit)->type() ) )
500 m_mimetypes.insert( (*dit)->type(), (*dit)->type() ); 502 m_mimetypes.insert( (*dit)->type(), (*dit)->type() );
501 } 503 }
502 }// else done in reparse 504 }// else done in reparse
503 } 505 }
504} 506}
505void OFileSelector::initVars() 507void OFileSelector::initVars()
506{ 508{
507 if( m_mimetypes.isEmpty() ) 509 if( m_mimetypes.isEmpty() )
508 m_autoMime = true; 510 m_autoMime = true;
509 else 511 else
510 m_autoMime = false; 512 m_autoMime = false;
511 513
512 m_shClose = false; 514 m_shClose = false;
513 m_shNew = false; 515 m_shNew = false;
514 m_shTool = true; 516 m_shTool = true;
515 m_shPerm = false; 517 m_shPerm = false;
516 m_shLne = true; 518 m_shLne = true;
517 m_shChooser = true; 519 m_shChooser = true;
518 m_shYesNo = true; 520 m_shYesNo = true;
519 m_case = false; 521 m_case = false;
520 m_dir = true; 522 m_dir = true;
521 m_files = true; 523 m_files = true;
522 m_showPopup = false; 524 m_showPopup = false;
523 m_mainView = 0l; 525 m_mainView = 0l;
524 m_fileView = 0l; 526 m_fileView = 0l;
525 m_lister = 0l; 527 m_lister = 0l;
526 528
527 if(m_pixmaps == 0 ) // init the pixmaps 529 if(m_pixmaps == 0 ) // init the pixmaps
528 initPics(); 530 initPics();
529 531
530 // pointers 532 // pointers
531 m_location = 0; 533 m_location = 0;
532 m_mimeCheck = 0; 534 m_mimeCheck = 0;
533 m_viewCheck = 0; 535 m_viewCheck = 0;
534 m_homeButton = 0; 536 m_homeButton = 0;
535 m_docButton = 0; 537 m_docButton = 0;
536 m_hideButton = 0; 538 m_hideButton = 0;
537 m_ok = 0; 539 m_ok = 0;
538 m_cancel = 0; 540 m_cancel = 0;
539 m_reread = 0; 541 m_reread = 0;
540 m_up = 0; 542 m_up = 0;
541 m_View = 0; 543 m_View = 0;
542 m_checkPerm = 0; 544 m_checkPerm = 0;
543 m_pseudo = 0; 545 m_pseudo = 0;
544 m_pseudoLayout = 0; 546 m_pseudoLayout = 0;
545 m_select = 0; 547 m_select = 0;
546 m_lay = 0; 548 m_lay = 0;
547 m_Oselector = 0; 549 m_Oselector = 0;
548 m_boxToolbar = 0; 550 m_boxToolbar = 0;
549 m_boxOk = 0; 551 m_boxOk = 0;
550 m_boxName = 0; 552 m_boxName = 0;
551 m_boxView = 0; 553 m_boxView = 0;
552 m_edit = 0; 554 m_edit = 0;
553 m_fnLabel = 0; 555 m_fnLabel = 0;
554 m_new = 0; 556 m_new = 0;
555 m_close = 0; 557 m_close = 0;
556} 558}
557void OFileSelector::initializeName() 559void OFileSelector::initializeName()
558{ 560{
559 /** Name Layout Line 561 /** Name Layout Line
560 * This is the Layout line arranged in 562 * This is the Layout line arranged in
561 * horizontal way each components 563 * horizontal way each components
562 * are next to each other 564 * are next to each other
563 * but we will only do this if 565 * but we will only do this if
564 * we didn't initialize a while ago. 566 * we didn't initialize a while ago.
565 */ 567 */
566 if( m_boxName == 0 ){ 568 if( m_boxName == 0 ){
567 m_boxName = new QHBox( this ); // remove this this? or use a QHBox 569 m_boxName = new QHBox( this ); // remove this this? or use a QHBox
568 m_fnLabel = new QLabel( m_boxName ); 570 m_fnLabel = new QLabel( m_boxName );
569 m_fnLabel->setText( tr("Name:") ); 571 m_fnLabel->setText( tr("Name:") );
570 m_edit = new QLineEdit( m_boxName ); 572 m_edit = new QLineEdit( m_boxName );
571 m_edit->setText( m_name ); 573 m_edit->setText( m_name );
572 //m_boxName->addWidget( m_fnLabel ); 574 //m_boxName->addWidget( m_fnLabel );
573 m_boxName->setMargin( 5 ); 575 m_boxName->setMargin( 5 );
574 m_boxName->setSpacing( 8 ); 576 m_boxName->setSpacing( 8 );
575 //m_boxName->setStretchFactor(m_edit, 100 ); // 100 is stretch factor 577 //m_boxName->setStretchFactor(m_edit, 100 ); // 100 is stretch factor
576 578
577 m_lay->addWidget( m_boxName, 0 ); // add it to the topLevel layout 579 m_lay->addWidget( m_boxName, 0 ); // add it to the topLevel layout
578 }// else we already initialized 580 }// else we already initialized
579 // maybe show the components? 581 // maybe show the components?
580 // 582 //
581} 583}
582void OFileSelector::initializeYes() 584void OFileSelector::initializeYes()
583{ 585{
584 /** The Save Cancel bar 586 /** The Save Cancel bar
585 * 587 *
586 */ 588 */
587 if( m_boxOk == 0 ){ 589 if( m_boxOk == 0 ){
588 m_boxOk = new QHBox( this ); 590 m_boxOk = new QHBox( this );
589 m_ok = new QPushButton( tr("&Save"),m_boxOk , "save" ); 591 m_ok = new QPushButton( tr("&Save"),m_boxOk , "save" );
590 m_cancel = new QPushButton( tr("C&ancel"), m_boxOk, "cancel" ); 592 m_cancel = new QPushButton( tr("C&ancel"), m_boxOk, "cancel" );
591 593
592 //m_boxOk->addWidget( m_ok ); 594 //m_boxOk->addWidget( m_ok );
593 //m_boxOk->addWidget( m_cancel ); 595 //m_boxOk->addWidget( m_cancel );
594 m_boxOk->setMargin( 5 ); 596 m_boxOk->setMargin( 5 );
595 m_boxOk->setSpacing( 10 ); 597 m_boxOk->setSpacing( 10 );
596 m_lay->addWidget( m_boxOk, 0 ); 598 m_lay->addWidget( m_boxOk, 0 );
597 599
598 connect( m_ok, SIGNAL( clicked() ), 600 connect( m_ok, SIGNAL( clicked() ),
599 this, SLOT(slotOk() ) ); 601 this, SLOT(slotOk() ) );
600 connect( m_cancel, SIGNAL( clicked() ), 602 connect( m_cancel, SIGNAL( clicked() ),
601 this, SLOT( slotCancel() ) ); 603 this, SLOT( slotCancel() ) );
602 } 604 }
603} 605}
604/* 606/*
605 * OK m_mimeCheck is a QComboBox we now want to fill 607 * OK m_mimeCheck is a QComboBox we now want to fill
606 * out that combobox 608 * out that combobox
607 * if automime we need to update the mimetypes 609 * if automime we need to update the mimetypes
608 */ 610 */
609void OFileSelector::updateMimeCheck() { 611void OFileSelector::updateMimeCheck() {
610 m_mimeCheck->clear(); 612 m_mimeCheck->clear();
611 if (m_autoMime ) { 613 if (m_autoMime ) {
612 //m_mimeCheck->insertItem( tr("All") ); 614 //m_mimeCheck->insertItem( tr("All") );
613 updateMimes(); 615 updateMimes();
614 } 616 }
615 617
616 QMap<QString, QStringList>::Iterator it; 618 QMap<QString, QStringList>::Iterator it;
617 for (it = m_mimetypes.begin(); it != m_mimetypes.end(); ++it ) { 619 for (it = m_mimetypes.begin(); it != m_mimetypes.end(); ++it ) {
618 m_mimeCheck->insertItem( it.key() ); 620 m_mimeCheck->insertItem( it.key() );
619 } 621 }
620} 622}
621 623
622void OFileSelector::initializeChooser() 624void OFileSelector::initializeChooser()
623{ 625{
624 if( m_boxView == 0 ){ 626 if( m_boxView == 0 ){
625 m_boxView = new QHBox( this ); 627 m_boxView = new QHBox( this );
626 m_viewCheck = new QComboBox( m_boxView, "view check"); 628 m_viewCheck = new QComboBox( m_boxView, "view check");
627 m_mimeCheck = new QComboBox( m_boxView, "mime check"); 629 m_mimeCheck = new QComboBox( m_boxView, "mime check");
628 m_boxView->setSpacing( 8 ); 630 m_boxView->setSpacing( 8 );
629 m_lay->addWidget(m_boxView, 0 ); 631 m_lay->addWidget(m_boxView, 0 );
630 632
631 633
632 updateMimeCheck(); 634 updateMimeCheck();
633 fillList(); 635 fillList();
634 636
635 connect( m_viewCheck, SIGNAL( activated(const QString & ) ), 637 connect( m_viewCheck, SIGNAL( activated(const QString & ) ),
636 this, SLOT( slotViewCheck(const QString & ) ) ); 638 this, SLOT( slotViewCheck(const QString & ) ) );
637 connect( m_mimeCheck, SIGNAL( activated(const QString & ) ), 639 connect( m_mimeCheck, SIGNAL( activated(const QString & ) ),
638 this, SLOT( slotMimeCheck( const QString & ) ) ); 640 this, SLOT( slotMimeCheck( const QString & ) ) );
639 } 641 }
640} 642}
641/* generate the buttons for the toolbar */ 643/* generate the buttons for the toolbar */
642void OFileSelector::initToolbar() { 644void OFileSelector::initToolbar() {
643 m_mainView = new OFileSelectorMain( this ); 645 m_mainView = new OFileSelectorMain( this );
644 646
645 /* now generate the tool bar */ 647 /* now generate the tool bar */
646 qWarning( "toolbar" ); 648 qWarning( "toolbar" );
647 m_pseudo = new QWidget( m_mainView, "Pseudo Widget" ); 649 m_pseudo = new QWidget( m_mainView, "Pseudo Widget" );
648 m_pseudoLayout = new QVBoxLayout( m_pseudo ); 650 m_pseudoLayout = new QVBoxLayout( m_pseudo );
649 651
650 m_boxToolbar = new QHBox( m_pseudo ); 652 m_boxToolbar = new QHBox( m_pseudo );
651 m_boxToolbar->setSpacing( 0 ); 653 m_boxToolbar->setSpacing( 0 );
652 654
653 // tool bar members now 655 // tool bar members now
654 m_location = new QComboBox( m_boxToolbar ); 656 m_location = new QComboBox( m_boxToolbar );
655 m_location->setEditable( TRUE ); 657 m_location->setEditable( TRUE );
656 m_location->setDuplicatesEnabled( FALSE ); 658 m_location->setDuplicatesEnabled( FALSE );
657 connect( m_location, SIGNAL(activated(const QString& ) ), 659 connect( m_location, SIGNAL(activated(const QString& ) ),
658 this, SLOT(slotLocationActivated(const QString& )) ); 660 this, SLOT(slotLocationActivated(const QString& )) );
659 connect( m_location->lineEdit(), SIGNAL(returnPressed() ) , 661 connect( m_location->lineEdit(), SIGNAL(returnPressed() ) ,
660 this, SLOT(locationComboChanged() ) ); 662 this, SLOT(locationComboChanged() ) );
661 663
662 // UP Button 664 // UP Button
663 m_up = new QPushButton( Resource::loadIconSet("up"), QString::null, 665 m_up = new QPushButton( Resource::loadIconSet("up"), QString::null,
664 m_boxToolbar, "cdUpButton" ); 666 m_boxToolbar, "cdUpButton" );
665 m_up->setFixedSize( QSize(20, 20 ) ); 667 m_up->setFixedSize( QSize(20, 20 ) );
666 connect( m_up, SIGNAL( clicked() ), this, SLOT(cdUP() ) ); 668 connect( m_up, SIGNAL( clicked() ), this, SLOT(cdUP() ) );
667 m_up->setFlat( TRUE ); 669 m_up->setFlat( TRUE );
668 670
669 // Home Button 671 // Home Button
670 m_homeButton = new QPushButton(Resource::loadIconSet("home"), 672 m_homeButton = new QPushButton(Resource::loadIconSet("home"),
671 QString::null, m_boxToolbar ); 673 QString::null, m_boxToolbar );
672 m_homeButton->setFixedSize( QSize(20, 20 ) ); 674 m_homeButton->setFixedSize( QSize(20, 20 ) );
673 connect(m_homeButton, SIGNAL(clicked() ), this, SLOT(slotHome() ) ); 675 connect(m_homeButton, SIGNAL(clicked() ), this, SLOT(slotHome() ) );
674 m_homeButton->setFlat( TRUE ); 676 m_homeButton->setFlat( TRUE );
675 677
676 // Documents Button 678 // Documents Button
677 m_docButton = new QPushButton( Resource::loadIconSet("DocsIcon"), 679 m_docButton = new QPushButton( Resource::loadIconSet("DocsIcon"),
678 QString::null, m_boxToolbar, 680 QString::null, m_boxToolbar,
679 "docsButton" ); 681 "docsButton" );
680 m_docButton->setFixedSize( QSize(20, 20 ) ); 682 m_docButton->setFixedSize( QSize(20, 20 ) );
681 m_docButton->setFlat( true ); 683 m_docButton->setFlat( true );
682 connect( m_docButton, SIGNAL(clicked() ), 684 connect( m_docButton, SIGNAL(clicked() ),
683 this, SLOT(slotDoc() ) ); 685 this, SLOT(slotDoc() ) );
684 686
685 // close button 687 // close button
686 m_close = new QPushButton( Resource::loadIconSet( "close"), "", 688 m_close = new QPushButton( Resource::loadIconSet( "close"), "",
687 m_boxToolbar ); 689 m_boxToolbar );
688 connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) ); 690 connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) );
689 m_close->setFixedSize( 20, 20 ); 691 m_close->setFixedSize( 20, 20 );
690 692
691 m_boxToolbar->setFixedHeight( 20 ); 693 m_boxToolbar->setFixedHeight( 20 );
692 m_pseudoLayout->addWidget(m_boxToolbar ); 694 m_pseudoLayout->addWidget(m_boxToolbar );
693 695
694 /* init the locations */ 696 /* init the locations */
695 initLocations(); 697 initLocations();
696 698
697 if( !m_shTool ){ 699 if( !m_shTool ){
698 m_location->hide( ); 700 m_location->hide( );
699 m_up->hide( ); 701 m_up->hide( );
700 m_homeButton->hide( ); 702 m_homeButton->hide( );
701 m_docButton->hide( ); 703 m_docButton->hide( );
702 } 704 }
703 if(!m_shClose ) 705 if(!m_shClose )
704 m_close->hide(); 706 m_close->hide();
705 707
706 m_mainView->setToolbar( m_pseudo ); 708 m_mainView->setToolbar( m_pseudo );
707 m_lay->addWidget( m_mainView, 100 ); 709 m_lay->addWidget( m_mainView, 100 );
708} 710}
709/* put default locations into the bar */ 711/* put default locations into the bar */
710void OFileSelector::initLocations () { 712void OFileSelector::initLocations () {
711 713
712 // let;s fill the Location ComboBox 714 // let;s fill the Location ComboBox
713 StorageInfo storage; 715 StorageInfo storage;
714 const QList<FileSystem> &fs = storage.fileSystems(); 716 const QList<FileSystem> &fs = storage.fileSystems();
715 QListIterator<FileSystem> it ( fs ); 717 QListIterator<FileSystem> it ( fs );
716 for( ; it.current(); ++it ){ 718 for( ; it.current(); ++it ){
717 const QString disk = (*it)->name(); 719 const QString disk = (*it)->name();
718 const QString path = (*it)->path(); 720 const QString path = (*it)->path();
719 m_location->insertItem(path+ "<-"+disk ); 721 m_location->insertItem(path+ "<-"+disk );
720 } 722 }
721 int count = m_location->count(); 723 int count = m_location->count();
722 m_location->insertItem( m_currentDir ); 724 m_location->insertItem( m_currentDir );
723 m_location->setCurrentItem( count ); 725 m_location->setCurrentItem( count );
724 726
725} 727}
726void OFileSelector::initializePerm() 728void OFileSelector::initializePerm()
727{ 729{
728 if( m_checkPerm == 0 ){ 730 if( m_checkPerm == 0 ){
729 m_checkPerm = new QCheckBox(tr("Set Permission"), this, "perm"); 731 m_checkPerm = new QCheckBox(tr("Set Permission"), this, "perm");
730 m_checkPerm->setChecked( false ); 732 m_checkPerm->setChecked( false );
731 m_lay->addWidget( m_checkPerm ); 733 m_lay->addWidget( m_checkPerm );
732 } 734 }
733} 735}
734void OFileSelector::initPics() 736void OFileSelector::initPics()
735{ 737{
736 m_pixmaps = new QMap<QString,QPixmap>; 738 m_pixmaps = new QMap<QString,QPixmap>;
737 QPixmap pm = Resource::loadPixmap( "folder" ); 739 QPixmap pm = Resource::loadPixmap( "folder" );
738 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 740 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
739 741
740 QPainter painter( &pm ); 742 QPainter painter( &pm );
741 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 743 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
742 pm.setMask( pm.createHeuristicMask( FALSE ) ); 744 pm.setMask( pm.createHeuristicMask( FALSE ) );
743 m_pixmaps->insert("dirsymlink", pm ); 745 m_pixmaps->insert("dirsymlink", pm );
744 746
745 QPixmap pm2 = Resource::loadPixmap( "lockedfolder" ); 747 QPixmap pm2 = Resource::loadPixmap( "lockedfolder" );
746 QPainter pen(&pm2 ); 748 QPainter pen(&pm2 );
747 pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk ); 749 pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk );
748 pm2.setMask( pm2.createHeuristicMask( FALSE ) ); 750 pm2.setMask( pm2.createHeuristicMask( FALSE ) );
749 m_pixmaps->insert("symlinkedlocked", pm2 ); 751 m_pixmaps->insert("symlinkedlocked", pm2 );
750} 752}
751// if a mime complies with the m_mimeCheck->currentItem 753// if a mime complies with the m_mimeCheck->currentItem
752bool OFileSelector::compliesMime( const QString &path, const QString &mime ) 754bool OFileSelector::compliesMime( const QString &path, const QString &mime )
753{ 755{
754 if( mime == "All" ) 756 if( mime == "All" )
755 return true; 757 return true;
756 MimeType type( path ); 758 MimeType type( path );
757 if( type.id() == mime ) 759 if( type.id() == mime )
758 return true; 760 return true;
759 return false; 761 return false;
760} 762}
761/* check if the mimetype in mime 763/* check if the mimetype in mime
762 * complies with the one which is current 764 * complies with the one which is current
763 */ 765 */
764/* 766/*
765 * We've the mimetype of the file 767 * We've the mimetype of the file
766 * We need to get the stringlist of the current mimetype 768 * We need to get the stringlist of the current mimetype
767 * 769 *
768 * mime = image/jpeg 770 * mime = image/jpeg
769 * QStringList = 'image/*' 771 * QStringList = 'image/*'
770 * or QStringList = image/jpeg;image/png;application/x-ogg 772 * or QStringList = image/jpeg;image/png;application/x-ogg
771 * or QStringList = application/x-ogg;image/*; 773 * or QStringList = application/x-ogg;image/*;
772 * with all these mime filters it should get acceptes 774 * with all these mime filters it should get acceptes
773 * to do so we need to look if mime is contained inside 775 * to do so we need to look if mime is contained inside
774 * the stringlist 776 * the stringlist
775 * if it's contained return true 777 * if it's contained return true
776 * if not ( I'm no RegExp expert at all ) we'll look if a '/*' 778 * if not ( I'm no RegExp expert at all ) we'll look if a '/*'
777 * is contained in the mimefilter and then we will 779 * is contained in the mimefilter and then we will
778 * look if both are equal until the '/' 780 * look if both are equal until the '/'
779 */ 781 */
780bool OFileSelector::compliesMime( const QString& mime ) { 782bool OFileSelector::compliesMime( const QString& mime ) {
781 qWarning("mimetype is %s", mime.latin1() ); 783 qWarning("mimetype is %s", mime.latin1() );
782 QString currentText; 784 QString currentText;
783 if (m_shChooser ) 785 if (m_shChooser )
784 currentText = m_mimeCheck->currentText(); 786 currentText = m_mimeCheck->currentText();
785 787
786 qWarning("current text is %s", currentText.latin1() ); 788 qWarning("current text is %s", currentText.latin1() );
787 QMap<QString, QStringList>::Iterator it; 789 QMap<QString, QStringList>::Iterator it;
788 QStringList list; 790 QStringList list;
789 if ( currentText == tr("All") ) return true; 791 if ( currentText == tr("All") ) return true;
790 else if ( currentText.isEmpty() && !m_mimetypes.isEmpty() ) { 792 else if ( currentText.isEmpty() && !m_mimetypes.isEmpty() ) {
791 it = m_mimetypes.begin(); 793 it = m_mimetypes.begin();
792 list = it.data(); 794 list = it.data();
793 }else if ( currentText.isEmpty() ) return true; 795 }else if ( currentText.isEmpty() ) return true;
794 else{ 796 else{
795 it = m_mimetypes.find(currentText ); 797 it = m_mimetypes.find(currentText );
796 if ( it == m_mimetypes.end() ) qWarning("not there"), list << currentText; 798 if ( it == m_mimetypes.end() ) qWarning("not there"), list << currentText;
797 else qWarning("found"), list = it.data(); 799 else qWarning("found"), list = it.data();
798 } 800 }
799 801
800 802
801 if ( list.contains(mime) ) return true; 803 if ( list.contains(mime) ) return true;
802 qWarning("list doesn't contain it "); 804 qWarning("list doesn't contain it ");
803 QStringList::Iterator it2; 805 QStringList::Iterator it2;
804 int pos; 806 int pos;
805 for ( it2 = list.begin(); it2 != list.end(); ++it2 ) { 807 for ( it2 = list.begin(); it2 != list.end(); ++it2 ) {
806 pos = (*it2).findRev("/*"); 808 pos = (*it2).findRev("/*");
807 if ( pos >= 0 ) { 809 if ( pos >= 0 ) {
808 if ( mime.contains( (*it2).left(pos) ) ) return true; 810 if ( mime.contains( (*it2).left(pos) ) ) return true;
809 } 811 }
810 } 812 }
811 return false; 813 return false;
812} 814}
813void OFileSelector::slotFileSelected( const QString &string ) 815void OFileSelector::slotFileSelected( const QString &string )
814{ 816{
815 if( m_shLne ) 817 if( m_shLne )
816 m_edit->setText( string ); 818 m_edit->setText( string );
817 emit fileSelected( string ); 819 emit fileSelected( string );
818} 820}
819void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) 821void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk )
820{ 822{
821 slotFileSelected( lnk.name() ); 823 slotFileSelected( lnk.name() );
822 // emit fileSelected( lnk ); 824 // emit fileSelected( lnk );
823} 825}
824 826
825 827
826void OFileSelector::slotDelete() 828void OFileSelector::slotDelete()
827{ 829{
828 /* 830 /*
829 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 831 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
830 QStringList list = QStringList::split("->", sel->text(1) ); 832 QStringList list = QStringList::split("->", sel->text(1) );
831 if( sel->isDir() ){ 833 if( sel->isDir() ){
832 QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry 834 QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry
833 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0], 835 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0],
834 tr("Yes"),tr("No"),0,1,1) ) { 836 tr("Yes"),tr("No"),0,1,1) ) {
835 case 0: 837 case 0:
836 ::system(str.utf8().data() ); 838 ::system(str.utf8().data() );
837 break; 839 break;
838 } 840 }
839 } else { 841 } else {
840 QFile::remove( list[0] ); 842 QFile::remove( list[0] );
841 } 843 }
842 m_View->takeItem( sel ); 844 m_View->takeItem( sel );
843 delete sel; 845 delete sel;
844 */ 846 */
845} 847}
846void OFileSelector::cdUP() 848void OFileSelector::cdUP()
847{ 849{
848 // FIXME won't work on non filesystem based systems 850 // FIXME won't work on non filesystem based systems
849 // better call the Olister 851 // better call the Olister
850 QDir dir( m_currentDir ); 852 QDir dir( m_currentDir );
851 dir.cdUp(); 853 dir.cdUp();
852 if(dir.exists() ){ 854 if(dir.exists() ){
853 m_currentDir = dir.absPath(); 855 m_currentDir = dir.absPath();
854 reparse(); 856 reparse();
855 int count = m_location->count(); 857 int count = m_location->count();
856 slotInsertLocationPath( m_currentDir, count); 858 slotInsertLocationPath( m_currentDir, count);
857 m_location->setCurrentItem( indexByString( m_location, m_currentDir)); 859 m_location->setCurrentItem( indexByString( m_location, m_currentDir));
858 } 860 }
859} 861}
860void OFileSelector::slotHome() 862void OFileSelector::slotHome()
861{ 863{
862 cd(QDir::homeDirPath() ); 864 cd(QDir::homeDirPath() );
863} 865}
864void OFileSelector::slotDoc() 866void OFileSelector::slotDoc()
865{ 867{
866 cd(QPEApplication::documentDir() ); 868 cd(QPEApplication::documentDir() );
867} 869}
868void OFileSelector::slotNavigate( ) 870void OFileSelector::slotNavigate( )
869{ 871{
870 872
871} 873}
872// fill the View with life 874// fill the View with life
873void OFileSelector::reparse() 875void OFileSelector::reparse()
874{ 876{
875 if( m_selector == Normal ) 877 if( m_selector == Normal )
876 return; 878 return;
877 879
878 currentView()->clear(); 880 currentView()->clear();
879 881
880 if( m_shChooser) 882 if( m_shChooser)
881 qWarning("reparse %s", m_mimeCheck->currentText().latin1() ); 883 qWarning("reparse %s", m_mimeCheck->currentText().latin1() );
882 884
883 QString currentMimeType; 885 QString currentMimeType;
884 886
885 // let's update the mimetype 887 // let's update the mimetype
886 if( m_autoMime ){ 888 if( m_autoMime ){
887 m_mimetypes.clear(); 889 m_mimetypes.clear();
888 // ok we can change mimetype so we need to be able to give a selection 890 // ok we can change mimetype so we need to be able to give a selection
889 if( m_shChooser ) { 891 if( m_shChooser ) {
890 currentMimeType = m_mimeCheck->currentText(); 892 currentMimeType = m_mimeCheck->currentText();
891 m_mimeCheck->clear(); 893 m_mimeCheck->clear();
892 894
893 // let's find possible mimetypes 895 // let's find possible mimetypes
894 m_mimetypes = currentLister()->mimeTypes( m_currentDir ); 896 m_mimetypes = currentLister()->mimeTypes( m_currentDir );
895 897
896 // add them to the chooser 898 // add them to the chooser
897 updateMimeCheck(); 899 updateMimeCheck();
898 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currentMimeType ) ); 900 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currentMimeType ) );
899 currentMimeType = m_mimeCheck->currentText(); 901 currentMimeType = m_mimeCheck->currentText();
900 } 902 }
901 }else { // no autoMime 903 }else { // no autoMime
902 // let the mimetype be set from out side the m_mimeCheck FEATURE 904 // let the mimetype be set from out side the m_mimeCheck FEATURE
903 905
904 if( m_shChooser ) 906 if( m_shChooser )
905 currentMimeType = m_mimeCheck->currentText(); 907 currentMimeType = m_mimeCheck->currentText();
906 908
907 } 909 }
908 // now we got our mimetypes we can add the files 910 // now we got our mimetypes we can add the files
909 911
910 currentLister()->reparse( m_currentDir ); 912 currentLister()->reparse( m_currentDir );
911 /* we're done with adding let's sort */ 913 /* we're done with adding let's sort */
912 currentView()->sort(); 914 currentView()->sort();
913 915
914 916
915 if( m_shTool ){ 917 if( m_shTool ){
916 m_location->insertItem( m_currentDir ); 918 m_location->insertItem( m_currentDir );
917 919
918 } 920 }
919 // reenable painting and updates 921 // reenable painting and updates
920} 922}
921/* switch lister to @param lister */ 923/* switch lister to @param lister */
922void OFileSelector::setLister(const QString& lister) { 924void OFileSelector::setLister(const QString& lister) {
923 QStringList listerList = factory()->lister(); 925 QStringList listerList = factory()->lister();
924 926
925 if (listerList.contains(lister) ) { 927 if (listerList.contains(lister) ) {
926 delete (OLister*) m_lister; 928 delete (OLister*) m_lister;
927 m_lister = factory()->lister( lister, this ); 929 m_lister = factory()->lister( lister, this );
928 }else if (!m_lister ) { 930 }else if (!m_lister ) {
929 /* 931 /*
930 * if we do not have a lister 932 * if we do not have a lister
931 * we need to take the default one 933 * we need to take the default one
932 */ 934 */
933 m_lister = new OLocalLister(this); 935 m_lister = new OLocalLister(this);
934 } 936 }
935 m_listerName = lister; 937 m_listerName = lister;
936} 938}
937void OFileSelector::setView( const QString& lis ) { 939void OFileSelector::setView( const QString& lis ) {
938 qWarning("setView "); 940 qWarning("setView ");
939 fillList(); 941 fillList();
940 if ( lis == tr("Documents") ) { 942 if ( lis == tr("Documents") ) {
941 m_selector = Normal; 943 m_selector = Normal;
942 delete m_lister; 944 delete m_lister;
943 delete m_fileView; 945 delete m_fileView;
944 m_lister = 0l; 946 m_lister = 0l;
945 m_fileView = 0l; 947 m_fileView = 0l;
946 initializeOldSelector(); 948 initializeOldSelector();
947 }else { 949 }else {
948 qWarning("lis %s", lis.latin1() ); 950 qWarning("lis %s", lis.latin1() );
949 QString list; 951 QString list;
950 952
951 delete m_lister; 953 delete m_lister;
952 delete m_fileView; 954 delete m_fileView;
953 delete m_select; 955 delete m_select;
954 m_lister =0l; 956 m_lister =0l;
955 m_fileView = 0l; 957 m_fileView = 0l;
956 m_select = 0l; 958 m_select = 0l;
957 if ( lis.startsWith("All") ) { 959 if ( lis.startsWith("All") ) {
958 m_selector = ExtendedAll; 960 m_selector = ExtendedAll;
959 list = lis.mid(4 ).stripWhiteSpace(); 961 list = lis.mid(4 ).stripWhiteSpace();
960 } else{ 962 } else{
961 list = lis; 963 list = lis;
962 m_selector = Extended; 964 m_selector = Extended;
963 } 965 }
964 setLister(m_listerName); 966 setLister(m_listerName);
965 m_fileView = factory()->view( list, this, m_mainView ); 967 m_fileView = factory()->view( list, this, m_mainView );
966 m_mainView->setWidget( m_fileView->widget() ); 968 m_mainView->setWidget( m_fileView->widget() );
967 reparse(); 969 reparse();
968 } 970 }
969} 971}
970/* 972/*
971 * the factory 973 * the factory
972 */ 974 */
973void OFileSelector::initFactory() { 975void OFileSelector::initFactory() {
974 m_fileFactory = new OFileFactory(); 976 m_fileFactory = new OFileFactory();
975 m_fileFactory->addLister(tr("Files"), newLocalLister ); 977 m_fileFactory->addLister(tr("Files"), newLocalLister );
976 m_fileFactory->addView(tr("List View"), newFileListView ); 978 m_fileFactory->addView(tr("List View"), newFileListView );
977 /* the factory is just a dummy */ 979 m_fileFactory->addView(tr("Documents"), newFileIconView );
978 m_fileFactory->addView(tr("Documents"), newFileListView );
979} 980}
981
980void OFileSelector::fillList() { 982void OFileSelector::fillList() {
981 qWarning("fill list"); 983 qWarning("fill list");
982 if (!m_viewCheck ) 984 if (!m_viewCheck )
983 return; 985 return;
984 986
985 m_viewCheck->clear(); 987 m_viewCheck->clear();
986 QStringList list = factory()->views(); 988 QStringList list = factory()->views();
987 qWarning("views: " + list.join(";") ); 989 qWarning("views: " + list.join(";") );
988 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 990 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
989 qWarning( (*it) ); 991 qWarning( (*it) );
990 if ( (*it) == tr("Documents") ) { 992 if ( (*it) == tr("Documents") ) {
991 m_viewCheck->insertItem( (*it) ); 993 m_viewCheck->insertItem( (*it) );
992 }else{ 994 }else{
993 m_viewCheck->insertItem( (*it) ); 995 m_viewCheck->insertItem( (*it) );
994 m_viewCheck->insertItem( tr("All ") + (*it) ); 996 m_viewCheck->insertItem( tr("All ") + (*it) );
995 } 997 }
996 } 998 }
997} 999}
998OFileFactory* OFileSelector::factory() { 1000OFileFactory* OFileSelector::factory() {
999 return m_fileFactory; 1001 return m_fileFactory;
1000} 1002}
1001 1003
1002 1004
1003OFileView* OFileSelector::currentView() { 1005OFileView* OFileSelector::currentView() {
1004 return m_fileView; 1006 return m_fileView;
1005} 1007}
1006OFileView* OFileSelector::currentView() const{ 1008OFileView* OFileSelector::currentView() const{
1007 return m_fileView; 1009 return m_fileView;
1008} 1010}
1009int OFileSelector::filter() { 1011int OFileSelector::filter() {
1010 int filter; 1012 int filter;
1011 if ( m_selector == ExtendedAll ) 1013 if ( m_selector == ExtendedAll )
1012 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; 1014 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All;
1013 else 1015 else
1014 filter = QDir::Files | QDir::Dirs | QDir::All ; 1016 filter = QDir::Files | QDir::Dirs | QDir::All ;
1015 1017
1016 return filter; 1018 return filter;
1017} 1019}
1018int OFileSelector::sorting() { 1020int OFileSelector::sorting() {
1019 int sort; 1021 int sort;
1020 1022
1021 if (m_case ) 1023 if (m_case )
1022 sort = ( QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed ); 1024 sort = ( QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed );
1023 else 1025 else
1024 sort = ( QDir::Name | QDir::DirsFirst | QDir::Reversed ); 1026 sort = ( QDir::Name | QDir::DirsFirst | QDir::Reversed );
1025 1027
1026 return sort; 1028 return sort;
1027} 1029}
1028void OFileSelector::internFileSelected( const QString& s) { 1030void OFileSelector::internFileSelected( const QString& s) {
1029 emit fileSelected( s ); 1031 emit fileSelected( s );
1030 DocLnk lnk( s ); 1032 DocLnk lnk( s );
1031 internFileSelected( lnk ); 1033 internFileSelected( lnk );
1032} 1034}
1033void OFileSelector::internFileSelected( const DocLnk& d ) { 1035void OFileSelector::internFileSelected( const DocLnk& d ) {
1034 emit fileSelected( d ); 1036 emit fileSelected( d );
1035} 1037}
1036void OFileSelector::internContextMenu() { 1038void OFileSelector::internContextMenu() {
1037 emit contextMenu(); 1039 emit contextMenu();
1038} 1040}
1039void OFileSelector::internChangedDir( const QString& s) { 1041void OFileSelector::internChangedDir( const QString& s) {
1040 emit dirSelected( s ); 1042 emit dirSelected( s );
1041 cd(s ); 1043 cd(s );
1042} 1044}
1043void OFileSelector::internChangedDir( const QDir& s) { 1045void OFileSelector::internChangedDir( const QDir& s) {
1044 emit dirSelected( s ); 1046 emit dirSelected( s );
1045} 1047}
1046QPixmap OFileSelector::pixmap( const QString& s ) { 1048QPixmap OFileSelector::pixmap( const QString& s ) {
1047 1049
1048 return (*m_pixmaps)[s]; 1050 return (*m_pixmaps)[s];
1049} 1051}
1050OLister* OFileSelector::currentLister()const { 1052OLister* OFileSelector::currentLister()const {
1051 return m_lister; 1053 return m_lister;
1052} 1054}
1053void OFileSelector::initializeOldSelector() { 1055void OFileSelector::initializeOldSelector() {
1054 qWarning("initializeOldSelector"); 1056 qWarning("initializeOldSelector");
1055 1057
1056 delete m_select; 1058 delete m_select;
1057 1059
1058 // we need to initialize but keep the selected mimetype 1060 // we need to initialize but keep the selected mimetype
1059 /* we default not to show close and new buttons */ 1061 /* we default not to show close and new buttons */
1060 QString mime = currentMimeType(); 1062 QString mime = currentMimeType();
1061 qWarning("MimeType " + mime ); 1063 qWarning("MimeType " + mime );
1062 m_select = new FileSelector( mime , 1064 m_select = new FileSelector( mime ,
1063 m_mainView, "fileselector", 1065 m_mainView, "fileselector",
1064 FALSE, FALSE); 1066 FALSE, FALSE);
1065 m_select->setCategorySelectVisible( FALSE ); 1067 m_select->setCategorySelectVisible( FALSE );
1066 m_select->setTypeComboVisible( FALSE ); 1068 m_select->setTypeComboVisible( FALSE );
1067 1069
1068 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), 1070 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
1069 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); 1071 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
1070 connect(m_select, SIGNAL(closeMe() ), 1072 connect(m_select, SIGNAL(closeMe() ),
1071 this, SIGNAL(closeMe() ) ); 1073 this, SIGNAL(closeMe() ) );
1072 //connect to close me and other signals as well 1074 //connect to close me and other signals as well
1073 m_mainView->setWidget( m_select ); 1075 m_mainView->setWidget( m_select );
1074} 1076}
1075/* 1077/*
1076 * initialize the listview 1078 * initialize the listview
1077 * we will call fillList 1079 * we will call fillList
1078 * setLister 1080 * setLister
1079 * with QString::null to get the default 1081 * with QString::null to get the default
1080 * setView with either Files or All Files 1082 * setView with either Files or All Files
1081 * depending on Extended 1083 * depending on Extended
1082 */ 1084 */
1083void OFileSelector::initializeView() { 1085void OFileSelector::initializeView() {
1084 setLister(QString::null); 1086 setLister(QString::null);
1085 fillList(); 1087 fillList();
1086 if (m_selector == Extended ) { 1088 if (m_selector == Extended ) {
1087 setView( tr("List View") ); 1089 setView( tr("List View") );
1088 }else{ 1090 }else{
1089 setView( tr("All List View") ); 1091 setView( tr("All List View") );
1090 } 1092 }
1091} 1093}
1092 1094
diff --git a/libopie/todayplugininterface.h b/libopie/todayplugininterface.h
index becb79c..b37a3ab 100644
--- a/libopie/todayplugininterface.h
+++ b/libopie/todayplugininterface.h
@@ -1,79 +1,85 @@
1 1
2#ifndef TODAY_PLUGIN_INTERFACE 2#ifndef TODAY_PLUGIN_INTERFACE
3#define TODAY_PLUGIN_INTERFACE 3#define TODAY_PLUGIN_INTERFACE
4 4
5#include <qpe/qcom.h> 5#include <qpe/qcom.h>
6#include "todayconfigwidget.h" 6#include "todayconfigwidget.h"
7 7
8class QString; 8class QString;
9class QWidget; 9class QWidget;
10 10
11#ifndef IID_TodayPluginInterface 11#ifndef IID_TodayPluginInterface
12#define IID_TodayPluginInterface QUuid( 0x70481804, 0x2b50, 0x4fba, 0x80, 0xbb, 0x0b, 0xf8, 0xdc, 0x72, 0x04, 0x14) 12#define IID_TodayPluginInterface QUuid( 0x70481804, 0x2b50, 0x4fba, 0x80, 0xbb, 0x0b, 0xf8, 0xdc, 0x72, 0x04, 0x14)
13#endif 13#endif
14 14
15/** 15/**
16 * 16 *
17 * 17 *
18 * 18 *
19 */ 19 */
20class TodayPluginObject { 20class TodayPluginObject {
21 21
22 Q_OBJECT 22 Q_OBJECT
23 23
24public: 24public:
25 25
26 virtual ~TodayPluginObject() {}; 26 virtual ~TodayPluginObject() {};
27 27
28 /** 28 /**
29 * The name if the plugin 29 * The name if the plugin
30 */ 30 */
31 virtual QString pluginName() const = 0; 31 virtual QString pluginName() const = 0;
32 32
33 /** 33 /**
34 * Version numbering 34 * Version numbering
35 */ 35 */
36 virtual double versionNumber() const = 0; 36 virtual double versionNumber() const = 0;
37 37
38 38
39 virtual QString pixmapNameWidget() const = 0; 39 virtual QString pixmapNameWidget() const = 0;
40 40
41 /** widget for the today view 41 /** widget for the today view
42 * It _needs_ a parent here. 42 * It _needs_ a parent here.
43 */ 43 */
44 virtual QWidget* widget( QWidget * ) = 0; 44 virtual QWidget* widget( QWidget * ) = 0;
45 45
46 /** 46 /**
47 * Pixmap used in the config widget 47 * Pixmap used in the config widget
48 */ 48 */
49 virtual QString pixmapNameConfig() const = 0; 49 virtual QString pixmapNameConfig() const = 0;
50 50
51 /** 51 /**
52 * Config plugin widget - optional 52 * Config plugin widget - optional
53 * If the plugin has a config widget, it _needs_ a parent here. 53 * If the plugin has a config widget, it _needs_ a parent here.
54 */ 54 */
55 virtual TodayConfigWidget* configWidget( QWidget * ) = 0; 55 virtual TodayConfigWidget* configWidget( QWidget * ) = 0;
56 56
57 /** 57 /**
58 * The application that should be assigned to the button (pixmap) 58 * The application that should be assigned to the button (pixmap)
59 */ 59 */
60 virtual QString appName() const = 0; 60 virtual QString appName() const = 0;
61 61
62
63 /**
64 * If the plugin should take part in the periodic refresh
65 */
66 virtual bool excludeFromRefresh() const = 0;
67
62 /** 68 /**
63 * minimum height the plugin at least should have 69 * minimum height the plugin at least should have
64 */ 70 */
65 // virtual int minHeight() const = 0; 71 // virtual int minHeight() const = 0;
66 72
67 /** 73 /**
68 * maximum height that should be used before starting scrolling 74 * maximum height that should be used before starting scrolling
69 */ 75 */
70 // virtual int maxHeight() const = 0; 76 // virtual int maxHeight() const = 0;
71 77
72}; 78};
73 79
74 80
75struct TodayPluginInterface : public QUnknownInterface { 81struct TodayPluginInterface : public QUnknownInterface {
76 virtual TodayPluginObject *guiPart() = 0; 82 virtual TodayPluginObject *guiPart() = 0;
77}; 83};
78 84
79#endif 85#endif