-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,1217 +1,1218 @@ | |||
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) ) { |
834 | case 0: { | 835 | case 0: { |
835 | f=f.left(f.length()-1); | 836 | f=f.left(f.length()-1); |
836 | QString cmd="rm -rf "+f; | 837 | QString cmd="rm -rf "+f; |
837 | system( cmd.latin1()); | 838 | system( cmd.latin1()); |
838 | populateLocalView(); | 839 | populateLocalView(); |
839 | } | 840 | } |
840 | break; | 841 | break; |
841 | case 1: | 842 | case 1: |
842 | // exit | 843 | // exit |
843 | break; | 844 | break; |
844 | }; | 845 | }; |
845 | 846 | ||
846 | } else { | 847 | } else { |
847 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 848 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
848 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 849 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
849 | case 0: { | 850 | case 0: { |
850 | QString cmd="rm "+f; | 851 | QString cmd="rm "+f; |
851 | QFile file(f); | 852 | QFile file(f); |
852 | file.remove(); | 853 | file.remove(); |
853 | // system( cmd.latin1()); | 854 | // system( cmd.latin1()); |
854 | populateLocalView(); | 855 | populateLocalView(); |
855 | } | 856 | } |
856 | break; | 857 | break; |
857 | case 1: | 858 | case 1: |
858 | // exit | 859 | // exit |
859 | break; | 860 | break; |
860 | }; | 861 | }; |
861 | } | 862 | } |
862 | } | 863 | } |
863 | } | 864 | } |
864 | 865 | ||
865 | void AdvancedFm::remoteDelete() | 866 | void AdvancedFm::remoteDelete() |
866 | { | 867 | { |
867 | QStringList curFileList = getPath(); | 868 | QStringList curFileList = getPath(); |
868 | QString myFile; | 869 | QString myFile; |
869 | 870 | ||
870 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 871 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
871 | myFile = (*it); | 872 | myFile = (*it); |
872 | if(myFile.find(" -> ",0,TRUE) != -1) | 873 | if(myFile.find(" -> ",0,TRUE) != -1) |
873 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); | 874 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); |
874 | QString f = currentRemoteDir.canonicalPath(); | 875 | QString f = currentRemoteDir.canonicalPath(); |
875 | if(f.right(1).find("/",0,TRUE) == -1) | 876 | if(f.right(1).find("/",0,TRUE) == -1) |
876 | f+="/"; | 877 | f+="/"; |
877 | f+=myFile; | 878 | f+=myFile; |
878 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 879 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
879 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 880 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
880 | "\nand all it's contents ?", | 881 | "\nand all it's contents ?", |
881 | tr("Yes"),tr("No"),0,0,1) ) { | 882 | tr("Yes"),tr("No"),0,0,1) ) { |
882 | case 0: { | 883 | case 0: { |
883 | f=f.left(f.length()-1); | 884 | f=f.left(f.length()-1); |
884 | QString cmd="rm -rf "+f; | 885 | QString cmd="rm -rf "+f; |
885 | system( cmd.latin1()); | 886 | system( cmd.latin1()); |
886 | populateRemoteView(); | 887 | populateRemoteView(); |
887 | } | 888 | } |
888 | break; | 889 | break; |
889 | case 1: | 890 | case 1: |
890 | // exit | 891 | // exit |
891 | break; | 892 | break; |
892 | }; | 893 | }; |
893 | 894 | ||
894 | } else { | 895 | } else { |
895 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 896 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
896 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 897 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
897 | case 0: { | 898 | case 0: { |
898 | QString cmd="rm "+f; | 899 | QString cmd="rm "+f; |
899 | QFile file(f); | 900 | QFile file(f); |
900 | file.remove(); | 901 | file.remove(); |
901 | // system( cmd.latin1()); | 902 | // system( cmd.latin1()); |
902 | populateRemoteView(); | 903 | populateRemoteView(); |
903 | } | 904 | } |
904 | break; | 905 | break; |
905 | case 1: | 906 | case 1: |
906 | // exit | 907 | // exit |
907 | break; | 908 | break; |
908 | }; | 909 | }; |
909 | } | 910 | } |
910 | } | 911 | } |
911 | } | 912 | } |
912 | 913 | ||
913 | void AdvancedFm::localRename() | 914 | void AdvancedFm::localRename() |
914 | { | 915 | { |
915 | QString curFile = Local_View->currentItem()->text(0); | 916 | QString curFile = Local_View->currentItem()->text(0); |
916 | InputDialog *fileDlg; | 917 | InputDialog *fileDlg; |
917 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 918 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
918 | fileDlg->setInputText((const QString &)curFile); | 919 | fileDlg->setInputText((const QString &)curFile); |
919 | fileDlg->exec(); | 920 | fileDlg->exec(); |
920 | if( fileDlg->result() == 1 ) { | 921 | if( fileDlg->result() == 1 ) { |
921 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 922 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
922 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 923 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
923 | if( rename(oldname.latin1(), newName.latin1())== -1) | 924 | if( rename(oldname.latin1(), newName.latin1())== -1) |
924 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 925 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
925 | } | 926 | } |
926 | populateLocalView(); | 927 | populateLocalView(); |
927 | } | 928 | } |
928 | 929 | ||
929 | void AdvancedFm::remoteRename() | 930 | void AdvancedFm::remoteRename() |
930 | { | 931 | { |
931 | QString curFile = Local_View->currentItem()->text(0); | 932 | QString curFile = Local_View->currentItem()->text(0); |
932 | InputDialog *fileDlg; | 933 | InputDialog *fileDlg; |
933 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 934 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
934 | fileDlg->setInputText((const QString &)curFile); | 935 | fileDlg->setInputText((const QString &)curFile); |
935 | fileDlg->exec(); | 936 | fileDlg->exec(); |
936 | if( fileDlg->result() == 1 ) { | 937 | if( fileDlg->result() == 1 ) { |
937 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; | 938 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; |
938 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 939 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
939 | if( rename(oldname.latin1(), newName.latin1())== -1) | 940 | if( rename(oldname.latin1(), newName.latin1())== -1) |
940 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 941 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
941 | } | 942 | } |
942 | populateRemoteView(); | 943 | populateRemoteView(); |
943 | } | 944 | } |
944 | 945 | ||
945 | void AdvancedFm::switchToLocalTab() | 946 | void AdvancedFm::switchToLocalTab() |
946 | { | 947 | { |
947 | TabWidget->setCurrentPage(0); | 948 | TabWidget->setCurrentPage(0); |
948 | Local_View->setFocus(); | 949 | Local_View->setFocus(); |
949 | } | 950 | } |
950 | 951 | ||
951 | void AdvancedFm::switchToRemoteTab() | 952 | void AdvancedFm::switchToRemoteTab() |
952 | { | 953 | { |
953 | TabWidget->setCurrentPage(1); | 954 | TabWidget->setCurrentPage(1); |
954 | Remote_View->setFocus(); | 955 | Remote_View->setFocus(); |
955 | } | 956 | } |
956 | 957 | ||
957 | void AdvancedFm::readConfig() | 958 | void AdvancedFm::readConfig() |
958 | { | 959 | { |
959 | Config cfg("AdvancedFm"); | 960 | Config cfg("AdvancedFm"); |
960 | } | 961 | } |
961 | 962 | ||
962 | void AdvancedFm::writeConfig() | 963 | void AdvancedFm::writeConfig() |
963 | { | 964 | { |
964 | Config cfg("AdvancedFm"); | 965 | Config cfg("AdvancedFm"); |
965 | } | 966 | } |
966 | 967 | ||
967 | void AdvancedFm::currentPathComboChanged() | 968 | void AdvancedFm::currentPathComboChanged() |
968 | { | 969 | { |
969 | if (TabWidget->currentPageIndex() == 0) { | 970 | if (TabWidget->currentPageIndex() == 0) { |
970 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 971 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
971 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); | 972 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
972 | populateLocalView(); | 973 | populateLocalView(); |
973 | } else { | 974 | } else { |
974 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 975 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
975 | } | 976 | } |
976 | } | 977 | } |
977 | if (TabWidget->currentPageIndex() == 0) { | 978 | if (TabWidget->currentPageIndex() == 0) { |
978 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 979 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
979 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); | 980 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); |
980 | populateRemoteView(); | 981 | populateRemoteView(); |
981 | } else { | 982 | } else { |
982 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 983 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
983 | } | 984 | } |
984 | } | 985 | } |
985 | } | 986 | } |
986 | 987 | ||
987 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 988 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
988 | 989 | ||
989 | if (TabWidget->currentPageIndex() == 0) { | 990 | if (TabWidget->currentPageIndex() == 0) { |
990 | currentPathCombo->lineEdit()->setText( currentPath); | 991 | currentPathCombo->lineEdit()->setText( currentPath); |
991 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 992 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
992 | currentPathCombo->clear(); | 993 | currentPathCombo->clear(); |
993 | localDirPathStringList.prepend( currentPath ); | 994 | localDirPathStringList.prepend( currentPath ); |
994 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 995 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
995 | } | 996 | } |
996 | } else { | 997 | } else { |
997 | currentPathCombo->lineEdit()->setText( currentPath); | 998 | currentPathCombo->lineEdit()->setText( currentPath); |
998 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 999 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
999 | currentPathCombo->clear(); | 1000 | currentPathCombo->clear(); |
1000 | remoteDirPathStringList.prepend( currentPath ); | 1001 | remoteDirPathStringList.prepend( currentPath ); |
1001 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 1002 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
1002 | } | 1003 | } |
1003 | } | 1004 | } |
1004 | } | 1005 | } |
1005 | 1006 | ||
1006 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 1007 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
1007 | if (TabWidget->currentPageIndex() == 0) { | 1008 | if (TabWidget->currentPageIndex() == 0) { |
1008 | chdir( currentPath.latin1() ); | 1009 | chdir( currentPath.latin1() ); |
1009 | currentDir.cd( currentPath, TRUE); | 1010 | currentDir.cd( currentPath, TRUE); |
1010 | populateLocalView(); | 1011 | populateLocalView(); |
1011 | update(); | 1012 | update(); |
1012 | } else { | 1013 | } else { |
1013 | chdir( currentPath.latin1() ); | 1014 | chdir( currentPath.latin1() ); |
1014 | currentRemoteDir.cd( currentPath, TRUE); | 1015 | currentRemoteDir.cd( currentPath, TRUE); |
1015 | populateRemoteView(); | 1016 | populateRemoteView(); |
1016 | update(); | 1017 | update(); |
1017 | } | 1018 | } |
1018 | } | 1019 | } |
1019 | 1020 | ||
1020 | void AdvancedFm::filePerms() { | 1021 | void AdvancedFm::filePerms() { |
1021 | 1022 | ||
1022 | QStringList curFileList = getPath(); | 1023 | QStringList curFileList = getPath(); |
1023 | QString filePath; | 1024 | QString filePath; |
1024 | 1025 | ||
1025 | if (TabWidget->currentPageIndex() == 0) { | 1026 | if (TabWidget->currentPageIndex() == 0) { |
1026 | filePath = currentDir.canonicalPath()+"/"; | 1027 | filePath = currentDir.canonicalPath()+"/"; |
1027 | } else { | 1028 | } else { |
1028 | filePath= currentRemoteDir.canonicalPath()+"/"; | 1029 | filePath= currentRemoteDir.canonicalPath()+"/"; |
1029 | } | 1030 | } |
1030 | 1031 | ||
1031 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1032 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1032 | filePermissions *filePerm; | 1033 | filePermissions *filePerm; |
1033 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 1034 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
1034 | filePerm->showMaximized(); | 1035 | filePerm->showMaximized(); |
1035 | filePerm->exec(); | 1036 | filePerm->exec(); |
1036 | if( filePerm) | 1037 | if( filePerm) |
1037 | delete filePerm; | 1038 | delete filePerm; |
1038 | } | 1039 | } |
1039 | } | 1040 | } |
1040 | 1041 | ||
1041 | void AdvancedFm::doProperties() { | 1042 | void AdvancedFm::doProperties() { |
1042 | QStringList curFileList = getPath(); | 1043 | QStringList curFileList = getPath(); |
1043 | QString filePath; | 1044 | QString filePath; |
1044 | if (TabWidget->currentPageIndex() == 0) { | 1045 | if (TabWidget->currentPageIndex() == 0) { |
1045 | filePath = currentDir.canonicalPath()+"/"; | 1046 | filePath = currentDir.canonicalPath()+"/"; |
1046 | } else { | 1047 | } else { |
1047 | filePath= currentRemoteDir.canonicalPath()+"/"; | 1048 | filePath= currentRemoteDir.canonicalPath()+"/"; |
1048 | } | 1049 | } |
1049 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1050 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1050 | DocLnk lnk( (filePath+*it)); | 1051 | DocLnk lnk( (filePath+*it)); |
1051 | LnkProperties prop( &lnk ); | 1052 | LnkProperties prop( &lnk ); |
1052 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 1053 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
1053 | prop.showMaximized(); | 1054 | prop.showMaximized(); |
1054 | prop.exec(); | 1055 | prop.exec(); |
1055 | } | 1056 | } |
1056 | } | 1057 | } |
1057 | 1058 | ||
1058 | QStringList AdvancedFm::getPath() { | 1059 | QStringList AdvancedFm::getPath() { |
1059 | QStringList strList; | 1060 | QStringList strList; |
1060 | if (TabWidget->currentPageIndex() == 0) { | 1061 | if (TabWidget->currentPageIndex() == 0) { |
1061 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 1062 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
1062 | QListViewItemIterator it( Local_View ); | 1063 | QListViewItemIterator it( Local_View ); |
1063 | for ( ; it.current(); ++it ) { | 1064 | for ( ; it.current(); ++it ) { |
1064 | if ( it.current()->isSelected() ) { | 1065 | if ( it.current()->isSelected() ) { |
1065 | strList << it.current()->text(0); | 1066 | strList << it.current()->text(0); |
1066 | } | 1067 | } |
1067 | } | 1068 | } |
1068 | return strList; | 1069 | return strList; |
1069 | } else { | 1070 | } else { |
1070 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 1071 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
1071 | QListViewItemIterator it( Remote_View ); | 1072 | QListViewItemIterator it( Remote_View ); |
1072 | for ( ; it.current(); ++it ) { | 1073 | for ( ; it.current(); ++it ) { |
1073 | if ( it.current()->isSelected() ) { | 1074 | if ( it.current()->isSelected() ) { |
1074 | strList << it.current()->text(0); | 1075 | strList << it.current()->text(0); |
1075 | } | 1076 | } |
1076 | } | 1077 | } |
1077 | return strList; | 1078 | return strList; |
1078 | } | 1079 | } |
1079 | return ""; | 1080 | return ""; |
1080 | } | 1081 | } |
1081 | 1082 | ||
1082 | void AdvancedFm::homeButtonPushed() { | 1083 | void AdvancedFm::homeButtonPushed() { |
1083 | QString current = QDir::homeDirPath(); | 1084 | QString current = QDir::homeDirPath(); |
1084 | chdir( current.latin1() ); | 1085 | chdir( current.latin1() ); |
1085 | if (TabWidget->currentPageIndex() == 0) { | 1086 | if (TabWidget->currentPageIndex() == 0) { |
1086 | currentDir.cd( current, TRUE); | 1087 | currentDir.cd( current, TRUE); |
1087 | populateLocalView(); | 1088 | populateLocalView(); |
1088 | } else { | 1089 | } else { |
1089 | currentRemoteDir.cd( current, TRUE); | 1090 | currentRemoteDir.cd( current, TRUE); |
1090 | populateRemoteView(); | 1091 | populateRemoteView(); |
1091 | } | 1092 | } |
1092 | update(); | 1093 | update(); |
1093 | } | 1094 | } |
1094 | 1095 | ||
1095 | void AdvancedFm::docButtonPushed() { | 1096 | void AdvancedFm::docButtonPushed() { |
1096 | QString current = QPEApplication::documentDir(); | 1097 | QString current = QPEApplication::documentDir(); |
1097 | chdir( current.latin1() ); | 1098 | chdir( current.latin1() ); |
1098 | if (TabWidget->currentPageIndex() == 0) { | 1099 | if (TabWidget->currentPageIndex() == 0) { |
1099 | currentDir.cd( current, TRUE); | 1100 | currentDir.cd( current, TRUE); |
1100 | populateLocalView(); | 1101 | populateLocalView(); |
1101 | } else { | 1102 | } else { |
1102 | currentRemoteDir.cd( current, TRUE); | 1103 | currentRemoteDir.cd( current, TRUE); |
1103 | populateRemoteView(); | 1104 | populateRemoteView(); |
1104 | } | 1105 | } |
1105 | update(); | 1106 | update(); |
1106 | } | 1107 | } |
1107 | 1108 | ||
1108 | void AdvancedFm::SDButtonPushed() { | 1109 | void AdvancedFm::SDButtonPushed() { |
1109 | QString current = "/mnt/card"; | 1110 | QString current = "/mnt/card"; |
1110 | chdir( current.latin1() ); | 1111 | chdir( current.latin1() ); |
1111 | if (TabWidget->currentPageIndex() == 0) { | 1112 | if (TabWidget->currentPageIndex() == 0) { |
1112 | currentDir.cd( current, TRUE); | 1113 | currentDir.cd( current, TRUE); |
1113 | populateLocalView(); | 1114 | populateLocalView(); |
1114 | } else { | 1115 | } else { |
1115 | currentRemoteDir.cd( current, TRUE); | 1116 | currentRemoteDir.cd( current, TRUE); |
1116 | populateRemoteView(); | 1117 | populateRemoteView(); |
1117 | } | 1118 | } |
1118 | update(); | 1119 | update(); |
1119 | 1120 | ||
1120 | } | 1121 | } |
1121 | 1122 | ||
1122 | void AdvancedFm::CFButtonPushed() { | 1123 | void AdvancedFm::CFButtonPushed() { |
1123 | QString current = "/mnt/cf"; | 1124 | QString current = "/mnt/cf"; |
1124 | chdir( current.latin1() ); | 1125 | chdir( current.latin1() ); |
1125 | if (TabWidget->currentPageIndex() == 0) { | 1126 | if (TabWidget->currentPageIndex() == 0) { |
1126 | currentDir.cd( current, TRUE); | 1127 | currentDir.cd( current, TRUE); |
1127 | populateLocalView(); | 1128 | populateLocalView(); |
1128 | } else { | 1129 | } else { |
1129 | currentRemoteDir.cd( current, TRUE); | 1130 | currentRemoteDir.cd( current, TRUE); |
1130 | populateRemoteView(); | 1131 | populateRemoteView(); |
1131 | } | 1132 | } |
1132 | update(); | 1133 | update(); |
1133 | 1134 | ||
1134 | } | 1135 | } |
1135 | 1136 | ||
1136 | 1137 | ||
1137 | void AdvancedFm::upDir() | 1138 | void AdvancedFm::upDir() |
1138 | { | 1139 | { |
1139 | if (TabWidget->currentPageIndex() == 0) { | 1140 | if (TabWidget->currentPageIndex() == 0) { |
1140 | QString current = currentDir.canonicalPath(); | 1141 | QString current = currentDir.canonicalPath(); |
1141 | QDir dir(current); | 1142 | QDir dir(current); |
1142 | dir.cdUp(); | 1143 | dir.cdUp(); |
1143 | current = dir.canonicalPath(); | 1144 | current = dir.canonicalPath(); |
1144 | chdir( current.latin1() ); | 1145 | chdir( current.latin1() ); |
1145 | currentDir.cd( current, TRUE); | 1146 | currentDir.cd( current, TRUE); |
1146 | populateLocalView(); | 1147 | populateLocalView(); |
1147 | update(); | 1148 | update(); |
1148 | } else { | 1149 | } else { |
1149 | QString current = currentRemoteDir.canonicalPath(); | 1150 | QString current = currentRemoteDir.canonicalPath(); |
1150 | QDir dir(current); | 1151 | QDir dir(current); |
1151 | dir.cdUp(); | 1152 | dir.cdUp(); |
1152 | current = dir.canonicalPath(); | 1153 | current = dir.canonicalPath(); |
1153 | chdir( current.latin1() ); | 1154 | chdir( current.latin1() ); |
1154 | currentRemoteDir.cd( current, TRUE); | 1155 | currentRemoteDir.cd( current, TRUE); |
1155 | populateRemoteView(); | 1156 | populateRemoteView(); |
1156 | update(); | 1157 | update(); |
1157 | } | 1158 | } |
1158 | } | 1159 | } |
1159 | 1160 | ||
1160 | void AdvancedFm::copy() | 1161 | void AdvancedFm::copy() |
1161 | { | 1162 | { |
1162 | QStringList curFileList = getPath(); | 1163 | QStringList curFileList = getPath(); |
1163 | QString curFile; | 1164 | QString curFile; |
1164 | if (TabWidget->currentPageIndex() == 0) { | 1165 | if (TabWidget->currentPageIndex() == 0) { |
1165 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1166 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1166 | 1167 | ||
1167 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1168 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1168 | // if(destFile.right(1).find("/",0,TRUE) == -1) | 1169 | // if(destFile.right(1).find("/",0,TRUE) == -1) |
1169 | // destFile+="/"; | 1170 | // destFile+="/"; |
1170 | // destFile +=(*it); | 1171 | // destFile +=(*it); |
1171 | 1172 | ||
1172 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1173 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1173 | // if(curFile.right(1).find("/",0,TRUE) == -1) | 1174 | // if(curFile.right(1).find("/",0,TRUE) == -1) |
1174 | // curFile +="/"; | 1175 | // curFile +="/"; |
1175 | // curFile +=(*it); | 1176 | // curFile +=(*it); |
1176 | 1177 | ||
1177 | QFile f(destFile); | 1178 | QFile f(destFile); |
1178 | if( f.exists()) | 1179 | if( f.exists()) |
1179 | f.remove(); | 1180 | f.remove(); |
1180 | if(!copyFile(destFile, curFile) ) { | 1181 | if(!copyFile(destFile, curFile) ) { |
1181 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 1182 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
1182 | qWarning("nothin doing"); | 1183 | qWarning("nothin doing"); |
1183 | } | 1184 | } |
1184 | } | 1185 | } |
1185 | populateRemoteView(); | 1186 | populateRemoteView(); |
1186 | TabWidget->setCurrentPage(1); | 1187 | TabWidget->setCurrentPage(1); |
1187 | 1188 | ||
1188 | } else { | 1189 | } else { |
1189 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1190 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1190 | 1191 | ||
1191 | QString destFile = currentDir.canonicalPath()+"/"+(*it); | 1192 | QString destFile = currentDir.canonicalPath()+"/"+(*it); |
1192 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1193 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1193 | 1194 | ||
1194 | QFile f(destFile); | 1195 | QFile f(destFile); |
1195 | if( f.exists()) | 1196 | if( f.exists()) |
1196 | f.remove(); | 1197 | f.remove(); |
1197 | if(!copyFile(destFile, curFile) ) { | 1198 | if(!copyFile(destFile, curFile) ) { |
1198 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 1199 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
1199 | 1200 | ||
1200 | qWarning("nothin doing"); | 1201 | qWarning("nothin doing"); |
1201 | } | 1202 | } |
1202 | } | 1203 | } |
1203 | populateLocalView(); | 1204 | populateLocalView(); |
1204 | TabWidget->setCurrentPage(0); | 1205 | TabWidget->setCurrentPage(0); |
1205 | } | 1206 | } |
1206 | } | 1207 | } |
1207 | 1208 | ||
1208 | void AdvancedFm::copyAs() | 1209 | void AdvancedFm::copyAs() |
1209 | { | 1210 | { |
1210 | QStringList curFileList = getPath(); | 1211 | QStringList curFileList = getPath(); |
1211 | QString curFile; | 1212 | QString curFile; |
1212 | InputDialog *fileDlg; | 1213 | InputDialog *fileDlg; |
1213 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | 1214 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); |
1214 | 1215 | ||
1215 | if (TabWidget->currentPageIndex() == 0) { | 1216 | if (TabWidget->currentPageIndex() == 0) { |
1216 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1217 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1217 | QString destFile; | 1218 | QString destFile; |