summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector.cc89
1 files changed, 49 insertions, 40 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index ce66f51..3a11032 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -63,13 +63,12 @@ QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0;
namespace {
int indexByString( const QComboBox *box, const QString &str ){
int index= -1;
for(int i= 0; i < box->count(); i++ ){
- qWarning("str T%sT boxT%sT", str.latin1(), box->text(i).latin1() );
if( str == box->text(i ) ){
index= i;
break;
}
}
return index;
@@ -83,23 +82,25 @@ OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString
{
if(wid!=0)
resize(wid->width(),wid->height());
m_selector = selector;
m_currentDir = dirName;
m_name = fileName;
- requestedMimeTypesList = m_mimetypes = mimetypes;
+ m_mimetypes = mimetypes;
-// if( mimetypes.isEmpty() )
-// m_autoMime = true;
+ if( mimetypes.isEmpty() )
+ m_autoMime = true;
+ qWarning("OFileSelector mimetypes %s", mimetypes.join(" ").latin1() );
m_mode = mode;
m_shTool = true;
m_shPerm = true;
m_shLne = true;
m_shChooser = true;
m_shYesNo = true;
+
// for FILESELECTOR only view is interesting
m_location = 0;
m_homeButton = 0;
m_docButton = 0;
m_hideButton = 0;
m_ok = 0;
@@ -186,23 +187,27 @@ void OFileSelector::delItems()
}
void OFileSelector::init()
{
// qDebug("init");
m_stack = new QWidgetStack(this, "wstack" );
+ if( m_selector == NORMAL ){
QString currMime;
if( m_mimeCheck != 0 )
currMime = m_mimeCheck->currentText();
updateMimes();
- m_select = new FileSelector( currMime == "All" ? QString::null : currMime , m_stack, "fileselector", FALSE, FALSE );
+ m_select = new FileSelector( currMime == "All" ? QString::null : currMime ,
+ m_stack, "fileselector", FALSE, FALSE );
m_stack->addWidget(m_select, NORMAL );
m_lay->addWidget(m_stack );
m_stack->raiseWidget(NORMAL );
- connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) );
+ connect(m_select, SIGNAL(fileSelected( const DocLnk &) ),
+ this, SLOT(slotFileBridgeSelected(const DocLnk &) ) );
m_pseudoLayout = 0l;
- if( m_selector != NORMAL ) {
+
+ } else {
initializeListView();
}
if(m_shLne ){
initializeName();
}
if(m_shPerm ){
@@ -212,14 +217,14 @@ void OFileSelector::init()
}
if( m_shChooser )
initializeChooser();
if(m_shYesNo )
initializeYes();
- m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, requestedMimeTypesList.first()) );
- reparse();
+ // m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, requestedMimeTypesList.first()) );
+ // reparse();
}
void OFileSelector::setYesCancelVisible( bool show )
{
if ( show == m_shYesNo )
@@ -440,13 +445,16 @@ void OFileSelector::reparse()
++it;
}
m_mimetypes.prepend("All" );
m_mimeCheck->insertStringList(m_mimetypes );
// set it to the current mimetype
m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currMime ) );
- };
+ }else{
+ m_mimeCheck->clear();
+ m_mimeCheck->insertItem( m_mimetypes.join(";") );
+ }
QDir dir( m_currentDir );
//dir.setFilter(-1 );
int sort = QDir::Name | QDir::DirsFirst | QDir::Reversed;
if( m_case )
sort = QDir::IgnoreCase;
@@ -575,18 +583,18 @@ void OFileSelector::initializeChooser()
m_lay->insertSpacing( 4, 8);
m_viewCheck->insertItem(tr("Documents") );
m_viewCheck->insertItem(tr("Files") );
m_viewCheck->insertItem(tr("All Files") );
-// if(!m_autoMime )
-// m_mimeCheck->insertItem(m_mimetypes.join("," ) );
-// else{ // check
- updateMimes();
- m_mimeCheck->insertStringList( m_mimetypes );
-// }
+ if(!m_autoMime )
+ m_mimeCheck->insertItem(m_mimetypes.join("," ) );
+ else{ // check
+ updateMimes();
+ m_mimeCheck->insertStringList( m_mimetypes );
+ }
connect( m_viewCheck, SIGNAL(activated(const QString &) ),
this, SLOT(slotViewCheck(const QString & ) ) );
connect( m_mimeCheck, SIGNAL(activated(const QString &) ),
this, SLOT(slotMimeCheck(const QString & ) ) );
@@ -666,45 +674,46 @@ void OFileSelector::slotViewCheck(const QString &view ){
}
void OFileSelector::updateMimes() // lets check which mode is active
// check the current dir for items then
{
- m_mimetypes.clear();
- m_mimetypes.append("All" );
-// if( m_selector == NORMAL ){
- DocLnkSet set;
- Global::findDocuments(&set, QString::null );
- QListIterator<DocLnk> dit( set.children() );
- for ( ; dit.current(); ++dit ) {
- if( !m_mimetypes.contains((*dit)->type() ) )
- m_mimetypes.append( (*dit)->type() );
- }
-// }else{
- // should be allreday updatet
- // ;
- // }
+ if( m_autoMime ){
+ m_mimetypes.clear();
+ m_mimetypes.append("All" );
+ if( m_selector == NORMAL ){
+ DocLnkSet set;
+ Global::findDocuments(&set, QString::null );
+ QListIterator<DocLnk> dit( set.children() );
+ for ( ; dit.current(); ++dit ) {
+ if( !m_mimetypes.contains((*dit)->type() ) )
+ m_mimetypes.append( (*dit)->type() );
+ }
+ }else{
+ // should be allreday updatet
+ ;
+ }
+ }
}
void OFileSelector::initializeListView()
{
// in the instance that a developer selected the view to be Files or Entended,
// in the initial initialization, you are deleting objects here
// that aren't even existing yet.
// just to make sure but clean it up better FIXME
- // if( m_View) delete m_View;
-// m_View = 0;
-// if(m_boxToolbar) delete m_boxToolbar;
-// if(m_homeButton) delete m_homeButton;
-// if(m_docButton) delete m_docButton;
-// if( m_location) delete m_location;
-// if(m_up) delete m_up;
- //delete m_pseudo;
- //if(m_pseudoLayout!=0 ) // why did you overload malloc
- //delete m_pseudoLayout;
+ delete m_View;
+ m_View = 0;
+ delete m_boxToolbar;
+ delete m_homeButton;
+ delete m_docButton;
+ delete m_location;
+ delete m_up;
+ delete m_pseudo;
+
m_boxToolbar = 0;
m_homeButton = 0;
m_docButton = 0;
m_location = 0;
m_up = 0;
m_pseudo = 0;