summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/advancedfm.cpp
Unidiff
Diffstat (limited to 'noncore/apps/advancedfm/advancedfm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index a60d6ce..a47edd8 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -68,13 +68,13 @@ void AdvancedFm::cleanUp() {
68 QFile file( sfile); 68 QFile file( sfile);
69 if(file.exists()) 69 if(file.exists())
70 file.remove(); 70 file.remove();
71} 71}
72 72
73void AdvancedFm::tabChanged(QWidget *) { 73void AdvancedFm::tabChanged(QWidget *) {
74// qWarning("tab changed"); 74// owarn << "tab changed" << oendl;
75 QString path = CurrentDir()->canonicalPath(); 75 QString path = CurrentDir()->canonicalPath();
76 currentPathCombo->lineEdit()->setText( path ); 76 currentPathCombo->lineEdit()->setText( path );
77 77
78 if(whichTab == 1) { 78 if(whichTab == 1) {
79 viewMenu->setItemChecked(viewMenu->idAt(0), true); 79 viewMenu->setItemChecked(viewMenu->idAt(0), true);
80 viewMenu->setItemChecked(viewMenu->idAt(1), false); 80 viewMenu->setItemChecked(viewMenu->idAt(1), false);
@@ -90,19 +90,19 @@ void AdvancedFm::tabChanged(QWidget *) {
90 chdir( path.latin1()); 90 chdir( path.latin1());
91} 91}
92 92
93 93
94void AdvancedFm::populateView() { 94void AdvancedFm::populateView() {
95 95
96// qWarning("PopulateView"); 96// owarn << "PopulateView" << oendl;
97 QPixmap pm; 97 QPixmap pm;
98 QListView *thisView = CurrentView(); 98 QListView *thisView = CurrentView();
99 QDir *thisDir = CurrentDir(); 99 QDir *thisDir = CurrentDir();
100 QString path = thisDir->canonicalPath(); 100 QString path = thisDir->canonicalPath();
101 101
102//qWarning("path is "+path); 102//owarn << "path is "+path << oendl;
103 thisView->clear(); 103 thisView->clear();
104 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 104 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
105 thisDir->setMatchAllDirs(TRUE); 105 thisDir->setMatchAllDirs(TRUE);
106 thisDir->setNameFilter(filterStr); 106 thisDir->setNameFilter(filterStr);
107 QString fileL, fileS, fileDate; 107 QString fileL, fileS, fileDate;
108 QString fs= getFileSystemType((const QString &) path); 108 QString fs= getFileSystemType((const QString &) path);
@@ -157,13 +157,13 @@ void AdvancedFm::populateView() {
157 pm=mt.pixmap(); //sets the correct pixmap for mimetype 157 pm=mt.pixmap(); //sets the correct pixmap for mimetype
158 if(pm.isNull()) { 158 if(pm.isNull()) {
159 pm = unknownXpm; 159 pm = unknownXpm;
160 } 160 }
161 } 161 }
162 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { 162 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) {
163 // qDebug(" overlay link image"); 163 // odebug << " overlay link image" << oendl;
164 pm= Resource::loadPixmap( "advancedfm/symlink" ); 164 pm= Resource::loadPixmap( "advancedfm/symlink" );
165 // pm= Resource::loadPixmap( "folder" ); 165 // pm= Resource::loadPixmap( "folder" );
166// QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 166// QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
167// QPainter painter( &pm ); 167// QPainter painter( &pm );
168// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 168// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
169// pm.setMask( pm.createHeuristicMask( FALSE ) ); 169// pm.setMask( pm.createHeuristicMask( FALSE ) );
@@ -181,13 +181,13 @@ void AdvancedFm::populateView() {
181 DIR *dir; 181 DIR *dir;
182 struct dirent *mydirent; 182 struct dirent *mydirent;
183 183
184 if((dir = opendir( path.latin1())) != NULL) 184 if((dir = opendir( path.latin1())) != NULL)
185 while ((mydirent = readdir(dir)) != NULL) { 185 while ((mydirent = readdir(dir)) != NULL) {
186 lstat( mydirent->d_name, &buf); 186 lstat( mydirent->d_name, &buf);
187// qDebug(mydirent->d_name); 187// odebug << mydirent->d_name << oendl;
188 fileL.sprintf("%s", mydirent->d_name); 188 fileL.sprintf("%s", mydirent->d_name);
189 devT = buf.st_dev; 189 devT = buf.st_dev;
190 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 190 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
191 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 191 fileDate.sprintf("%s", ctime( &buf.st_mtime));
192 if( fileL.find(".") == -1 ) { 192 if( fileL.find(".") == -1 ) {
193 item= new QListViewItem( thisView, fileL, fileS, fileDate); 193 item= new QListViewItem( thisView, fileL, fileS, fileDate);
@@ -206,26 +206,26 @@ void AdvancedFm::populateView() {
206void AdvancedFm::rePopulate() { 206void AdvancedFm::rePopulate() {
207 populateView(); 207 populateView();
208 setOtherTabCurrent(); 208 setOtherTabCurrent();
209 populateView(); 209 populateView();
210 210
211// int tmpTab = whichTab; 211// int tmpTab = whichTab;
212// // qDebug("%d", tmpTab); 212// // odebug << "" << tmpTab << "" << oendl;
213 213
214// for(int i =1; i < 3; i++) { 214// for(int i =1; i < 3; i++) {
215// TabWidget->setCurrentWidget(i - 1); 215// TabWidget->setCurrentWidget(i - 1);
216// populateView(); 216// populateView();
217// } 217// }
218// TabWidget->setCurrentWidget( tmpTab - 1); 218// TabWidget->setCurrentWidget( tmpTab - 1);
219} 219}
220 220
221void AdvancedFm::ListClicked(QListViewItem *selectedItem) { 221void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
222//qWarning("listclicked"); 222//owarn << "listclicked" << oendl;
223 if(selectedItem) { 223 if(selectedItem) {
224 QString strItem=selectedItem->text(0); 224 QString strItem=selectedItem->text(0);
225// qWarning(strItem); 225// owarn << strItem << oendl;
226 QString strSize=selectedItem->text(1); 226 QString strSize=selectedItem->text(1);
227 strSize=strSize.stripWhiteSpace(); 227 strSize=strSize.stripWhiteSpace();
228 bool isDirectory = false; 228 bool isDirectory = false;
229 QString strItem2; 229 QString strItem2;
230 230
231 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink 231 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink
@@ -264,19 +264,19 @@ void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , in
264 break; 264 break;
265 }; 265 };
266} 266}
267 267
268 268
269void AdvancedFm::switchToLocalTab() { 269void AdvancedFm::switchToLocalTab() {
270//qWarning("switch to local view"); 270//owarn << "switch to local view" << oendl;
271 TabWidget->setCurrentWidget(0); 271 TabWidget->setCurrentWidget(0);
272 Local_View->setFocus(); 272 Local_View->setFocus();
273} 273}
274 274
275void AdvancedFm::switchToRemoteTab() { 275void AdvancedFm::switchToRemoteTab() {
276//qWarning("switch to local view"); 276//owarn << "switch to local view" << oendl;
277 TabWidget->setCurrentWidget(1); 277 TabWidget->setCurrentWidget(1);
278 Remote_View->setFocus(); 278 Remote_View->setFocus();
279} 279}
280 280
281void AdvancedFm::readConfig() { 281void AdvancedFm::readConfig() {
282 Config cfg("AdvancedFm"); 282 Config cfg("AdvancedFm");
@@ -326,13 +326,13 @@ QStringList AdvancedFm::getPath() {
326 QListView *thisView=CurrentView(); 326 QListView *thisView=CurrentView();
327 QList<QListViewItem> * getSelectedItems( QListView * thisView ); 327 QList<QListViewItem> * getSelectedItems( QListView * thisView );
328 QListViewItemIterator it( thisView ); 328 QListViewItemIterator it( thisView );
329 for ( ; it.current(); ++it ) { 329 for ( ; it.current(); ++it ) {
330 if ( it.current()->isSelected() ) { 330 if ( it.current()->isSelected() ) {
331 strList << it.current()->text(0); 331 strList << it.current()->text(0);
332// qDebug(it.current()->text(0)); 332// odebug << it.current()->text(0) << oendl;
333 } 333 }
334 } 334 }
335 return strList; 335 return strList;
336} 336}
337 337
338void AdvancedFm::homeButtonPushed() { 338void AdvancedFm::homeButtonPushed() {
@@ -377,13 +377,13 @@ void AdvancedFm::doAbout() {
377 "is copyright 2002-2003 by\n" 377 "is copyright 2002-2003 by\n"
378 "L.J.Potter<llornkcor@handhelds.org>\n" 378 "L.J.Potter<llornkcor@handhelds.org>\n"
379 "and is licensed by the GPL")); 379 "and is licensed by the GPL"));
380} 380}
381 381
382void AdvancedFm::keyPressEvent( QKeyEvent *e) { 382void AdvancedFm::keyPressEvent( QKeyEvent *e) {
383// qWarning("key %d", e->key()); 383// owarn << "key " << e->key() << "" << oendl;
384// if( CurrentView()->hasFocus() ) 384// if( CurrentView()->hasFocus() )
385 { 385 {
386 switch ( e->key() ) { 386 switch ( e->key() ) {
387 case Key_Left: 387 case Key_Left:
388 upDir(); 388 upDir();
389 break; 389 break;
@@ -635,13 +635,13 @@ void AdvancedFm::addToDocs() {
635 QDir *thisDir = CurrentDir(); 635 QDir *thisDir = CurrentDir();
636 636
637 if( strListPaths.count() > 0) { 637 if( strListPaths.count() > 0) {
638 QString curFile; 638 QString curFile;
639 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { 639 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
640 curFile = thisDir->canonicalPath()+"/"+(*it); 640 curFile = thisDir->canonicalPath()+"/"+(*it);
641// qDebug(curFile); 641// odebug << curFile << oendl;
642 QFileInfo fi(curFile); 642 QFileInfo fi(curFile);
643 DocLnk f; 643 DocLnk f;
644// curFile.replace(QRegExp("\\..*"),""); 644// curFile.replace(QRegExp("\\..*"),"");
645 f.setName(fi.baseName() ); 645 f.setName(fi.baseName() );
646 f.setFile( curFile); 646 f.setFile( curFile);
647 f.writeLink(); 647 f.writeLink();
@@ -708,13 +708,13 @@ void AdvancedFm::addCustomDir() {
708 708
709 cfg.writeEntry("CustomDir", list, ','); 709 cfg.writeEntry("CustomDir", list, ',');
710 cfg.write(); 710 cfg.write();
711} 711}
712 712
713void AdvancedFm::removeCustomDir() { 713void AdvancedFm::removeCustomDir() {
714// qDebug("remove custom dir"); 714// odebug << "remove custom dir" << oendl;
715 Config cfg("AdvancedFm"); 715 Config cfg("AdvancedFm");
716 cfg.setGroup("Menu"); 716 cfg.setGroup("Menu");
717 QString dir; 717 QString dir;
718 QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); 718 QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)',');
719 QStringList list2; 719 QStringList list2;
720 dir = CurrentDir()->canonicalPath(); 720 dir = CurrentDir()->canonicalPath();
@@ -743,13 +743,13 @@ void AdvancedFm::removeCustomDir() {
743 } 743 }
744// customDirsToMenu(); 744// customDirsToMenu();
745 745
746} 746}
747 747
748void AdvancedFm::gotoCustomDir(const QString &dir) { 748void AdvancedFm::gotoCustomDir(const QString &dir) {
749// qDebug("gotoCustomDir(const QString &dir) " +dir ); 749// odebug << "gotoCustomDir(const QString &dir) " +dir << oendl;
750// QString curDir = dir; 750// QString curDir = dir;
751// QDir *thisDir = CurrentDir(); 751// QDir *thisDir = CurrentDir();
752// if( curDir.isEmpty()) { 752// if( curDir.isEmpty()) {
753// } 753// }
754 if( dir == s_addBookmark) { 754 if( dir == s_addBookmark) {
755 addCustomDir(); 755 addCustomDir();
@@ -784,56 +784,56 @@ QDir *AdvancedFm::OtherDir() {
784 return &currentDir; 784 return &currentDir;
785 } 785 }
786} 786}
787 787
788QListView * AdvancedFm::CurrentView() { 788QListView * AdvancedFm::CurrentView() {
789 if ( whichTab == 1) { 789 if ( whichTab == 1) {
790// qWarning("CurrentView Tab 1"); 790// owarn << "CurrentView Tab 1" << oendl;
791 return Local_View; 791 return Local_View;
792 } else { 792 } else {
793// qWarning("CurrentView Tab 2"); 793// owarn << "CurrentView Tab 2" << oendl;
794 return Remote_View; 794 return Remote_View;
795 } 795 }
796} 796}
797 797
798QListView * AdvancedFm::OtherView() { 798QListView * AdvancedFm::OtherView() {
799 if ( whichTab == 1) 799 if ( whichTab == 1)
800 return Remote_View; 800 return Remote_View;
801 else 801 else
802 return Local_View; 802 return Local_View;
803} 803}
804 804
805void AdvancedFm::setOtherTabCurrent() { 805void AdvancedFm::setOtherTabCurrent() {
806// qWarning("setOtherTabCurrent() %d", whichTab); 806// owarn << "setOtherTabCurrent() " << whichTab << "" << oendl;
807 if ( whichTab == 1) { 807 if ( whichTab == 1) {
808 TabWidget->setCurrentWidget(1); 808 TabWidget->setCurrentWidget(1);
809 } else { 809 } else {
810 TabWidget->setCurrentWidget(0); 810 TabWidget->setCurrentWidget(0);
811 } 811 }
812 OtherView()->setFocus(); 812 OtherView()->setFocus();
813 OtherView()->setSelected( CurrentView()->firstChild(), true); 813 OtherView()->setSelected( CurrentView()->firstChild(), true);
814} 814}
815 815
816void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { 816void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
817// qDebug("qcop message "+msg ); 817// odebug << "qcop message "+msg << oendl;
818 QDataStream stream ( data, IO_ReadOnly ); 818 QDataStream stream ( data, IO_ReadOnly );
819 if ( msg == "openDirectory(QString)" ) { 819 if ( msg == "openDirectory(QString)" ) {
820// qDebug("received"); 820// odebug << "received" << oendl;
821 QString file; 821 QString file;
822 stream >> file; 822 stream >> file;
823 gotoDirectory( (const QString &) file); 823 gotoDirectory( (const QString &) file);
824 } 824 }
825} 825}
826 826
827void AdvancedFm::setDocument(const QString &file) { 827void AdvancedFm::setDocument(const QString &file) {
828 gotoDirectory( file); 828 gotoDirectory( file);
829 829
830} 830}
831 831
832void AdvancedFm::gotoDirectory(const QString &file) { 832void AdvancedFm::gotoDirectory(const QString &file) {
833// qWarning("goto dir "+file); 833// owarn << "goto dir "+file << oendl;
834 QString curDir = file; 834 QString curDir = file;
835 QDir *thisDir = CurrentDir(); 835 QDir *thisDir = CurrentDir();
836 if(QDir( curDir).exists() ) { 836 if(QDir( curDir).exists() ) {
837 thisDir->setPath( curDir ); 837 thisDir->setPath( curDir );
838 chdir( curDir.latin1() ); 838 chdir( curDir.latin1() );
839 thisDir->cd( curDir, TRUE); 839 thisDir->cd( curDir, TRUE);
@@ -863,13 +863,13 @@ void AdvancedFm::findFile(const QString &fileName) {
863 thisView->ensureItemVisible(it.current()); 863 thisView->ensureItemVisible(it.current());
864 } 864 }
865 } 865 }
866} 866}
867 867
868void AdvancedFm::slotSwitchMenu(int ) { 868void AdvancedFm::slotSwitchMenu(int ) {
869// qDebug("Switch %d", item); 869// odebug << "Switch " << item << "" << oendl;
870 // viewMenu->setItemChecked(item, true); 870 // viewMenu->setItemChecked(item, true);
871} 871}
872 872
873void AdvancedFm::dealWithSchmooSchmaa(QWidget *w) { 873void AdvancedFm::dealWithSchmooSchmaa(QWidget *w) {
874 tabChanged( w); 874 tabChanged( w);
875 if( w == Local_View) { 875 if( w == Local_View) {