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.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index ac16540..9c13e53 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -28,49 +28,53 @@
28#include <qpe/resource.h> 28#include <qpe/resource.h>
29#include <qpe/menubutton.h> 29#include <qpe/menubutton.h>
30 30
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qlistview.h> 35#include <qlistview.h>
36#include <qlabel.h> 36#include <qlabel.h>
37#include <qwidget.h> 37#include <qwidget.h>
38#include <qlayout.h> 38#include <qlayout.h>
39#include <qimage.h> 39#include <qimage.h>
40#include <qmessagebox.h> 40#include <qmessagebox.h>
41#include <qlineedit.h> 41#include <qlineedit.h>
42 42
43#include <qpe/qpemessagebox.h> 43#include <qpe/qpemessagebox.h>
44 44
45#include <sys/stat.h> 45#include <sys/stat.h>
46#include <time.h> 46#include <time.h>
47#include <dirent.h> 47#include <dirent.h>
48#include <fcntl.h> 48#include <fcntl.h>
49#include <sys/vfs.h> 49#include <sys/vfs.h>
50#include <mntent.h> 50#include <mntent.h>
51 51
52#ifdef NOQUICKLAUNCH
52AdvancedFm::AdvancedFm( ) 53AdvancedFm::AdvancedFm( )
54#else
55AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags )
56#endif
53 : QMainWindow( ) { 57 : QMainWindow( ) {
54 init(); 58 init();
55 renameBox = 0; 59 renameBox = 0;
56 60
57 unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 61 unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
58 62
59 initConnections(); 63 initConnections();
60 whichTab=1; 64 whichTab=1;
61 rePopulate(); 65 rePopulate();
62 currentPathCombo->setFocus(); 66 currentPathCombo->setFocus();
63 channel = new QCopChannel( "QPE/Application/advancedfm", this ); 67 channel = new QCopChannel( "QPE/Application/advancedfm", this );
64 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 68 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
65 this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); 69 this, SLOT( qcopReceive(const QCString&, const QByteArray&)) );
66} 70}
67 71
68AdvancedFm::~AdvancedFm() { 72AdvancedFm::~AdvancedFm() {
69} 73}
70 74
71 75
72void AdvancedFm::cleanUp() { 76void AdvancedFm::cleanUp() {
73 QString sfile=QDir::homeDirPath(); 77 QString sfile=QDir::homeDirPath();
74 if(sfile.right(1) != "/") 78 if(sfile.right(1) != "/")
75 sfile+="/._temp"; 79 sfile+="/._temp";
76 else 80 else
@@ -82,55 +86,55 @@ void AdvancedFm::cleanUp() {
82 86
83void AdvancedFm::tabChanged(QWidget *) { 87void AdvancedFm::tabChanged(QWidget *) {
84// qWarning("tab changed"); 88// qWarning("tab changed");
85 QString path = CurrentDir()->canonicalPath(); 89 QString path = CurrentDir()->canonicalPath();
86 currentPathCombo->lineEdit()->setText( path ); 90 currentPathCombo->lineEdit()->setText( path );
87 91
88 if(whichTab == 1) { 92 if(whichTab == 1) {
89 viewMenu->setItemChecked(viewMenu->idAt(0), true); 93 viewMenu->setItemChecked(viewMenu->idAt(0), true);
90 viewMenu->setItemChecked(viewMenu->idAt(1), false); 94 viewMenu->setItemChecked(viewMenu->idAt(1), false);
91 } else { 95 } else {
92 viewMenu->setItemChecked(viewMenu->idAt(0), false); 96 viewMenu->setItemChecked(viewMenu->idAt(0), false);
93 viewMenu->setItemChecked(viewMenu->idAt(1), true); 97 viewMenu->setItemChecked(viewMenu->idAt(1), true);
94 } 98 }
95 99
96 QString fs= getFileSystemType( (const QString &) path); 100 QString fs= getFileSystemType( (const QString &) path);
97 101
98 setCaption(tr("AdvancedFm :: ")+fs+" :: " 102 setCaption(tr("AdvancedFm :: ")+fs+" :: "
99 +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); 103 +checkDiskSpace( (const QString &) path )+ tr(" kB free") );
100 chdir( path.latin1()); 104 chdir( path.latin1());
101} 105}
102 106
103 107
104void AdvancedFm::populateView() { 108void AdvancedFm::populateView() {
105 109
106qWarning("PopulateView"); 110// qWarning("PopulateView");
107 QPixmap pm; 111 QPixmap pm;
108 QListView *thisView = CurrentView(); 112 QListView *thisView = CurrentView();
109 QDir *thisDir = CurrentDir(); 113 QDir *thisDir = CurrentDir();
110 QString path = thisDir->canonicalPath(); 114 QString path = thisDir->canonicalPath();
111 115
112qWarning("path is "+path); 116//qWarning("path is "+path);
113 thisView->clear(); 117 thisView->clear();
114 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 118 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
115 thisDir->setMatchAllDirs(TRUE); 119 thisDir->setMatchAllDirs(TRUE);
116 thisDir->setNameFilter(filterStr); 120 thisDir->setNameFilter(filterStr);
117 QString fileL, fileS, fileDate; 121 QString fileL, fileS, fileDate;
118 QString fs= getFileSystemType((const QString &) path); 122 QString fs= getFileSystemType((const QString &) path);
119 setCaption(tr("AdvancedFm :: ")+fs+" :: " 123 setCaption(tr("AdvancedFm :: ")+fs+" :: "
120 +checkDiskSpace((const QString &) path)+ tr(" kB free") ); 124 +checkDiskSpace((const QString &) path)+ tr(" kB free") );
121 bool isDir=FALSE; 125 bool isDir=FALSE;
122 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 126 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
123 QFileInfoListIterator it(*list); 127 QFileInfoListIterator it(*list);
124 QFileInfo *fi; 128 QFileInfo *fi;
125 while ( (fi=it.current()) ) { 129 while ( (fi=it.current()) ) {
126 if (fi->isSymLink() ) { 130 if (fi->isSymLink() ) {
127 QString symLink=fi->readLink(); 131 QString symLink=fi->readLink();
128 QFileInfo sym( symLink); 132 QFileInfo sym( symLink);
129 fileS.sprintf( "%10i", sym.size() ); 133 fileS.sprintf( "%10i", sym.size() );
130 fileL = fi->fileName() +" -> " + sym.filePath().data(); 134 fileL = fi->fileName() +" -> " + sym.filePath().data();
131 fileDate = sym.lastModified().toString(); 135 fileDate = sym.lastModified().toString();
132 } else { 136 } else {
133 fileS.sprintf( "%10i", fi->size() ); 137 fileS.sprintf( "%10i", fi->size() );
134 fileL = fi->fileName(); 138 fileL = fi->fileName();
135 fileDate= fi->lastModified().toString(); 139 fileDate= fi->lastModified().toString();
136 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { 140 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) {
@@ -792,49 +796,49 @@ QDir *AdvancedFm::OtherDir() {
792 return &currentRemoteDir; 796 return &currentRemoteDir;
793 } else { 797 } else {
794 return &currentDir; 798 return &currentDir;
795 } 799 }
796} 800}
797 801
798QListView * AdvancedFm::CurrentView() { 802QListView * AdvancedFm::CurrentView() {
799 if ( whichTab == 1) { 803 if ( whichTab == 1) {
800// qWarning("CurrentView Tab 1"); 804// qWarning("CurrentView Tab 1");
801 return Local_View; 805 return Local_View;
802 } else { 806 } else {
803// qWarning("CurrentView Tab 2"); 807// qWarning("CurrentView Tab 2");
804 return Remote_View; 808 return Remote_View;
805 } 809 }
806} 810}
807 811
808QListView * AdvancedFm::OtherView() { 812QListView * AdvancedFm::OtherView() {
809 if ( whichTab == 1) 813 if ( whichTab == 1)
810 return Remote_View; 814 return Remote_View;
811 else 815 else
812 return Local_View; 816 return Local_View;
813} 817}
814 818
815void AdvancedFm::setOtherTabCurrent() { 819void AdvancedFm::setOtherTabCurrent() {
816 qWarning("setOtherTabCurrent() %d", whichTab); 820// qWarning("setOtherTabCurrent() %d", whichTab);
817 if ( whichTab == 1) { 821 if ( whichTab == 1) {
818 TabWidget->setCurrentWidget(1); 822 TabWidget->setCurrentWidget(1);
819 } else { 823 } else {
820 TabWidget->setCurrentWidget(0); 824 TabWidget->setCurrentWidget(0);
821 } 825 }
822 OtherView()->setFocus(); 826 OtherView()->setFocus();
823 OtherView()->setSelected( CurrentView()->firstChild(), true); 827 OtherView()->setSelected( CurrentView()->firstChild(), true);
824} 828}
825 829
826void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { 830void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
827// qDebug("qcop message "+msg ); 831// qDebug("qcop message "+msg );
828 QDataStream stream ( data, IO_ReadOnly ); 832 QDataStream stream ( data, IO_ReadOnly );
829 if ( msg == "openDirectory(QString)" ) { 833 if ( msg == "openDirectory(QString)" ) {
830// qDebug("received"); 834// qDebug("received");
831 QString file; 835 QString file;
832 stream >> file; 836 stream >> file;
833 gotoDirectory( (const QString &) file); 837 gotoDirectory( (const QString &) file);
834 } 838 }
835} 839}
836 840
837void AdvancedFm::setDocument(const QString &file) { 841void AdvancedFm::setDocument(const QString &file) {
838 gotoDirectory( file); 842 gotoDirectory( file);
839 843
840} 844}