summaryrefslogtreecommitdiff
path: root/libopie
Unidiff
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector.cc148
1 files changed, 76 insertions, 72 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index 6a6a300..7481360 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -949,351 +949,355 @@ void OFileSelector::initPics()
949 m_pixmaps = new QMap<QString,QPixmap>; 949 m_pixmaps = new QMap<QString,QPixmap>;
950 QPixmap pm = Resource::loadPixmap( "folder" ); 950 QPixmap pm = Resource::loadPixmap( "folder" );
951 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 951 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
952 QPainter painter( &pm ); 952 QPainter painter( &pm );
953 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 953 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
954 pm.setMask( pm.createHeuristicMask( FALSE ) ); 954 pm.setMask( pm.createHeuristicMask( FALSE ) );
955 m_pixmaps->insert("dirsymlink", pm ); 955 m_pixmaps->insert("dirsymlink", pm );
956 956
957 QPixmap pm2 = Resource::loadPixmap( "lockedfolder" ); 957 QPixmap pm2 = Resource::loadPixmap( "lockedfolder" );
958 QPainter pen(&pm2 ); 958 QPainter pen(&pm2 );
959 pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk ); 959 pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk );
960 pm2.setMask( pm2.createHeuristicMask( FALSE ) ); 960 pm2.setMask( pm2.createHeuristicMask( FALSE ) );
961 m_pixmaps->insert("symlinkedlocked", pm2 ); 961 m_pixmaps->insert("symlinkedlocked", pm2 );
962} 962}
963// if a mime complies with the m_mimeCheck->currentItem 963// if a mime complies with the m_mimeCheck->currentItem
964bool OFileSelector::compliesMime( const QString &path, const QString &mime ) 964bool OFileSelector::compliesMime( const QString &path, const QString &mime )
965{ 965{
966 if( mime == "All" ) 966 if( mime == "All" )
967 return true; 967 return true;
968 MimeType type( path ); 968 MimeType type( path );
969 if( type.id() == mime ) 969 if( type.id() == mime )
970 return true; 970 return true;
971 return false; 971 return false;
972} 972}
973/* check if the mimetype in mime 973/* check if the mimetype in mime
974 * complies with the one which is current 974 * complies with the one which is current
975 */ 975 */
976/* 976/*
977 * We've the mimetype of the file 977 * We've the mimetype of the file
978 * We need to get the stringlist of the current mimetype 978 * We need to get the stringlist of the current mimetype
979 * 979 *
980 * mime = image/jpeg 980 * mime = image/jpeg
981 * QStringList = 'image/*' 981 * QStringList = 'image/*'
982 * or QStringList = image/jpeg;image/png;application/x-ogg 982 * or QStringList = image/jpeg;image/png;application/x-ogg
983 * or QStringList = application/x-ogg;image/*; 983 * or QStringList = application/x-ogg;image/*;
984 * with all these mime filters it should get acceptes 984 * with all these mime filters it should get acceptes
985 * to do so we need to look if mime is contained inside 985 * to do so we need to look if mime is contained inside
986 * the stringlist 986 * the stringlist
987 * if it's contained return true 987 * if it's contained return true
988 * if not ( I'm no RegExp expert at all ) we'll look if a '/*' 988 * if not ( I'm no RegExp expert at all ) we'll look if a '/*'
989 * is contained in the mimefilter and then we will 989 * is contained in the mimefilter and then we will
990 * look if both are equal until the '/' 990 * look if both are equal until the '/'
991 */ 991 */
992bool OFileSelector::compliesMime( const QString& mime ) { 992bool OFileSelector::compliesMime( const QString& mime ) {
993 qWarning("mimetype is %s", mime.latin1() ); 993 qWarning("mimetype is %s", mime.latin1() );
994 QString currentText; 994 QString currentText;
995 if (m_shChooser ) 995 if (m_shChooser )
996 currentText = m_mimeCheck->currentText(); 996 currentText = m_mimeCheck->currentText();
997 997
998 qWarning("current text is %s", currentText.latin1() ); 998 qWarning("current text is %s", currentText.latin1() );
999 QMap<QString, QStringList>::Iterator it; 999 QMap<QString, QStringList>::Iterator it;
1000 QStringList list; 1000 QStringList list;
1001 if ( currentText == tr("All") ) return true; 1001 if ( currentText == tr("All") ) return true;
1002 else if ( currentText.isEmpty() && !m_mimetypes.isEmpty() ) { 1002 else if ( currentText.isEmpty() && !m_mimetypes.isEmpty() ) {
1003 it = m_mimetypes.begin(); 1003 it = m_mimetypes.begin();
1004 list = it.data(); 1004 list = it.data();
1005 }else if ( currentText.isEmpty() ) return true; 1005 }else if ( currentText.isEmpty() ) return true;
1006 else{ 1006 else{
1007 it = m_mimetypes.find(currentText ); 1007 it = m_mimetypes.find(currentText );
1008 if ( it == m_mimetypes.end() ) qWarning("not there"), list << currentText; 1008 if ( it == m_mimetypes.end() ) qWarning("not there"), list << currentText;
1009 else qWarning("found"), list = it.data(); 1009 else qWarning("found"), list = it.data();
1010 } 1010 }
1011 // dump it now 1011 // dump it now
1012 //for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 1012 //for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
1013 // qWarning( "%s", (*it).latin1() ); 1013 // qWarning( "%s", (*it).latin1() );
1014 //} 1014 //}
1015 1015
1016 1016
1017 if ( list.contains(mime) ) return true; 1017 if ( list.contains(mime) ) return true;
1018 qWarning("list doesn't contain it "); 1018 qWarning("list doesn't contain it ");
1019 QStringList::Iterator it2; 1019 QStringList::Iterator it2;
1020 int pos; 1020 int pos;
1021 for ( it2 = list.begin(); it2 != list.end(); ++it2 ) { 1021 for ( it2 = list.begin(); it2 != list.end(); ++it2 ) {
1022 pos = (*it2).findRev("/*"); 1022 pos = (*it2).findRev("/*");
1023 if ( pos >= 0 ) { 1023 if ( pos >= 0 ) {
1024 if ( mime.contains( (*it2).left(pos) ) ) return true; 1024 if ( mime.contains( (*it2).left(pos) ) ) return true;
1025 } 1025 }
1026 } 1026 }
1027 return false; 1027 return false;
1028} 1028}
1029void OFileSelector::slotFileSelected( const QString &string ) 1029void OFileSelector::slotFileSelected( const QString &string )
1030{ 1030{
1031 if( m_shLne ) 1031 if( m_shLne )
1032 m_edit->setText( string ); 1032 m_edit->setText( string );
1033 emit fileSelected( string ); 1033 emit fileSelected( string );
1034} 1034}
1035void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) 1035void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk )
1036{ 1036{
1037 slotFileSelected( lnk.name() ); 1037 slotFileSelected( lnk.name() );
1038 emit fileSelected( lnk ); 1038 emit fileSelected( lnk );
1039} 1039}
1040void OFileSelector::slotSelectionChanged() 1040void OFileSelector::slotSelectionChanged()
1041{ 1041{
1042 1042
1043} 1043}
1044void OFileSelector::slotCurrentChanged(QListViewItem* item ) 1044void OFileSelector::slotCurrentChanged(QListViewItem* item )
1045{ 1045{
1046 if( item == 0 ) 1046 if( item == 0 )
1047 return; 1047 return;
1048 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { 1048 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) {
1049 OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;) 1049 OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;)
1050 qWarning("current changed"); 1050 qWarning("current changed");
1051 if(!sel->isDir() ){ 1051 if(!sel->isDir() ){
1052 if( m_shLne ) 1052 if( m_shLne )
1053 m_edit->setText( sel->text(1) ); 1053 m_edit->setText( sel->text(1) );
1054 1054
1055 if (m_mode == FILESELECTOR ) { 1055 if (m_mode == FILESELECTOR ) {
1056 QStringList str = QStringList::split("->", sel->text(1) ); 1056 QStringList str = QStringList::split("->", sel->text(1) );
1057 QString path =sel->directory() + "/" + str[0].stripWhiteSpace(); 1057 QString path =sel->directory() + "/" + str[0].stripWhiteSpace();
1058 emit fileSelected(path ); 1058 emit fileSelected(path );
1059 DocLnk lnk( path ); 1059 DocLnk lnk( path );
1060 emit fileSelected(lnk ); 1060 emit fileSelected(lnk );
1061 } 1061 }
1062 } 1062 }
1063 } 1063 }
1064} 1064}
1065void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &, int) 1065void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &, int)
1066{ 1066{
1067 if ( item == 0 ) 1067 if ( item == 0 )
1068 return; 1068 return;
1069 1069
1070 if( button != Qt::LeftButton ) 1070 if( button != Qt::LeftButton )
1071 return; 1071 return;
1072 1072
1073 switch( m_selector ){ 1073 switch( m_selector ){
1074 default: 1074 default:
1075 break; 1075 break;
1076 case EXTENDED: // fall through 1076 case EXTENDED: // fall through
1077 case EXTENDED_ALL:{ 1077 case EXTENDED_ALL:{
1078 OFileSelectorItem *sel = (OFileSelectorItem*)item; 1078 OFileSelectorItem *sel = (OFileSelectorItem*)item;
1079 if(!sel->isLocked() ){ 1079 if(!sel->isLocked() ){
1080 QStringList str = QStringList::split("->", sel->text(1) ); 1080 QStringList str = QStringList::split("->", sel->text(1) );
1081 if( sel->isDir() ){ 1081 if( sel->isDir() ){
1082 cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1082 cd( sel->directory() + "/" + str[0].stripWhiteSpace() );
1083 // if MODE Dir m_shLne set the Text 1083 // if MODE Dir m_shLne set the Text
1084 }else{ 1084 }else{
1085 if( m_shLne ) 1085 if( m_shLne )
1086 m_edit->setText( str[0].stripWhiteSpace() ); 1086 m_edit->setText( str[0].stripWhiteSpace() );
1087 qWarning("selected here in slot clicked"); 1087 qWarning("selected here in slot clicked");
1088 emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1088 emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() );
1089 DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1089 DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() );
1090 qWarning("file selected"); 1090 qWarning("file selected");
1091 emit fileSelected( lnk ); 1091 emit fileSelected( lnk );
1092 } 1092 }
1093 } 1093 }
1094 break; 1094 break;
1095 } 1095 }
1096 } 1096 }
1097} 1097}
1098void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) 1098void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int )
1099{ 1099{
1100 if( item == 0 ) 1100 if( item == 0 )
1101 return; 1101 return;
1102 1102
1103 if( button != Qt::RightButton ) 1103 if( button != Qt::RightButton )
1104 return; 1104 return;
1105 slotContextMenu( item ); 1105 slotContextMenu( item );
1106} 1106}
1107void OFileSelector::slotContextMenu( QListViewItem * /*item*/) 1107void OFileSelector::slotContextMenu( QListViewItem * /*item*/)
1108{ 1108{
1109 1109
1110} 1110}
1111void OFileSelector::slotChangedDir() 1111void OFileSelector::slotChangedDir()
1112{ 1112{
1113 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1113 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1114 if(sel->isDir() ){ 1114 if(sel->isDir() ){
1115 QStringList str = QStringList::split("->", sel->text(1) ); 1115 QStringList str = QStringList::split("->", sel->text(1) );
1116 cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1116 cd( sel->directory() + "/" + str[0].stripWhiteSpace() );
1117 } 1117 }
1118} 1118}
1119void OFileSelector::slotOpen() 1119void OFileSelector::slotOpen()
1120{ 1120{
1121 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1121 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1122 if(!sel->isDir() ){ 1122 if(!sel->isDir() ){
1123 QStringList str = QStringList::split("->", sel->text(1) ); 1123 QStringList str = QStringList::split("->", sel->text(1) );
1124 slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() ); 1124 slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() );
1125 qWarning("slot open"); 1125 qWarning("slot open");
1126 // DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1126 // DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() );
1127 //emit fileSelected( lnk ); 1127 //emit fileSelected( lnk );
1128 } 1128 }
1129} 1129}
1130void OFileSelector::slotRescan() 1130void OFileSelector::slotRescan()
1131{ 1131{
1132 1132
1133} 1133}
1134void OFileSelector::slotRename() 1134void OFileSelector::slotRename()
1135{ 1135{
1136 reparse(); 1136 reparse();
1137} 1137}
1138void OFileSelector::slotDelete() 1138void OFileSelector::slotDelete()
1139{ 1139{
1140 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1140 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1141 QStringList list = QStringList::split("->", sel->text(1) ); 1141 QStringList list = QStringList::split("->", sel->text(1) );
1142 if( sel->isDir() ){ 1142 if( sel->isDir() ){
1143 QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry 1143 QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry
1144 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0], 1144 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0],
1145 tr("Yes"),tr("No"),0,1,1) ) { 1145 tr("Yes"),tr("No"),0,1,1) ) {
1146 case 0: 1146 case 0:
1147 ::system(str.utf8().data() ); 1147 ::system(str.utf8().data() );
1148 break; 1148 break;
1149 } 1149 }
1150 } else { 1150 } else {
1151 QFile::remove( list[0] ); 1151 QFile::remove( list[0] );
1152 } 1152 }
1153 m_View->takeItem( sel ); 1153 m_View->takeItem( sel );
1154 delete sel; 1154 delete sel;
1155} 1155}
1156void OFileSelector::cdUP() 1156void OFileSelector::cdUP()
1157{ 1157{
1158 QDir dir( m_currentDir ); 1158 QDir dir( m_currentDir );
1159 dir.cdUp(); 1159 dir.cdUp();
1160 if(dir.exists() ){ 1160 if(dir.exists() ){
1161 m_currentDir = dir.absPath(); 1161 m_currentDir = dir.absPath();
1162 reparse(); 1162 reparse();
1163 int count = m_location->count(); 1163 int count = m_location->count();
1164 slotInsertLocationPath( m_currentDir, count); 1164 slotInsertLocationPath( m_currentDir, count);
1165 m_location->setCurrentItem( indexByString( m_location, m_currentDir)); 1165 m_location->setCurrentItem( indexByString( m_location, m_currentDir));
1166 //this wont work in all instances 1166 //this wont work in all instances
1167 // FIXME 1167 // FIXME
1168 } 1168 }
1169} 1169}
1170void OFileSelector::slotHome() 1170void OFileSelector::slotHome()
1171{ 1171{
1172 cd(QDir::homeDirPath() ); 1172 cd(QDir::homeDirPath() );
1173} 1173}
1174void OFileSelector::slotDoc() 1174void OFileSelector::slotDoc()
1175{ 1175{
1176 cd(QPEApplication::documentDir() ); 1176 cd(QPEApplication::documentDir() );
1177} 1177}
1178void OFileSelector::slotNavigate( ) 1178void OFileSelector::slotNavigate( )
1179{ 1179{
1180 1180
1181} 1181}
1182// fill the View with life 1182// fill the View with life
1183void OFileSelector::reparse() 1183void OFileSelector::reparse()
1184{ 1184{
1185 if( m_selector == NORMAL ) 1185 if( m_selector == NORMAL )
1186 return; 1186 return;
1187 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) 1187 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL )
1188 m_View->clear(); 1188 m_View->clear();
1189 else // custom view 1189 else // custom view
1190 ; // currentView()->clear(); 1190 ; // currentView()->clear();
1191 if( m_shChooser) 1191 if( m_shChooser)
1192 qWarning("reparse %s", m_mimeCheck->currentText().latin1() ); 1192 qWarning("reparse %s", m_mimeCheck->currentText().latin1() );
1193 1193
1194 QString currentMimeType; 1194 QString currentMimeType;
1195 // let's update the mimetype 1195 // let's update the mimetype
1196 if( m_autoMime ){ 1196 if( m_autoMime ){
1197 m_mimetypes.clear(); 1197 m_mimetypes.clear();
1198 // ok we can change mimetype so we need to be able to give a selection 1198 // ok we can change mimetype so we need to be able to give a selection
1199 if( m_shChooser ) { 1199 if( m_shChooser ) {
1200 currentMimeType = m_mimeCheck->currentText(); 1200 currentMimeType = m_mimeCheck->currentText();
1201 m_mimeCheck->clear(); 1201 m_mimeCheck->clear();
1202 1202
1203 // let's find possible mimetypes 1203 // let's find possible mimetypes
1204 QDir dir( m_currentDir ); 1204 QDir dir( m_currentDir );
1205 dir.setFilter( QDir::Files | QDir::Readable ); 1205 if( dir.exists() ){
1206 dir.setSorting( QDir::Size ); 1206 dir.setFilter( QDir::Files | QDir::Readable );
1207 const QFileInfoList *list = dir.entryInfoList(); 1207 dir.setSorting( QDir::Size );
1208 QFileInfoListIterator it( *list ); 1208 const QFileInfoList *list = dir.entryInfoList();
1209 QFileInfo *fi; 1209 QFileInfoListIterator it( *list );
1210 while( (fi=it.current() ) ) { 1210 QFileInfo *fi;
1211 if( fi->extension() == QString::fromLatin1("desktop") ){ 1211 while( (fi=it.current() ) ) {
1212 ++it; 1212 if( fi->extension() == QString::fromLatin1("desktop") ){
1213 continue; 1213 ++it;
1214 } 1214 continue;
1215 MimeType type( fi->absFilePath() ); 1215 }
1216 if( !m_mimetypes.contains( type.id() ) ){ 1216 MimeType type( fi->absFilePath() );
1217 //qWarning("Type %s", type.id().latin1() ); 1217 if( !m_mimetypes.contains( type.id() ) ){
1218 m_mimetypes.insert( type.id(), type.id() ); 1218 //qWarning("Type %s", type.id().latin1() );
1219 } 1219 m_mimetypes.insert( type.id(), type.id() );
1220 }
1220 1221
1221 ++it; 1222 ++it;
1223 }
1224 // add them to the chooser
1225 updateMimeCheck();
1226 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currentMimeType ) );
1227 currentMimeType = m_mimeCheck->currentText();
1222 } 1228 }
1223 // add them to the chooser
1224 updateMimeCheck();
1225 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currentMimeType ) );
1226 currentMimeType = m_mimeCheck->currentText();
1227 } 1229 }
1228 }else { // no autoMime 1230 }else { // no autoMime
1229 // let the mimetype be set from out side the m_mimeCheck FEATURE 1231 // let the mimetype be set from out side the m_mimeCheck FEATURE
1230 1232
1231 if( m_shChooser ){ 1233 if( m_shChooser ){
1232 currentMimeType = m_mimeCheck->currentText(); 1234 currentMimeType = m_mimeCheck->currentText();
1233// updateMimeCheck(); 1235// updateMimeCheck();
1234 } 1236 }
1235 } 1237 }
1236 // now we got our mimetypes we can add the files 1238 // now we got our mimetypes we can add the files
1237 1239
1238 QDir dir( m_currentDir ); 1240 QDir dir( m_currentDir );
1239 1241
1240 int sort; 1242 if( dir.exists() ){
1241 if ( m_case ) 1243 int sort;
1242 sort = (QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed); 1244 if ( m_case )
1243 else 1245 sort = (QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed);
1244 sort = (QDir::Name | QDir::DirsFirst | QDir::Reversed); 1246 else
1245 dir.setSorting( sort ); 1247 sort = (QDir::Name | QDir::DirsFirst | QDir::Reversed);
1246 1248 dir.setSorting( sort );
1247 int filter; 1249
1248 if( m_selector == EXTENDED_ALL /*|| m_selector ==CUSTOM_ALL */ ){ 1250 int filter;
1249 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; 1251 if( m_selector == EXTENDED_ALL /*|| m_selector ==CUSTOM_ALL */ ){
1250 }else 1252 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All;
1251 filter = QDir::Files | QDir::Dirs | QDir::All; 1253 }else
1252 dir.setFilter( filter ); 1254 filter = QDir::Files | QDir::Dirs | QDir::All;
1253 1255 dir.setFilter( filter );
1254 // now go through all files 1256
1255 const QFileInfoList *list = dir.entryInfoList(); 1257 // now go through all files
1256 QFileInfoListIterator it( *list ); 1258 const QFileInfoList *list = dir.entryInfoList();
1257 QFileInfo *fi; 1259 QFileInfoListIterator it( *list );
1258 while( (fi=it.current() ) ){ 1260 QFileInfo *fi;
1259 //qWarning("True and only" ); 1261 while( (fi=it.current() ) ){
1260 if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){ 1262 //qWarning("True and only" );
1261 //qWarning(".. or ." ); 1263 if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){
1264 //qWarning(".. or ." );
1265 ++it;
1266 continue;
1267 }
1268 if( fi->isSymLink() ){
1269 QString file = fi->dirPath( true ) + "/" + fi->readLink();
1270 for( int i = 0; i<=4; i++) { // 5 tries to prevent dos
1271 QFileInfo info( file );
1272 if( !info.exists() ){
1273 addSymlink( currentMimeType, fi, TRUE );
1274 break;
1275 }else if( info.isDir() ){
1276 addDir( currentMimeType, fi, TRUE );
1277 break;
1278 }else if( info.isFile() ){
1279 addFile( currentMimeType, fi, TRUE );
1280 break;
1281 }else if( info.isSymLink() ){
1282 file = info.dirPath(true ) + "/" + info.readLink() ;
1283 break;
1284 }else if( i == 4){
1285 addSymlink( currentMimeType, fi );
1286 }
1287 } // off for loop
1288 }else if( fi->isDir() ){
1289 addDir( currentMimeType, fi );
1290 }else if( fi->isFile() ){
1291 addFile( currentMimeType, fi );
1292 }
1293 //qWarning( "%s", fi->fileName().latin1() );
1262 ++it; 1294 ++it;
1263 continue; 1295 } // of while loop
1264 } 1296 } // if ( dir.exists() )
1265 if( fi->isSymLink() ){
1266 QString file = fi->dirPath( true ) + "/" + fi->readLink();
1267 for( int i = 0; i<=4; i++) { // 5 tries to prevent dos
1268 QFileInfo info( file );
1269 if( !info.exists() ){
1270 addSymlink( currentMimeType, fi, TRUE );
1271 break;
1272 }else if( info.isDir() ){
1273 addDir( currentMimeType, fi, TRUE );
1274 break;
1275 }else if( info.isFile() ){
1276 addFile( currentMimeType, fi, TRUE );
1277 break;
1278 }else if( info.isSymLink() ){
1279 file = info.dirPath(true ) + "/" + info.readLink() ;
1280 break;
1281 }else if( i == 4){
1282 addSymlink( currentMimeType, fi );
1283 }
1284 } // off for loop
1285 }else if( fi->isDir() ){
1286 addDir( currentMimeType, fi );
1287 }else if( fi->isFile() ){
1288 addFile( currentMimeType, fi );
1289 }
1290 //qWarning( "%s", fi->fileName().latin1() );
1291 ++it;
1292 } // of while loop
1293 m_View->sort(); 1297 m_View->sort();
1294 if( m_shTool ){ 1298 if( m_shTool ){
1295 m_location->insertItem( m_currentDir ); 1299 m_location->insertItem( m_currentDir );
1296 1300
1297 } 1301 }
1298 // reenable painting and updates 1302 // reenable painting and updates
1299} 1303}