author | llornkcor <llornkcor> | 2002-05-02 03:35:28 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-05-02 03:35:28 (UTC) |
commit | a52fd4b1995e34963888397587aa2592ea858da6 (patch) (unidiff) | |
tree | 6f8461a8ff72a96078bac6e3a644d33a8b25873a | |
parent | dd8d5784a9ef93b0d4ed7b6d1751942a904ab7cb (diff) | |
download | opie-a52fd4b1995e34963888397587aa2592ea858da6.zip opie-a52fd4b1995e34963888397587aa2592ea858da6.tar.gz opie-a52fd4b1995e34963888397587aa2592ea858da6.tar.bz2 |
I hate vfat.. I really do, or maybe I hate the way the kernel deals with it
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index b224deb..f4ca349 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,833 +1,834 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | AdvancedFm.cpp | 2 | AdvancedFm.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #define DEVELOPERS_VERSION | 12 | #define DEVELOPERS_VERSION |
13 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties | 13 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties |
14 | 14 | ||
15 | #include "advancedfm.h" | 15 | #include "advancedfm.h" |
16 | #include "inputDialog.h" | 16 | #include "inputDialog.h" |
17 | #include "filePermissions.h" | 17 | #include "filePermissions.h" |
18 | #include "output.h" | 18 | #include "output.h" |
19 | 19 | ||
20 | #include <qpe/lnkproperties.h> | 20 | #include <qpe/lnkproperties.h> |
21 | #include <qpe/filemanager.h> | 21 | #include <qpe/filemanager.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/qpemenubar.h> | 23 | #include <qpe/qpemenubar.h> |
24 | #include <qpe/qpetoolbar.h> | 24 | #include <qpe/qpetoolbar.h> |
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qcopenvelope_qws.h> | 27 | #include <qpe/qcopenvelope_qws.h> |
28 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
29 | #include <qpe/mimetype.h> | 29 | #include <qpe/mimetype.h> |
30 | #include <qpe/applnk.h> | 30 | #include <qpe/applnk.h> |
31 | 31 | ||
32 | //#include <opie/ofileselector.h> | 32 | //#include <opie/ofileselector.h> |
33 | #include <qmultilineedit.h> | 33 | #include <qmultilineedit.h> |
34 | 34 | ||
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | #include <qpushbutton.h> | 36 | #include <qpushbutton.h> |
37 | #include <qtoolbutton.h> | 37 | #include <qtoolbutton.h> |
38 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
39 | #include <qdir.h> | 39 | #include <qdir.h> |
40 | #include <qfile.h> | 40 | #include <qfile.h> |
41 | #include <qstring.h> | 41 | #include <qstring.h> |
42 | #include <qcombobox.h> | 42 | #include <qcombobox.h> |
43 | #include <qpopupmenu.h> | 43 | #include <qpopupmenu.h> |
44 | #include <qlistview.h> | 44 | #include <qlistview.h> |
45 | #include <qmainwindow.h> | 45 | #include <qmainwindow.h> |
46 | #include <qlabel.h> | 46 | #include <qlabel.h> |
47 | #include <qprogressbar.h> | 47 | #include <qprogressbar.h> |
48 | #include <qspinbox.h> | 48 | #include <qspinbox.h> |
49 | #include <qtabwidget.h> | 49 | #include <qtabwidget.h> |
50 | #include <qwidget.h> | 50 | #include <qwidget.h> |
51 | #include <qlayout.h> | 51 | #include <qlayout.h> |
52 | #include <qimage.h> | 52 | #include <qimage.h> |
53 | #include <qpixmap.h> | 53 | #include <qpixmap.h> |
54 | #include <qmessagebox.h> | 54 | #include <qmessagebox.h> |
55 | #include <qlineedit.h> | 55 | #include <qlineedit.h> |
56 | #include <qregexp.h> | 56 | #include <qregexp.h> |
57 | 57 | ||
58 | #include <unistd.h> | 58 | #include <unistd.h> |
59 | #include <stdlib.h> | 59 | #include <stdlib.h> |
60 | #include <sys/stat.h> | 60 | #include <sys/stat.h> |
61 | #include <dirent.h> | 61 | #include <dirent.h> |
62 | #include <stdio.h> | 62 | #include <stdio.h> |
63 | #include <time.h> | 63 | #include <time.h> |
64 | #include <fcntl.h> | 64 | #include <fcntl.h> |
65 | #include <mntent.h> | 65 | #include <mntent.h> |
66 | #include <string.h> | 66 | #include <string.h> |
67 | #include <errno.h> | 67 | #include <errno.h> |
68 | 68 | ||
69 | AdvancedFm::AdvancedFm( ) | 69 | AdvancedFm::AdvancedFm( ) |
70 | : QMainWindow( ) | 70 | : QMainWindow( ) |
71 | { | 71 | { |
72 | setCaption( tr( "AdvancedFm" ) ); | 72 | setCaption( tr( "AdvancedFm" ) ); |
73 | 73 | ||
74 | QGridLayout *layout = new QGridLayout( this ); | 74 | QGridLayout *layout = new QGridLayout( this ); |
75 | layout->setSpacing( 2); | 75 | layout->setSpacing( 2); |
76 | layout->setMargin( 2); | 76 | layout->setMargin( 2); |
77 | 77 | ||
78 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 78 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
79 | 79 | ||
80 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 80 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
81 | // fileMenu = new QPopupMenu( this ); | 81 | // fileMenu = new QPopupMenu( this ); |
82 | fileMenu = new QPopupMenu( this ); | 82 | fileMenu = new QPopupMenu( this ); |
83 | viewMenu = new QPopupMenu( this ); | 83 | viewMenu = new QPopupMenu( this ); |
84 | 84 | ||
85 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); | 85 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); |
86 | 86 | ||
87 | menuBar->insertItem( tr( "File" ), fileMenu); | 87 | menuBar->insertItem( tr( "File" ), fileMenu); |
88 | menuBar->insertItem( tr( "View" ), viewMenu); | 88 | menuBar->insertItem( tr( "View" ), viewMenu); |
89 | 89 | ||
90 | qpeDirButton= new QPushButton(Resource::loadIconSet("go"),"",this,"QPEButton"); | 90 | qpeDirButton= new QPushButton(Resource::loadIconSet("go"),"",this,"QPEButton"); |
91 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); | 91 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); |
92 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); | 92 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); |
93 | qpeDirButton->setFlat(TRUE); | 93 | qpeDirButton->setFlat(TRUE); |
94 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); | 94 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); |
95 | 95 | ||
96 | cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); | 96 | cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); |
97 | cfButton ->setFixedSize( QSize( 20, 20 ) ); | 97 | cfButton ->setFixedSize( QSize( 20, 20 ) ); |
98 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); | 98 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); |
99 | cfButton->setFlat(TRUE); | 99 | cfButton->setFlat(TRUE); |
100 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); | 100 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); |
101 | 101 | ||
102 | sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); | 102 | sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); |
103 | sdButton->setFixedSize( QSize( 20, 20 ) ); | 103 | sdButton->setFixedSize( QSize( 20, 20 ) ); |
104 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); | 104 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); |
105 | sdButton->setFlat(TRUE); | 105 | sdButton->setFlat(TRUE); |
106 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); | 106 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); |
107 | 107 | ||
108 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); | 108 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); |
109 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 109 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
110 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 110 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
111 | cdUpButton ->setFlat(TRUE); | 111 | cdUpButton ->setFlat(TRUE); |
112 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); | 112 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); |
113 | 113 | ||
114 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); | 114 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); |
115 | docButton->setFixedSize( QSize( 20, 20 ) ); | 115 | docButton->setFixedSize( QSize( 20, 20 ) ); |
116 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 116 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
117 | docButton->setFlat(TRUE); | 117 | docButton->setFlat(TRUE); |
118 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); | 118 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); |
119 | 119 | ||
120 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); | 120 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); |
121 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 121 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
122 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 122 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
123 | homeButton->setFlat(TRUE); | 123 | homeButton->setFlat(TRUE); |
124 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); | 124 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); |
125 | // fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 125 | // fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
126 | // fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 126 | // fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
127 | // fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 127 | // fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
128 | 128 | ||
129 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 129 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
130 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 130 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
131 | fileMenu->insertSeparator(); | 131 | fileMenu->insertSeparator(); |
132 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 132 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
133 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 133 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
134 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 134 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
135 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 135 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
136 | fileMenu->insertSeparator(); | 136 | fileMenu->insertSeparator(); |
137 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 137 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
138 | fileMenu->setCheckable(TRUE); | 138 | fileMenu->setCheckable(TRUE); |
139 | 139 | ||
140 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 140 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
141 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 141 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
142 | viewMenu->insertSeparator(); | 142 | viewMenu->insertSeparator(); |
143 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 143 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
144 | viewMenu->setCheckable(TRUE); | 144 | viewMenu->setCheckable(TRUE); |
145 | 145 | ||
146 | TabWidget = new QTabWidget( this, "TabWidget" ); | 146 | TabWidget = new QTabWidget( this, "TabWidget" ); |
147 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 7); | 147 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 7); |
148 | 148 | ||
149 | tab = new QWidget( TabWidget, "tab" ); | 149 | tab = new QWidget( TabWidget, "tab" ); |
150 | tabLayout = new QGridLayout( tab ); | 150 | tabLayout = new QGridLayout( tab ); |
151 | tabLayout->setSpacing( 2); | 151 | tabLayout->setSpacing( 2); |
152 | tabLayout->setMargin( 2); | 152 | tabLayout->setMargin( 2); |
153 | 153 | ||
154 | Local_View = new QListView( tab, "Local_View" ); | 154 | Local_View = new QListView( tab, "Local_View" ); |
155 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 155 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
156 | Local_View->addColumn( tr("File"),130); | 156 | Local_View->addColumn( tr("File"),130); |
157 | Local_View->addColumn( tr("Size"),-1); | 157 | Local_View->addColumn( tr("Size"),-1); |
158 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 158 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
159 | Local_View->addColumn( tr("Date"),-1); | 159 | Local_View->addColumn( tr("Date"),-1); |
160 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 160 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
161 | Local_View->setAllColumnsShowFocus(TRUE); | 161 | Local_View->setAllColumnsShowFocus(TRUE); |
162 | Local_View->setMultiSelection( TRUE ); | 162 | Local_View->setMultiSelection( TRUE ); |
163 | Local_View->setSelectionMode(QListView::Extended); | 163 | Local_View->setSelectionMode(QListView::Extended); |
164 | 164 | ||
165 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 165 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
166 | 166 | ||
167 | tabLayout->addWidget( Local_View, 0, 0 ); | 167 | tabLayout->addWidget( Local_View, 0, 0 ); |
168 | 168 | ||
169 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 169 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
170 | this,SLOT( localListClicked(QListViewItem *)) ); | 170 | this,SLOT( localListClicked(QListViewItem *)) ); |
171 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 171 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
172 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); | 172 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); |
173 | 173 | ||
174 | TabWidget->insertTab( tab, tr("1")); | 174 | TabWidget->insertTab( tab, tr("1")); |
175 | 175 | ||
176 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 176 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
177 | tabLayout_2 = new QGridLayout( tab_2 ); | 177 | tabLayout_2 = new QGridLayout( tab_2 ); |
178 | tabLayout_2->setSpacing( 2); | 178 | tabLayout_2->setSpacing( 2); |
179 | tabLayout_2->setMargin( 2); | 179 | tabLayout_2->setMargin( 2); |
180 | 180 | ||
181 | Remote_View = new QListView( tab_2, "Remote_View" ); | 181 | Remote_View = new QListView( tab_2, "Remote_View" ); |
182 | Remote_View->addColumn( tr("File"),130); | 182 | Remote_View->addColumn( tr("File"),130); |
183 | Remote_View->addColumn( tr("Size"),-1); | 183 | Remote_View->addColumn( tr("Size"),-1); |
184 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 184 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
185 | Remote_View->addColumn( tr("Date"),-1); | 185 | Remote_View->addColumn( tr("Date"),-1); |
186 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 186 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
187 | Remote_View->setAllColumnsShowFocus(TRUE); | 187 | Remote_View->setAllColumnsShowFocus(TRUE); |
188 | Remote_View->setMultiSelection( TRUE ); | 188 | Remote_View->setMultiSelection( TRUE ); |
189 | Remote_View->setSelectionMode(QListView::Extended); | 189 | Remote_View->setSelectionMode(QListView::Extended); |
190 | 190 | ||
191 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 191 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
192 | 192 | ||
193 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 193 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
194 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 194 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
195 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 195 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
196 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 196 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
197 | 197 | ||
198 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 198 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
199 | 199 | ||
200 | TabWidget->insertTab( tab_2, tr( "2")); | 200 | TabWidget->insertTab( tab_2, tr( "2")); |
201 | 201 | ||
202 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 202 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
203 | this,SLOT(tabChanged(QWidget*))); | 203 | this,SLOT(tabChanged(QWidget*))); |
204 | 204 | ||
205 | // tab_3 = new QWidget( TabWidget, "tab_3" ); | 205 | // tab_3 = new QWidget( TabWidget, "tab_3" ); |
206 | // tabLayout_3 = new QGridLayout( tab_3 ); | 206 | // tabLayout_3 = new QGridLayout( tab_3 ); |
207 | // tabLayout_3->setSpacing( 2); | 207 | // tabLayout_3->setSpacing( 2); |
208 | // tabLayout_3->setMargin( 2); | 208 | // tabLayout_3->setMargin( 2); |
209 | 209 | ||
210 | // OFileSelector *fileSelector; | 210 | // OFileSelector *fileSelector; |
211 | // fileSelector = new OFileSelector(tab_3,0,0,"/","","*"); | 211 | // fileSelector = new OFileSelector(tab_3,0,0,"/","","*"); |
212 | // tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 ); | 212 | // tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 ); |
213 | 213 | ||
214 | // TabWidget->insertTab( tab_3, tr( "Files" ) ); | 214 | // TabWidget->insertTab( tab_3, tr( "Files" ) ); |
215 | 215 | ||
216 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 216 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
217 | currentDir.setPath( QDir::currentDirPath()); | 217 | currentDir.setPath( QDir::currentDirPath()); |
218 | 218 | ||
219 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 219 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
220 | currentRemoteDir.setPath( QDir::currentDirPath()); | 220 | currentRemoteDir.setPath( QDir::currentDirPath()); |
221 | 221 | ||
222 | b = TRUE; | 222 | b = TRUE; |
223 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 223 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
224 | currentPathCombo->setEditable(TRUE); | 224 | currentPathCombo->setEditable(TRUE); |
225 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7); | 225 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7); |
226 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 226 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
227 | 227 | ||
228 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 228 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
229 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 229 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
230 | 230 | ||
231 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 231 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
232 | this,SLOT(currentPathComboChanged())); | 232 | this,SLOT(currentPathComboChanged())); |
233 | 233 | ||
234 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 234 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
235 | 235 | ||
236 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7); | 236 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7); |
237 | 237 | ||
238 | filterStr="*"; | 238 | filterStr="*"; |
239 | b=FALSE; | 239 | b=FALSE; |
240 | populateLocalView(); | 240 | populateLocalView(); |
241 | populateRemoteView(); | 241 | populateRemoteView(); |
242 | } | 242 | } |
243 | 243 | ||
244 | AdvancedFm::~AdvancedFm() | 244 | AdvancedFm::~AdvancedFm() |
245 | { | 245 | { |
246 | } | 246 | } |
247 | 247 | ||
248 | void AdvancedFm::cleanUp() | 248 | void AdvancedFm::cleanUp() |
249 | { | 249 | { |
250 | QString sfile=QDir::homeDirPath(); | 250 | QString sfile=QDir::homeDirPath(); |
251 | if(sfile.right(1) != "/") | 251 | if(sfile.right(1) != "/") |
252 | sfile+="/._temp"; | 252 | sfile+="/._temp"; |
253 | else | 253 | else |
254 | sfile+="._temp"; | 254 | sfile+="._temp"; |
255 | QFile file( sfile); | 255 | QFile file( sfile); |
256 | if(file.exists()) | 256 | if(file.exists()) |
257 | file.remove(); | 257 | file.remove(); |
258 | } | 258 | } |
259 | 259 | ||
260 | void AdvancedFm::tabChanged(QWidget *w) | 260 | void AdvancedFm::tabChanged(QWidget *w) |
261 | { | 261 | { |
262 | if (TabWidget->currentPageIndex() == 0) { | 262 | if (TabWidget->currentPageIndex() == 0) { |
263 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 263 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
264 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 264 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
265 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 265 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
266 | } | 266 | } |
267 | if (TabWidget->currentPageIndex() == 1) { | 267 | if (TabWidget->currentPageIndex() == 1) { |
268 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); | 268 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); |
269 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); | 269 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); |
270 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); | 270 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); |
271 | } | 271 | } |
272 | } | 272 | } |
273 | 273 | ||
274 | 274 | ||
275 | void AdvancedFm::populateLocalView() | 275 | void AdvancedFm::populateLocalView() |
276 | { | 276 | { |
277 | QPixmap pm; | 277 | QPixmap pm; |
278 | Local_View->clear(); | 278 | Local_View->clear(); |
279 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 279 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
280 | currentDir.setMatchAllDirs(TRUE); | 280 | currentDir.setMatchAllDirs(TRUE); |
281 | currentDir.setNameFilter(filterStr); | 281 | currentDir.setNameFilter(filterStr); |
282 | QString fileL, fileS, fileDate; | 282 | QString fileL, fileS, fileDate; |
283 | // qDebug(currentDir.canonicalPath()); | 283 | // qDebug(currentDir.canonicalPath()); |
284 | // struct stat buf; | 284 | // struct stat buf; |
285 | // mode_t mode; | 285 | // mode_t mode; |
286 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 286 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
287 | setCaption("AdvancedFm :: "+fs); | 287 | setCaption("AdvancedFm :: "+fs); |
288 | bool isDir=FALSE; | 288 | bool isDir=FALSE; |
289 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 289 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
290 | QFileInfoListIterator it(*list); | 290 | QFileInfoListIterator it(*list); |
291 | QFileInfo *fi; | 291 | QFileInfo *fi; |
292 | while ( (fi=it.current()) ) { | 292 | while ( (fi=it.current()) ) { |
293 | if (fi->isSymLink() ) { | 293 | if (fi->isSymLink() ) { |
294 | QString symLink=fi->readLink(); | 294 | QString symLink=fi->readLink(); |
295 | // qDebug("Symlink detected "+symLink); | 295 | // qDebug("Symlink detected "+symLink); |
296 | QFileInfo sym( symLink); | 296 | QFileInfo sym( symLink); |
297 | fileS.sprintf( "%10li", sym.size() ); | 297 | fileS.sprintf( "%10li", sym.size() ); |
298 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); | 298 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
299 | fileDate = sym.lastModified().toString(); | 299 | fileDate = sym.lastModified().toString(); |
300 | } else { | 300 | } else { |
301 | fileS.sprintf( "%10li", fi->size() ); | 301 | fileS.sprintf( "%10li", fi->size() ); |
302 | fileL.sprintf( "%s",fi->fileName().data() ); | 302 | fileL.sprintf( "%s",fi->fileName().data() ); |
303 | fileDate= fi->lastModified().toString(); | 303 | fileDate= fi->lastModified().toString(); |
304 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 304 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
305 | fileL+="/"; | 305 | fileL+="/"; |
306 | isDir=TRUE; | 306 | isDir=TRUE; |
307 | // qDebug( fileL); | 307 | // qDebug( fileL); |
308 | } | 308 | } |
309 | } | 309 | } |
310 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); | 310 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); |
311 | if(fileL !="./" && fi->exists()) { | 311 | if(fileL !="./" && fi->exists()) { |
312 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); | 312 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); |
313 | 313 | ||
314 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 314 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
315 | 315 | ||
316 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 316 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
317 | pm = Resource::loadPixmap( "lockedfolder" ); | 317 | pm = Resource::loadPixmap( "lockedfolder" ); |
318 | else | 318 | else |
319 | pm= Resource::loadPixmap( "folder" ); | 319 | pm= Resource::loadPixmap( "folder" ); |
320 | // item->setPixmap( 0,pm ); | 320 | // item->setPixmap( 0,pm ); |
321 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | ||
322 | pm = Resource::loadPixmap( "exec"); | ||
321 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 323 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
322 | | fileInfo.permission( QFileInfo::ExeGroup) | 324 | | fileInfo.permission( QFileInfo::ExeGroup) |
323 | | fileInfo.permission( QFileInfo::ExeOther)) | 325 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
324 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 326 | pm = Resource::loadPixmap( "exec"); |
325 | pm = Resource::loadPixmap( "exec"); | ||
326 | // else { //is exec | 327 | // else { //is exec |
327 | // pm = Resource::loadPixmap( "exec"); | 328 | // pm = Resource::loadPixmap( "exec"); |
328 | // } | 329 | // } |
329 | // // item->setPixmap( 0,pm); | 330 | // // item->setPixmap( 0,pm); |
330 | } else if( !fi->isReadable() ) { | 331 | } else if( !fi->isReadable() ) { |
331 | pm = Resource::loadPixmap( "locked" ); | 332 | pm = Resource::loadPixmap( "locked" ); |
332 | // item->setPixmap( 0,pm); | 333 | // item->setPixmap( 0,pm); |
333 | } else { //everything else goes by mimetype | 334 | } else { //everything else goes by mimetype |
334 | MimeType mt(fi->filePath()); | 335 | MimeType mt(fi->filePath()); |
335 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 336 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
336 | if(pm.isNull()) | 337 | if(pm.isNull()) |
337 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 338 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
338 | // item->setPixmap( 0,pm); | 339 | // item->setPixmap( 0,pm); |
339 | } | 340 | } |
340 | item->setPixmap( 0,pm); | 341 | item->setPixmap( 0,pm); |
341 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 342 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
342 | // overlay link image | 343 | // overlay link image |
343 | pm= Resource::loadPixmap( "folder" ); | 344 | pm= Resource::loadPixmap( "folder" ); |
344 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 345 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
345 | QPainter painter( &pm ); | 346 | QPainter painter( &pm ); |
346 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 347 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
347 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 348 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
348 | item->setPixmap( 0, pm); | 349 | item->setPixmap( 0, pm); |
349 | } | 350 | } |
350 | } | 351 | } |
351 | isDir=FALSE; | 352 | isDir=FALSE; |
352 | ++it; | 353 | ++it; |
353 | } | 354 | } |
354 | 355 | ||
355 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { | 356 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { |
356 | struct stat buf; | 357 | struct stat buf; |
357 | // struct stat st; | 358 | // struct stat st; |
358 | dev_t devT; | 359 | dev_t devT; |
359 | // mode_t mode; | 360 | // mode_t mode; |
360 | DIR *dir; | 361 | DIR *dir; |
361 | // int fd = 0; | 362 | // int fd = 0; |
362 | struct dirent *mydirent; | 363 | struct dirent *mydirent; |
363 | // int i = 1; | 364 | // int i = 1; |
364 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) | 365 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) |
365 | while ((mydirent = readdir(dir)) != NULL) { | 366 | while ((mydirent = readdir(dir)) != NULL) { |
366 | lstat( mydirent->d_name, &buf); | 367 | lstat( mydirent->d_name, &buf); |
367 | qDebug(mydirent->d_name); | 368 | qDebug(mydirent->d_name); |
368 | // mode = buf.st_mode; | 369 | // mode = buf.st_mode; |
369 | fileL.sprintf("%s", mydirent->d_name); | 370 | fileL.sprintf("%s", mydirent->d_name); |
370 | // fileS.sprintf("%d, %d", ); //this isn't correct | 371 | // fileS.sprintf("%d, %d", ); //this isn't correct |
371 | devT = buf.st_dev; | 372 | devT = buf.st_dev; |
372 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 373 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
373 | // fileS.sprintf("%d,%d", devT, devT); | 374 | // fileS.sprintf("%d,%d", devT, devT); |
374 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 375 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
375 | if( fileL.find(".") == -1 ){ | 376 | if( fileL.find(".") == -1 ){ |
376 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); | 377 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); |
377 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 378 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
378 | item->setPixmap( 0,pm); | 379 | item->setPixmap( 0,pm); |
379 | } | 380 | } |
380 | } | 381 | } |
381 | 382 | ||
382 | closedir(dir); | 383 | closedir(dir); |
383 | } | 384 | } |
384 | 385 | ||
385 | Local_View->setSorting( 3,FALSE); | 386 | Local_View->setSorting( 3,FALSE); |
386 | fillCombo( (const QString &) currentDir.canonicalPath()); | 387 | fillCombo( (const QString &) currentDir.canonicalPath()); |
387 | } | 388 | } |
388 | 389 | ||
389 | 390 | ||
390 | void AdvancedFm::populateRemoteView() | 391 | void AdvancedFm::populateRemoteView() |
391 | { | 392 | { |
392 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 393 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
393 | // QListViewItemIterator it( Remote_View ); | 394 | // QListViewItemIterator it( Remote_View ); |
394 | // for ( ; it.current(); ++it ) { | 395 | // for ( ; it.current(); ++it ) { |
395 | // if ( it.current()->isSelected() ) { | 396 | // if ( it.current()->isSelected() ) { |
396 | // QString strItem = it.current()->text(0); | 397 | // QString strItem = it.current()->text(0); |
397 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; | 398 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; |
398 | // QFileInfo fi(localFile); | 399 | // QFileInfo fi(localFile); |
399 | // } | 400 | // } |
400 | // } | 401 | // } |
401 | QPixmap pm; | 402 | QPixmap pm; |
402 | Remote_View->clear(); | 403 | Remote_View->clear(); |
403 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 404 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
404 | currentRemoteDir.setMatchAllDirs(TRUE); | 405 | currentRemoteDir.setMatchAllDirs(TRUE); |
405 | currentRemoteDir.setNameFilter(filterStr); | 406 | currentRemoteDir.setNameFilter(filterStr); |
406 | QString fileL, fileS, fileDate; | 407 | QString fileL, fileS, fileDate; |
407 | 408 | ||
408 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 409 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
409 | setCaption("AdvancedFm :: "+fs); | 410 | setCaption("AdvancedFm :: "+fs); |
410 | bool isDir=FALSE; | 411 | bool isDir=FALSE; |
411 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 412 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
412 | QFileInfoListIterator it(*list); | 413 | QFileInfoListIterator it(*list); |
413 | QFileInfo *fi; | 414 | QFileInfo *fi; |
414 | while ( (fi=it.current()) ) { | 415 | while ( (fi=it.current()) ) { |
415 | if (fi->isSymLink() ){ | 416 | if (fi->isSymLink() ){ |
416 | QString symLink=fi->readLink(); | 417 | QString symLink=fi->readLink(); |
417 | // qDebug("Symlink detected "+symLink); | 418 | // qDebug("Symlink detected "+symLink); |
418 | QFileInfo sym( symLink); | 419 | QFileInfo sym( symLink); |
419 | fileS.sprintf( "%10li", sym.size() ); | 420 | fileS.sprintf( "%10li", sym.size() ); |
420 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); | 421 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
421 | fileDate = sym.lastModified().toString(); | 422 | fileDate = sym.lastModified().toString(); |
422 | } else { | 423 | } else { |
423 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 424 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
424 | fileS.sprintf( "%10li", fi->size() ); | 425 | fileS.sprintf( "%10li", fi->size() ); |
425 | fileL.sprintf( "%s",fi->fileName().data() ); | 426 | fileL.sprintf( "%s",fi->fileName().data() ); |
426 | fileDate= fi->lastModified().toString(); | 427 | fileDate= fi->lastModified().toString(); |
427 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { | 428 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { |
428 | fileL+="/"; | 429 | fileL+="/"; |
429 | isDir=TRUE; | 430 | isDir=TRUE; |
430 | // qDebug( fileL); | 431 | // qDebug( fileL); |
431 | } | 432 | } |
432 | } | 433 | } |
433 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); | 434 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); |
434 | if(fileL !="./" && fi->exists()) { | 435 | if(fileL !="./" && fi->exists()) { |
435 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 436 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
436 | QPixmap pm; | 437 | QPixmap pm; |
437 | 438 | ||
438 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 439 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
439 | if( !QDir( fi->filePath() ).isReadable()) | 440 | if( !QDir( fi->filePath() ).isReadable()) |
440 | pm = Resource::loadPixmap( "lockedfolder" ); | 441 | pm = Resource::loadPixmap( "lockedfolder" ); |
441 | else | 442 | else |
442 | pm= Resource::loadPixmap( "folder" ); | 443 | pm= Resource::loadPixmap( "folder" ); |
443 | // item->setPixmap( 0,pm ); | 444 | // item->setPixmap( 0,pm ); |
445 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | ||
446 | pm = Resource::loadPixmap( "exec"); | ||
444 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 447 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
445 | | fileInfo.permission( QFileInfo::ExeGroup) | 448 | | fileInfo.permission( QFileInfo::ExeGroup) |
446 | | fileInfo.permission( QFileInfo::ExeOther)) | 449 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
447 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 450 | pm = Resource::loadPixmap( "exec"); |
448 | ///// } else if(fileInfo.isExecutable()){ //is exec <<<< BROKEN!! | ||
449 | pm = Resource::loadPixmap( "exec"); | ||
450 | // item->setPixmap( 0,pm); | 451 | // item->setPixmap( 0,pm); |
451 | } else if( !fi->isReadable() ) { | 452 | } else if( !fi->isReadable() ) { |
452 | pm = Resource::loadPixmap( "locked" ); | 453 | pm = Resource::loadPixmap( "locked" ); |
453 | // item->setPixmap( 0,pm); | 454 | // item->setPixmap( 0,pm); |
454 | } else { | 455 | } else { |
455 | MimeType mt(fi->filePath()); | 456 | MimeType mt(fi->filePath()); |
456 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 457 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
457 | if(pm.isNull()) | 458 | if(pm.isNull()) |
458 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 459 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
459 | // item->setPixmap( 0,pm); | 460 | // item->setPixmap( 0,pm); |
460 | } | 461 | } |
461 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 462 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
462 | // overlay link image | 463 | // overlay link image |
463 | pm= Resource::loadPixmap( "folder" ); | 464 | pm= Resource::loadPixmap( "folder" ); |
464 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 465 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
465 | QPainter painter( &pm ); | 466 | QPainter painter( &pm ); |
466 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 467 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
467 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 468 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
468 | // item->setPixmap( 0, pm); | 469 | // item->setPixmap( 0, pm); |
469 | } | 470 | } |
470 | item->setPixmap( 0, pm); | 471 | item->setPixmap( 0, pm); |
471 | } | 472 | } |
472 | isDir=FALSE; | 473 | isDir=FALSE; |
473 | ++it; | 474 | ++it; |
474 | } | 475 | } |
475 | 476 | ||
476 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { | 477 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { |
477 | struct stat buf; | 478 | struct stat buf; |
478 | // struct stat st; | 479 | // struct stat st; |
479 | // mode_t mode; | 480 | // mode_t mode; |
480 | DIR *dir; | 481 | DIR *dir; |
481 | // int fd = 0; | 482 | // int fd = 0; |
482 | struct dirent *mydirent; | 483 | struct dirent *mydirent; |
483 | // int i = 1; | 484 | // int i = 1; |
484 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) | 485 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) |
485 | while ((mydirent = readdir(dir)) != NULL) { | 486 | while ((mydirent = readdir(dir)) != NULL) { |
486 | lstat( mydirent->d_name, &buf); | 487 | lstat( mydirent->d_name, &buf); |
487 | qDebug(mydirent->d_name); | 488 | qDebug(mydirent->d_name); |
488 | // mode = buf.st_mode; | 489 | // mode = buf.st_mode; |
489 | fileL.sprintf("%s", mydirent->d_name); | 490 | fileL.sprintf("%s", mydirent->d_name); |
490 | // fileS.sprintf("%d, %d", ); //this isn't correct | 491 | // fileS.sprintf("%d, %d", ); //this isn't correct |
491 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); | 492 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); |
492 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 493 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
493 | if( fileL.find(".") == -1 ){ | 494 | if( fileL.find(".") == -1 ){ |
494 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 495 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
495 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 496 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
496 | item->setPixmap( 0,pm); | 497 | item->setPixmap( 0,pm); |
497 | } | 498 | } |
498 | } | 499 | } |
499 | 500 | ||
500 | closedir(dir); | 501 | closedir(dir); |
501 | } | 502 | } |
502 | 503 | ||
503 | Remote_View->setSorting( 3,FALSE); | 504 | Remote_View->setSorting( 3,FALSE); |
504 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); | 505 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); |
505 | } | 506 | } |
506 | 507 | ||
507 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) | 508 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) |
508 | { | 509 | { |
509 | if(selectedItem) { | 510 | if(selectedItem) { |
510 | QString strItem=selectedItem->text(0); | 511 | QString strItem=selectedItem->text(0); |
511 | QString strSize=selectedItem->text(1); | 512 | QString strSize=selectedItem->text(1); |
512 | strSize=strSize.stripWhiteSpace(); | 513 | strSize=strSize.stripWhiteSpace(); |
513 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 514 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
514 | // is symlink | 515 | // is symlink |
515 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 516 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
516 | if(QDir(strItem2).exists() ) { | 517 | if(QDir(strItem2).exists() ) { |
517 | currentDir.cd(strItem2, TRUE); | 518 | currentDir.cd(strItem2, TRUE); |
518 | populateLocalView(); | 519 | populateLocalView(); |
519 | } | 520 | } |
520 | } else { // not a symlink | 521 | } else { // not a symlink |
521 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 522 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
522 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 523 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
523 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 524 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
524 | currentDir.cd(strItem,FALSE); | 525 | currentDir.cd(strItem,FALSE); |
525 | populateLocalView(); | 526 | populateLocalView(); |
526 | } else { | 527 | } else { |
527 | currentDir.cdUp(); | 528 | currentDir.cdUp(); |
528 | populateLocalView(); | 529 | populateLocalView(); |
529 | } | 530 | } |
530 | if(QDir(strItem).exists()){ | 531 | if(QDir(strItem).exists()){ |
531 | currentDir.cd(strItem, TRUE); | 532 | currentDir.cd(strItem, TRUE); |
532 | populateLocalView(); | 533 | populateLocalView(); |
533 | } | 534 | } |
534 | } else { | 535 | } else { |
535 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 536 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
536 | if( QFile::exists(strItem ) ) { | 537 | if( QFile::exists(strItem ) ) { |
537 | // qDebug("upload "+strItem); | 538 | // qDebug("upload "+strItem); |
538 | } | 539 | } |
539 | } //end not symlink | 540 | } //end not symlink |
540 | chdir(strItem.latin1()); | 541 | chdir(strItem.latin1()); |
541 | } | 542 | } |
542 | } | 543 | } |
543 | } | 544 | } |
544 | 545 | ||
545 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) | 546 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) |
546 | { | 547 | { |
547 | if(selectedItem) { | 548 | if(selectedItem) { |
548 | QString strItem=selectedItem->text(0); | 549 | QString strItem=selectedItem->text(0); |
549 | QString strSize=selectedItem->text(1); | 550 | QString strSize=selectedItem->text(1); |
550 | strSize=strSize.stripWhiteSpace(); | 551 | strSize=strSize.stripWhiteSpace(); |
551 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 552 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
552 | // is symlink | 553 | // is symlink |
553 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 554 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
554 | if(QDir(strItem2).exists() ) { | 555 | if(QDir(strItem2).exists() ) { |
555 | currentRemoteDir.cd(strItem2, TRUE); | 556 | currentRemoteDir.cd(strItem2, TRUE); |
556 | populateRemoteView(); | 557 | populateRemoteView(); |
557 | } | 558 | } |
558 | } else { // not a symlink | 559 | } else { // not a symlink |
559 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 560 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
560 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { | 561 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { |
561 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 562 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
562 | currentRemoteDir.cd(strItem,FALSE); | 563 | currentRemoteDir.cd(strItem,FALSE); |
563 | populateRemoteView(); | 564 | populateRemoteView(); |
564 | } else { | 565 | } else { |
565 | currentRemoteDir.cdUp(); | 566 | currentRemoteDir.cdUp(); |
566 | populateRemoteView(); | 567 | populateRemoteView(); |
567 | } | 568 | } |
568 | if(QDir(strItem).exists()){ | 569 | if(QDir(strItem).exists()){ |
569 | currentRemoteDir.cd(strItem, TRUE); | 570 | currentRemoteDir.cd(strItem, TRUE); |
570 | populateRemoteView(); | 571 | populateRemoteView(); |
571 | } | 572 | } |
572 | } else { | 573 | } else { |
573 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 574 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
574 | if( QFile::exists(strItem ) ) { | 575 | if( QFile::exists(strItem ) ) { |
575 | // qDebug("upload "+strItem); | 576 | // qDebug("upload "+strItem); |
576 | } | 577 | } |
577 | } //end not symlink | 578 | } //end not symlink |
578 | chdir(strItem.latin1()); | 579 | chdir(strItem.latin1()); |
579 | } | 580 | } |
580 | } | 581 | } |
581 | } | 582 | } |
582 | 583 | ||
583 | void AdvancedFm::doLocalCd() | 584 | void AdvancedFm::doLocalCd() |
584 | { | 585 | { |
585 | localListClicked( Local_View->currentItem()); | 586 | localListClicked( Local_View->currentItem()); |
586 | } | 587 | } |
587 | 588 | ||
588 | void AdvancedFm::doRemoteCd() | 589 | void AdvancedFm::doRemoteCd() |
589 | { | 590 | { |
590 | localListClicked( Remote_View->currentItem()); | 591 | localListClicked( Remote_View->currentItem()); |
591 | } | 592 | } |
592 | 593 | ||
593 | void AdvancedFm::showHidden() | 594 | void AdvancedFm::showHidden() |
594 | { | 595 | { |
595 | if (b) { | 596 | if (b) { |
596 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 597 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
597 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 598 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
598 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); | 599 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); |
599 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 600 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
600 | b=FALSE; | 601 | b=FALSE; |
601 | 602 | ||
602 | } else { | 603 | } else { |
603 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 604 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
604 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 605 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
605 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 606 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
606 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 607 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
607 | b=TRUE; | 608 | b=TRUE; |
608 | } | 609 | } |
609 | populateLocalView(); | 610 | populateLocalView(); |
610 | 611 | ||
611 | } | 612 | } |
612 | 613 | ||
613 | void AdvancedFm::showRemoteHidden() | 614 | void AdvancedFm::showRemoteHidden() |
614 | { | 615 | { |
615 | if (b) { | 616 | if (b) { |
616 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 617 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
617 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); | 618 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); |
618 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 619 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
619 | b=TRUE; | 620 | b=TRUE; |
620 | 621 | ||
621 | } else { | 622 | } else { |
622 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 623 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
623 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 624 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
624 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 625 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
625 | b=FALSE; | 626 | b=FALSE; |
626 | } | 627 | } |
627 | populateRemoteView(); | 628 | populateRemoteView(); |
628 | } | 629 | } |
629 | 630 | ||
630 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 631 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
631 | { | 632 | { |
632 | switch (mouse) { | 633 | switch (mouse) { |
633 | case 1: | 634 | case 1: |
634 | break; | 635 | break; |
635 | case 2: | 636 | case 2: |
636 | showLocalMenu(item); | 637 | showLocalMenu(item); |
637 | Local_View->clearSelection(); | 638 | Local_View->clearSelection(); |
638 | break; | 639 | break; |
639 | }; | 640 | }; |
640 | } | 641 | } |
641 | 642 | ||
642 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 643 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
643 | { | 644 | { |
644 | switch (mouse) { | 645 | switch (mouse) { |
645 | case 1: | 646 | case 1: |
646 | break; | 647 | break; |
647 | case 2: | 648 | case 2: |
648 | showRemoteMenu(item); | 649 | showRemoteMenu(item); |
649 | Remote_View->clearSelection(); | 650 | Remote_View->clearSelection(); |
650 | break; | 651 | break; |
651 | }; | 652 | }; |
652 | } | 653 | } |
653 | 654 | ||
654 | void AdvancedFm::showLocalMenu(QListViewItem * item) | 655 | void AdvancedFm::showLocalMenu(QListViewItem * item) |
655 | { | 656 | { |
656 | if(item) { | 657 | if(item) { |
657 | QPopupMenu m; | 658 | QPopupMenu m; |
658 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 659 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
659 | m.insertSeparator(); | 660 | m.insertSeparator(); |
660 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 661 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
661 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 662 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
662 | else | 663 | else |
663 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); | 664 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); |
664 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | 665 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); |
665 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 666 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
666 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 667 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
667 | m.insertSeparator(); | 668 | m.insertSeparator(); |
668 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 669 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
669 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 670 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
670 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 671 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
671 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 672 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
672 | m.insertSeparator(); | 673 | m.insertSeparator(); |
673 | m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); | 674 | m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); |
674 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 675 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
675 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 676 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
676 | m.insertSeparator(); | 677 | m.insertSeparator(); |
677 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 678 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
678 | m.insertSeparator(); | 679 | m.insertSeparator(); |
679 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 680 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
680 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 681 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
681 | m.setCheckable(TRUE); | 682 | m.setCheckable(TRUE); |
682 | if (!b) | 683 | if (!b) |
683 | m.setItemChecked(m.idAt(0),TRUE); | 684 | m.setItemChecked(m.idAt(0),TRUE); |
684 | else | 685 | else |
685 | m.setItemChecked(m.idAt(0),FALSE); | 686 | m.setItemChecked(m.idAt(0),FALSE); |
686 | m.exec( QCursor::pos() ); | 687 | m.exec( QCursor::pos() ); |
687 | } | 688 | } |
688 | } | 689 | } |
689 | 690 | ||
690 | void AdvancedFm::showRemoteMenu(QListViewItem * item) | 691 | void AdvancedFm::showRemoteMenu(QListViewItem * item) |
691 | { | 692 | { |
692 | if(item) { | 693 | if(item) { |
693 | QPopupMenu m; | 694 | QPopupMenu m; |
694 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); | 695 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); |
695 | m.insertSeparator(); | 696 | m.insertSeparator(); |
696 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 697 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
697 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); | 698 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); |
698 | else | 699 | else |
699 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); | 700 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); |
700 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | 701 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); |
701 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 702 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
702 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 703 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
703 | m.insertSeparator(); | 704 | m.insertSeparator(); |
704 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 705 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
705 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 706 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
706 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 707 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
707 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 708 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
708 | m.insertSeparator(); | 709 | m.insertSeparator(); |
709 | m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); | 710 | m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); |
710 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 711 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
711 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 712 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
712 | m.insertSeparator(); | 713 | m.insertSeparator(); |
713 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 714 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
714 | m.insertSeparator(); | 715 | m.insertSeparator(); |
715 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 716 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
716 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 717 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
717 | m.setCheckable(TRUE); | 718 | m.setCheckable(TRUE); |
718 | if (!b) | 719 | if (!b) |
719 | m.setItemChecked(m.idAt(0),TRUE); | 720 | m.setItemChecked(m.idAt(0),TRUE); |
720 | else | 721 | else |
721 | m.setItemChecked(m.idAt(0),FALSE); | 722 | m.setItemChecked(m.idAt(0),FALSE); |
722 | m.exec( QCursor::pos() ); | 723 | m.exec( QCursor::pos() ); |
723 | } | 724 | } |
724 | } | 725 | } |
725 | 726 | ||
726 | void AdvancedFm::runThis() { | 727 | void AdvancedFm::runThis() { |
727 | // QFileInfo *fi; | 728 | // QFileInfo *fi; |
728 | QString fs; | 729 | QString fs; |
729 | if (TabWidget->currentPageIndex() == 0) { | 730 | if (TabWidget->currentPageIndex() == 0) { |
730 | QString curFile = Local_View->currentItem()->text(0); | 731 | QString curFile = Local_View->currentItem()->text(0); |
731 | 732 | ||
732 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 733 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
733 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); | 734 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
734 | qDebug( fileInfo.owner()); | 735 | qDebug( fileInfo.owner()); |
735 | if( (fileInfo.permission( QFileInfo::ExeUser) | 736 | if( (fileInfo.permission( QFileInfo::ExeUser) |
736 | | fileInfo.permission( QFileInfo::ExeGroup) | 737 | | fileInfo.permission( QFileInfo::ExeGroup) |
737 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 738 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
738 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 739 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
739 | // if( fileInfo.isExecutable() | | 740 | // if( fileInfo.isExecutable() | |
740 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 741 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
741 | e << curFile; | 742 | e << curFile; |
742 | } else { | 743 | } else { |
743 | curFile = currentDir.canonicalPath()+"/"+curFile; | 744 | curFile = currentDir.canonicalPath()+"/"+curFile; |
744 | DocLnk nf(curFile); | 745 | DocLnk nf(curFile); |
745 | QString execStr = nf.exec(); | 746 | QString execStr = nf.exec(); |
746 | qDebug( execStr); | 747 | qDebug( execStr); |
747 | if( execStr.isEmpty() ) { | 748 | if( execStr.isEmpty() ) { |
748 | } else { | 749 | } else { |
749 | nf.execute(); | 750 | nf.execute(); |
750 | } | 751 | } |
751 | } | 752 | } |
752 | // MimeType mt( curFile); | 753 | // MimeType mt( curFile); |
753 | } else { | 754 | } else { |
754 | QString curFile = Remote_View->currentItem()->text(0); | 755 | QString curFile = Remote_View->currentItem()->text(0); |
755 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 756 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
756 | qDebug("Filesystemtype is "+fs); | 757 | qDebug("Filesystemtype is "+fs); |
757 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); | 758 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
758 | if( (fileInfo.permission( QFileInfo::ExeUser) | 759 | if( (fileInfo.permission( QFileInfo::ExeUser) |
759 | | fileInfo.permission( QFileInfo::ExeGroup) | 760 | | fileInfo.permission( QFileInfo::ExeGroup) |
760 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 761 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
761 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 762 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
762 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 763 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
763 | e << curFile; | 764 | e << curFile; |
764 | } else { | 765 | } else { |
765 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 766 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
766 | DocLnk nf(curFile); | 767 | DocLnk nf(curFile); |
767 | QString execStr = nf.exec(); | 768 | QString execStr = nf.exec(); |
768 | qDebug(execStr); | 769 | qDebug(execStr); |
769 | if( execStr.isEmpty() ) { | 770 | if( execStr.isEmpty() ) { |
770 | } else { | 771 | } else { |
771 | nf.execute(); | 772 | nf.execute(); |
772 | } | 773 | } |
773 | } | 774 | } |
774 | // MimeType mt( curFile); | 775 | // MimeType mt( curFile); |
775 | } | 776 | } |
776 | } | 777 | } |
777 | 778 | ||
778 | void AdvancedFm::runText() { | 779 | void AdvancedFm::runText() { |
779 | if (TabWidget->currentPageIndex() == 0) { | 780 | if (TabWidget->currentPageIndex() == 0) { |
780 | QString curFile = Local_View->currentItem()->text(0); | 781 | QString curFile = Local_View->currentItem()->text(0); |
781 | curFile = currentDir.canonicalPath()+"/"+curFile; | 782 | curFile = currentDir.canonicalPath()+"/"+curFile; |
782 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 783 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
783 | e << curFile; | 784 | e << curFile; |
784 | } else { | 785 | } else { |
785 | QString curFile = Remote_View->currentItem()->text(0); | 786 | QString curFile = Remote_View->currentItem()->text(0); |
786 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 787 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
787 | DocLnk nf(curFile); | 788 | DocLnk nf(curFile); |
788 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 789 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
789 | e << curFile; | 790 | e << curFile; |
790 | } | 791 | } |
791 | } | 792 | } |
792 | 793 | ||
793 | void AdvancedFm::localMakDir() | 794 | void AdvancedFm::localMakDir() |
794 | { | 795 | { |
795 | InputDialog *fileDlg; | 796 | InputDialog *fileDlg; |
796 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 797 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
797 | fileDlg->exec(); | 798 | fileDlg->exec(); |
798 | if( fileDlg->result() == 1 ) { | 799 | if( fileDlg->result() == 1 ) { |
799 | QString filename = fileDlg->LineEdit1->text(); | 800 | QString filename = fileDlg->LineEdit1->text(); |
800 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 801 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
801 | } | 802 | } |
802 | populateLocalView(); | 803 | populateLocalView(); |
803 | } | 804 | } |
804 | 805 | ||
805 | void AdvancedFm::remoteMakDir() | 806 | void AdvancedFm::remoteMakDir() |
806 | { | 807 | { |
807 | InputDialog *fileDlg; | 808 | InputDialog *fileDlg; |
808 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 809 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
809 | fileDlg->exec(); | 810 | fileDlg->exec(); |
810 | if( fileDlg->result() == 1 ) { | 811 | if( fileDlg->result() == 1 ) { |
811 | QString filename = fileDlg->LineEdit1->text(); | 812 | QString filename = fileDlg->LineEdit1->text(); |
812 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); | 813 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); |
813 | } | 814 | } |
814 | populateRemoteView(); | 815 | populateRemoteView(); |
815 | } | 816 | } |
816 | 817 | ||
817 | void AdvancedFm::localDelete() | 818 | void AdvancedFm::localDelete() |
818 | { | 819 | { |
819 | QStringList curFileList = getPath(); | 820 | QStringList curFileList = getPath(); |
820 | QString myFile; | 821 | QString myFile; |
821 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 822 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
822 | myFile = (*it); | 823 | myFile = (*it); |
823 | if( myFile.find(" -> ",0,TRUE) != -1) | 824 | if( myFile.find(" -> ",0,TRUE) != -1) |
824 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 825 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
825 | 826 | ||
826 | QString f = currentDir.canonicalPath(); | 827 | QString f = currentDir.canonicalPath(); |
827 | if(f.right(1).find("/",0,TRUE) == -1) | 828 | if(f.right(1).find("/",0,TRUE) == -1) |
828 | f+="/"; | 829 | f+="/"; |
829 | f+=myFile; | 830 | f+=myFile; |
830 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 831 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
831 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 832 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
832 | "\nand all it's contents ?" | 833 | "\nand all it's contents ?" |
833 | ,tr("Yes"),tr("No"),0,0,1) ) { | 834 | ,tr("Yes"),tr("No"),0,0,1) ) { |