summaryrefslogtreecommitdiffabout
path: root/microkde
authorzautrix <zautrix>2004-10-15 14:26:07 (UTC)
committer zautrix <zautrix>2004-10-15 14:26:07 (UTC)
commit4f276d80bd977401d656851515474cc00c661e5b (patch) (unidiff)
tree0d3a747bef0431ef791b69876f5bda554f9ca83f /microkde
parentc2fb960297c4b08980921c818a4d347057732390 (diff)
downloadkdepimpi-4f276d80bd977401d656851515474cc00c661e5b.zip
kdepimpi-4f276d80bd977401d656851515474cc00c661e5b.tar.gz
kdepimpi-4f276d80bd977401d656851515474cc00c661e5b.tar.bz2
many phone and sync fixes
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/microkde.pro2
-rw-r--r--microkde/ofileselector_p.cpp7
2 files changed, 5 insertions, 4 deletions
diff --git a/microkde/microkde.pro b/microkde/microkde.pro
index 71d662b..21da158 100644
--- a/microkde/microkde.pro
+++ b/microkde/microkde.pro
@@ -1,176 +1,174 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3#INCLUDEPATH += $(QTDIR)/include . 3#INCLUDEPATH += $(QTDIR)/include .
4#DEPENDPATH += $(QTDIR)/include 4#DEPENDPATH += $(QTDIR)/include
5INCLUDEPATH += . ../ ../kabc ./kdecore ./kdeui ./kio/kfile ./kio/kio 5INCLUDEPATH += . ../ ../kabc ./kdecore ./kdeui ./kio/kfile ./kio/kio
6#LIBS += -lqtcompat 6#LIBS += -lqtcompat
7 7
8 TARGET = microkde 8 TARGET = microkde
9DESTDIR= ../bin 9DESTDIR= ../bin
10DEFINES += DESKTOP_VERSION KDE_QT_ONLY 10DEFINES += DESKTOP_VERSION KDE_QT_ONLY
11unix : { 11unix : {
12OBJECTS_DIR = obj/unix 12OBJECTS_DIR = obj/unix
13MOC_DIR = moc/unix 13MOC_DIR = moc/unix
14} 14}
15win32: { 15win32: {
16DEFINES += _WIN32_ 16DEFINES += _WIN32_
17OBJECTS_DIR = obj/win 17OBJECTS_DIR = obj/win
18MOC_DIR = moc/win 18MOC_DIR = moc/win
19} 19}
20include( ../variables.pri ) 20include( ../variables.pri )
21 21
22 22
23 23
24HEADERS = \ 24HEADERS = \
25qlayoutengine_p.h \ 25qlayoutengine_p.h \
26KDGanttMinimizeSplitter.h \ 26KDGanttMinimizeSplitter.h \
27 kapplication.h \ 27 kapplication.h \
28 kaudioplayer.h \ 28 kaudioplayer.h \
29 kcalendarsystem.h \ 29 kcalendarsystem.h \
30 kcalendarsystemgregorian.h \ 30 kcalendarsystemgregorian.h \
31 kcolorbutton.h \ 31 kcolorbutton.h \
32 kcolordialog.h \ 32 kcolordialog.h \
33 kcombobox.h \ 33 kcombobox.h \
34 kconfig.h \ 34 kconfig.h \
35 kdatetbl.h \ 35 kdatetbl.h \
36 kdebug.h \ 36 kdebug.h \
37 kdialog.h \ 37 kdialog.h \
38 kdialogbase.h \ 38 kdialogbase.h \
39 keditlistbox.h \ 39 keditlistbox.h \
40 kemailsettings.h \ 40 kemailsettings.h \
41 kfiledialog.h \ 41 kfiledialog.h \
42 kfontdialog.h \ 42 kfontdialog.h \
43 kglobal.h \ 43 kglobal.h \
44 kglobalsettings.h \ 44 kglobalsettings.h \
45 kiconloader.h \ 45 kiconloader.h \
46 klineedit.h \ 46 klineedit.h \
47 klineeditdlg.h \ 47 klineeditdlg.h \
48 kmessagebox.h \ 48 kmessagebox.h \
49 knotifyclient.h \ 49 knotifyclient.h \
50 kprinter.h \ 50 kprinter.h \
51 kprocess.h \ 51 kprocess.h \
52 krestrictedline.h \ 52 krestrictedline.h \
53 krun.h \ 53 krun.h \
54 ksimpleconfig.h \ 54 ksimpleconfig.h \
55 kstaticdeleter.h \ 55 kstaticdeleter.h \
56 ksystemtray.h \ 56 ksystemtray.h \
57 ktempfile.h \ 57 ktempfile.h \
58 ktextedit.h \ 58 ktextedit.h \
59 kunload.h \ 59 kunload.h \
60 kurl.h \ 60 kurl.h \
61 kdeui/kguiitem.h \ 61 kdeui/kguiitem.h \
62 kdeui/kcmodule.h \ 62 kdeui/kcmodule.h \
63 kdeui/kbuttonbox.h \ 63 kdeui/kbuttonbox.h \
64 kdeui/klistbox.h \ 64 kdeui/klistbox.h \
65 kdeui/klistview.h \ 65 kdeui/klistview.h \
66 kdeui/kjanuswidget.h \ 66 kdeui/kjanuswidget.h \
67 kdeui/kseparator.h \ 67 kdeui/kseparator.h \
68 kdeui/knuminput.h \ 68 kdeui/knuminput.h \
69 kdeui/knumvalidator.h \ 69 kdeui/knumvalidator.h \
70 kdeui/ksqueezedtextlabel.h \ 70 kdeui/ksqueezedtextlabel.h \
71 kio/job.h \ 71 kio/job.h \
72 kio/kio/kdirwatch.h \ 72 kio/kio/kdirwatch.h \
73 kio/kio/kdirwatch_p.h \ 73 kio/kio/kdirwatch_p.h \
74 kio/kfile/kurlrequester.h \ 74 kio/kfile/kurlrequester.h \
75 kresources/resource.h \ 75 kresources/resource.h \
76 kresources/factory.h \ 76 kresources/factory.h \
77 kresources/managerimpl.h \ 77 kresources/managerimpl.h \
78 kresources/manager.h \ 78 kresources/manager.h \
79 kresources/selectdialog.h \ 79 kresources/selectdialog.h \
80 kresources/configpage.h \ 80 kresources/configpage.h \
81 kresources/configwidget.h \ 81 kresources/configwidget.h \
82 kresources/configdialog.h \ 82 kresources/configdialog.h \
83 kresources/kcmkresources.h \ 83 kresources/kcmkresources.h \
84 kresources/syncwidget.h \
85 kdecore/kmdcodec.h \ 84 kdecore/kmdcodec.h \
86 kdecore/kconfigbase.h \ 85 kdecore/kconfigbase.h \
87 kdecore/klocale.h \ 86 kdecore/klocale.h \
88 kdecore/kcatalogue.h \ 87 kdecore/kcatalogue.h \
89 kdecore/ksharedptr.h \ 88 kdecore/ksharedptr.h \
90 kdecore/kshell.h \ 89 kdecore/kshell.h \
91 kdecore/kstandarddirs.h \ 90 kdecore/kstandarddirs.h \
92 kdecore/kstringhandler.h \ 91 kdecore/kstringhandler.h \
93 kdecore/kshortcut.h \ 92 kdecore/kshortcut.h \
94 kutils/kcmultidialog.h \ 93 kutils/kcmultidialog.h \
95 kdeui/kxmlguiclient.h \ 94 kdeui/kxmlguiclient.h \
96 kdeui/kstdaction.h \ 95 kdeui/kstdaction.h \
97 kdeui/kmainwindow.h \ 96 kdeui/kmainwindow.h \
98 kdeui/ktoolbar.h \ 97 kdeui/ktoolbar.h \
99 kdeui/ktoolbarbutton.h \ 98 kdeui/ktoolbarbutton.h \
100 kdeui/ktoolbarhandler.h \ 99 kdeui/ktoolbarhandler.h \
101 kdeui/kaction.h \ 100 kdeui/kaction.h \
102 kdeui/kactionclasses.h \ 101 kdeui/kactionclasses.h \
103 kdeui/kactioncollection.h \ 102 kdeui/kactioncollection.h \
104 kdecore/kprefs.h \ 103 kdecore/kprefs.h \
105 kdecore/klibloader.h \ 104 kdecore/klibloader.h \
106 kidmanager.h 105 kidmanager.h
107 106
108 107
109# kdecore/klibloader.h \ 108# kdecore/klibloader.h \
110 109
111 110
112SOURCES = \ 111SOURCES = \
113KDGanttMinimizeSplitter.cpp \ 112KDGanttMinimizeSplitter.cpp \
114 kapplication.cpp \ 113 kapplication.cpp \
115 kcalendarsystem.cpp \ 114 kcalendarsystem.cpp \
116 kcalendarsystemgregorian.cpp \ 115 kcalendarsystemgregorian.cpp \
117 kcolorbutton.cpp \ 116 kcolorbutton.cpp \
118 kcolordialog.cpp \ 117 kcolordialog.cpp \
119 kconfig.cpp \ 118 kconfig.cpp \
120 kdatetbl.cpp \ 119 kdatetbl.cpp \
121 kdialog.cpp \ 120 kdialog.cpp \
122 kdialogbase.cpp \ 121 kdialogbase.cpp \
123 keditlistbox.cpp \ 122 keditlistbox.cpp \
124 kemailsettings.cpp \ 123 kemailsettings.cpp \
125 kfontdialog.cpp \ 124 kfontdialog.cpp \
126 kfiledialog.cpp \ 125 kfiledialog.cpp \
127 kglobal.cpp \ 126 kglobal.cpp \
128 kglobalsettings.cpp \ 127 kglobalsettings.cpp \
129 kiconloader.cpp \ 128 kiconloader.cpp \
130 kmessagebox.cpp \ 129 kmessagebox.cpp \
131 ktextedit.cpp \ 130 ktextedit.cpp \
132 kprocess.cpp \ 131 kprocess.cpp \
133 krun.cpp \ 132 krun.cpp \
134 ksystemtray.cpp \ 133 ksystemtray.cpp \
135 ktempfile.cpp \ 134 ktempfile.cpp \
136 kurl.cpp \ 135 kurl.cpp \
137 kdecore/kcatalogue.cpp \ 136 kdecore/kcatalogue.cpp \
138 kdecore/klocale.cpp \ 137 kdecore/klocale.cpp \
139 kdecore/kmdcodec.cpp \ 138 kdecore/kmdcodec.cpp \
140 kdecore/kshell.cpp \ 139 kdecore/kshell.cpp \
141 kdecore/kstandarddirs.cpp \ 140 kdecore/kstandarddirs.cpp \
142 kdecore/kstringhandler.cpp \ 141 kdecore/kstringhandler.cpp \
143 kdeui/kbuttonbox.cpp \ 142 kdeui/kbuttonbox.cpp \
144 kdeui/kcmodule.cpp \ 143 kdeui/kcmodule.cpp \
145 kdeui/kguiitem.cpp \ 144 kdeui/kguiitem.cpp \
146 kdeui/kjanuswidget.cpp \ 145 kdeui/kjanuswidget.cpp \
147 kdeui/klistbox.cpp \ 146 kdeui/klistbox.cpp \
148 kdeui/klistview.cpp \ 147 kdeui/klistview.cpp \
149 kdeui/knuminput.cpp \ 148 kdeui/knuminput.cpp \
150 kdeui/knumvalidator.cpp \ 149 kdeui/knumvalidator.cpp \
151 kdeui/kseparator.cpp \ 150 kdeui/kseparator.cpp \
152 kdeui/ksqueezedtextlabel.cpp \ 151 kdeui/ksqueezedtextlabel.cpp \
153 kio/kio/kdirwatch.cpp \ 152 kio/kio/kdirwatch.cpp \
154 kio/kfile/kurlrequester.cpp \ 153 kio/kfile/kurlrequester.cpp \
155 kresources/configpage.cpp \ 154 kresources/configpage.cpp \
156 kresources/configdialog.cpp \ 155 kresources/configdialog.cpp \
157 kresources/configwidget.cpp \ 156 kresources/configwidget.cpp \
158 kresources/factory.cpp \ 157 kresources/factory.cpp \
159 kresources/kcmkresources.cpp \ 158 kresources/kcmkresources.cpp \
160 kresources/managerimpl.cpp \ 159 kresources/managerimpl.cpp \
161 kresources/resource.cpp \ 160 kresources/resource.cpp \
162 kresources/selectdialog.cpp \ 161 kresources/selectdialog.cpp \
163 kresources/syncwidget.cpp \
164 kutils/kcmultidialog.cpp \ 162 kutils/kcmultidialog.cpp \
165 kdeui/kaction.cpp \ 163 kdeui/kaction.cpp \
166 kdeui/kactionclasses.cpp \ 164 kdeui/kactionclasses.cpp \
167 kdeui/kactioncollection.cpp \ 165 kdeui/kactioncollection.cpp \
168 kdeui/kmainwindow.cpp \ 166 kdeui/kmainwindow.cpp \
169 kdeui/ktoolbar.cpp \ 167 kdeui/ktoolbar.cpp \
170 kdeui/ktoolbarbutton.cpp \ 168 kdeui/ktoolbarbutton.cpp \
171 kdeui/ktoolbarhandler.cpp \ 169 kdeui/ktoolbarhandler.cpp \
172 kdeui/kstdaction.cpp \ 170 kdeui/kstdaction.cpp \
173 kdeui/kxmlguiclient.cpp \ 171 kdeui/kxmlguiclient.cpp \
174 kdecore/kprefs.cpp \ 172 kdecore/kprefs.cpp \
175 kdecore/klibloader.cpp \ 173 kdecore/klibloader.cpp \
176 kidmanager.cpp 174 kidmanager.cpp
diff --git a/microkde/ofileselector_p.cpp b/microkde/ofileselector_p.cpp
index cf6074d..fd5f965 100644
--- a/microkde/ofileselector_p.cpp
+++ b/microkde/ofileselector_p.cpp
@@ -1,214 +1,216 @@
1#include <qcombobox.h> 1#include <qcombobox.h>
2#include <qdir.h> 2#include <qdir.h>
3#include <qhbox.h> 3#include <qhbox.h>
4#include <qheader.h> 4#include <qheader.h>
5#include <qlabel.h> 5#include <qlabel.h>
6#include <qlayout.h> 6#include <qlayout.h>
7#include <qlineedit.h> 7#include <qlineedit.h>
8#include <qlistview.h> 8#include <qlistview.h>
9#include <qpopupmenu.h> 9#include <qpopupmenu.h>
10#include <qwidgetstack.h> 10#include <qwidgetstack.h>
11#include <qregexp.h> 11#include <qregexp.h>
12#include <qobjectlist.h> 12#include <qobjectlist.h>
13 13
14/* hacky but we need to get FileSelector::filter */ 14/* hacky but we need to get FileSelector::filter */
15#define private public 15#define private public
16#include <qpe/fileselector.h> 16#include <qpe/fileselector.h>
17#undef private 17#undef private
18 18
19#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
20#include <qpe/mimetype.h> 20#include <qpe/mimetype.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/storage.h> 22#include <qpe/storage.h>
23#include <kglobal.h>
24#include <klocale.h>
23 25
24#include "ofileselector_p.h" 26#include "ofileselector_p.h"
25//US#include "ofileselector.h" 27//US#include "ofileselector.h"
26 28
27#include "klocale.h" 29#include "klocale.h"
28 30
29OFileViewInterface::OFileViewInterface( OFileSelector* selector ) 31OFileViewInterface::OFileViewInterface( OFileSelector* selector )
30 : m_selector( selector ) { 32 : m_selector( selector ) {
31} 33}
32OFileViewInterface::~OFileViewInterface() { 34OFileViewInterface::~OFileViewInterface() {
33} 35}
34QString OFileViewInterface::name()const{ 36QString OFileViewInterface::name()const{
35 return m_name; 37 return m_name;
36} 38}
37void OFileViewInterface::setName( const QString& name ) { 39void OFileViewInterface::setName( const QString& name ) {
38 m_name = name; 40 m_name = name;
39} 41}
40OFileSelector* OFileViewInterface::selector()const { 42OFileSelector* OFileViewInterface::selector()const {
41 return m_selector; 43 return m_selector;
42} 44}
43 45
44DocLnk OFileViewInterface::selectedDocument()const { 46DocLnk OFileViewInterface::selectedDocument()const {
45 return DocLnk( selectedName() ); 47 return DocLnk( selectedName() );
46} 48}
47 49
48bool OFileViewInterface::showNew()const { 50bool OFileViewInterface::showNew()const {
49 return selector()->showNew(); 51 return selector()->showNew();
50} 52}
51bool OFileViewInterface::showClose()const { 53bool OFileViewInterface::showClose()const {
52 return selector()->showClose(); 54 return selector()->showClose();
53} 55}
54MimeTypes OFileViewInterface::mimeTypes()const { 56MimeTypes OFileViewInterface::mimeTypes()const {
55 return selector()->mimeTypes(); 57 return selector()->mimeTypes();
56} 58}
57QStringList OFileViewInterface::currentMimeType()const { 59QStringList OFileViewInterface::currentMimeType()const {
58 return selector()->currentMimeType(); 60 return selector()->currentMimeType();
59} 61}
60void OFileViewInterface::activate( const QString& ) { 62void OFileViewInterface::activate( const QString& ) {
61 // not implemented here 63 // not implemented here
62} 64}
63void OFileViewInterface::ok() { 65void OFileViewInterface::ok() {
64 emit selector()->ok(); 66 emit selector()->ok();
65} 67}
66void OFileViewInterface::cancel() { 68void OFileViewInterface::cancel() {
67 emit selector()->cancel(); 69 emit selector()->cancel();
68} 70}
69void OFileViewInterface::closeMe() { 71void OFileViewInterface::closeMe() {
70 emit selector()->closeMe(); 72 emit selector()->closeMe();
71} 73}
72void OFileViewInterface::fileSelected( const QString& str) { 74void OFileViewInterface::fileSelected( const QString& str) {
73 emit selector()->fileSelected( str); 75 emit selector()->fileSelected( str);
74} 76}
75void OFileViewInterface::fileSelected( const DocLnk& lnk) { 77void OFileViewInterface::fileSelected( const DocLnk& lnk) {
76 emit selector()->fileSelected( lnk ); 78 emit selector()->fileSelected( lnk );
77} 79}
78void OFileViewInterface::setCurrentFileName( const QString& str ) { 80void OFileViewInterface::setCurrentFileName( const QString& str ) {
79 selector()->m_lneEdit->setText( str ); 81 selector()->m_lneEdit->setText( str );
80} 82}
81QString OFileViewInterface::currentFileName()const{ 83QString OFileViewInterface::currentFileName()const{
82 return selector()->m_lneEdit->text(); 84 return selector()->m_lneEdit->text();
83} 85}
84QString OFileViewInterface::startDirectory()const{ 86QString OFileViewInterface::startDirectory()const{
85 return selector()->m_startDir; 87 return selector()->m_startDir;
86} 88}
87 89
88 90
89ODocumentFileView::ODocumentFileView( OFileSelector* selector ) 91ODocumentFileView::ODocumentFileView( OFileSelector* selector )
90 : OFileViewInterface( selector ) { 92 : OFileViewInterface( selector ) {
91 m_selector = 0; 93 m_selector = 0;
92 setName( i18n("Documents") ); 94 setName( i18n("Documents") );
93} 95}
94ODocumentFileView::~ODocumentFileView() { 96ODocumentFileView::~ODocumentFileView() {
95 97
96} 98}
97QString ODocumentFileView::selectedName()const { 99QString ODocumentFileView::selectedName()const {
98 if (!m_selector) 100 if (!m_selector)
99 return QString::null; 101 return QString::null;
100 102
101 return m_selector->selected()->file(); 103 return m_selector->selected()->file();
102} 104}
103QString ODocumentFileView::selectedPath()const { 105QString ODocumentFileView::selectedPath()const {
104 return QPEApplication::documentDir(); 106 return QPEApplication::documentDir();
105} 107}
106QString ODocumentFileView::directory()const { 108QString ODocumentFileView::directory()const {
107 return selectedPath(); 109 return selectedPath();
108} 110}
109void ODocumentFileView::reread() { 111void ODocumentFileView::reread() {
110 if (!m_selector) 112 if (!m_selector)
111 return; 113 return;
112 114
113 m_selector->setNewVisible( showNew() ); 115 m_selector->setNewVisible( showNew() );
114 m_selector->setCloseVisible( showClose() ); 116 m_selector->setCloseVisible( showClose() );
115 m_selector->filter = currentMimeType().join(";"); 117 m_selector->filter = currentMimeType().join(";");
116 m_selector->reread(); 118 m_selector->reread();
117} 119}
118int ODocumentFileView::fileCount()const { 120int ODocumentFileView::fileCount()const {
119 if (!m_selector) 121 if (!m_selector)
120 return -1; 122 return -1;
121 123
122 return m_selector->fileCount(); 124 return m_selector->fileCount();
123} 125}
124 126
125DocLnk ODocumentFileView::selectedDocument()const { 127DocLnk ODocumentFileView::selectedDocument()const {
126 if (!m_selector) 128 if (!m_selector)
127 return DocLnk(); 129 return DocLnk();
128 DocLnk lnk = *m_selector->selected(); 130 DocLnk lnk = *m_selector->selected();
129 return lnk; 131 return lnk;
130} 132}
131 133
132QWidget* ODocumentFileView::widget( QWidget* parent ) { 134QWidget* ODocumentFileView::widget( QWidget* parent ) {
133 if (!m_selector ) { 135 if (!m_selector ) {
134 m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); 136 m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() );
135 QObject::connect(m_selector, SIGNAL(fileSelected( const DocLnk& ) ), 137 QObject::connect(m_selector, SIGNAL(fileSelected( const DocLnk& ) ),
136 selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); 138 selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) );
137 QObject::connect(m_selector, SIGNAL(closeMe() ), 139 QObject::connect(m_selector, SIGNAL(closeMe() ),
138 selector(), SIGNAL(closeMe() ) ); 140 selector(), SIGNAL(closeMe() ) );
139 QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk& ) ), 141 QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk& ) ),
140 selector(), SIGNAL(newSelected(const DocLnk& ) ) ); 142 selector(), SIGNAL(newSelected(const DocLnk& ) ) );
141 } 143 }
142 144
143 return m_selector; 145 return m_selector;
144} 146}
145 147
146/* 148/*
147 * This is the file system view used 149 * This is the file system view used
148 * we use a QListView + QListViewItems for it 150 * we use a QListView + QListViewItems for it
149 */ 151 */
150 152
151OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, 153OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap,
152 const QString& path, const QString& date, 154 const QString& path, const QString& date,
153 const QString& size, const QString& dir, 155 const QString& size, const QString& dir,
154 bool isLocked, bool isDir ) 156 bool isLocked, bool isDir )
155 : QListViewItem( view ) 157 : QListViewItem( view )
156{ 158{
157 setPixmap(0, pixmap ); 159 setPixmap(0, pixmap );
158 setText(1, path ); 160 setText(1, path );
159 setText(2, size ); 161 setText(2, size );
160 setText(3, date ); 162 setText(3, date );
161 m_isDir = isDir; 163 m_isDir = isDir;
162 m_dir = dir; 164 m_dir = dir;
163 m_locked = isLocked; 165 m_locked = isLocked;
164} 166}
165OFileSelectorItem::~OFileSelectorItem() { 167OFileSelectorItem::~OFileSelectorItem() {
166 168
167} 169}
168bool OFileSelectorItem::isLocked()const { 170bool OFileSelectorItem::isLocked()const {
169 return m_locked; 171 return m_locked;
170} 172}
171QString OFileSelectorItem::directory()const { 173QString OFileSelectorItem::directory()const {
172 return m_dir; 174 return m_dir;
173} 175}
174bool OFileSelectorItem::isDir()const { 176bool OFileSelectorItem::isDir()const {
175 return m_isDir; 177 return m_isDir;
176} 178}
177QString OFileSelectorItem::path()const { 179QString OFileSelectorItem::path()const {
178 return text( 1 ); 180 return text( 1 );
179} 181}
180QString OFileSelectorItem::key( int id, bool )const { 182QString OFileSelectorItem::key( int id, bool )const {
181 QString ke; 183 QString ke;
182 if( id == 0 || id == 1 ){ // name 184 if( id == 0 || id == 1 ){ // name
183 if( m_isDir ){ 185 if( m_isDir ){
184 ke.append("0" ); 186 ke.append("0" );
185 ke.append( text(1) ); 187 ke.append( text(1) );
186 }else{ 188 }else{
187 ke.append("1" ); 189 ke.append("1" );
188 ke.append( text(1) ); 190 ke.append( text(1) );
189 } 191 }
190 return ke; 192 return ke;
191 }else 193 }else
192 return text( id ); 194 return text( id );
193 195
194} 196}
195 197
196OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, 198OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir,
197 OFileSelector* sel) 199 OFileSelector* sel)
198 : QWidget( parent ), m_sel( sel ) { 200 : QWidget( parent ), m_sel( sel ) {
199 m_all = false; 201 m_all = false;
200 QVBoxLayout* lay = new QVBoxLayout( this ); 202 QVBoxLayout* lay = new QVBoxLayout( this );
201 m_currentDir = startDir; 203 m_currentDir = startDir;
202 204
203 /* 205 /*
204 * now we add a special bar 206 * now we add a special bar
205 * One Button For Up 207 * One Button For Up
206 * Home 208 * Home
207 * Doc 209 * Doc
208 * And a dropdown menu with FileSystems 210 * And a dropdown menu with FileSystems
209 * FUTURE: one to change dir with lineedit 211 * FUTURE: one to change dir with lineedit
210 * Bookmarks 212 * Bookmarks
211 * Create Dir 213 * Create Dir
212 */ 214 */
213 QHBox* box = new QHBox(this ); 215 QHBox* box = new QHBox(this );
214 box->setBackgroundMode( PaletteButton ); 216 box->setBackgroundMode( PaletteButton );
@@ -278,405 +280,406 @@ OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& st
278 280
279 281
280 m_view->setSorting( 1 ); 282 m_view->setSorting( 1 );
281 m_view->setAllColumnsShowFocus( TRUE ); 283 m_view->setAllColumnsShowFocus( TRUE );
282 284
283 lay->addWidget( m_view, 1000 ); 285 lay->addWidget( m_view, 1000 );
284 connectSlots(); 286 connectSlots();
285} 287}
286OFileViewFileListView::~OFileViewFileListView() { 288OFileViewFileListView::~OFileViewFileListView() {
287} 289}
288void OFileViewFileListView::slotNew() { 290void OFileViewFileListView::slotNew() {
289 DocLnk lnk; 291 DocLnk lnk;
290 emit selector()->newSelected( lnk ); 292 emit selector()->newSelected( lnk );
291} 293}
292OFileSelectorItem* OFileViewFileListView::currentItem()const{ 294OFileSelectorItem* OFileViewFileListView::currentItem()const{
293 QListViewItem* item = m_view->currentItem(); 295 QListViewItem* item = m_view->currentItem();
294 if (!item ) 296 if (!item )
295 return 0l; 297 return 0l;
296 298
297 return static_cast<OFileSelectorItem*>(item); 299 return static_cast<OFileSelectorItem*>(item);
298} 300}
299void OFileViewFileListView::reread( bool all ) { 301void OFileViewFileListView::reread( bool all ) {
300 m_view->clear(); 302 m_view->clear();
301 303
302 if (selector()->showClose() ) 304 if (selector()->showClose() )
303 m_btnClose->show(); 305 m_btnClose->show();
304 else 306 else
305 m_btnClose->hide(); 307 m_btnClose->hide();
306 308
307 if (selector()->showNew() ) 309 if (selector()->showNew() )
308 m_btnNew->show(); 310 m_btnNew->show();
309 else 311 else
310 m_btnNew->hide(); 312 m_btnNew->hide();
311 313
312 m_mimes = selector()->currentMimeType(); 314 m_mimes = selector()->currentMimeType();
313 m_all = all; 315 m_all = all;
314 316
315 QDir dir( m_currentDir ); 317 QDir dir( m_currentDir );
316 if (!dir.exists() ) 318 if (!dir.exists() )
317 return; 319 return;
318 topLevelWidget()->setCaption( dir.path() ); 320 topLevelWidget()->setCaption( dir.path() );
319 dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed ); 321 dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed );
320 int filter; 322 int filter;
321 if (m_all ) 323 if (m_all )
322 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; 324 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All;
323 else 325 else
324 filter = QDir::Files | QDir::Dirs | QDir::All; 326 filter = QDir::Files | QDir::Dirs | QDir::All;
325 dir.setFilter( filter ); 327 dir.setFilter( filter );
326 328
327 // now go through all files 329 // now go through all files
328 const QFileInfoList *list = dir.entryInfoList(); 330 const QFileInfoList *list = dir.entryInfoList();
329 if (!list) { 331 if (!list) {
330 cdUP(); 332 cdUP();
331 return; 333 return;
332 } 334 }
333 QFileInfoListIterator it( *list ); 335 QFileInfoListIterator it( *list );
334 QFileInfo *fi; 336 QFileInfo *fi;
335 while( (fi=it.current() ) ){ 337 while( (fi=it.current() ) ){
336 if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){ 338 if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){
337 ++it; 339 ++it;
338 continue; 340 continue;
339 } 341 }
340 342
341 /* 343 /*
342 * It is a symlink we try to resolve it now but don't let us attack by DOS 344 * It is a symlink we try to resolve it now but don't let us attack by DOS
343 * 345 *
344 */ 346 */
345 if( fi->isSymLink() ){ 347 if( fi->isSymLink() ){
346 QString file = fi->dirPath( true ) + "/" + fi->readLink(); 348 QString file = fi->dirPath( true ) + "/" + fi->readLink();
347 for( int i = 0; i<=4; i++) { // 5 tries to prevent dos 349 for( int i = 0; i<=4; i++) { // 5 tries to prevent dos
348 QFileInfo info( file ); 350 QFileInfo info( file );
349 if( !info.exists() ){ 351 if( !info.exists() ){
350 addSymlink( fi, TRUE ); 352 addSymlink( fi, TRUE );
351 break; 353 break;
352 }else if( info.isDir() ){ 354 }else if( info.isDir() ){
353 addDir( fi, TRUE ); 355 addDir( fi, TRUE );
354 break; 356 break;
355 }else if( info.isFile() ){ 357 }else if( info.isFile() ){
356 addFile( fi, TRUE ); 358 addFile( fi, TRUE );
357 break; 359 break;
358 }else if( info.isSymLink() ){ 360 }else if( info.isSymLink() ){
359 file = info.dirPath(true ) + "/" + info.readLink() ; 361 file = info.dirPath(true ) + "/" + info.readLink() ;
360 break; 362 break;
361 }else if( i == 4){ // couldn't resolve symlink add it as symlink 363 }else if( i == 4){ // couldn't resolve symlink add it as symlink
362 addSymlink( fi ); 364 addSymlink( fi );
363 } 365 }
364 } // off for loop for symlink resolving 366 } // off for loop for symlink resolving
365 }else if( fi->isDir() ) 367 }else if( fi->isDir() )
366 addDir( fi ); 368 addDir( fi );
367 else if( fi->isFile() ) 369 else if( fi->isFile() )
368 addFile( fi ); 370 addFile( fi );
369 371
370 ++it; 372 ++it;
371 } // of while loop 373 } // of while loop
372 m_view->sort(); 374 m_view->sort();
373 375
374} 376}
375int OFileViewFileListView::fileCount()const{ 377int OFileViewFileListView::fileCount()const{
376 return m_view->childCount(); 378 return m_view->childCount();
377} 379}
378QString OFileViewFileListView::currentDir()const{ 380QString OFileViewFileListView::currentDir()const{
379 return m_currentDir; 381 return m_currentDir;
380} 382}
381OFileSelector* OFileViewFileListView::selector() { 383OFileSelector* OFileViewFileListView::selector() {
382 return m_sel; 384 return m_sel;
383} 385}
384 386
385bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) { 387bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) {
386 if ( e->type() == QEvent::KeyPress ) { 388 if ( e->type() == QEvent::KeyPress ) {
387 QKeyEvent *k = (QKeyEvent *)e; 389 QKeyEvent *k = (QKeyEvent *)e;
388 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) { 390 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) {
389 slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); 391 slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0);
390 return true; 392 return true;
391 } 393 }
392 } 394 }
393 return false; 395 return false;
394} 396}
395 397
396 398
397void OFileViewFileListView::connectSlots() { 399void OFileViewFileListView::connectSlots() {
398 connect(m_view, SIGNAL(clicked(QListViewItem*) ), 400 connect(m_view, SIGNAL(clicked(QListViewItem*) ),
399 this, SLOT(slotCurrentChanged(QListViewItem*) ) ); 401 this, SLOT(slotCurrentChanged(QListViewItem*) ) );
400 connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ), 402 connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ),
401 this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) ); 403 this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) );
402} 404}
403void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) { 405void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) {
404 if (!item) 406 if (!item)
405 return; 407 return;
406#if 0 408#if 0
407 409
408 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 410 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
409 411
410 if (!sel->isDir() ) { 412 if (!sel->isDir() ) {
411 selector()->m_lneEdit->setText( sel->text(1) ); 413 selector()->m_lneEdit->setText( sel->text(1) );
412 // if in fileselector mode we will emit selected 414 // if in fileselector mode we will emit selected
413 if ( selector()->mode() == OFileSelector::FileSelector ) { 415 if ( selector()->mode() == OFileSelector::FileSelector ) {
414 qWarning("slot Current Changed"); 416 qWarning("slot Current Changed");
415 QStringList str = QStringList::split("->", sel->text(1) ); 417 QStringList str = QStringList::split("->", sel->text(1) );
416 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 418 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
417 emit selector()->fileSelected( path ); 419 emit selector()->fileSelected( path );
418 DocLnk lnk( path ); 420 DocLnk lnk( path );
419 emit selector()->fileSelected( lnk ); 421 emit selector()->fileSelected( lnk );
420 } 422 }
421 } 423 }
422#endif 424#endif
423} 425}
424void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) { 426void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) {
425 if (!item || ( button != Qt::LeftButton) ) 427 if (!item || ( button != Qt::LeftButton) )
426 return; 428 return;
427 429
428 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 430 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
429 if (!sel->isLocked() ) { 431 if (!sel->isLocked() ) {
430 QStringList str = QStringList::split("->", sel->text(1) ); 432 QStringList str = QStringList::split("->", sel->text(1) );
431 if (sel->isDir() ) { 433 if (sel->isDir() ) {
432 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); 434 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace();
433 emit selector()->dirSelected( m_currentDir ); 435 emit selector()->dirSelected( m_currentDir );
434 reread( m_all ); 436 reread( m_all );
435 }else { // file 437 }else { // file
436 qWarning("slot Clicked"); 438 qWarning("slot Clicked");
437 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); 439 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() );
438 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 440 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
439 emit selector()->fileSelected( path ); 441 emit selector()->fileSelected( path );
440 DocLnk lnk( path ); 442 DocLnk lnk( path );
441 emit selector()->fileSelected( lnk ); 443 emit selector()->fileSelected( lnk );
442 } 444 }
443 } // not locked 445 } // not locked
444} 446}
445void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) { 447void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) {
446 MimeType type( info->absFilePath() ); 448 MimeType type( info->absFilePath() );
447 if (!compliesMime( type.id() ) ) 449 if (!compliesMime( type.id() ) )
448 return; 450 return;
449 451
450 QPixmap pix = type.pixmap(); 452 QPixmap pix = type.pixmap();
451 QString dir, name; bool locked; 453 QString dir, name; bool locked;
452 if ( pix.isNull() ) { 454 if ( pix.isNull() ) {
453 QWMatrix matrix; 455 QWMatrix matrix;
454 QPixmap pixer(Resource::loadPixmap("UnknownDocument") ); 456 QPixmap pixer(Resource::loadPixmap("UnknownDocument") );
455 matrix.scale( .4, .4 ); 457 matrix.scale( .4, .4 );
456 pix = pixer.xForm( matrix ); 458 pix = pixer.xForm( matrix );
457 } 459 }
458 dir = info->dirPath( true ); 460 dir = info->dirPath( true );
459 locked = false; 461 locked = false;
460 if ( symlink ) 462 if ( symlink )
461 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); 463 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink();
462 else{ 464 else{
463 name = info->fileName(); 465 name = info->fileName();
464 if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || 466 if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) ||
465 ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) { 467 ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) {
466 locked = true; pix = Resource::loadPixmap("locked"); 468 locked = true; pix = Resource::loadPixmap("locked");
467 } 469 }
468 } 470 }
469 (void)new OFileSelectorItem( m_view, pix, name, 471 (void)new OFileSelectorItem( m_view, pix, name,
470 info->lastModified().toString(), QString::number( info->size() ), 472 KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate),
473 QString::number( info->size() ),
471 dir, locked ); 474 dir, locked );
472} 475}
473void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) { 476void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) {
474 bool locked = false; QString name; QPixmap pix; 477 bool locked = false; QString name; QPixmap pix;
475 478
476 if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) || 479 if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) ||
477 ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) { 480 ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) {
478 locked = true; 481 locked = true;
479 if ( symlink ) 482 if ( symlink )
480 pix = Resource::loadPixmap( "symlink" ); 483 pix = Resource::loadPixmap( "symlink" );
481 else 484 else
482 pix = Resource::loadPixmap( "lockedfolder" ); 485 pix = Resource::loadPixmap( "lockedfolder" );
483 }else 486 }else
484 pix = symlink ? Resource::loadPixmap( "symlink") : Resource::loadPixmap("folder"); 487 pix = symlink ? Resource::loadPixmap( "symlink") : Resource::loadPixmap("folder");
485 488
486 name = symlink ? info->fileName() + " -> " + info->dirPath(true) + "/" + info->readLink() : 489 name = symlink ? info->fileName() + " -> " + info->dirPath(true) + "/" + info->readLink() :
487 info->fileName(); 490 info->fileName();
488 491
489 (void)new OFileSelectorItem( m_view, pix, name, 492 (void)new OFileSelectorItem( m_view, pix, name,
490 info->lastModified().toString(), 493 KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate),
491 QString::number( info->size() ), 494 QString::number( info->size() ),
492 info->dirPath( true ), locked, true ); 495 info->dirPath( true ), locked, true );
493 496
494 497
495} 498}
496void OFileViewFileListView::addSymlink( QFileInfo* , bool ) { 499void OFileViewFileListView::addSymlink( QFileInfo* , bool ) {
497 500
498} 501}
499void OFileViewFileListView::cdUP() { 502void OFileViewFileListView::cdUP() {
500 QDir dir( m_currentDir ); 503 QDir dir( m_currentDir );
501 dir.cdUp(); 504 dir.cdUp();
502 505
503 if (!dir.exists() ) 506 if (!dir.exists() )
504 m_currentDir = "/"; 507 m_currentDir = "/";
505 else 508 else
506 m_currentDir = dir.absPath(); 509 m_currentDir = dir.absPath();
507 510
508 emit selector()->dirSelected( m_currentDir ); 511 emit selector()->dirSelected( m_currentDir );
509 reread( m_all ); 512 reread( m_all );
510} 513}
511void OFileViewFileListView::cdHome() { 514void OFileViewFileListView::cdHome() {
512 m_currentDir = QDir::homeDirPath(); 515 m_currentDir = QDir::homeDirPath();
513 emit selector()->dirSelected( m_currentDir ); 516 emit selector()->dirSelected( m_currentDir );
514 reread( m_all ); 517 reread( m_all );
515} 518}
516void OFileViewFileListView::cdDoc() { 519void OFileViewFileListView::cdDoc() {
517 m_currentDir = QPEApplication::documentDir(); 520 m_currentDir = QPEApplication::documentDir();
518 emit selector()->dirSelected( m_currentDir ); 521 emit selector()->dirSelected( m_currentDir );
519 reread( m_all ); 522 reread( m_all );
520} 523}
521void OFileViewFileListView::changeDir( const QString& dir ) { 524void OFileViewFileListView::changeDir( const QString& dir ) {
522 m_currentDir = dir; 525 m_currentDir = dir;
523 emit selector()->dirSelected( m_currentDir ); 526 emit selector()->dirSelected( m_currentDir );
524 reread( m_all ); 527 reread( m_all );
525} 528}
526void OFileViewFileListView::slotFSActivated( int id ) { 529void OFileViewFileListView::slotFSActivated( int id ) {
527 changeDir ( m_dev[m_fsPop->text(id)] ); 530 changeDir ( m_dev[m_fsPop->text(id)] );
528} 531}
529 532
530/* check if the mimetype in mime 533/* check if the mimetype in mime
531 * complies with the one which is current 534 * complies with the one which is current
532 */ 535 */
533/* 536/*
534 * We've the mimetype of the file 537 * We've the mimetype of the file
535 * We need to get the stringlist of the current mimetype 538 * We need to get the stringlist of the current mimetype
536 * 539 *
537 * mime = image@slashjpeg 540 * mime = image@slashjpeg
538 * QStringList = 'image@slash*' 541 * QStringList = 'image@slash*'
539 * or QStringList = image/jpeg;image/png;application/x-ogg 542 * or QStringList = image/jpeg;image/png;application/x-ogg
540 * or QStringList = application/x-ogg;image@slash*; 543 * or QStringList = application/x-ogg;image@slash*;
541 * with all these mime filters it should get acceptes 544 * with all these mime filters it should get acceptes
542 * to do so we need to look if mime is contained inside 545 * to do so we need to look if mime is contained inside
543 * the stringlist 546 * the stringlist
544 * if it's contained return true 547 * if it's contained return true
545 * if not ( I'm no RegExp expert at all ) we'll look if a '@slash*' 548 * if not ( I'm no RegExp expert at all ) we'll look if a '@slash*'
546 * is contained in the mimefilter and then we will 549 * is contained in the mimefilter and then we will
547 * look if both are equal until the '/' 550 * look if both are equal until the '/'
548 */ 551 */
549bool OFileViewFileListView::compliesMime( const QString& str) { 552bool OFileViewFileListView::compliesMime( const QString& str) {
550 if (str.isEmpty() || m_mimes.isEmpty() || str.stripWhiteSpace().isEmpty() ) 553 if (str.isEmpty() || m_mimes.isEmpty() || str.stripWhiteSpace().isEmpty() )
551 return true; 554 return true;
552 555
553 for (QStringList::Iterator it = m_mimes.begin(); it != m_mimes.end(); ++it ) { 556 for (QStringList::Iterator it = m_mimes.begin(); it != m_mimes.end(); ++it ) {
554 QRegExp reg( (*it) ); 557 QRegExp reg( (*it) );
555 reg.setWildcard( true ); 558 reg.setWildcard( true );
556 if ( str.find( reg ) != -1 ) 559 if ( str.find( reg ) != -1 )
557 return true; 560 return true;
558 561
559 } 562 }
560 return false; 563 return false;
561} 564}
562/* 565/*
563 * The listView giving access to the file system! 566 * The listView giving access to the file system!
564 */ 567 */
565class OFileViewFileSystem : public OFileViewInterface { 568class OFileViewFileSystem : public OFileViewInterface {
566public: 569public:
567 OFileViewFileSystem( OFileSelector* ); 570 OFileViewFileSystem( OFileSelector* );
568 ~OFileViewFileSystem(); 571 ~OFileViewFileSystem();
569 572
570 QString selectedName() const; 573 QString selectedName() const;
571 QString selectedPath() const; 574 QString selectedPath() const;
572 575
573 QString directory()const; 576 QString directory()const;
574 void reread(); 577 void reread();
575 int fileCount()const; 578 int fileCount()const;
576 579
577 QWidget* widget( QWidget* parent ); 580 QWidget* widget( QWidget* parent );
578 void activate( const QString& ); 581 void activate( const QString& );
579private: 582private:
580 OFileViewFileListView* m_view; 583 OFileViewFileListView* m_view;
581 bool m_all : 1; 584 bool m_all : 1;
582}; 585};
583OFileViewFileSystem::OFileViewFileSystem( OFileSelector* sel) 586OFileViewFileSystem::OFileViewFileSystem( OFileSelector* sel)
584 : OFileViewInterface( sel ) { 587 : OFileViewInterface( sel ) {
585 m_view = 0; 588 m_view = 0;
586 m_all = false; 589 m_all = false;
587} 590}
588OFileViewFileSystem::~OFileViewFileSystem() { 591OFileViewFileSystem::~OFileViewFileSystem() {
589} 592}
590QString OFileViewFileSystem::selectedName()const{ 593QString OFileViewFileSystem::selectedName()const{
591 if (!m_view ) 594 if (!m_view )
592 return QString::null; 595 return QString::null;
593 596
594 QString cFN=currentFileName(); 597 QString cFN=currentFileName();
595 if (cFN.startsWith("/")) return cFN; 598 if (cFN.startsWith("/")) return cFN;
596 return m_view->currentDir() + "/" + cFN; 599 return m_view->currentDir() + "/" + cFN;
597} 600}
598QString OFileViewFileSystem::selectedPath()const{ 601QString OFileViewFileSystem::selectedPath()const{
599 return QString::null; 602 return QString::null;
600} 603}
601QString OFileViewFileSystem::directory()const{ 604QString OFileViewFileSystem::directory()const{
602 if (!m_view) 605 if (!m_view)
603 return QString::null; 606 return QString::null;
604 607
605 OFileSelectorItem* item = m_view->currentItem(); 608 OFileSelectorItem* item = m_view->currentItem();
606 if (!item ) 609 if (!item )
607 return QString::null; 610 return QString::null;
608 611
609 return QDir(item->directory() ).absPath(); 612 return QDir(item->directory() ).absPath();
610} 613}
611void OFileViewFileSystem::reread() { 614void OFileViewFileSystem::reread() {
612 if (!m_view) 615 if (!m_view)
613 return; 616 return;
614 617
615 m_view->reread( m_all ); 618 m_view->reread( m_all );
616} 619}
617int OFileViewFileSystem::fileCount()const{ 620int OFileViewFileSystem::fileCount()const{
618 if (!m_view ) 621 if (!m_view )
619 return -1; 622 return -1;
620 return m_view->fileCount(); 623 return m_view->fileCount();
621} 624}
622QWidget* OFileViewFileSystem::widget( QWidget* parent ) { 625QWidget* OFileViewFileSystem::widget( QWidget* parent ) {
623 if (!m_view ) { 626 if (!m_view ) {
624 m_view = new OFileViewFileListView( parent, startDirectory(), selector() ); 627 m_view = new OFileViewFileListView( parent, startDirectory(), selector() );
625 } 628 }
626 return m_view; 629 return m_view;
627} 630}
628void OFileViewFileSystem::activate( const QString& str) { 631void OFileViewFileSystem::activate( const QString& str) {
629 m_all = (str !=i18n("Files") ); 632 m_all = (str !=i18n("Files") );
630 633
631 634
632} 635}
633 636
634/* Selector */ 637/* Selector */
635OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, 638OFileSelector::OFileSelector( QWidget* parent, int mode, int sel,
636 const QString& dirName, const QString& fileName, 639 const QString& dirName, const QString& fileName,
637 const MimeTypes& mimetypes, 640 const MimeTypes& mimetypes,
638 bool showNew, bool showClose) 641 bool showNew, bool showClose)
639 : QWidget( parent, "OFileSelector" ) 642 : QWidget( parent, "OFileSelector" )
640{ 643{
641 m_current = 0; 644 m_current = 0;
642 m_shNew = showNew; 645 m_shNew = showNew;
643 m_shClose = showClose; 646 m_shClose = showClose;
644 m_mimeType = mimetypes; 647 m_mimeType = mimetypes;
645 m_startDir = dirName; 648 m_startDir = dirName;
646 m_mode = mode; 649 m_mode = mode;
647 m_selector = sel; 650 m_selector = sel;
648 651
649 initUI(); 652 initUI();
650 m_lneEdit->setText( fileName ); 653 m_lneEdit->setText( fileName );
651 initMime(); 654 initMime();
652 initViews(); 655 initViews();
653 656
654 QString str; 657 QString str;
655 switch ( m_selector ) { 658 switch ( m_selector ) {
656 default: 659 default:
657 case Normal: 660 case Normal:
658 str = i18n("Documents"); 661 str = i18n("Documents");
659 m_cmbView->setCurrentItem( 0 ); 662 m_cmbView->setCurrentItem( 0 );
660 break; 663 break;
661 case Extended: 664 case Extended:
662 str = i18n("Files"); 665 str = i18n("Files");
663 m_cmbView->setCurrentItem( 1 ); 666 m_cmbView->setCurrentItem( 1 );
664 break; 667 break;
665 case ExtendedAll: 668 case ExtendedAll:
666 str = i18n("All Files"); 669 str = i18n("All Files");
667 m_cmbView->setCurrentItem( 2 ); 670 m_cmbView->setCurrentItem( 2 );
668 break; 671 break;
669 } 672 }
670 slotViewChange( str ); 673 slotViewChange( str );
671 674
672} 675}
673OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name, 676OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name,
674 bool showNew, bool showClose ) 677 bool showNew, bool showClose )
675 : QWidget( parent, name ) 678 : QWidget( parent, name )
676{ 679{
677 m_current = 0; 680 m_current = 0;
678 m_shNew = showNew; 681 m_shNew = showNew;
679 m_shClose = showClose; 682 m_shClose = showClose;
680 m_startDir = QPEApplication::documentDir(); 683 m_startDir = QPEApplication::documentDir();
681 684
682 if (!mimeFilter.isEmpty() ) 685 if (!mimeFilter.isEmpty() )