summaryrefslogtreecommitdiff
path: root/libopie/ofileselector
Unidiff
Diffstat (limited to 'libopie/ofileselector') (more/less context) (ignore whitespace changes)
-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
5 files changed, 19 insertions, 5 deletions
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
@@ -71,33 +71,33 @@ QString OFileDialog::fileName()const
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();
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
@@ -19,33 +19,34 @@
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,
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
@@ -472,32 +472,34 @@ void OFileSelector::init()
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 }
@@ -638,33 +640,33 @@ void OFileSelector::initializeChooser()
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"),
@@ -961,35 +963,35 @@ void OFileSelector::setView( const QString& lis ) {
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 }