summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp53
1 files changed, 30 insertions, 23 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp
index acd50c2..ebb78d1 100644
--- a/core/apps/textedit/fileBrowser.cpp
+++ b/core/apps/textedit/fileBrowser.cpp
@@ -10,24 +10,25 @@
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13****************************************************************************/ 13****************************************************************************/
14#include "fileBrowser.h" 14#include "fileBrowser.h"
15#include "inputDialog.h" 15#include "inputDialog.h"
16 16
17#include <qpe/config.h> 17#include <qpe/config.h>
18#include <qpe/resource.h> 18#include <qpe/resource.h>
19#include <qpe/fileselector.h> 19#include <qpe/fileselector.h>
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21#include <qpe/menubutton.h> 21#include <qpe/menubutton.h>
22#include <qpe/mimetype.h>
22 23
23#include <qdict.h> 24#include <qdict.h>
24#include <qwidgetstack.h> 25#include <qwidgetstack.h>
25#include <qlistview.h> 26#include <qlistview.h>
26#include <qcombo.h> 27#include <qcombo.h>
27#include <qpushbutton.h> 28#include <qpushbutton.h>
28#include <qfile.h> 29#include <qfile.h>
29#include <qmessagebox.h> 30#include <qmessagebox.h>
30#include <qlayout.h> 31#include <qlayout.h>
31#include <unistd.h> 32#include <unistd.h>
32#include <qpopupmenu.h> 33#include <qpopupmenu.h>
33#include <qlineedit.h> 34#include <qlineedit.h>
@@ -109,25 +110,25 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags
109 ListView->setColumnWidthMode(0,QListView::Manual); 110 ListView->setColumnWidthMode(0,QListView::Manual);
110 ListView->setColumnAlignment(1,QListView::AlignRight); 111 ListView->setColumnAlignment(1,QListView::AlignRight);
111 ListView->setColumnAlignment(2,QListView::AlignRight); 112 ListView->setColumnAlignment(2,QListView::AlignRight);
112 ListView->setAllColumnsShowFocus( TRUE ); 113 ListView->setAllColumnsShowFocus( TRUE );
113 114
114 QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); 115 QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold);
115 connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 116 connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
116 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 117 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
117 118
118 connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); 119 connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
119 120
120 FileStack->addWidget( ListView, get_unique_id() ); 121 FileStack->addWidget( ListView, get_unique_id() );
121 mimeType="text/*"; 122mimeType="text/*";
122 fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy 123 fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy
123// connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); 124// connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) );
124// connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); 125// connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
125 connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); 126 connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) );
126 layout->addMultiCellWidget( FileStack, 1, 1, 0, 7 ); 127 layout->addMultiCellWidget( FileStack, 1, 1, 0, 7 );
127 128
128 SelectionCombo = new QComboBox( FALSE, this, "SelectionCombo" ); 129 SelectionCombo = new QComboBox( FALSE, this, "SelectionCombo" );
129 SelectionCombo->insertItem( tr( "Documents" ) ); 130 SelectionCombo->insertItem( tr( "Documents" ) );
130 SelectionCombo->insertItem( tr( "All files" ) ); 131 SelectionCombo->insertItem( tr( "All files" ) );
131 SelectionCombo->insertItem( tr( "Hidden files" ) ); 132 SelectionCombo->insertItem( tr( "Hidden files" ) );
132// SelectionCombo->setMaximumWidth(120); 133// SelectionCombo->setMaximumWidth(120);
133 layout->addMultiCellWidget( SelectionCombo, 2, 2, 0, 3 ); 134 layout->addMultiCellWidget( SelectionCombo, 2, 2, 0, 3 );
@@ -185,48 +186,54 @@ void fileBrowser::populateList()
185 } else { 186 } else {
186// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 187// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
187 fileS.sprintf( "%10li", fi->size() ); 188 fileS.sprintf( "%10li", fi->size() );
188 fileL.sprintf( "%s",fi->fileName().data() ); 189 fileL.sprintf( "%s",fi->fileName().data() );
189 fileDate= fi->lastModified().toString(); 190 fileDate= fi->lastModified().toString();
190 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 191 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
191 fileL+="/"; 192 fileL+="/";
192 isDir=TRUE; 193 isDir=TRUE;
193// qDebug( fileL); 194// qDebug( fileL);
194 } 195 }
195 } 196 }
196 if(fileL !="./") { 197 if(fileL !="./") {
197 item= new QListViewItem( ListView,fileL,fileS , fileDate); 198 item= new QListViewItem( ListView,fileL,fileS , fileDate);
198 QPixmap pm; 199 QPixmap pm;
199 pm= Resource::loadPixmap( "folder" );
200 200
201 if(isDir || fileL.find("/",0,TRUE) != -1) { 201 if(isDir || fileL.find("/",0,TRUE) != -1) {
202 if( !QDir( fi->filePath() ).isReadable()) 202 if( !QDir( fi->filePath() ).isReadable())
203 pm = Resource::loadPixmap( "lockedfolder" ); 203 pm = Resource::loadPixmap( "lockedfolder" );
204 item->setPixmap( 0,pm ); 204 else
205 } else { 205 pm= Resource::loadPixmap( "folder" );
206 if( !fi->isReadable() ) 206 item->setPixmap( 0,pm );
207 pm = Resource::loadPixmap( "locked" ); 207 } else {
208 else 208 if( !fi->isReadable() )
209 pm = Resource::loadPixmap( "fileopen" ); 209 pm = Resource::loadPixmap( "locked" );
210 item->setPixmap( 0,pm); 210 else {
211 } 211 MimeType mt(fi->filePath());
212 if( fileL.find("->",0,TRUE) != -1) { 212 pm=mt.pixmap();
213 // overlay link image 213 if(pm.isNull())
214 QPixmap lnk = Resource::loadPixmap( "symlink" ); 214 pm = Resource::loadPixmap( "UnknownDocument-14" );
215 QPainter painter( &pm ); 215 item->setPixmap( 0,pm);
216 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 216 }
217 pm.setMask( pm.createHeuristicMask( FALSE ) ); 217 }
218 item->setPixmap( 0, pm); 218 if( fileL.find("->",0,TRUE) != -1) {
219 // overlay link image
220 pm= Resource::loadPixmap( "folder" );
221 QPixmap lnk = Resource::loadPixmap( "symlink" );
222 QPainter painter( &pm );
223 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
224 pm.setMask( pm.createHeuristicMask( FALSE ) );
225 item->setPixmap( 0, pm);
226 }
219 } 227 }
220 }
221 isDir=FALSE; 228 isDir=FALSE;
222 ++it; 229 ++it;
223 } 230 }
224 ListView->setSorting( 3, FALSE); 231 ListView->setSorting( 3, FALSE);
225 QString currentPath = currentDir.canonicalPath(); 232 QString currentPath = currentDir.canonicalPath();
226 233
227 fillCombo( (const QString &)currentPath); 234 fillCombo( (const QString &)currentPath);
228// dirPathCombo->lineEdit()->setText(currentPath); 235// dirPathCombo->lineEdit()->setText(currentPath);
229 236
230// if( dirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 237// if( dirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
231// dirPathCombo->clear(); 238// dirPathCombo->clear();
232// dirPathStringList.prepend(currentPath ); 239// dirPathStringList.prepend(currentPath );