author | llornkcor <llornkcor> | 2002-04-24 12:24:16 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-24 12:24:16 (UTC) |
commit | 997b7685dcc48cc36737240ca53331f83b66dbeb (patch) (side-by-side diff) | |
tree | 21148b19266eea39859646c249d0e04f3f40fd9a | |
parent | 8f67324fd1a60c165ae7043b9457f911b9690e43 (diff) | |
download | opie-997b7685dcc48cc36737240ca53331f83b66dbeb.zip opie-997b7685dcc48cc36737240ca53331f83b66dbeb.tar.gz opie-997b7685dcc48cc36737240ca53331f83b66dbeb.tar.bz2 |
fixed requested mimetype- for now.. still needs work
-rw-r--r-- | libopie/ofileselector.cc | 135 | ||||
-rw-r--r-- | libopie/ofileselector.h | 4 |
2 files changed, 69 insertions, 70 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index d1f1e1f..ce66f51 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc @@ -88,3 +88,4 @@ OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString m_name = fileName; - m_mimetypes = mimetypes; + requestedMimeTypesList = m_mimetypes = mimetypes; + // if( mimetypes.isEmpty() ) @@ -188,5 +189,4 @@ void OFileSelector::init() { - +// qDebug("init"); m_stack = new QWidgetStack(this, "wstack" ); - if( m_selector == NORMAL ){ QString currMime; @@ -194,3 +194,2 @@ void OFileSelector::init() currMime = m_mimeCheck->currentText(); - updateMimes(); @@ -202,6 +201,5 @@ void OFileSelector::init() m_pseudoLayout = 0l; - }else { + if( m_selector != NORMAL ) { initializeListView(); } - if(m_shLne ){ @@ -209,3 +207,2 @@ void OFileSelector::init() } - if(m_shPerm ){ @@ -215,9 +212,9 @@ void OFileSelector::init() } - if( m_shChooser ) initializeChooser(); - if(m_shYesNo ) initializeYes(); - + + m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, requestedMimeTypesList.first()) ); + reparse(); @@ -418,8 +415,6 @@ void OFileSelector::reparse() { + qDebug("reparse"); if(m_View== 0 || m_selector == NORMAL) return; - m_View->clear(); - - QString currMime =m_mimeCheck->currentText(); @@ -472,3 +467,3 @@ void OFileSelector::reparse() dir.setFilter( filter ); - + qDebug("infoList"); const QFileInfoList *list = dir.entryInfoList(); @@ -481,7 +476,7 @@ void OFileSelector::reparse() } - qWarning("Test: %s", fi->fileName().latin1() ); +// qWarning("Test: %s", fi->fileName().latin1() ); if(fi->isSymLink() ){ - qWarning("Symlink %s", fi->fileName().latin1() ); +// qWarning("Symlink %s", fi->fileName().latin1() ); QString file = fi->dirPath(true)+"/"+ fi->readLink(); - qWarning("File ->%s", file.latin1() ); +// qWarning("File ->%s", file.latin1() ); for(int i=0; i<=4; i++ ){ // prepend from dos @@ -489,3 +484,3 @@ void OFileSelector::reparse() if( !info.exists() ){ - qWarning("does not exist" ); +// qWarning("does not exist" ); addSymlink(currMime, fi, TRUE ); @@ -493,3 +488,3 @@ void OFileSelector::reparse() }else if( info.isDir() ){ - qWarning("isDir" ); +// qWarning("isDir" ); addDir(currMime, fi, TRUE ); @@ -497,3 +492,3 @@ void OFileSelector::reparse() }else if( info.isFile() ){ - qWarning("isFile" ); +// qWarning("isFile" ); addFile(currMime, fi, TRUE ); @@ -502,6 +497,6 @@ void OFileSelector::reparse() file = info.dirPath(true)+ "/"+ info.readLink(); - qWarning("isSymlink again %s", file.latin1() ); +// qWarning("isSymlink again %s", file.latin1() ); }else if( i == 4 ){ // just insert it and have the symlink symbol addSymlink(currMime, fi ); - qWarning("level too deep" ); +// qWarning("level too deep" ); } @@ -516,2 +511,3 @@ void OFileSelector::reparse() m_View->sort(); +// m_View->ensureItemVisible(); } @@ -588,3 +584,3 @@ void OFileSelector::initializeChooser() updateMimes(); - m_mimeCheck->insertStringList( m_mimetypes ); + m_mimeCheck->insertStringList( m_mimetypes ); // } @@ -648,3 +644,3 @@ void OFileSelector::slotViewCheck(const QString &view ){ - }else if(view == QString::fromLatin1("Files") ){ + } else if(view == QString::fromLatin1("Files") ){ // remove from the stack @@ -655,10 +651,6 @@ void OFileSelector::slotViewCheck(const QString &view ){ - - m_selector = EXTENDED; - // create the ListView or IconView initializeListView(); - reparse(); - }else if(view == QString::fromLatin1("All Files") ) { + } else if(view == QString::fromLatin1("All Files") ) { // remove from the stack @@ -672,3 +664,3 @@ void OFileSelector::slotViewCheck(const QString &view ){ reparse(); - }; + } } @@ -681,3 +673,3 @@ void OFileSelector::updateMimes() // lets check which mode is active m_mimetypes.append("All" ); - if( m_selector == NORMAL ){ +// if( m_selector == NORMAL ){ DocLnkSet set; @@ -689,6 +681,6 @@ void OFileSelector::updateMimes() // lets check which mode is active } - }else{ +// }else{ // should be allreday updatet - ; - } + // ; + // } } @@ -696,11 +688,15 @@ void OFileSelector::updateMimes() // lets check which mode is active 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 - delete m_View; - m_View = 0; - delete m_boxToolbar; - delete m_homeButton; - delete m_docButton; - delete m_location; - delete m_up; + // 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; @@ -715,3 +711,3 @@ void OFileSelector::initializeListView() m_pseudoLayout = 0; - // time for the toolbar + qDebug(" time for the toolbar "); m_pseudo = new QWidget(m_stack, "Pseudo Widget"); @@ -722,3 +718,5 @@ void OFileSelector::initializeListView() m_location = new QComboBox(m_pseudo ); + m_location ->setEditable(TRUE); connect( m_location, SIGNAL(activated(const QString &) ), this, SLOT( locationComboActivated(const QString & ) ) ); + connect( m_location->lineEdit(),SIGNAL(returnPressed()), this,SLOT( locationComboChanged())); @@ -744,3 +742,3 @@ void OFileSelector::initializeListView() m_pseudoLayout->addLayout(m_boxToolbar ); - // lets fill the combobox + qDebug("lets fill the combobox"); StorageInfo storage; @@ -757,2 +755,3 @@ void OFileSelector::initializeListView() }; + m_View = new QListView(m_pseudo, "Extended view" ); @@ -785,2 +784,3 @@ void OFileSelector::initializeListView() }; + /* If a item is locked depends on the mode @@ -794,5 +794,5 @@ void OFileSelector::initializeListView() void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){ - qWarning("Add Files" ); +// qWarning("Add Files" ); if( !m_files ){ - qWarning("not mfiles" ); +// qWarning("not mfiles" ); return; @@ -903,3 +903,3 @@ void OFileSelector::slotCurrentChanged(QListViewItem *item ) { - qWarning("current changed" ); +// qWarning("current changed" ); if( item == 0 ) @@ -910,6 +910,6 @@ void OFileSelector::slotCurrentChanged(QListViewItem *item ) if(!sel->isDir() ){ - qWarning("is not dir" ); +// qWarning("is not dir" ); if(m_shLne ){ m_edit->setText(sel->text(1) ); - qWarning("setTexy" ); +// qWarning("setTexy" ); } @@ -930,5 +930,5 @@ void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint & - qWarning("clicked" ); +// qWarning("clicked" ); if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ - qWarning("inside" ); +// qWarning("inside" ); OFileSelectorItem *sel = (OFileSelectorItem*)item; @@ -939,3 +939,3 @@ void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint & } else { - qWarning("file" ); +// qWarning("file" ); if(m_shLne ) @@ -958,3 +958,3 @@ void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoin return; - qWarning("right button" ); +// qWarning("right button" ); slotContextMenu(item); @@ -964,3 +964,3 @@ void OFileSelector::slotContextMenu(QListViewItem *item) { - qWarning("context menu" ); +// qWarning("context menu" ); if( item ==0 || !m_showPopup ) @@ -1016,3 +1016,3 @@ bool OFileSelector::cd(const QString &str ) { - qWarning(" dir %s", str.latin1() ); +// qWarning(" dir %s", str.latin1() ); QDir dir( str); @@ -1033,6 +1033,9 @@ void OFileSelector::insertLocationPath(const QString ¤tPath, int count) { QStringList pathList; + bool underDog = FALSE; for(int i=0;i<count;i++) { pathList << m_location->text(i); + if( m_location->text(i) == currentPath) + underDog = TRUE; } - if( pathList.grep( currentPath,TRUE).isEmpty() ) { + if( !underDog) { m_location->clear(); @@ -1077,3 +1080,3 @@ void OFileSelector::slotDelete() { - qWarning("delete slot" ); +// qWarning("delete slot" ); OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); @@ -1103,4 +1106,4 @@ void OFileSelector::cdUP() int count = m_location->count(); - insertLocationPath( m_currentDir,count ); - m_location->setCurrentItem( indexFromString(m_currentDir )); + insertLocationPath( m_currentDir, count); + m_location->setCurrentItem( indexByString( m_location, m_currentDir)); //this wont work in all instances @@ -1110,11 +1113,2 @@ void OFileSelector::cdUP() -int OFileSelector::indexFromString(const QString &str) { - - for(int i=0;i< m_location->count();i++) { - if(str == m_location->text(i)) - return i; - } - return 0; -} - void OFileSelector::slotHome() @@ -1138 +1132,6 @@ void OFileSelector::locationComboActivated(const QString & file ) { } + +void OFileSelector::locationComboChanged() { + cd( m_location->lineEdit()->text()); + reparse(); +} diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h index 81a9e63..babe09f 100644 --- a/libopie/ofileselector.h +++ b/libopie/ofileselector.h @@ -194,3 +194,3 @@ class OFileSelector : public QWidget { void insertLocationPath(const QString &, int); - int indexFromString(const QString &); + void locationComboChanged(); protected: @@ -213,3 +213,3 @@ class OFileSelector : public QWidget { QString m_name; - QStringList m_mimetypes; + QStringList m_mimetypes, requestedMimeTypesList; |