summaryrefslogtreecommitdiff
path: root/libopie/ofileselector
authorzecke <zecke>2002-09-20 17:28:20 (UTC)
committer zecke <zecke>2002-09-20 17:28:20 (UTC)
commit55dd11ddae09bfc4907399c473f0387c135fdae6 (patch) (side-by-side diff)
tree69d52e2f0e1030bbdcbf518f0a334ff4861500fa /libopie/ofileselector
parent40df2487c53a5ab484d33d619f5b6ed449c0b485 (diff)
downloadopie-55dd11ddae09bfc4907399c473f0387c135fdae6.zip
opie-55dd11ddae09bfc4907399c473f0387c135fdae6.tar.gz
opie-55dd11ddae09bfc4907399c473f0387c135fdae6.tar.bz2
OTodo know is the first implementation of OPimRecord
Diffstat (limited to 'libopie/ofileselector') (more/less context) (show whitespace changes)
-rw-r--r--libopie/ofileselector/ofileselector.cpp249
-rw-r--r--libopie/ofileselector/ofileselector.h17
-rw-r--r--libopie/ofileselector/olister.h1
3 files changed, 124 insertions, 143 deletions
diff --git a/libopie/ofileselector/ofileselector.cpp b/libopie/ofileselector/ofileselector.cpp
index 98b61f7..c52aa62 100644
--- a/libopie/ofileselector/ofileselector.cpp
+++ b/libopie/ofileselector/ofileselector.cpp
@@ -32,3 +32,5 @@
#include "ofileview.h"
+#include "ofileselectormain.h"
#include "ofileselector.h"
+#include "olocallister.h"
#include "olister.h"
@@ -103,20 +105,5 @@ void OFileSelector::setNewVisible( bool visible )
m_shNew = visible;
- if( m_selector == Normal ){
- delete m_select;
- // we need to initialize but keep the selected mimetype
- QString mime = currentMimeType();
- m_select = new FileSelector( mime ,
- m_stack, "fileselector",
- m_shNew, m_shClose);
-
- connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
- this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
- connect(m_select, SIGNAL(closeMe() ),
- this, SIGNAL(closeMe() ) );
- //connect to close me and other signals as well
- m_stack->addWidget( m_select, Normal );
- }else{
+ if (m_new )
m_new->show();
}
-}
void OFileSelector::setCloseVisible( bool visible )
@@ -124,16 +111,13 @@ void OFileSelector::setCloseVisible( bool visible )
m_shClose = visible;
- if( m_selector == Normal ){
- setNewVisible( m_shNew ); // yeah baby
- }else{
+
+ if( m_close )
m_close->show();
}
-}
void OFileSelector::reread()
{
- if( m_selector == Normal ){
- setNewVisible( m_shNew ); // make it a initializeSelector
- }else {
+ if( m_selector == Normal )
+ initializeOldSelector();
+ else
reparse();
}
-}
@@ -149,2 +133,3 @@ void OFileSelector::setYesCancelVisible( bool show )
m_shYesNo = show;
+
if( m_shYesNo )
@@ -158,3 +143,2 @@ void OFileSelector::setToolbarVisible( bool show )
m_shTool = show;
- initializeListView(); // FIXME see above waste of memory
@@ -176,2 +160,3 @@ void OFileSelector::setPermissionBarVisible( bool show )
initializePerm();
+
if( m_shPerm )
@@ -187,6 +172,6 @@ void OFileSelector::setLineEditVisible( bool show )
}else{
- if( m_shLne && m_boxName != 0 ){ // check if we showed before this is the way to go
+ // check if we showed before this is the way to go
+ if( m_shLne && m_boxName != 0 )
m_boxName->hide();
}
- }
m_shLne = show;
@@ -198,7 +183,8 @@ void OFileSelector::setChooserVisible( bool show )
initializeChooser();
- if( m_shChooser ){
+
+ if( m_shChooser )
m_boxView->hide();
- }else{
+ else
m_boxView->show();
- }
+
}
@@ -228,5 +214,6 @@ void OFileSelector::setMode(int mode) // FIXME do direct raising
}
-void OFileSelector::setShowDirs(bool )
+void OFileSelector::setShowDirs(bool dir)
{
- m_dir = true;
+ m_dir = dir;
+ if ( m_selector != Fileselector )
reparse();
@@ -236,2 +223,4 @@ void OFileSelector::setCaseSensetive(bool caSe )
m_case = caSe;
+
+ if ( m_selector != Fileselector )
reparse();
@@ -382,29 +371,14 @@ void OFileSelector::slotViewCheck(const QString &sel)
if( sel == tr("Documents" ) ){
- if( m_select == 0 ){
- // autMime? fix cause now we use All and not the current
- // yes currentMime fixes that for us
- QString mime = currentMimeType();
- m_select = new FileSelector(mime,
- m_stack, "fileselector",
- m_shNew, m_shClose);
- connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
- this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
- connect(m_select, SIGNAL(closeMe() ),
- this, SIGNAL(closeMe() ) );
- //connect to close me and other signals as well
-
- m_stack->addWidget( m_select, Normal );
- }
- m_stack->raiseWidget( Normal );
+ initializeOldSelector();
m_selector = Normal;
+
}else if( sel == tr("Files") ){
m_selector = Extended;
- initializeListView();
- reparse();
- m_stack->raiseWidget( Extended );
+
+ // FIXME call the factory
+ //reparse();
}else if( sel == tr("All Files") ){
m_selector = ExtendedAll;
- initializeListView();
- reparse();
- m_stack->raiseWidget( Extended ); // same widget other QFileFilter
+/* see above
+ reparse(); */
}
@@ -415,5 +389,6 @@ QString OFileSelector::currentMimeType() const{
QString currentText;
- if (m_shChooser )
+ if (m_shChooser && m_mimeCheck )
currentText = m_mimeCheck->currentText();
+ qWarning("CurrentText" + currentText );
if (tr("All") == currentText ) return QString::null;
@@ -424,3 +399,3 @@ QString OFileSelector::currentMimeType() const{
it = m_mimetypes.find( currentText );
- if ( it == m_mimetypes.end() ) {
+ if ( it != m_mimetypes.end() ) {
mime = it.data().join(";");
@@ -435,25 +410,4 @@ void OFileSelector::slotMimeCheck(const QString &mime)
if( m_selector == Normal ){
- //if( m_autoMime ){
- QString newMimeType;
- if (mime != tr("All") ) {
- QMap<QString, QStringList>::Iterator it;
- it = m_mimetypes.find(mime);
- if ( it != m_mimetypes.end() ) {
- newMimeType = it.data().join(";");
- }else{
- newMimeType = mime;
- }
- }
- delete m_select;
- m_select = new FileSelector( newMimeType,
- m_stack, "fileselector",
- m_shNew, m_shClose);
+ initializeOldSelector();
- connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
- this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
- connect(m_select, SIGNAL(closeMe() ),
- this, SIGNAL(closeMe() ) );
- //connect to close me and other signals as well
- m_stack->addWidget( m_select, Normal );
- m_stack->raiseWidget( Normal );
updateMimes();
@@ -461,3 +415,2 @@ void OFileSelector::slotMimeCheck(const QString &mime)
m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) );
- //}
}else{ // others
@@ -526,3 +479,7 @@ void OFileSelector::init()
- m_stack = new QWidgetStack( this );
+ /* take care of the main view... */
+ initToolbar();
+
+ /* initialize the file lister */
+ initLister();
if( m_selector == Normal ){
@@ -536,21 +493,6 @@ void OFileSelector::init()
}
- m_select = new FileSelector(mime,
- m_stack, "fileselector",
- m_shNew, m_shClose);
-
- connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
- this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
- connect(m_select, SIGNAL(closeMe() ),
- this, SIGNAL( closeMe() ) );
- //connect to close me and other signals as well
-
- m_stack->addWidget( m_select, Normal );
- m_stack->raiseWidget( Normal );
- }else{ // we're in init so it will be EXTENDED or EXTENDED_ALL
- // and initializeListview will take care of those
- // toolbar get's generade in initializeListView
- initializeListView( ); // will raise the widget as well
- m_stack->raiseWidget( Extended );
+ initializeOldSelector();
+ }else{
+ initializeView();
}
- m_lay->addWidget( m_stack, 100 ); // add to the layout 10 = stretch
@@ -605,2 +547,5 @@ void OFileSelector::initVars()
m_showPopup = false;
+ m_mainView = 0l;
+ m_fileView = 0l;
+ m_lister = 0l;
@@ -625,3 +570,2 @@ void OFileSelector::initVars()
m_select = 0;
- m_stack = 0;
m_lay = 0;
@@ -632,3 +576,2 @@ void OFileSelector::initVars()
m_boxView = 0;
- m_custom = 0;
m_edit = 0;
@@ -716,2 +659,3 @@ void OFileSelector::initializeChooser()
/* update to custom views */
+
updateMimeCheck();
@@ -724,16 +668,15 @@ void OFileSelector::initializeChooser()
}
-void OFileSelector::initializeListView()
-{
- qWarning("initializeListView");
- if( m_pseudo == 0 ){
- qWarning("init");
- m_pseudo = new QWidget( m_stack, "Pseudo Widget");
+/* generate the buttons for the toolbar */
+void OFileSelector::initToolbar() {
+ m_mainView = new OFileSelectorMain( this );
+
+ /* now generate the tool bar */
+ qWarning( "toolbar" );
+ m_pseudo = new QWidget( m_mainView, "Pseudo Widget" );
m_pseudoLayout = new QVBoxLayout( m_pseudo );
- // toolbar
+
m_boxToolbar = new QHBox( m_pseudo );
- m_boxToolbar->setSpacing(0 ); // next to each other please
+ m_boxToolbar->setSpacing( 0 );
- // toolbar members
- {
- // location QComboBox
+ // tool bar members now
m_location = new QComboBox( m_boxToolbar );
@@ -745,4 +688,5 @@ void OFileSelector::initializeListView()
this, SLOT(locationComboChanged() ) );
+
// UP Button
- m_up = new QPushButton(Resource::loadIconSet("up"),"",
+ m_up = new QPushButton( Resource::loadIconSet("up"), QString::null,
m_boxToolbar,"cdUpButton");
@@ -754,3 +698,3 @@ void OFileSelector::initializeListView()
m_homeButton = new QPushButton(Resource::loadIconSet("home") ,
- "", m_boxToolbar);
+ QString::null, m_boxToolbar );
m_homeButton->setFixedSize( QSize( 20, 20 ) );
@@ -758,10 +702,13 @@ void OFileSelector::initializeListView()
m_homeButton->setFlat(TRUE);
+
// Documents Button
- m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",
- m_boxToolbar,"docsButton");
+ m_docButton = new QPushButton( Resource::loadIconSet("DocsIcon"),
+ QString::null, m_boxToolbar,
+ "docsButton" );
m_docButton->setFixedSize( QSize( 20, 20 ) );
- connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) );
- m_docButton->setFlat(TRUE);
+ m_docButton->setFlat( true );
+ connect( m_docButton, SIGNAL(clicked() ),
+ this, SLOT(slotDoc() ) );
- // Close button
+ // close button
m_close = new QPushButton( Resource::loadIconSet( "close"), "",
@@ -774,2 +721,24 @@ void OFileSelector::initializeListView()
+ /* init the locations */
+ initLocations();
+
+ if( !m_shTool ){
+ m_location->hide( );
+ m_up->hide( );
+ m_homeButton->hide( );
+ m_docButton->hide( );
+ }
+ if(!m_shClose )
+ m_close->hide();
+
+ m_mainView->setToolbar( m_pseudo );
+ m_lay->addWidget( m_mainView, 100 );
+}
+/* initialize the OLocalLister */
+void OFileSelector::initLister() {
+ m_lister = new OLocalLister(this);
+}
+/* put default locations into the bar */
+void OFileSelector::initLocations () {
+
// let;s fill the Location ComboBox
@@ -786,21 +755,3 @@ void OFileSelector::initializeListView()
m_location->setCurrentItem( count );
- // due to the New and Close button we can not simply hide m_boxToolBar to not show it
- if( !m_shTool ){
- m_location->hide( );
- m_up->hide( );
- m_homeButton->hide( );
- m_docButton->hide( );
- }
- if(!m_shClose )
- m_close->hide();
- //if(!m_shNew)
- //m_close->hide();
-
- } // off toolbar
- // the Main ListView
- // make a QWidgetStack first so Views can share the Toolbar
- // m_pseudoLayout->addWidget( m_View, 288 );
- m_stack->addWidget( m_pseudo, Extended );
- }
}
@@ -1004,6 +955,6 @@ void OFileSelector::reparse()
OFileView* OFileSelector::currentView() {
- return 0l;
+ return m_fileView;
}
OFileView* OFileSelector::currentView() const{
- return 0l;
+ return m_fileView;
}
@@ -1049,3 +1000,23 @@ QPixmap OFileSelector::pixmap( const QString& s ) {
OLister* OFileSelector::currentLister()const {
- return 0l;
+ return m_lister;
+}
+void OFileSelector::initializeOldSelector() {
+ qWarning("initializeOldSelector");
+
+ delete m_select;
+
+ // we need to initialize but keep the selected mimetype
+ /* we default not to show close and new buttons */
+ QString mime = currentMimeType();
+ qWarning("MimeType " + mime );
+ m_select = new FileSelector( mime ,
+ m_mainView, "fileselector",
+ FALSE, FALSE);
+
+ connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
+ this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
+ connect(m_select, SIGNAL(closeMe() ),
+ this, SIGNAL(closeMe() ) );
+ //connect to close me and other signals as well
+ m_mainView->setWidget( m_select );
}
diff --git a/libopie/ofileselector/ofileselector.h b/libopie/ofileselector/ofileselector.h
index a7b363f..bf9a26b 100644
--- a/libopie/ofileselector/ofileselector.h
+++ b/libopie/ofileselector/ofileselector.h
@@ -71,2 +71,3 @@ class OFileView;
class OLister;
+class OFileSelectorMain;
//
@@ -344,2 +345,4 @@ class OFileSelector : public QWidget {
QPixmap pixmap( const QString& );
+ /* our tool bar */
+ QWidget* toolBar();
@@ -371,2 +374,5 @@ class OFileSelector : public QWidget {
+ OFileSelectorMain* m_mainView;
+ OLister* m_lister;
+ OFileView* m_fileView;
FileSelector* m_select;
@@ -392,6 +398,5 @@ class OFileSelector : public QWidget {
QString m_name;
- QMap<QString, QStringList> m_mimetypes;
+ QMap<QString, QStringList> m_mimetypes;
- QWidgetStack *m_stack;
QVBoxLayout *m_lay;
@@ -404,3 +409,2 @@ class OFileSelector : public QWidget {
- QPopupMenu *m_custom;
@@ -422,2 +426,3 @@ class OFileSelector : public QWidget {
bool m_showPopup : 1;
+ bool m_showHidden : 1;
@@ -429,3 +434,2 @@ class OFileSelector : public QWidget {
void initializeChooser();
- void initializeListView();
void initializePerm();
@@ -440,2 +444,7 @@ class OFileSelector : public QWidget {
+ void initializeOldSelector();
+ void initLister();
+ void initToolbar();
+ void initLocations();
+ void initializeView() {}; // FIXME
/**
diff --git a/libopie/ofileselector/olister.h b/libopie/ofileselector/olister.h
index 081b876..ef61cab 100644
--- a/libopie/ofileselector/olister.h
+++ b/libopie/ofileselector/olister.h
@@ -6,2 +6,3 @@
#include <qstring.h>
+#include <qstringlist.h>