summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index b3aacd6..9534667 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -943,193 +943,193 @@ void OFileSelector::initializePerm()
943 m_lay->addWidget( m_checkPerm ); 943 m_lay->addWidget( m_checkPerm );
944 944
945 } 945 }
946} 946}
947void OFileSelector::initPics() 947void OFileSelector::initPics()
948{ 948{
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 int pos2; 1021 int pos2;
1022 for ( it2 = list.begin(); it2 != list.end(); ++it2 ) { 1022 for ( it2 = list.begin(); it2 != list.end(); ++it2 ) {
1023 pos = (*it2).findRev("/*"); 1023 pos = (*it2).findRev("/*");
1024 if ( pos >= 0 ) { 1024 if ( pos >= 0 ) {
1025 if ( mime.contains( (*it2).left(pos) ) ) return true; 1025 if ( mime.contains( (*it2).left(pos) ) ) return true;
1026 } 1026 }
1027 } 1027 }
1028 return false; 1028 return false;
1029} 1029}
1030void OFileSelector::slotFileSelected( const QString &string ) 1030void OFileSelector::slotFileSelected( const QString &string )
1031{ 1031{
1032 if( m_shLne ) 1032 if( m_shLne )
1033 m_edit->setText( string ); 1033 m_edit->setText( string );
1034 emit fileSelected( string ); 1034 emit fileSelected( string );
1035} 1035}
1036void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) 1036void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk )
1037{ 1037{
1038 slotFileSelected( lnk.name() ); 1038 slotFileSelected( lnk.name() );
1039 // emit fileSelected( lnk ); 1039 emit fileSelected( lnk );
1040} 1040}
1041void OFileSelector::slotSelectionChanged() 1041void OFileSelector::slotSelectionChanged()
1042{ 1042{
1043 1043
1044} 1044}
1045void OFileSelector::slotCurrentChanged(QListViewItem* item ) 1045void OFileSelector::slotCurrentChanged(QListViewItem* item )
1046{ 1046{
1047 if( item == 0 ) 1047 if( item == 0 )
1048 return; 1048 return;
1049 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { 1049 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) {
1050 OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;) 1050 OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;)
1051 qWarning("current changed"); 1051 qWarning("current changed");
1052 if(!sel->isDir() ){ 1052 if(!sel->isDir() ){
1053 if( m_shLne ) 1053 if( m_shLne )
1054 m_edit->setText( sel->text(1) ); 1054 m_edit->setText( sel->text(1) );
1055 1055
1056 if (m_mode == FILESELECTOR ) { 1056 if (m_mode == FILESELECTOR ) {
1057 QStringList str = QStringList::split("->", sel->text(1) ); 1057 QStringList str = QStringList::split("->", sel->text(1) );
1058 QString path =sel->directory() + "/" + str[0].stripWhiteSpace(); 1058 QString path =sel->directory() + "/" + str[0].stripWhiteSpace();
1059 emit fileSelected(path ); 1059 emit fileSelected(path );
1060 DocLnk lnk( path ); 1060 DocLnk lnk( path );
1061 emit fileSelected(lnk ); 1061 emit fileSelected(lnk );
1062 } 1062 }
1063 } 1063 }
1064 } 1064 }
1065} 1065}
1066void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &, int) 1066void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &, int)
1067{ 1067{
1068 if ( item == 0 ) 1068 if ( item == 0 )
1069 return; 1069 return;
1070 1070
1071 if( button != Qt::LeftButton ) 1071 if( button != Qt::LeftButton )
1072 return; 1072 return;
1073 1073
1074 switch( m_selector ){ 1074 switch( m_selector ){
1075 default: 1075 default:
1076 break; 1076 break;
1077 case EXTENDED: // fall through 1077 case EXTENDED: // fall through
1078 case EXTENDED_ALL:{ 1078 case EXTENDED_ALL:{
1079 OFileSelectorItem *sel = (OFileSelectorItem*)item; 1079 OFileSelectorItem *sel = (OFileSelectorItem*)item;
1080 if(!sel->isLocked() ){ 1080 if(!sel->isLocked() ){
1081 QStringList str = QStringList::split("->", sel->text(1) ); 1081 QStringList str = QStringList::split("->", sel->text(1) );
1082 if( sel->isDir() ){ 1082 if( sel->isDir() ){
1083 cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1083 cd( sel->directory() + "/" + str[0].stripWhiteSpace() );
1084 // if MODE Dir m_shLne set the Text 1084 // if MODE Dir m_shLne set the Text
1085 }else{ 1085 }else{
1086 if( m_shLne ) 1086 if( m_shLne )
1087 m_edit->setText( str[0].stripWhiteSpace() ); 1087 m_edit->setText( str[0].stripWhiteSpace() );
1088 qWarning("selected here in slot clicked"); 1088 qWarning("selected here in slot clicked");
1089 emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1089 emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() );
1090 DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1090 DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() );
1091 qWarning("file selected"); 1091 qWarning("file selected");
1092 emit fileSelected( lnk ); 1092 emit fileSelected( lnk );
1093 } 1093 }
1094 } 1094 }
1095 break; 1095 break;
1096 } 1096 }
1097 } 1097 }
1098} 1098}
1099void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) 1099void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int )
1100{ 1100{
1101 if( item == 0 ) 1101 if( item == 0 )
1102 return; 1102 return;
1103 1103
1104 if( button != Qt::RightButton ) 1104 if( button != Qt::RightButton )
1105 return; 1105 return;
1106 slotContextMenu( item ); 1106 slotContextMenu( item );
1107} 1107}
1108void OFileSelector::slotContextMenu( QListViewItem *item) 1108void OFileSelector::slotContextMenu( QListViewItem *item)
1109{ 1109{
1110 1110
1111} 1111}
1112void OFileSelector::slotChangedDir() 1112void OFileSelector::slotChangedDir()
1113{ 1113{
1114 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1114 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1115 if(sel->isDir() ){ 1115 if(sel->isDir() ){
1116 QStringList str = QStringList::split("->", sel->text(1) ); 1116 QStringList str = QStringList::split("->", sel->text(1) );
1117 cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1117 cd( sel->directory() + "/" + str[0].stripWhiteSpace() );
1118 } 1118 }
1119} 1119}
1120void OFileSelector::slotOpen() 1120void OFileSelector::slotOpen()
1121{ 1121{
1122 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1122 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1123 if(!sel->isDir() ){ 1123 if(!sel->isDir() ){
1124 QStringList str = QStringList::split("->", sel->text(1) ); 1124 QStringList str = QStringList::split("->", sel->text(1) );
1125 slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() ); 1125 slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() );
1126 qWarning("slot open"); 1126 qWarning("slot open");
1127 // DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1127 // DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() );
1128 //emit fileSelected( lnk ); 1128 //emit fileSelected( lnk );
1129 } 1129 }
1130} 1130}
1131void OFileSelector::slotRescan() 1131void OFileSelector::slotRescan()
1132{ 1132{
1133 1133
1134} 1134}
1135void OFileSelector::slotRename() 1135void OFileSelector::slotRename()