summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-06-03 18:16:49 (UTC)
committer llornkcor <llornkcor>2002-06-03 18:16:49 (UTC)
commit8d5f42d770abca69d490774f4b1fc8284e7a86be (patch) (unidiff)
treebb40659658517007ddbab1044a376618ee897e8f
parentd068b0a50826a189d11e2f2037ee21a4c0850567 (diff)
downloadopie-8d5f42d770abca69d490774f4b1fc8284e7a86be.zip
opie-8d5f42d770abca69d490774f4b1fc8284e7a86be.tar.gz
opie-8d5f42d770abca69d490774f4b1fc8284e7a86be.tar.bz2
fixed bug with opening in app
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 869a433..a000e9b 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -924,830 +924,830 @@ void AdvancedFm::readConfig()
924} 924}
925 925
926void AdvancedFm::writeConfig() 926void AdvancedFm::writeConfig()
927{ 927{
928 Config cfg("AdvancedFm"); 928 Config cfg("AdvancedFm");
929} 929}
930 930
931void AdvancedFm::currentPathComboChanged() 931void AdvancedFm::currentPathComboChanged()
932{ 932{
933 if (TabWidget->currentPageIndex() == 0) { 933 if (TabWidget->currentPageIndex() == 0) {
934 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 934 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
935 currentDir.setPath( currentPathCombo->lineEdit()->text() ); 935 currentDir.setPath( currentPathCombo->lineEdit()->text() );
936 populateLocalView(); 936 populateLocalView();
937 } else { 937 } else {
938 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 938 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
939 } 939 }
940 } 940 }
941 if (TabWidget->currentPageIndex() == 0) { 941 if (TabWidget->currentPageIndex() == 0) {
942 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 942 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
943 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); 943 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() );
944 populateRemoteView(); 944 populateRemoteView();
945 } else { 945 } else {
946 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 946 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
947 } 947 }
948 } 948 }
949} 949}
950 950
951void AdvancedFm::fillCombo(const QString &currentPath) { 951void AdvancedFm::fillCombo(const QString &currentPath) {
952 952
953 if (TabWidget->currentPageIndex() == 0) { 953 if (TabWidget->currentPageIndex() == 0) {
954 currentPathCombo->lineEdit()->setText( currentPath); 954 currentPathCombo->lineEdit()->setText( currentPath);
955 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 955 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
956 currentPathCombo->clear(); 956 currentPathCombo->clear();
957 localDirPathStringList.prepend( currentPath ); 957 localDirPathStringList.prepend( currentPath );
958 currentPathCombo->insertStringList( localDirPathStringList,-1); 958 currentPathCombo->insertStringList( localDirPathStringList,-1);
959 } 959 }
960 } else { 960 } else {
961 currentPathCombo->lineEdit()->setText( currentPath); 961 currentPathCombo->lineEdit()->setText( currentPath);
962 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 962 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
963 currentPathCombo->clear(); 963 currentPathCombo->clear();
964 remoteDirPathStringList.prepend( currentPath ); 964 remoteDirPathStringList.prepend( currentPath );
965 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 965 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
966 } 966 }
967 } 967 }
968} 968}
969 969
970void AdvancedFm::currentPathComboActivated(const QString & currentPath) { 970void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
971 if (TabWidget->currentPageIndex() == 0) { 971 if (TabWidget->currentPageIndex() == 0) {
972 chdir( currentPath.latin1() ); 972 chdir( currentPath.latin1() );
973 currentDir.cd( currentPath, TRUE); 973 currentDir.cd( currentPath, TRUE);
974 populateLocalView(); 974 populateLocalView();
975 update(); 975 update();
976 } else { 976 } else {
977 chdir( currentPath.latin1() ); 977 chdir( currentPath.latin1() );
978 currentRemoteDir.cd( currentPath, TRUE); 978 currentRemoteDir.cd( currentPath, TRUE);
979 populateRemoteView(); 979 populateRemoteView();
980 update(); 980 update();
981 } 981 }
982} 982}
983 983
984void AdvancedFm::filePerms() { 984void AdvancedFm::filePerms() {
985 985
986 QStringList curFileList = getPath(); 986 QStringList curFileList = getPath();
987 QString filePath; 987 QString filePath;
988 988
989 if (TabWidget->currentPageIndex() == 0) { 989 if (TabWidget->currentPageIndex() == 0) {
990 filePath = currentDir.canonicalPath()+"/"; 990 filePath = currentDir.canonicalPath()+"/";
991 } else { 991 } else {
992 filePath= currentRemoteDir.canonicalPath()+"/"; 992 filePath= currentRemoteDir.canonicalPath()+"/";
993 } 993 }
994 994
995 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 995 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
996 filePermissions *filePerm; 996 filePermissions *filePerm;
997 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); 997 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
998 filePerm->showMaximized(); 998 filePerm->showMaximized();
999 filePerm->exec(); 999 filePerm->exec();
1000 if( filePerm) 1000 if( filePerm)
1001 delete filePerm; 1001 delete filePerm;
1002 } 1002 }
1003 if (TabWidget->currentPageIndex() == 0) { 1003 if (TabWidget->currentPageIndex() == 0) {
1004 populateLocalView(); 1004 populateLocalView();
1005 } else { 1005 } else {
1006 populateRemoteView(); 1006 populateRemoteView();
1007 } 1007 }
1008} 1008}
1009 1009
1010void AdvancedFm::doProperties() { 1010void AdvancedFm::doProperties() {
1011 QStringList curFileList = getPath(); 1011 QStringList curFileList = getPath();
1012 QString filePath; 1012 QString filePath;
1013 if (TabWidget->currentPageIndex() == 0) { 1013 if (TabWidget->currentPageIndex() == 0) {
1014 filePath = currentDir.canonicalPath()+"/"; 1014 filePath = currentDir.canonicalPath()+"/";
1015 } else { 1015 } else {
1016 filePath= currentRemoteDir.canonicalPath()+"/"; 1016 filePath= currentRemoteDir.canonicalPath()+"/";
1017 } 1017 }
1018 // qDebug("%d",curFileList.count()); 1018 // qDebug("%d",curFileList.count());
1019 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1019 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1020 qDebug((filePath+*it)); 1020 qDebug((filePath+*it));
1021 DocLnk lnk( (filePath+*it)); 1021 DocLnk lnk( (filePath+*it));
1022 LnkProperties prop( &lnk ); 1022 LnkProperties prop( &lnk );
1023// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 1023// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
1024 prop.showMaximized(); 1024 prop.showMaximized();
1025 prop.exec(); 1025 prop.exec();
1026 } 1026 }
1027} 1027}
1028 1028
1029QStringList AdvancedFm::getPath() { 1029QStringList AdvancedFm::getPath() {
1030 QStringList strList; 1030 QStringList strList;
1031 if (TabWidget->currentPageIndex() == 0) { 1031 if (TabWidget->currentPageIndex() == 0) {
1032 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 1032 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
1033 QListViewItemIterator it( Local_View ); 1033 QListViewItemIterator it( Local_View );
1034 for ( ; it.current(); ++it ) { 1034 for ( ; it.current(); ++it ) {
1035 if ( it.current()->isSelected() ) { 1035 if ( it.current()->isSelected() ) {
1036 strList << it.current()->text(0); 1036 strList << it.current()->text(0);
1037 } 1037 }
1038 } 1038 }
1039 return strList; 1039 return strList;
1040 } else { 1040 } else {
1041 QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); 1041 QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
1042 QListViewItemIterator it( Remote_View ); 1042 QListViewItemIterator it( Remote_View );
1043 for ( ; it.current(); ++it ) { 1043 for ( ; it.current(); ++it ) {
1044 if ( it.current()->isSelected() ) { 1044 if ( it.current()->isSelected() ) {
1045 strList << it.current()->text(0); 1045 strList << it.current()->text(0);
1046 } 1046 }
1047 } 1047 }
1048 return strList; 1048 return strList;
1049 } 1049 }
1050 return ""; 1050 return "";
1051} 1051}
1052 1052
1053void AdvancedFm::homeButtonPushed() { 1053void AdvancedFm::homeButtonPushed() {
1054 QString current = QDir::homeDirPath(); 1054 QString current = QDir::homeDirPath();
1055 chdir( current.latin1() ); 1055 chdir( current.latin1() );
1056 if (TabWidget->currentPageIndex() == 0) { 1056 if (TabWidget->currentPageIndex() == 0) {
1057 currentDir.cd( current, TRUE); 1057 currentDir.cd( current, TRUE);
1058 populateLocalView(); 1058 populateLocalView();
1059 } else { 1059 } else {
1060 currentRemoteDir.cd( current, TRUE); 1060 currentRemoteDir.cd( current, TRUE);
1061 populateRemoteView(); 1061 populateRemoteView();
1062 } 1062 }
1063 update(); 1063 update();
1064} 1064}
1065 1065
1066void AdvancedFm::docButtonPushed() { 1066void AdvancedFm::docButtonPushed() {
1067 QString current = QPEApplication::documentDir(); 1067 QString current = QPEApplication::documentDir();
1068 chdir( current.latin1() ); 1068 chdir( current.latin1() );
1069 if (TabWidget->currentPageIndex() == 0) { 1069 if (TabWidget->currentPageIndex() == 0) {
1070 currentDir.cd( current, TRUE); 1070 currentDir.cd( current, TRUE);
1071 populateLocalView(); 1071 populateLocalView();
1072 } else { 1072 } else {
1073 currentRemoteDir.cd( current, TRUE); 1073 currentRemoteDir.cd( current, TRUE);
1074 populateRemoteView(); 1074 populateRemoteView();
1075 } 1075 }
1076 update(); 1076 update();
1077} 1077}
1078 1078
1079void AdvancedFm::SDButtonPushed() { 1079void AdvancedFm::SDButtonPushed() {
1080 QString current = "/mnt/card"; 1080 QString current = "/mnt/card";
1081 chdir( current.latin1() ); 1081 chdir( current.latin1() );
1082 if (TabWidget->currentPageIndex() == 0) { 1082 if (TabWidget->currentPageIndex() == 0) {
1083 currentDir.cd( current, TRUE); 1083 currentDir.cd( current, TRUE);
1084 populateLocalView(); 1084 populateLocalView();
1085 } else { 1085 } else {
1086 currentRemoteDir.cd( current, TRUE); 1086 currentRemoteDir.cd( current, TRUE);
1087 populateRemoteView(); 1087 populateRemoteView();
1088 } 1088 }
1089 update(); 1089 update();
1090 1090
1091} 1091}
1092 1092
1093void AdvancedFm::CFButtonPushed() { 1093void AdvancedFm::CFButtonPushed() {
1094 QString current = "/mnt/cf"; 1094 QString current = "/mnt/cf";
1095 chdir( current.latin1() ); 1095 chdir( current.latin1() );
1096 if (TabWidget->currentPageIndex() == 0) { 1096 if (TabWidget->currentPageIndex() == 0) {
1097 currentDir.cd( current, TRUE); 1097 currentDir.cd( current, TRUE);
1098 populateLocalView(); 1098 populateLocalView();
1099 } else { 1099 } else {
1100 currentRemoteDir.cd( current, TRUE); 1100 currentRemoteDir.cd( current, TRUE);
1101 populateRemoteView(); 1101 populateRemoteView();
1102 } 1102 }
1103 update(); 1103 update();
1104 1104
1105} 1105}
1106 1106
1107 1107
1108void AdvancedFm::upDir() 1108void AdvancedFm::upDir()
1109{ 1109{
1110 if (TabWidget->currentPageIndex() == 0) { 1110 if (TabWidget->currentPageIndex() == 0) {
1111 QString current = currentDir.canonicalPath(); 1111 QString current = currentDir.canonicalPath();
1112 QDir dir(current); 1112 QDir dir(current);
1113 dir.cdUp(); 1113 dir.cdUp();
1114 current = dir.canonicalPath(); 1114 current = dir.canonicalPath();
1115 chdir( current.latin1() ); 1115 chdir( current.latin1() );
1116 currentDir.cd( current, TRUE); 1116 currentDir.cd( current, TRUE);
1117 populateLocalView(); 1117 populateLocalView();
1118 update(); 1118 update();
1119 } else { 1119 } else {
1120 QString current = currentRemoteDir.canonicalPath(); 1120 QString current = currentRemoteDir.canonicalPath();
1121 QDir dir(current); 1121 QDir dir(current);
1122 dir.cdUp(); 1122 dir.cdUp();
1123 current = dir.canonicalPath(); 1123 current = dir.canonicalPath();
1124 chdir( current.latin1() ); 1124 chdir( current.latin1() );
1125 currentRemoteDir.cd( current, TRUE); 1125 currentRemoteDir.cd( current, TRUE);
1126 populateRemoteView(); 1126 populateRemoteView();
1127 update(); 1127 update();
1128 } 1128 }
1129} 1129}
1130 1130
1131void AdvancedFm::copy() 1131void AdvancedFm::copy()
1132{ 1132{
1133 QStringList curFileList = getPath(); 1133 QStringList curFileList = getPath();
1134 if( curFileList.count() > 0) { 1134 if( curFileList.count() > 0) {
1135 QString curFile; 1135 QString curFile;
1136 if (TabWidget->currentPageIndex() == 0) { 1136 if (TabWidget->currentPageIndex() == 0) {
1137 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1137 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1138 1138
1139 QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1139 QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1140// if(destFile.right(1).find("/",0,TRUE) == -1) 1140// if(destFile.right(1).find("/",0,TRUE) == -1)
1141// destFile+="/"; 1141// destFile+="/";
1142// destFile +=(*it); 1142// destFile +=(*it);
1143 1143
1144 curFile = currentDir.canonicalPath()+"/"+(*it); 1144 curFile = currentDir.canonicalPath()+"/"+(*it);
1145// if(curFile.right(1).find("/",0,TRUE) == -1) 1145// if(curFile.right(1).find("/",0,TRUE) == -1)
1146// curFile +="/"; 1146// curFile +="/";
1147// curFile +=(*it); 1147// curFile +=(*it);
1148 1148
1149 QFile f(destFile); 1149 QFile f(destFile);
1150 if( f.exists()) 1150 if( f.exists())
1151 f.remove(); 1151 f.remove();
1152 if(!copyFile(destFile, curFile) ) { 1152 if(!copyFile(destFile, curFile) ) {
1153 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); 1153 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
1154 qWarning("nothin doing"); 1154 qWarning("nothin doing");
1155 } 1155 }
1156 } 1156 }
1157 populateRemoteView(); 1157 populateRemoteView();
1158 TabWidget->setCurrentPage(1); 1158 TabWidget->setCurrentPage(1);
1159 1159
1160 } else { 1160 } else {
1161 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1161 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1162 1162
1163 QString destFile = currentDir.canonicalPath()+"/"+(*it); 1163 QString destFile = currentDir.canonicalPath()+"/"+(*it);
1164 curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1164 curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1165 1165
1166 QFile f(destFile); 1166 QFile f(destFile);
1167 if( f.exists()) 1167 if( f.exists())
1168 f.remove(); 1168 f.remove();
1169 if(!copyFile(destFile, curFile) ) { 1169 if(!copyFile(destFile, curFile) ) {
1170 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); 1170 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
1171 1171
1172 qWarning("nothin doing"); 1172 qWarning("nothin doing");
1173 } 1173 }
1174 } 1174 }
1175 populateLocalView(); 1175 populateLocalView();
1176 TabWidget->setCurrentPage(0); 1176 TabWidget->setCurrentPage(0);
1177 } 1177 }
1178} 1178}
1179} 1179}
1180 1180
1181void AdvancedFm::copyAs() 1181void AdvancedFm::copyAs()
1182{ 1182{
1183 QStringList curFileList = getPath(); 1183 QStringList curFileList = getPath();
1184 if( curFileList.count() > 0) { 1184 if( curFileList.count() > 0) {
1185 QString curFile; 1185 QString curFile;
1186 InputDialog *fileDlg; 1186 InputDialog *fileDlg;
1187 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); 1187 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
1188 1188
1189 if (TabWidget->currentPageIndex() == 0) { 1189 if (TabWidget->currentPageIndex() == 0) {
1190 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1190 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1191 QString destFile; 1191 QString destFile;
1192 curFile = currentDir.canonicalPath()+"/"+(*it); 1192 curFile = currentDir.canonicalPath()+"/"+(*it);
1193// InputDialog *fileDlg; 1193// InputDialog *fileDlg;
1194// fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); 1194// fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
1195 fileDlg->setInputText((const QString &) destFile ); 1195 fileDlg->setInputText((const QString &) destFile );
1196 fileDlg->exec(); 1196 fileDlg->exec();
1197 if( fileDlg->result() == 1 ) { 1197 if( fileDlg->result() == 1 ) {
1198 QString filename = fileDlg->LineEdit1->text(); 1198 QString filename = fileDlg->LineEdit1->text();
1199 destFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1199 destFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1200 1200
1201 QFile f(destFile); 1201 QFile f(destFile);
1202 if( f.exists()) 1202 if( f.exists())
1203 f.remove(); 1203 f.remove();
1204 if(!copyFile(destFile, curFile) ) { 1204 if(!copyFile(destFile, curFile) ) {
1205 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); 1205 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
1206 qWarning("nothin doing"); 1206 qWarning("nothin doing");
1207 } 1207 }
1208 } 1208 }
1209 } 1209 }
1210 1210
1211 populateRemoteView(); 1211 populateRemoteView();
1212 TabWidget->setCurrentPage(1); 1212 TabWidget->setCurrentPage(1);
1213 } else { 1213 } else {
1214 if (TabWidget->currentPageIndex() == 0) { 1214 if (TabWidget->currentPageIndex() == 0) {
1215 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1215 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1216 1216
1217 curFile = currentDir.canonicalPath()+"/"+(*it); 1217 curFile = currentDir.canonicalPath()+"/"+(*it);
1218 QString destFile; 1218 QString destFile;
1219 fileDlg->setInputText((const QString &) destFile); 1219 fileDlg->setInputText((const QString &) destFile);
1220 fileDlg->exec(); 1220 fileDlg->exec();
1221 if( fileDlg->result() == 1 ) { 1221 if( fileDlg->result() == 1 ) {
1222 QString filename = fileDlg->LineEdit1->text(); 1222 QString filename = fileDlg->LineEdit1->text();
1223 destFile = currentDir.canonicalPath()+"/"+(*it); 1223 destFile = currentDir.canonicalPath()+"/"+(*it);
1224 1224
1225 QFile f(destFile); 1225 QFile f(destFile);
1226 if( f.exists()) 1226 if( f.exists())
1227 f.remove(); 1227 f.remove();
1228 if(!copyFile(destFile, curFile) ) { 1228 if(!copyFile(destFile, curFile) ) {
1229 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); 1229 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
1230 qWarning("nothin doing"); 1230 qWarning("nothin doing");
1231 } 1231 }
1232 } 1232 }
1233 } 1233 }
1234 populateLocalView(); 1234 populateLocalView();
1235 TabWidget->setCurrentPage(0); 1235 TabWidget->setCurrentPage(0);
1236 } 1236 }
1237 } 1237 }
1238} 1238}
1239} 1239}
1240 1240
1241void AdvancedFm::move() { 1241void AdvancedFm::move() {
1242 1242
1243 QStringList curFileList = getPath(); 1243 QStringList curFileList = getPath();
1244 if( curFileList.count() > 0) { 1244 if( curFileList.count() > 0) {
1245 QString curFile; 1245 QString curFile;
1246// qDebug(curFile); 1246// qDebug(curFile);
1247 QString destFile; 1247 QString destFile;
1248 1248
1249 if (TabWidget->currentPageIndex() == 0) { 1249 if (TabWidget->currentPageIndex() == 0) {
1250 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1250 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1251 QString destFile = currentRemoteDir.canonicalPath(); 1251 QString destFile = currentRemoteDir.canonicalPath();
1252 if(destFile.right(1).find("/",0,TRUE) == -1) 1252 if(destFile.right(1).find("/",0,TRUE) == -1)
1253 destFile+="/"; 1253 destFile+="/";
1254 destFile +=(*it); 1254 destFile +=(*it);
1255 curFile = currentDir.canonicalPath(); 1255 curFile = currentDir.canonicalPath();
1256 qDebug("Destination file is "+destFile); 1256 qDebug("Destination file is "+destFile);
1257 if(curFile.right(1).find("/",0,TRUE) == -1) 1257 if(curFile.right(1).find("/",0,TRUE) == -1)
1258 curFile +="/"; 1258 curFile +="/";
1259 curFile+=(*it); 1259 curFile+=(*it);
1260 1260
1261 QFile f(destFile); 1261 QFile f(destFile);
1262 if( f.exists()) 1262 if( f.exists())
1263 f.remove(); 1263 f.remove();
1264 if(!copyFile( destFile, curFile) ) { 1264 if(!copyFile( destFile, curFile) ) {
1265 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); 1265 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile));
1266 return; 1266 return;
1267 } 1267 }
1268 QFile::remove(curFile); 1268 QFile::remove(curFile);
1269 } 1269 }
1270 TabWidget->setCurrentPage(1); 1270 TabWidget->setCurrentPage(1);
1271 } else { 1271 } else {
1272 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1272 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1273 QString destFile = currentRemoteDir.canonicalPath(); 1273 QString destFile = currentRemoteDir.canonicalPath();
1274 if(destFile.right(1).find("/",0,TRUE) == -1) 1274 if(destFile.right(1).find("/",0,TRUE) == -1)
1275 destFile+="/"; 1275 destFile+="/";
1276 destFile +=(*it); 1276 destFile +=(*it);
1277 qDebug("Destination file is "+destFile); 1277 qDebug("Destination file is "+destFile);
1278 curFile = currentDir.canonicalPath(); 1278 curFile = currentDir.canonicalPath();
1279 if(curFile.right(1).find("/",0,TRUE) == -1) 1279 if(curFile.right(1).find("/",0,TRUE) == -1)
1280 curFile +="/"; 1280 curFile +="/";
1281 curFile+=(*it); 1281 curFile+=(*it);
1282 1282
1283 QFile f(destFile); 1283 QFile f(destFile);
1284 if( f.exists()) 1284 if( f.exists())
1285 f.remove(); 1285 f.remove();
1286 if(!copyFile(destFile, curFile) ) { 1286 if(!copyFile(destFile, curFile) ) {
1287 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); 1287 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile));
1288 return; 1288 return;
1289 } 1289 }
1290 QFile::remove(curFile); 1290 QFile::remove(curFile);
1291 TabWidget->setCurrentPage(0); 1291 TabWidget->setCurrentPage(0);
1292 } 1292 }
1293 } 1293 }
1294 populateRemoteView(); 1294 populateRemoteView();
1295 populateLocalView(); 1295 populateLocalView();
1296} 1296}
1297 } 1297 }
1298 1298
1299 bool AdvancedFm::copyFile( const QString & dest, const QString & src ) 1299 bool AdvancedFm::copyFile( const QString & dest, const QString & src )
1300{ 1300{
1301 char bf[ 50000 ]; 1301 char bf[ 50000 ];
1302 int bytesRead; 1302 int bytesRead;
1303 bool success = TRUE; 1303 bool success = TRUE;
1304 struct stat status; 1304 struct stat status;
1305 1305
1306 QFile s( src ); 1306 QFile s( src );
1307 QFile d( dest ); 1307 QFile d( dest );
1308 1308
1309 if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { 1309 if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) {
1310 while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { 1310 while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) {
1311 if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ 1311 if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){
1312 success = FALSE; 1312 success = FALSE;
1313 break; 1313 break;
1314 } 1314 }
1315 } 1315 }
1316 if( success && (bytesRead > 0) ){ 1316 if( success && (bytesRead > 0) ){
1317 d.writeBlock( bf, bytesRead ); 1317 d.writeBlock( bf, bytesRead );
1318 } 1318 }
1319 } else { 1319 } else {
1320 success = FALSE; 1320 success = FALSE;
1321 } 1321 }
1322 1322
1323 // Set file permissions 1323 // Set file permissions
1324 if( stat( (const char *) src, &status ) == 0 ){ 1324 if( stat( (const char *) src, &status ) == 0 ){
1325 chmod( (const char *) dest, status.st_mode ); 1325 chmod( (const char *) dest, status.st_mode );
1326 } 1326 }
1327 1327
1328 return success; 1328 return success;
1329} 1329}
1330 1330
1331void AdvancedFm::runCommand() { 1331void AdvancedFm::runCommand() {
1332 QString curFile; 1332 QString curFile;
1333 if (TabWidget->currentPageIndex() == 0) { 1333 if (TabWidget->currentPageIndex() == 0) {
1334 if( Local_View->currentItem()) 1334 if( Local_View->currentItem())
1335 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); 1335 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0);
1336 } else { 1336 } else {
1337 if(Remote_View->currentItem()) 1337 if(Remote_View->currentItem())
1338 curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); 1338 curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0);
1339 } 1339 }
1340 1340
1341 InputDialog *fileDlg; 1341 InputDialog *fileDlg;
1342 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 1342 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
1343 fileDlg->setInputText(curFile); 1343 fileDlg->setInputText(curFile);
1344 fileDlg->exec(); 1344 fileDlg->exec();
1345 QString command; 1345 QString command;
1346 if( fileDlg->result() == 1 ) { 1346 if( fileDlg->result() == 1 ) {
1347 command = fileDlg->LineEdit1->text(); 1347 command = fileDlg->LineEdit1->text();
1348 1348
1349// int err=0; 1349// int err=0;
1350 Output *outDlg; 1350 Output *outDlg;
1351 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); 1351 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
1352 outDlg->showMaximized(); 1352 outDlg->showMaximized();
1353 outDlg->show(); 1353 outDlg->show();
1354 qApp->processEvents(); 1354 qApp->processEvents();
1355 FILE *fp; 1355 FILE *fp;
1356 char line[130]; 1356 char line[130];
1357 sleep(1); 1357 sleep(1);
1358// if(command.find("2>",0,TRUE) != -1) 1358// if(command.find("2>",0,TRUE) != -1)
1359 command +=" 2>&1"; 1359 command +=" 2>&1";
1360 fp = popen( (const char *) command, "r"); 1360 fp = popen( (const char *) command, "r");
1361 if ( !fp ) { 1361 if ( !fp ) {
1362 qDebug("Could not execute '" + command + "'! err=%d", fp); 1362 qDebug("Could not execute '" + command + "'! err=%d", fp);
1363 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); 1363 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") );
1364 pclose(fp); 1364 pclose(fp);
1365 return; 1365 return;
1366 } else { 1366 } else {
1367 while ( fgets( line, sizeof line, fp)) { 1367 while ( fgets( line, sizeof line, fp)) {
1368 QString lineStr = line; 1368 QString lineStr = line;
1369 lineStr=lineStr.left(lineStr.length()-1); 1369 lineStr=lineStr.left(lineStr.length()-1);
1370 outDlg->OutputEdit->append(lineStr); 1370 outDlg->OutputEdit->append(lineStr);
1371 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 1371 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
1372 } 1372 }
1373 } 1373 }
1374 } 1374 }
1375} 1375}
1376 1376
1377void AdvancedFm::runCommandStd() { 1377void AdvancedFm::runCommandStd() {
1378 QString curFile; 1378 QString curFile;
1379 if (TabWidget->currentPageIndex() == 0) { 1379 if (TabWidget->currentPageIndex() == 0) {
1380 if( Local_View->currentItem()) 1380 if( Local_View->currentItem())
1381 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); 1381 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0);
1382 } else { 1382 } else {
1383 if(Remote_View->currentItem()) 1383 if(Remote_View->currentItem())
1384 curFile = currentRemoteDir.canonicalPath() +"/"+ Remote_View->currentItem()->text(0); 1384 curFile = currentRemoteDir.canonicalPath() +"/"+ Remote_View->currentItem()->text(0);
1385 } 1385 }
1386 1386
1387 InputDialog *fileDlg; 1387 InputDialog *fileDlg;
1388 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 1388 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
1389 fileDlg->setInputText(curFile); 1389 fileDlg->setInputText(curFile);
1390 fileDlg->exec(); 1390 fileDlg->exec();
1391 QString command; 1391 QString command;
1392 if( fileDlg->result() == 1 ) { 1392 if( fileDlg->result() == 1 ) {
1393 qApp->processEvents(); 1393 qApp->processEvents();
1394 command = fileDlg->LineEdit1->text() + " &"; 1394 command = fileDlg->LineEdit1->text() + " &";
1395 system(command.latin1()); 1395 system(command.latin1());
1396 } 1396 }
1397} 1397}
1398 1398
1399void AdvancedFm::fileStatus() { 1399void AdvancedFm::fileStatus() {
1400 QString curFile; 1400 QString curFile;
1401 if (TabWidget->currentPageIndex() == 0) { 1401 if (TabWidget->currentPageIndex() == 0) {
1402 curFile = Local_View->currentItem()->text(0); 1402 curFile = Local_View->currentItem()->text(0);
1403 } else { 1403 } else {
1404 curFile = Remote_View->currentItem()->text(0); 1404 curFile = Remote_View->currentItem()->text(0);
1405 } 1405 }
1406 QString command = " stat -l "+ curFile +" 2>&1"; 1406 QString command = " stat -l "+ curFile +" 2>&1";
1407// int err=0; 1407// int err=0;
1408 Output *outDlg; 1408 Output *outDlg;
1409 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); 1409 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
1410 outDlg->showMaximized(); 1410 outDlg->showMaximized();
1411 outDlg->show(); 1411 outDlg->show();
1412 qApp->processEvents(); 1412 qApp->processEvents();
1413 FILE *fp; 1413 FILE *fp;
1414 char line[130]; 1414 char line[130];
1415 sleep(1); 1415 sleep(1);
1416 fp = popen( (const char *) command, "r"); 1416 fp = popen( (const char *) command, "r");
1417 if ( !fp ) { 1417 if ( !fp ) {
1418 qDebug("Could not execute '" + command + "'! err=%d", fp); 1418 qDebug("Could not execute '" + command + "'! err=%d", fp);
1419 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); 1419 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") );
1420 pclose(fp); 1420 pclose(fp);
1421 return; 1421 return;
1422 } else { 1422 } else {
1423 while ( fgets( line, sizeof line, fp)) { 1423 while ( fgets( line, sizeof line, fp)) {
1424 outDlg->OutputEdit->append(line); 1424 outDlg->OutputEdit->append(line);
1425 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 1425 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
1426 1426
1427 } 1427 }
1428 1428
1429 } 1429 }
1430} 1430}
1431 1431
1432void AdvancedFm::mkDir() { 1432void AdvancedFm::mkDir() {
1433 if (TabWidget->currentPageIndex() == 0) 1433 if (TabWidget->currentPageIndex() == 0)
1434 localMakDir(); 1434 localMakDir();
1435 else 1435 else
1436 remoteMakDir(); 1436 remoteMakDir();
1437 1437
1438} 1438}
1439 1439
1440void AdvancedFm::rn() { 1440void AdvancedFm::rn() {
1441 if (TabWidget->currentPageIndex() == 0) 1441 if (TabWidget->currentPageIndex() == 0)
1442 localRename(); 1442 localRename();
1443 else 1443 else
1444 remoteRename(); 1444 remoteRename();
1445 1445
1446} 1446}
1447 1447
1448void AdvancedFm::del() { 1448void AdvancedFm::del() {
1449 if (TabWidget->currentPageIndex() == 0) 1449 if (TabWidget->currentPageIndex() == 0)
1450 localDelete(); 1450 localDelete();
1451 else 1451 else
1452 remoteDelete(); 1452 remoteDelete();
1453} 1453}
1454 1454
1455void AdvancedFm::doAbout() { 1455void AdvancedFm::doAbout() {
1456 QMessageBox::message("AdvancedFm","Advanced FileManager\n" 1456 QMessageBox::message("AdvancedFm","Advanced FileManager\n"
1457 "is copyright 2002 by\n" 1457 "is copyright 2002 by\n"
1458 "L.J.Potter<llornkcor@handhelds.org>\n" 1458 "L.J.Potter<llornkcor@handhelds.org>\n"
1459 "and is licensed by the GPL"); 1459 "and is licensed by the GPL");
1460} 1460}
1461 1461
1462void AdvancedFm::keyReleaseEvent( QKeyEvent *e) 1462void AdvancedFm::keyReleaseEvent( QKeyEvent *e)
1463{ 1463{
1464 switch ( e->key() ) { 1464 switch ( e->key() ) {
1465 case Key_Delete: 1465 case Key_Delete:
1466 del(); 1466 del();
1467 break; 1467 break;
1468 case Key_H: 1468 case Key_H:
1469 showHidden(); 1469 showHidden();
1470 break; 1470 break;
1471 case Key_E: 1471 case Key_E:
1472 runThis(); 1472 runThis();
1473 break; 1473 break;
1474 case Key_C: 1474 case Key_C:
1475 copy(); 1475 copy();
1476 break; 1476 break;
1477 case Key_A: 1477 case Key_A:
1478 copyAs(); 1478 copyAs();
1479 break; 1479 break;
1480 case Key_M: 1480 case Key_M:
1481 move(); 1481 move();
1482 break; 1482 break;
1483 case Key_R: 1483 case Key_R:
1484 rn(); 1484 rn();
1485 break; 1485 break;
1486 case Key_I: 1486 case Key_I:
1487 fileStatus(); 1487 fileStatus();
1488 break; 1488 break;
1489 case Key_U: 1489 case Key_U:
1490 upDir(); 1490 upDir();
1491 break; 1491 break;
1492 case Key_P: 1492 case Key_P:
1493 filePerms(); 1493 filePerms();
1494 break; 1494 break;
1495 case Key_N: 1495 case Key_N:
1496 mkDir(); 1496 mkDir();
1497 break; 1497 break;
1498 case Key_1: 1498 case Key_1:
1499 switchToLocalTab(); 1499 switchToLocalTab();
1500 break; 1500 break;
1501 case Key_2: 1501 case Key_2:
1502 switchToRemoteTab(); 1502 switchToRemoteTab();
1503 break; 1503 break;
1504 case Key_3: 1504 case Key_3:
1505 CFButtonPushed(); 1505 CFButtonPushed();
1506 break; 1506 break;
1507 case Key_4: 1507 case Key_4:
1508 SDButtonPushed(); 1508 SDButtonPushed();
1509 break; 1509 break;
1510 case Key_5: 1510 case Key_5:
1511 homeButtonPushed(); 1511 homeButtonPushed();
1512 break; 1512 break;
1513 case Key_6: 1513 case Key_6:
1514 docButtonPushed(); 1514 docButtonPushed();
1515 break; 1515 break;
1516 case Key_7: 1516 case Key_7:
1517 break; 1517 break;
1518 case Key_8: 1518 case Key_8:
1519 break; 1519 break;
1520 case Key_9: 1520 case Key_9:
1521 break; 1521 break;
1522 case Key_0: 1522 case Key_0:
1523 break; 1523 break;
1524 } 1524 }
1525} 1525}
1526 1526
1527void AdvancedFm::mkSym() { 1527void AdvancedFm::mkSym() {
1528 QString cmd; 1528 QString cmd;
1529 QStringList curFileList = getPath(); 1529 QStringList curFileList = getPath();
1530 if( curFileList.count() > 0) { 1530 if( curFileList.count() > 0) {
1531 1531
1532 if (TabWidget->currentPageIndex() == 0) { 1532 if (TabWidget->currentPageIndex() == 0) {
1533 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1533 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1534 1534
1535 QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); 1535 QString destName = currentRemoteDir.canonicalPath()+"/"+(*it);
1536 if(destName.right(1) == "/") destName = destName.left( destName.length() -1); 1536 if(destName.right(1) == "/") destName = destName.left( destName.length() -1);
1537 QString curFile = currentDir.canonicalPath()+"/"+(*it); 1537 QString curFile = currentDir.canonicalPath()+"/"+(*it);
1538 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); 1538 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
1539 cmd = "ln -s "+curFile+" "+destName; 1539 cmd = "ln -s "+curFile+" "+destName;
1540 qDebug(cmd); 1540 qDebug(cmd);
1541 system(cmd.latin1() ); 1541 system(cmd.latin1() );
1542 } 1542 }
1543 populateRemoteView(); 1543 populateRemoteView();
1544 TabWidget->setCurrentPage(1); 1544 TabWidget->setCurrentPage(1);
1545 } else { 1545 } else {
1546 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1546 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1547 1547
1548 QString destName = currentDir.canonicalPath()+"/"+(*it); 1548 QString destName = currentDir.canonicalPath()+"/"+(*it);
1549 if(destName.right(1) == "/") destName = destName.left( destName.length() -1); 1549 if(destName.right(1) == "/") destName = destName.left( destName.length() -1);
1550 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1550 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1551 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); 1551 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
1552 1552
1553 cmd = "ln -s "+curFile+" "+destName; 1553 cmd = "ln -s "+curFile+" "+destName;
1554 qDebug(cmd); 1554 qDebug(cmd);
1555 system(cmd.latin1() ); 1555 system(cmd.latin1() );
1556 } 1556 }
1557 populateLocalView(); 1557 populateLocalView();
1558 TabWidget->setCurrentPage(0); 1558 TabWidget->setCurrentPage(0);
1559 } 1559 }
1560} 1560}
1561} 1561}
1562 1562
1563void AdvancedFm::QPEButtonPushed() { 1563void AdvancedFm::QPEButtonPushed() {
1564 QString current = QPEApplication::qpeDir(); 1564 QString current = QPEApplication::qpeDir();
1565 chdir( current.latin1() ); 1565 chdir( current.latin1() );
1566 if (TabWidget->currentPageIndex() == 0) { 1566 if (TabWidget->currentPageIndex() == 0) {
1567 currentDir.cd( current, TRUE); 1567 currentDir.cd( current, TRUE);
1568 populateLocalView(); 1568 populateLocalView();
1569 } else { 1569 } else {
1570 currentRemoteDir.cd( current, TRUE); 1570 currentRemoteDir.cd( current, TRUE);
1571 populateRemoteView(); 1571 populateRemoteView();
1572 } 1572 }
1573 update(); 1573 update();
1574} 1574}
1575 1575
1576void AdvancedFm::parsetab(const QString &fileName) { 1576void AdvancedFm::parsetab(const QString &fileName) {
1577 1577
1578 fileSystemTypeList.clear(); 1578 fileSystemTypeList.clear();
1579 fsList.clear(); 1579 fsList.clear();
1580 struct mntent *me; 1580 struct mntent *me;
1581// if(fileName == "/etc/mtab") { 1581// if(fileName == "/etc/mtab") {
1582 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 1582 FILE *mntfp = setmntent( fileName.latin1(), "r" );
1583 if ( mntfp ) { 1583 if ( mntfp ) {
1584 while ( (me = getmntent( mntfp )) != 0 ) { 1584 while ( (me = getmntent( mntfp )) != 0 ) {
1585 QString deviceName = me->mnt_fsname; 1585 QString deviceName = me->mnt_fsname;
1586 QString filesystemType = me->mnt_type; 1586 QString filesystemType = me->mnt_type;
1587 QString mountDir = me->mnt_dir; 1587 QString mountDir = me->mnt_dir;
1588 if(deviceName != "none") { 1588 if(deviceName != "none") {
1589 if( fsList.contains(filesystemType) == 0 1589 if( fsList.contains(filesystemType) == 0
1590 & filesystemType.find("proc",0,TRUE) == -1 1590 & filesystemType.find("proc",0,TRUE) == -1
1591 & filesystemType.find("cramfs",0,TRUE) == -1 1591 & filesystemType.find("cramfs",0,TRUE) == -1
1592 & filesystemType.find("auto",0,TRUE) == -1) 1592 & filesystemType.find("auto",0,TRUE) == -1)
1593 fsList << filesystemType; 1593 fsList << filesystemType;
1594// deviceList << deviceName; 1594// deviceList << deviceName;
1595// qDebug(mountDir+"::"+filesystemType); 1595// qDebug(mountDir+"::"+filesystemType);
1596 fileSystemTypeList << mountDir+"::"+filesystemType; 1596 fileSystemTypeList << mountDir+"::"+filesystemType;
1597 } 1597 }
1598 } 1598 }
1599 } 1599 }
1600 endmntent( mntfp ); 1600 endmntent( mntfp );
1601} 1601}
1602 1602
1603QString AdvancedFm::getFileSystemType(const QString &currentText) { 1603QString AdvancedFm::getFileSystemType(const QString &currentText) {
1604 parsetab("/etc/mtab"); //why did TT forget filesystem type? 1604 parsetab("/etc/mtab"); //why did TT forget filesystem type?
1605 QString current = currentText;//.right( currentText.length()-1); 1605 QString current = currentText;//.right( currentText.length()-1);
1606 QString baseFs; 1606 QString baseFs;
1607 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 1607 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
1608 QString temp = (*it); 1608 QString temp = (*it);
1609 QString path = temp.left(temp.find("::",0,TRUE) ); 1609 QString path = temp.left(temp.find("::",0,TRUE) );
1610 path = path.right( path.length()-1); 1610 path = path.right( path.length()-1);
1611 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 1611 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
1612 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { 1612 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
1613 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 1613 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
1614 } 1614 }
1615 } 1615 }
1616 return baseFs; 1616 return baseFs;
1617} 1617}
1618 1618
1619 1619
1620void AdvancedFm::doBeam() { 1620void AdvancedFm::doBeam() {
1621 Ir ir; 1621 Ir ir;
1622 if(!ir.supported()){ 1622 if(!ir.supported()){
1623 } else { 1623 } else {
1624 1624
1625 QStringList curFileList = getPath(); 1625 QStringList curFileList = getPath();
1626 if( curFileList.count() > 0) { 1626 if( curFileList.count() > 0) {
1627 1627
1628 if (TabWidget->currentPageIndex() == 0) { 1628 if (TabWidget->currentPageIndex() == 0) {
1629 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1629 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1630 1630
1631 QString curFile = currentDir.canonicalPath()+"/"+(*it); 1631 QString curFile = currentDir.canonicalPath()+"/"+(*it);
1632 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); 1632 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
1633 Ir *file = new Ir(this, "IR"); 1633 Ir *file = new Ir(this, "IR");
1634 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); 1634 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * )));
1635 file->send( curFile, curFile ); 1635 file->send( curFile, curFile );
1636 } 1636 }
1637 1637
1638 } else { 1638 } else {
1639 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1639 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1640 1640
1641 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1641 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1642 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); 1642 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
1643 Ir *file = new Ir(this, "IR"); 1643 Ir *file = new Ir(this, "IR");
1644 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); 1644 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * )));
1645 file->send( curFile, curFile ); 1645 file->send( curFile, curFile );
1646 1646
1647 } 1647 }
1648 } 1648 }
1649 } 1649 }
1650} 1650}
1651 1651
1652} 1652}
1653 1653
1654void AdvancedFm::fileBeamFinished( Ir *ir) { 1654void AdvancedFm::fileBeamFinished( Ir *ir) {
1655 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); 1655 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
1656 1656
1657} 1657}
1658 1658
1659 1659
1660// QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 1660// QList<QListViewItem> * getSelectedItems( QListView * Local_View );
1661// QListViewItemIterator it( Local_View ); 1661// QListViewItemIterator it( Local_View );
1662// for ( ; it.current(); ++it ) { 1662// for ( ; it.current(); ++it ) {
1663// if ( it.current()->isSelected() ) { 1663// if ( it.current()->isSelected() ) {
1664// QString strItem = it.current()->text(0); 1664// QString strItem = it.current()->text(0);
1665// QString localFile = currentDir.canonicalPath()+"/"+strItem; 1665// QString localFile = currentDir.canonicalPath()+"/"+strItem;
1666// QFileInfo fi(localFile); 1666// QFileInfo fi(localFile);
1667// } 1667// }
1668// } 1668// }
1669 1669
1670void AdvancedFm::showFileMenu() { 1670void AdvancedFm::showFileMenu() {
1671 QString curApp; 1671 QString curApp;
1672 bool isLocalView = false; 1672 bool isLocalView = false;
1673 if (TabWidget->currentPageIndex() == 0) { 1673 if (TabWidget->currentPageIndex() == 0) {
1674 isLocalView = TRUE; 1674 isLocalView = TRUE;
1675 curApp = Local_View->currentItem()->text(0); 1675 curApp = Local_View->currentItem()->text(0);
1676 } else { 1676 } else {
1677 curApp = Remote_View->currentItem()->text(0); 1677 curApp = Remote_View->currentItem()->text(0);
1678 } 1678 }
1679 1679
1680 MimeType mt( curApp ); 1680 MimeType mt( curApp );
1681 const AppLnk* app = mt.application(); 1681 const AppLnk* app = mt.application();
1682 QFile fi(curApp); 1682 QFile fi(curApp);
1683 1683
1684 QPopupMenu m; 1684 QPopupMenu m;
1685 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 1685 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
1686 m.insertSeparator(); 1686 m.insertSeparator();
1687 if ( QFileInfo(fi).isDir() ) { 1687 if ( QFileInfo(fi).isDir() ) {
1688 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 1688 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
1689 } else { 1689 } else {
1690 1690
1691 if ( app ) 1691 if ( app )
1692 m.insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( run() ) ); 1692 m.insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( runThis() ) );
1693 else if( QFileInfo(fi).isExecutable() ) 1693 else if( QFileInfo(fi).isExecutable() )
1694 m.insertItem( tr( "Execute" ), this, SLOT( run() ) ); 1694 m.insertItem( tr( "Execute" ), this, SLOT( runThis() ) );
1695 1695
1696 m.insertItem( /*Resource::loadPixmap( "txt" ),*/ tr( "Open as text" ),this, SLOT( runText() ) ); 1696 m.insertItem( /*Resource::loadPixmap( "txt" ),*/ tr( "Open as text" ),this, SLOT( runText() ) );
1697 } 1697 }
1698 m.insertSeparator(); 1698 m.insertSeparator();
1699 1699
1700 1700
1701 if(isLocalView) 1701 if(isLocalView)
1702 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 1702 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
1703 else 1703 else
1704 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 1704 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
1705 1705
1706 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 1706 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
1707 m.insertSeparator(); 1707 m.insertSeparator();
1708 1708
1709 if(isLocalView) 1709 if(isLocalView)
1710 m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); 1710 m.insertItem( tr( "Rename" ), this, SLOT( localRename() ));
1711 else 1711 else
1712 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 1712 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
1713 1713
1714 m.insertItem( tr( "Copy" ), this, SLOT( copy() )); 1714 m.insertItem( tr( "Copy" ), this, SLOT( copy() ));
1715 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 1715 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
1716 m.insertItem( tr( "Move" ), this, SLOT( move() )); 1716 m.insertItem( tr( "Move" ), this, SLOT( move() ));
1717 m.insertSeparator(); 1717 m.insertSeparator();
1718 1718
1719 if(isLocalView) 1719 if(isLocalView)
1720 m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); 1720 m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() ));
1721 else 1721 else
1722 m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); 1722 m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() ));
1723 1723
1724 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 1724 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
1725 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 1725 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
1726 m.insertSeparator(); 1726 m.insertSeparator();
1727 1727
1728 if(isLocalView) 1728 if(isLocalView)
1729 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 1729 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
1730 else 1730 else
1731 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 1731 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
1732 1732
1733 m.insertSeparator(); 1733 m.insertSeparator();
1734 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 1734 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
1735 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings 1735 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings
1736 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 1736 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
1737 m.setCheckable(TRUE); 1737 m.setCheckable(TRUE);
1738 if (!b) 1738 if (!b)
1739 m.setItemChecked(m.idAt(0),TRUE); 1739 m.setItemChecked(m.idAt(0),TRUE);
1740 else 1740 else
1741 m.setItemChecked(m.idAt(0),FALSE); 1741 m.setItemChecked(m.idAt(0),FALSE);
1742 if(Ir::supported()) 1742 if(Ir::supported())
1743 m.insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); 1743 m.insertItem( tr( "Beam File" ), this, SLOT( doBeam() ));
1744 m.exec( QCursor::pos() ); 1744 m.exec( QCursor::pos() );
1745} 1745}
1746 1746
1747 1747
1748void AdvancedFm::cancelMenuTimer() 1748void AdvancedFm::cancelMenuTimer()
1749{ 1749{
1750qDebug("cancel menu timer"); 1750qDebug("cancel menu timer");
1751 if( menuTimer.isActive() ) 1751 if( menuTimer.isActive() )
1752 menuTimer.stop(); 1752 menuTimer.stop();
1753} 1753}