author | llornkcor <llornkcor> | 2002-04-19 12:09:05 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-19 12:09:05 (UTC) |
commit | 9233f285e5f3366ca5e1d44892e0797d7ef0608c (patch) (side-by-side diff) | |
tree | f4599e33492b04d7d8a9250d662e8bb814313bdf | |
parent | 6ffbfe7daee3b01b8dce2afa9036b70b187a8fc7 (diff) | |
download | opie-9233f285e5f3366ca5e1d44892e0797d7ef0608c.zip opie-9233f285e5f3366ca5e1d44892e0797d7ef0608c.tar.gz opie-9233f285e5f3366ca5e1d44892e0797d7ef0608c.tar.bz2 |
fixed a slight bugy
-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 59 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 75 | ||||
-rw-r--r-- | core/apps/textedit/textedit.h | 2 |
3 files changed, 77 insertions, 59 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index f322513..fced326 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp @@ -12,5 +12,5 @@ ** ****************************************************************************/ -//#define QTOPIA_INTERNAL_MIMEEXT +#define QTOPIA_INTERNAL_MIMEEXT #include "fileBrowser.h" //#include "inputDialog.h" @@ -51,22 +51,28 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags setName( "fileBrowser" ); setCaption(tr( name ) ); -// mimeType = mimeFilter; -// MimeType mt( mimeType); -// if( mt.extension().isEmpty()) -// QStringList filterList; -// filterList=QStringList::split(";",mimeFilter,FALSE); -// for ( QStringList::Iterator it = filterList.begin(); it != filterList.end(); ++it ) { -// printf( "%s \n", (*it).latin1() ); -// } - filterStr = mimeFilter.right(mimeFilter.length() - mimeFilter.find("/",0,TRUE) - 1);// "*"; +// getMimeTypes(); + + mimeType = mimeFilter; + MimeType mt( mimeType); + + if( mt.extension().isEmpty()) { + + QStringList filterList; + filterList=QStringList::split(";",mimeFilter,FALSE); + + for ( QStringList::Iterator it = filterList.begin(); it != filterList.end(); ++it ) { + printf( "%s \n", (*it).latin1() ); + } + + filterStr = mimeFilter.right(mimeFilter.length() - mimeFilter.find("/",0,TRUE) - 1);// "*"; - qDebug(filterStr); -// else -// filterStr = "*."+ mt.extension(); + qDebug(filterStr); + } else { + filterStr = "*."+ mt.extension(); // qDebug("description "+mt.description()); // qDebug( "id "+mt.id()); // qDebug("extension "+mt.extension()); - + } // channel = new QCopChannel( "QPE/fileDialog", this ); // connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), @@ -235,5 +241,5 @@ void fileBrowser::populateList() // overlay link image pm= Resource::loadPixmap( "folder" ); - QPixmap lnk = Resource::loadPixmap( "symlink" ); + QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); QPainter painter( &pm ); painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); @@ -493,5 +499,5 @@ void fileBrowser::updateMimeTypeMenu() { void fileBrowser::showType(const QString &t) { - qDebug(t); +// qDebug("Show type "+t); if(t.find("All",0,TRUE) != -1) { filterStr = "*"; @@ -501,13 +507,15 @@ void fileBrowser::showType(const QString &t) { for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { mimeType =(*it); - MimeType mt( mimeType); -// qDebug("mime "+mimeType); -// qDebug("description "+mt.description()); -// qDebug( "id "+mt.id()); -// qDebug("extension "+mt.extension()); -// if( mt.extension().isEmpty()) + MimeType mt(mimeType); + +// qDebug("mime "+mimeType); +// qDebug("description "+mt.description()); +// qDebug( "id "+mt.id()); +// qDebug("extension "+mt.extension()); + + if( mt.extension().isEmpty()) filterStr = "*"; -// else -// filterStr = "*."+ mt.extension()+" "; + else + filterStr = "*."+ mt.extension()+" "; // printf( "%s \n", (*it).latin1() ); } @@ -547,8 +555,9 @@ QStringList fileBrowser::getMimeTypes() { for ( f = maj.begin(); f != maj.end(); f++ ) { QString temp = *f; + qDebug("type "+temp); mimetypes << temp; int sl = temp.find('/'); if (sl >= 0) { - QString k = temp.left(sl); + QString k = temp;//.left(sl); if( r.grep(k,TRUE).isEmpty() ) { r << k; diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 18402d4..84888c1 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp @@ -502,37 +502,46 @@ void TextEdit::fileNew() void TextEdit::fileOpen() { - QString str = OFileDialog::getOpenFileName(1,"/","", QStringList() , this ); - if(!str.isEmpty() ) - openFile( str ); -// browseForFiles = new fileBrowser(this,tr("Open File"),TRUE,0, "text/*"); // -// browseForFiles->setFileView( viewSelection ); -// browseForFiles->showMaximized(); -// // if( result != -1 ) - -// if( browseForFiles->exec() != -1 ) { -// QString selFile = browseForFiles->selectedFileName; -// QStringList fileList = browseForFiles->fileList; -// qDebug(selFile); -// QStringList::ConstIterator f; -// QString fileTemp; -// for ( f = fileList.begin(); f != fileList.end(); f++ ) { -// fileTemp = *f; -// fileTemp.right( fileTemp.length()-5); -// QString fileName = fileTemp; -// if( fileName != "Unnamed" || fileName != "Empty Text" ) { -// currentFileName = fileName; -// qDebug("please open "+currentFileName); -// openFile(str ); -// } -// } -// viewSelection = browseForFiles->SelectionCombo->currentItem(); -// } -// delete browseForFiles; -// editor->setEdited( FALSE); -// edited1=FALSE; -// edited=FALSE; -// if(caption().left(1)=="*") -// setCaption(caption().right(caption().length()-1)); -// doSearchBar(); + Config cfg("TextEdit"); + cfg.setGroup("View"); + bool b=FALSE; + if(cfg.readEntry("useOldFileDialog") == "TRUE") + b=TRUE; + if(!b) { + QString str = OFileDialog::getOpenFileName( 1,"/","", "text/plain", this ); + if(!str.isEmpty() ) + openFile( str ); + } else { + QString str; + browseForFiles = new fileBrowser(this,tr("Open File"),TRUE,0, "text/*"); // + browseForFiles->setFileView( viewSelection ); + browseForFiles->showMaximized(); +// if( result != -1 ) + + if( browseForFiles->exec() != -1 ) { + QString selFile = browseForFiles->selectedFileName; + QStringList fileList = browseForFiles->fileList; + qDebug(selFile); + QStringList::ConstIterator f; + QString fileTemp; + for ( f = fileList.begin(); f != fileList.end(); f++ ) { + fileTemp = *f; + fileTemp.right( fileTemp.length()-5); + QString fileName = fileTemp; + if( fileName != "Unnamed" || fileName != "Empty Text" ) { + currentFileName = fileName; + qDebug("please open "+currentFileName); + openFile(str ); + } + } + viewSelection = browseForFiles->SelectionCombo->currentItem(); + } + delete browseForFiles; + editor->setEdited( FALSE); + edited1=FALSE; + edited=FALSE; + if(caption().left(1)=="*") + setCaption(caption().right(caption().length()-1)); + doSearchBar(); + } } diff --git a/core/apps/textedit/textedit.h b/core/apps/textedit/textedit.h index 61fa2a0..edc6fe3 100644 --- a/core/apps/textedit/textedit.h +++ b/core/apps/textedit/textedit.h @@ -58,5 +58,5 @@ public: QPopupMenu *font; - QAction *nStart; + QAction *nStart, *nFileDlgOpt; bool edited, edited1; void openFile( const QString & ); |