-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 57 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 1 |
2 files changed, 45 insertions, 13 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 0f2555d..c054465 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,1917 +1,1948 @@ | |||
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 <opie/ofileselector.h> | 20 | // #include <opie/ofileselector.h> |
21 | // #include <opie/ofiledialog.h> | 21 | // #include <opie/ofiledialog.h> |
22 | 22 | ||
23 | 23 | ||
24 | #include <qpe/lnkproperties.h> | 24 | #include <qpe/lnkproperties.h> |
25 | #include <qpe/filemanager.h> | 25 | #include <qpe/filemanager.h> |
26 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
27 | #include <qpe/qpemenubar.h> | 27 | #include <qpe/qpemenubar.h> |
28 | #include <qpe/qpetoolbar.h> | 28 | #include <qpe/qpetoolbar.h> |
29 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
30 | #include <qpe/resource.h> | 30 | #include <qpe/resource.h> |
31 | #include <qpe/qcopenvelope_qws.h> | 31 | #include <qpe/qcopenvelope_qws.h> |
32 | #include <qpe/config.h> | 32 | #include <qpe/config.h> |
33 | #include <qpe/mimetype.h> | 33 | #include <qpe/mimetype.h> |
34 | #include <qpe/applnk.h> | 34 | #include <qpe/applnk.h> |
35 | #include <qpe/ir.h> | 35 | #include <qpe/ir.h> |
36 | 36 | ||
37 | //#include <opie/ofileselector.h> | 37 | //#include <opie/ofileselector.h> |
38 | #include <qmultilineedit.h> | 38 | #include <qmultilineedit.h> |
39 | 39 | ||
40 | #include <qtextstream.h> | 40 | #include <qtextstream.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qtoolbutton.h> | 42 | #include <qtoolbutton.h> |
43 | #include <qdatetime.h> | 43 | #include <qdatetime.h> |
44 | #include <qdir.h> | 44 | #include <qdir.h> |
45 | #include <qfile.h> | 45 | #include <qfile.h> |
46 | #include <qstring.h> | 46 | #include <qstring.h> |
47 | #include <qcombobox.h> | 47 | #include <qcombobox.h> |
48 | #include <qpopupmenu.h> | 48 | #include <qpopupmenu.h> |
49 | #include <qlistview.h> | 49 | #include <qlistview.h> |
50 | #include <qmainwindow.h> | 50 | #include <qmainwindow.h> |
51 | #include <qlabel.h> | 51 | #include <qlabel.h> |
52 | #include <qprogressbar.h> | 52 | #include <qprogressbar.h> |
53 | #include <qspinbox.h> | 53 | #include <qspinbox.h> |
54 | #include <qtabwidget.h> | 54 | #include <qtabwidget.h> |
55 | #include <qwidget.h> | 55 | #include <qwidget.h> |
56 | #include <qlayout.h> | 56 | #include <qlayout.h> |
57 | #include <qimage.h> | 57 | #include <qimage.h> |
58 | #include <qpixmap.h> | 58 | #include <qpixmap.h> |
59 | #include <qmessagebox.h> | 59 | #include <qmessagebox.h> |
60 | #include <qlineedit.h> | 60 | #include <qlineedit.h> |
61 | #include <qregexp.h> | 61 | #include <qregexp.h> |
62 | 62 | ||
63 | #include <unistd.h> | 63 | #include <unistd.h> |
64 | #include <stdlib.h> | 64 | #include <stdlib.h> |
65 | #include <sys/stat.h> | 65 | #include <sys/stat.h> |
66 | #include <dirent.h> | 66 | #include <dirent.h> |
67 | #include <stdio.h> | 67 | #include <stdio.h> |
68 | #include <time.h> | 68 | #include <time.h> |
69 | #include <fcntl.h> | 69 | #include <fcntl.h> |
70 | #include <mntent.h> | 70 | #include <mntent.h> |
71 | #include <string.h> | 71 | #include <string.h> |
72 | #include <errno.h> | 72 | #include <errno.h> |
73 | #include <sys/vfs.h> | 73 | #include <sys/vfs.h> |
74 | #include <mntent.h> | 74 | #include <mntent.h> |
75 | #include <sys/utsname.h> | 75 | #include <sys/utsname.h> |
76 | 76 | ||
77 | AdvancedFm::AdvancedFm( ) | 77 | AdvancedFm::AdvancedFm( ) |
78 | : QMainWindow( ) | 78 | : QMainWindow( ) |
79 | { | 79 | { |
80 | setCaption( tr( "AdvancedFm" ) ); | 80 | setCaption( tr( "AdvancedFm" ) ); |
81 | 81 | ||
82 | QGridLayout *layout = new QGridLayout( this ); | 82 | QGridLayout *layout = new QGridLayout( this ); |
83 | layout->setSpacing( 2); | 83 | layout->setSpacing( 2); |
84 | layout->setMargin( 2); | 84 | layout->setMargin( 2); |
85 | 85 | ||
86 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 86 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
87 | 87 | ||
88 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 88 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
89 | fileMenu = new QPopupMenu( this ); | 89 | fileMenu = new QPopupMenu( this ); |
90 | viewMenu = new QPopupMenu( this ); | 90 | viewMenu = new QPopupMenu( this ); |
91 | 91 | ||
92 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); | 92 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); |
93 | 93 | ||
94 | menuBar->insertItem( tr( "File" ), fileMenu); | 94 | menuBar->insertItem( tr( "File" ), fileMenu); |
95 | menuBar->insertItem( tr( "View" ), viewMenu); | 95 | menuBar->insertItem( tr( "View" ), viewMenu); |
96 | 96 | ||
97 | qpeDirButton= new QToolButton(this,"QPEButton"); | 97 | qpeDirButton= new QToolButton(this,"QPEButton"); |
98 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); | 98 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); |
99 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); | 99 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); |
100 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); | 100 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); |
101 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); | 101 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); |
102 | 102 | ||
103 | cfButton = new QToolButton( this,"CFButton"); | 103 | cfButton = new QToolButton( this,"CFButton"); |
104 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); | 104 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); |
105 | cfButton ->setFixedSize( QSize( 20, 20 ) ); | 105 | cfButton ->setFixedSize( QSize( 20, 20 ) ); |
106 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); | 106 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); |
107 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); | 107 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); |
108 | 108 | ||
109 | sdButton = new QToolButton( this,"SDButton"); | 109 | sdButton = new QToolButton( this,"SDButton"); |
110 | sdButton->setPixmap(Resource::loadPixmap("sdmon/sdcard")); | 110 | sdButton->setPixmap(Resource::loadPixmap("sdmon/sdcard")); |
111 | sdButton->setFixedSize( QSize( 20, 20 ) ); | 111 | sdButton->setFixedSize( QSize( 20, 20 ) ); |
112 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); | 112 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); |
113 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); | 113 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); |
114 | 114 | ||
115 | cdUpButton = new QToolButton( this,"cdUpButton"); | 115 | cdUpButton = new QToolButton( this,"cdUpButton"); |
116 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | 116 | cdUpButton->setPixmap(Resource::loadPixmap("up")); |
117 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 117 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
118 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 118 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
119 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); | 119 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); |
120 | 120 | ||
121 | docButton = new QToolButton( this,"docsButton"); | 121 | docButton = new QToolButton( this,"docsButton"); |
122 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); | 122 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); |
123 | docButton->setFixedSize( QSize( 20, 20 ) ); | 123 | docButton->setFixedSize( QSize( 20, 20 ) ); |
124 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 124 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
125 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); | 125 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); |
126 | 126 | ||
127 | homeButton = new QToolButton( this,"homeButton"); | 127 | homeButton = new QToolButton( this,"homeButton"); |
128 | homeButton->setPixmap(Resource::loadPixmap("home")); | 128 | homeButton->setPixmap(Resource::loadPixmap("home")); |
129 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 129 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
130 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 130 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
131 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); | 131 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); |
132 | 132 | ||
133 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 133 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
134 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 134 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
135 | fileMenu->insertSeparator(); | 135 | fileMenu->insertSeparator(); |
136 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 136 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
137 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 137 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
138 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 138 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
139 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 139 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
140 | fileMenu->insertSeparator(); | 140 | fileMenu->insertSeparator(); |
141 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | ||
141 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 142 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
142 | fileMenu->setCheckable(TRUE); | 143 | fileMenu->setCheckable(TRUE); |
143 | 144 | ||
144 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 145 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
145 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 146 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
146 | viewMenu->insertSeparator(); | 147 | viewMenu->insertSeparator(); |
147 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 148 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
148 | viewMenu->setCheckable(TRUE); | 149 | viewMenu->setCheckable(TRUE); |
149 | 150 | ||
150 | 151 | ||
151 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 152 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
152 | currentPathCombo->setEditable(TRUE); | 153 | currentPathCombo->setEditable(TRUE); |
153 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 154 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); |
154 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 155 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
155 | 156 | ||
156 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 157 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
157 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 158 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
158 | 159 | ||
159 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 160 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
160 | this,SLOT(currentPathComboChanged())); | 161 | this,SLOT(currentPathComboChanged())); |
161 | 162 | ||
162 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 163 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
163 | 164 | ||
164 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 165 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); |
165 | 166 | ||
166 | 167 | ||
167 | TabWidget = new QTabWidget( this, "TabWidget" ); | 168 | TabWidget = new QTabWidget( this, "TabWidget" ); |
168 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); | 169 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); |
169 | 170 | ||
170 | tab = new QWidget( TabWidget, "tab" ); | 171 | tab = new QWidget( TabWidget, "tab" ); |
171 | tabLayout = new QGridLayout( tab ); | 172 | tabLayout = new QGridLayout( tab ); |
172 | tabLayout->setSpacing( 2); | 173 | tabLayout->setSpacing( 2); |
173 | tabLayout->setMargin( 2); | 174 | tabLayout->setMargin( 2); |
174 | 175 | ||
175 | Local_View = new QListView( tab, "Local_View" ); | 176 | Local_View = new QListView( tab, "Local_View" ); |
176 | Local_View->addColumn( tr("File"),130); | 177 | Local_View->addColumn( tr("File"),130); |
177 | Local_View->addColumn( tr("Size"),-1); | 178 | Local_View->addColumn( tr("Size"),-1); |
178 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 179 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
179 | Local_View->addColumn( tr("Date"),-1); | 180 | Local_View->addColumn( tr("Date"),-1); |
180 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 181 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
181 | Local_View->setAllColumnsShowFocus(TRUE); | 182 | Local_View->setAllColumnsShowFocus(TRUE); |
182 | Local_View->setMultiSelection( TRUE ); | 183 | Local_View->setMultiSelection( TRUE ); |
183 | Local_View->setSelectionMode(QListView::Extended); | 184 | Local_View->setSelectionMode(QListView::Extended); |
184 | 185 | ||
185 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 186 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
186 | 187 | ||
187 | tabLayout->addWidget( Local_View, 0, 0 ); | 188 | tabLayout->addWidget( Local_View, 0, 0 ); |
188 | 189 | ||
189 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 190 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
190 | this,SLOT( localListClicked(QListViewItem *)) ); | 191 | this,SLOT( localListClicked(QListViewItem *)) ); |
191 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 192 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
192 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); | 193 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); |
193 | 194 | ||
194 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | 195 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); |
195 | 196 | ||
196 | TabWidget->insertTab( tab, tr("1")); | 197 | TabWidget->insertTab( tab, tr("1")); |
197 | 198 | ||
198 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 199 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
199 | tabLayout_2 = new QGridLayout( tab_2 ); | 200 | tabLayout_2 = new QGridLayout( tab_2 ); |
200 | tabLayout_2->setSpacing( 2); | 201 | tabLayout_2->setSpacing( 2); |
201 | tabLayout_2->setMargin( 2); | 202 | tabLayout_2->setMargin( 2); |
202 | 203 | ||
203 | Remote_View = new QListView( tab_2, "Remote_View" ); | 204 | Remote_View = new QListView( tab_2, "Remote_View" ); |
204 | Remote_View->addColumn( tr("File"),130); | 205 | Remote_View->addColumn( tr("File"),130); |
205 | Remote_View->addColumn( tr("Size"),-1); | 206 | Remote_View->addColumn( tr("Size"),-1); |
206 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 207 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
207 | Remote_View->addColumn( tr("Date"),-1); | 208 | Remote_View->addColumn( tr("Date"),-1); |
208 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 209 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
209 | Remote_View->setAllColumnsShowFocus(TRUE); | 210 | Remote_View->setAllColumnsShowFocus(TRUE); |
210 | Remote_View->setMultiSelection( TRUE ); | 211 | Remote_View->setMultiSelection( TRUE ); |
211 | Remote_View->setSelectionMode(QListView::Extended); | 212 | Remote_View->setSelectionMode(QListView::Extended); |
212 | 213 | ||
213 | 214 | ||
214 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 215 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
215 | 216 | ||
216 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 217 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
217 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 218 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
218 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 219 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
219 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 220 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
220 | 221 | ||
221 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 222 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
222 | 223 | ||
223 | 224 | ||
224 | TabWidget->insertTab( tab_2, tr( "2")); | 225 | TabWidget->insertTab( tab_2, tr( "2")); |
225 | 226 | ||
226 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 227 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
227 | this,SLOT(tabChanged(QWidget*))); | 228 | this,SLOT(tabChanged(QWidget*))); |
228 | 229 | ||
229 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); | 230 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); |
230 | tabLayout_3 = new QGridLayout( tab_3 ); | 231 | tabLayout_3 = new QGridLayout( tab_3 ); |
231 | tabLayout_3->setSpacing( 2); | 232 | tabLayout_3->setSpacing( 2); |
232 | tabLayout_3->setMargin( 2); | 233 | tabLayout_3->setMargin( 2); |
233 | 234 | ||
234 | 235 | ||
235 | // OFileDialog fileDialog; | 236 | // OFileDialog fileDialog; |
236 | // fileDialog; | 237 | // fileDialog; |
237 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy | 238 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy |
238 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); | 239 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); |
239 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); | 240 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); |
240 | 241 | ||
241 | QListView *fileTree; | 242 | QListView *fileTree; |
242 | fileTree = new QListView( tab_3, "tree" ); | 243 | fileTree = new QListView( tab_3, "tree" ); |
243 | 244 | ||
244 | 245 | ||
245 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | 246 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); |
246 | 247 | ||
247 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | 248 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); |
248 | */ | 249 | */ |
249 | 250 | ||
250 | /////////////// | 251 | /////////////// |
251 | 252 | ||
252 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | 253 | struct utsname name; /* check for embedix kernel running on the zaurus*/ |
253 | if (uname(&name) != -1) { | 254 | if (uname(&name) != -1) { |
254 | QString release=name.release; | 255 | QString release=name.release; |
255 | if(release.find("embedix",0,TRUE) !=-1) { | 256 | if(release.find("embedix",0,TRUE) !=-1) { |
256 | zaurusDevice=TRUE; | 257 | zaurusDevice=TRUE; |
257 | } else { | 258 | } else { |
258 | zaurusDevice=FALSE; | 259 | zaurusDevice=FALSE; |
259 | sdButton->hide(); | 260 | sdButton->hide(); |
260 | } | 261 | } |
261 | } | 262 | } |
262 | 263 | ||
263 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 264 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
264 | currentDir.setPath( QDir::currentDirPath()); | 265 | currentDir.setPath( QDir::currentDirPath()); |
265 | 266 | ||
266 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 267 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
267 | currentRemoteDir.setPath( QDir::currentDirPath()); | 268 | currentRemoteDir.setPath( QDir::currentDirPath()); |
268 | 269 | ||
269 | b = TRUE; | 270 | b = TRUE; |
270 | 271 | ||
271 | filterStr="*"; | 272 | filterStr="*"; |
272 | b=FALSE; | 273 | b=FALSE; |
273 | 274 | ||
274 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); | 275 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); |
275 | 276 | ||
276 | populateLocalView(); | 277 | populateLocalView(); |
277 | populateRemoteView(); | 278 | populateRemoteView(); |
278 | currentPathCombo->setFocus(); | 279 | currentPathCombo->setFocus(); |
279 | } | 280 | } |
280 | 281 | ||
281 | AdvancedFm::~AdvancedFm() | 282 | AdvancedFm::~AdvancedFm() |
282 | { | 283 | { |
283 | } | 284 | } |
284 | 285 | ||
285 | void AdvancedFm::cleanUp() | 286 | void AdvancedFm::cleanUp() |
286 | { | 287 | { |
287 | QString sfile=QDir::homeDirPath(); | 288 | QString sfile=QDir::homeDirPath(); |
288 | if(sfile.right(1) != "/") | 289 | if(sfile.right(1) != "/") |
289 | sfile+="/._temp"; | 290 | sfile+="/._temp"; |
290 | else | 291 | else |
291 | sfile+="._temp"; | 292 | sfile+="._temp"; |
292 | QFile file( sfile); | 293 | QFile file( sfile); |
293 | if(file.exists()) | 294 | if(file.exists()) |
294 | file.remove(); | 295 | file.remove(); |
295 | } | 296 | } |
296 | 297 | ||
297 | void AdvancedFm::tabChanged(QWidget *w) | 298 | void AdvancedFm::tabChanged(QWidget *) |
298 | { | 299 | { |
299 | if (TabWidget->currentPageIndex() == 0) { | 300 | if (TabWidget->currentPageIndex() == 0) { |
300 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 301 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
301 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 302 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
302 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 303 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
303 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 304 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
304 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); | 305 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); |
305 | 306 | ||
306 | } | 307 | } |
307 | if (TabWidget->currentPageIndex() == 1) { | 308 | if (TabWidget->currentPageIndex() == 1) { |
308 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); | 309 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); |
309 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); | 310 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); |
310 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); | 311 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); |
311 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 312 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
312 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); | 313 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); |
313 | } | 314 | } |
314 | } | 315 | } |
315 | 316 | ||
316 | 317 | ||
317 | void AdvancedFm::populateLocalView() | 318 | void AdvancedFm::populateLocalView() |
318 | { | 319 | { |
319 | QPixmap pm; | 320 | QPixmap pm; |
320 | Local_View->clear(); | 321 | Local_View->clear(); |
321 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 322 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
322 | currentDir.setMatchAllDirs(TRUE); | 323 | currentDir.setMatchAllDirs(TRUE); |
323 | currentDir.setNameFilter(filterStr); | 324 | currentDir.setNameFilter(filterStr); |
324 | QString fileL, fileS, fileDate; | 325 | QString fileL, fileS, fileDate; |
325 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 326 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
326 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); | 327 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); |
327 | bool isDir=FALSE; | 328 | bool isDir=FALSE; |
328 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 329 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
329 | QFileInfoListIterator it(*list); | 330 | QFileInfoListIterator it(*list); |
330 | QFileInfo *fi; | 331 | QFileInfo *fi; |
331 | while ( (fi=it.current()) ) { | 332 | while ( (fi=it.current()) ) { |
332 | if (fi->isSymLink() ) { | 333 | if (fi->isSymLink() ) { |
333 | QString symLink=fi->readLink(); | 334 | QString symLink=fi->readLink(); |
334 | QFileInfo sym( symLink); | 335 | QFileInfo sym( symLink); |
335 | fileS.sprintf( "%10li", sym.size() ); | 336 | fileS.sprintf( "%10i", sym.size() ); |
336 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); | 337 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
337 | fileDate = sym.lastModified().toString(); | 338 | fileDate = sym.lastModified().toString(); |
338 | } else { | 339 | } else { |
339 | fileS.sprintf( "%10li", fi->size() ); | 340 | fileS.sprintf( "%10i", fi->size() ); |
340 | fileL.sprintf( "%s",fi->fileName().data() ); | 341 | fileL.sprintf( "%s",fi->fileName().data() ); |
341 | fileDate= fi->lastModified().toString(); | 342 | fileDate= fi->lastModified().toString(); |
342 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 343 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
343 | fileL+="/"; | 344 | fileL+="/"; |
344 | isDir=TRUE; | 345 | isDir=TRUE; |
345 | } | 346 | } |
346 | } | 347 | } |
347 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); | 348 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); |
348 | if(fileL !="./" && fi->exists()) { | 349 | if(fileL !="./" && fi->exists()) { |
349 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); | 350 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); |
350 | 351 | ||
351 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 352 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
352 | 353 | ||
353 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 354 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
354 | pm = Resource::loadPixmap( "lockedfolder" ); | 355 | pm = Resource::loadPixmap( "lockedfolder" ); |
355 | else | 356 | else |
356 | pm= Resource::loadPixmap( "folder" ); | 357 | pm= Resource::loadPixmap( "folder" ); |
357 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 358 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
358 | pm = Resource::loadPixmap( "exec"); | 359 | pm = Resource::loadPixmap( "exec"); |
359 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 360 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
360 | | fileInfo.permission( QFileInfo::ExeGroup) | 361 | | fileInfo.permission( QFileInfo::ExeGroup) |
361 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 362 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
362 | pm = Resource::loadPixmap( "exec"); | 363 | pm = Resource::loadPixmap( "exec"); |
363 | } else if( !fi->isReadable() ) { | 364 | } else if( !fi->isReadable() ) { |
364 | pm = Resource::loadPixmap( "locked" ); | 365 | pm = Resource::loadPixmap( "locked" ); |
365 | } else { //everything else goes by mimetype | 366 | } else { //everything else goes by mimetype |
366 | MimeType mt(fi->filePath()); | 367 | MimeType mt(fi->filePath()); |
367 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 368 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
368 | if(pm.isNull()) | 369 | if(pm.isNull()) |
369 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 370 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
370 | } | 371 | } |
371 | item->setPixmap( 0,pm); | 372 | item->setPixmap( 0,pm); |
372 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 373 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
373 | // overlay link image | 374 | // overlay link image |
374 | pm= Resource::loadPixmap( "folder" ); | 375 | pm= Resource::loadPixmap( "folder" ); |
375 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 376 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
376 | QPainter painter( &pm ); | 377 | QPainter painter( &pm ); |
377 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 378 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
378 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 379 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
379 | item->setPixmap( 0, pm); | 380 | item->setPixmap( 0, pm); |
380 | } | 381 | } |
381 | } | 382 | } |
382 | isDir=FALSE; | 383 | isDir=FALSE; |
383 | ++it; | 384 | ++it; |
384 | } | 385 | } |
385 | 386 | ||
386 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { | 387 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { |
387 | struct stat buf; | 388 | struct stat buf; |
388 | dev_t devT; | 389 | dev_t devT; |
389 | DIR *dir; | 390 | DIR *dir; |
390 | struct dirent *mydirent; | 391 | struct dirent *mydirent; |
391 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) | 392 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) |
392 | while ((mydirent = readdir(dir)) != NULL) { | 393 | while ((mydirent = readdir(dir)) != NULL) { |
393 | lstat( mydirent->d_name, &buf); | 394 | lstat( mydirent->d_name, &buf); |
394 | qDebug(mydirent->d_name); | 395 | qDebug(mydirent->d_name); |
395 | fileL.sprintf("%s", mydirent->d_name); | 396 | fileL.sprintf("%s", mydirent->d_name); |
396 | devT = buf.st_dev; | 397 | devT = buf.st_dev; |
397 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 398 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
398 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 399 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
399 | if( fileL.find(".") == -1 ){ | 400 | if( fileL.find(".") == -1 ){ |
400 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); | 401 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); |
401 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 402 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
402 | item->setPixmap( 0,pm); | 403 | item->setPixmap( 0,pm); |
403 | } | 404 | } |
404 | } | 405 | } |
405 | 406 | ||
406 | closedir(dir); | 407 | closedir(dir); |
407 | } | 408 | } |
408 | 409 | ||
409 | Local_View->setSorting( 3,FALSE); | 410 | Local_View->setSorting( 3,FALSE); |
410 | fillCombo( (const QString &) currentDir.canonicalPath()); | 411 | fillCombo( (const QString &) currentDir.canonicalPath()); |
411 | } | 412 | } |
412 | 413 | ||
413 | 414 | ||
414 | void AdvancedFm::populateRemoteView() | 415 | void AdvancedFm::populateRemoteView() |
415 | { | 416 | { |
416 | QPixmap pm; | 417 | QPixmap pm; |
417 | Remote_View->clear(); | 418 | Remote_View->clear(); |
418 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 419 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
419 | currentRemoteDir.setMatchAllDirs(TRUE); | 420 | currentRemoteDir.setMatchAllDirs(TRUE); |
420 | currentRemoteDir.setNameFilter(filterStr); | 421 | currentRemoteDir.setNameFilter(filterStr); |
421 | QString fileL, fileS, fileDate; | 422 | QString fileL, fileS, fileDate; |
422 | 423 | ||
423 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 424 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
424 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); | 425 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); |
425 | bool isDir=FALSE; | 426 | bool isDir=FALSE; |
426 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 427 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
427 | QFileInfoListIterator it(*list); | 428 | QFileInfoListIterator it(*list); |
428 | QFileInfo *fi; | 429 | QFileInfo *fi; |
429 | while ( (fi=it.current()) ) { | 430 | while ( (fi=it.current()) ) { |
430 | if (fi->isSymLink() ){ | 431 | if (fi->isSymLink() ){ |
431 | QString symLink=fi->readLink(); | 432 | QString symLink=fi->readLink(); |
432 | // qDebug("Symlink detected "+symLink); | 433 | // qDebug("Symlink detected "+symLink); |
433 | QFileInfo sym( symLink); | 434 | QFileInfo sym( symLink); |
434 | fileS.sprintf( "%10li", sym.size() ); | 435 | fileS.sprintf( "%10i", sym.size() ); |
435 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); | 436 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
436 | fileDate = sym.lastModified().toString(); | 437 | fileDate = sym.lastModified().toString(); |
437 | } else { | 438 | } else { |
438 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 439 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
439 | fileS.sprintf( "%10li", fi->size() ); | 440 | fileS.sprintf( "%10i", fi->size() ); |
440 | fileL.sprintf( "%s",fi->fileName().data() ); | 441 | fileL.sprintf( "%s",fi->fileName().data() ); |
441 | fileDate= fi->lastModified().toString(); | 442 | fileDate= fi->lastModified().toString(); |
442 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { | 443 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { |
443 | fileL+="/"; | 444 | fileL+="/"; |
444 | isDir=TRUE; | 445 | isDir=TRUE; |
445 | // qDebug( fileL); | 446 | // qDebug( fileL); |
446 | } | 447 | } |
447 | } | 448 | } |
448 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); | 449 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); |
449 | if(fileL !="./" && fi->exists()) { | 450 | if(fileL !="./" && fi->exists()) { |
450 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 451 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
451 | QPixmap pm; | 452 | QPixmap pm; |
452 | 453 | ||
453 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 454 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
454 | if( !QDir( fi->filePath() ).isReadable()) | 455 | if( !QDir( fi->filePath() ).isReadable()) |
455 | pm = Resource::loadPixmap( "lockedfolder" ); | 456 | pm = Resource::loadPixmap( "lockedfolder" ); |
456 | else | 457 | else |
457 | pm= Resource::loadPixmap( "folder" ); | 458 | pm= Resource::loadPixmap( "folder" ); |
458 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 459 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
459 | pm = Resource::loadPixmap( "exec"); | 460 | pm = Resource::loadPixmap( "exec"); |
460 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 461 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
461 | | fileInfo.permission( QFileInfo::ExeGroup) | 462 | | fileInfo.permission( QFileInfo::ExeGroup) |
462 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 463 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
463 | pm = Resource::loadPixmap( "exec"); | 464 | pm = Resource::loadPixmap( "exec"); |
464 | } else if( !fi->isReadable() ) { | 465 | } else if( !fi->isReadable() ) { |
465 | pm = Resource::loadPixmap( "locked" ); | 466 | pm = Resource::loadPixmap( "locked" ); |
466 | } else { | 467 | } else { |
467 | MimeType mt(fi->filePath()); | 468 | MimeType mt(fi->filePath()); |
468 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 469 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
469 | if(pm.isNull()) | 470 | if(pm.isNull()) |
470 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 471 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
471 | } | 472 | } |
472 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 473 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
473 | // overlay link image | 474 | // overlay link image |
474 | pm= Resource::loadPixmap( "folder" ); | 475 | pm= Resource::loadPixmap( "folder" ); |
475 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 476 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
476 | QPainter painter( &pm ); | 477 | QPainter painter( &pm ); |
477 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 478 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
478 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 479 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
479 | } | 480 | } |
480 | item->setPixmap( 0, pm); | 481 | item->setPixmap( 0, pm); |
481 | } | 482 | } |
482 | isDir=FALSE; | 483 | isDir=FALSE; |
483 | ++it; | 484 | ++it; |
484 | } | 485 | } |
485 | 486 | ||
486 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { | 487 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { |
487 | struct stat buf; | 488 | struct stat buf; |
488 | DIR *dir; | 489 | DIR *dir; |
489 | struct dirent *mydirent; | 490 | struct dirent *mydirent; |
490 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) | 491 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) |
491 | while ((mydirent = readdir(dir)) != NULL) { | 492 | while ((mydirent = readdir(dir)) != NULL) { |
492 | lstat( mydirent->d_name, &buf); | 493 | lstat( mydirent->d_name, &buf); |
493 | qDebug(mydirent->d_name); | 494 | qDebug(mydirent->d_name); |
494 | fileL.sprintf("%s", mydirent->d_name); | 495 | fileL.sprintf("%s", mydirent->d_name); |
495 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); | 496 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); |
496 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 497 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
497 | if( fileL.find(".") == -1 ){ | 498 | if( fileL.find(".") == -1 ){ |
498 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 499 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
499 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 500 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
500 | item->setPixmap( 0,pm); | 501 | item->setPixmap( 0,pm); |
501 | } | 502 | } |
502 | } | 503 | } |
503 | 504 | ||
504 | closedir(dir); | 505 | closedir(dir); |
505 | } | 506 | } |
506 | 507 | ||
507 | Remote_View->setSorting( 3,FALSE); | 508 | Remote_View->setSorting( 3,FALSE); |
508 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); | 509 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); |
509 | } | 510 | } |
510 | 511 | ||
511 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) | 512 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) |
512 | { | 513 | { |
513 | if(selectedItem) { | 514 | if(selectedItem) { |
514 | QString strItem=selectedItem->text(0); | 515 | QString strItem=selectedItem->text(0); |
515 | QString strSize=selectedItem->text(1); | 516 | QString strSize=selectedItem->text(1); |
516 | strSize=strSize.stripWhiteSpace(); | 517 | strSize=strSize.stripWhiteSpace(); |
517 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 518 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
518 | // is symlink | 519 | // is symlink |
519 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 520 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
520 | if(QDir(strItem2).exists() ) { | 521 | if(QDir(strItem2).exists() ) { |
521 | currentDir.cd(strItem2, TRUE); | 522 | currentDir.cd(strItem2, TRUE); |
522 | populateLocalView(); | 523 | populateLocalView(); |
523 | } | 524 | } |
524 | } else { // not a symlink | 525 | } else { // not a symlink |
525 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 526 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
526 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 527 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
527 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 528 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
528 | currentDir.cd(strItem,FALSE); | 529 | currentDir.cd(strItem,FALSE); |
529 | populateLocalView(); | 530 | populateLocalView(); |
530 | } else { | 531 | } else { |
531 | currentDir.cdUp(); | 532 | currentDir.cdUp(); |
532 | populateLocalView(); | 533 | populateLocalView(); |
533 | } | 534 | } |
534 | if(QDir(strItem).exists()){ | 535 | if(QDir(strItem).exists()){ |
535 | currentDir.cd(strItem, TRUE); | 536 | currentDir.cd(strItem, TRUE); |
536 | populateLocalView(); | 537 | populateLocalView(); |
537 | } | 538 | } |
538 | } else { | 539 | } else { |
539 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 540 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
540 | if( QFile::exists(strItem ) ) { | 541 | if( QFile::exists(strItem ) ) { |
541 | // qDebug("clicked item "+strItem); | 542 | // qDebug("clicked item "+strItem); |
542 | // DocLnk doc( strItem, FALSE ); | 543 | // DocLnk doc( strItem, FALSE ); |
543 | // doc.execute(); | 544 | // doc.execute(); |
544 | // Local_View->clearSelection(); | 545 | // Local_View->clearSelection(); |
545 | } | 546 | } |
546 | } //end not symlink | 547 | } //end not symlink |
547 | chdir(strItem.latin1()); | 548 | chdir(strItem.latin1()); |
548 | } | 549 | } |
549 | } | 550 | } |
550 | } | 551 | } |
551 | 552 | ||
552 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) | 553 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) |
553 | { | 554 | { |
554 | if(selectedItem) { | 555 | if(selectedItem) { |
555 | QString strItem=selectedItem->text(0); | 556 | QString strItem=selectedItem->text(0); |
556 | QString strSize=selectedItem->text(1); | 557 | QString strSize=selectedItem->text(1); |
557 | strSize=strSize.stripWhiteSpace(); | 558 | strSize=strSize.stripWhiteSpace(); |
558 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 559 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
559 | // is symlink | 560 | // is symlink |
560 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 561 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
561 | if(QDir(strItem2).exists() ) { | 562 | if(QDir(strItem2).exists() ) { |
562 | currentRemoteDir.cd(strItem2, TRUE); | 563 | currentRemoteDir.cd(strItem2, TRUE); |
563 | populateRemoteView(); | 564 | populateRemoteView(); |
564 | } | 565 | } |
565 | } else { // not a symlink | 566 | } else { // not a symlink |
566 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 567 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
567 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { | 568 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { |
568 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 569 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
569 | currentRemoteDir.cd(strItem,FALSE); | 570 | currentRemoteDir.cd(strItem,FALSE); |
570 | populateRemoteView(); | 571 | populateRemoteView(); |
571 | } else { | 572 | } else { |
572 | currentRemoteDir.cdUp(); | 573 | currentRemoteDir.cdUp(); |
573 | populateRemoteView(); | 574 | populateRemoteView(); |
574 | } | 575 | } |
575 | if(QDir(strItem).exists()){ | 576 | if(QDir(strItem).exists()){ |
576 | currentRemoteDir.cd(strItem, TRUE); | 577 | currentRemoteDir.cd(strItem, TRUE); |
577 | populateRemoteView(); | 578 | populateRemoteView(); |
578 | } | 579 | } |
579 | } else { | 580 | } else { |
580 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 581 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
581 | if( QFile::exists(strItem ) ) { | 582 | if( QFile::exists(strItem ) ) { |
582 | // qDebug("clicked item "+strItem); | 583 | // qDebug("clicked item "+strItem); |
583 | // DocLnk doc( strItem, FALSE ); | 584 | // DocLnk doc( strItem, FALSE ); |
584 | // doc.execute(); | 585 | // doc.execute(); |
585 | // Remote_View->clearSelection(); | 586 | // Remote_View->clearSelection(); |
586 | } | 587 | } |
587 | } //end not symlink | 588 | } //end not symlink |
588 | chdir(strItem.latin1()); | 589 | chdir(strItem.latin1()); |
589 | } | 590 | } |
590 | } | 591 | } |
591 | } | 592 | } |
592 | 593 | ||
593 | void AdvancedFm::doLocalCd() | 594 | void AdvancedFm::doLocalCd() |
594 | { | 595 | { |
595 | localListClicked( Local_View->currentItem()); | 596 | localListClicked( Local_View->currentItem()); |
596 | } | 597 | } |
597 | 598 | ||
598 | void AdvancedFm::doRemoteCd() | 599 | void AdvancedFm::doRemoteCd() |
599 | { | 600 | { |
600 | localListClicked( Remote_View->currentItem()); | 601 | localListClicked( Remote_View->currentItem()); |
601 | } | 602 | } |
602 | 603 | ||
603 | void AdvancedFm::showHidden() | 604 | void AdvancedFm::showHidden() |
604 | { | 605 | { |
605 | if (b) { | 606 | if (b) { |
606 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 607 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
607 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 608 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
608 | b=FALSE; | 609 | b=FALSE; |
609 | 610 | ||
610 | } else { | 611 | } else { |
611 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 612 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
612 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 613 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
613 | b=TRUE; | 614 | b=TRUE; |
614 | } | 615 | } |
615 | populateLocalView(); | 616 | populateLocalView(); |
616 | 617 | ||
617 | } | 618 | } |
618 | 619 | ||
619 | void AdvancedFm::showRemoteHidden() | 620 | void AdvancedFm::showRemoteHidden() |
620 | { | 621 | { |
621 | if (b) { | 622 | if (b) { |
622 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 623 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
623 | b=TRUE; | 624 | b=TRUE; |
624 | 625 | ||
625 | } else { | 626 | } else { |
626 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 627 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
627 | b=FALSE; | 628 | b=FALSE; |
628 | } | 629 | } |
629 | populateRemoteView(); | 630 | populateRemoteView(); |
630 | } | 631 | } |
631 | 632 | ||
632 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 633 | void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int ) |
633 | { | 634 | { |
634 | qDebug("list pressed"); | 635 | qDebug("list pressed"); |
635 | switch (mouse) { | 636 | switch (mouse) { |
636 | case 1: | 637 | case 1: |
637 | break; | 638 | break; |
638 | case 2: | 639 | case 2: |
639 | menuTimer.start( 750, TRUE ); | 640 | menuTimer.start( 750, TRUE ); |
640 | qDebug("Start menu timer\n"); | 641 | qDebug("Start menu timer\n"); |
641 | break; | 642 | break; |
642 | }; | 643 | }; |
643 | } | 644 | } |
644 | 645 | ||
645 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 646 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) |
646 | { | 647 | { |
647 | 648 | ||
648 | switch (mouse) { | 649 | switch (mouse) { |
649 | case 1: | 650 | case 1: |
650 | break; | 651 | break; |
651 | case 2: | 652 | case 2: |
652 | menuTimer.start( 750, TRUE ); | 653 | menuTimer.start( 750, TRUE ); |
653 | qDebug("Start menu timer"); | 654 | qDebug("Start menu timer"); |
654 | break; | 655 | break; |
655 | }; | 656 | }; |
656 | } | 657 | } |
657 | 658 | ||
658 | void AdvancedFm::runThis() { | 659 | void AdvancedFm::runThis() { |
659 | QString fs; | 660 | QString fs; |
660 | if (TabWidget->currentPageIndex() == 0) { | 661 | if (TabWidget->currentPageIndex() == 0) { |
661 | QString curFile = Local_View->currentItem()->text(0); | 662 | QString curFile = Local_View->currentItem()->text(0); |
662 | if(curFile != "../") { | 663 | if(curFile != "../") { |
663 | 664 | ||
664 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 665 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
665 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); | 666 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
666 | qDebug( fileInfo.owner()); | 667 | qDebug( fileInfo.owner()); |
667 | if( (fileInfo.permission( QFileInfo::ExeUser) | 668 | if( (fileInfo.permission( QFileInfo::ExeUser) |
668 | | fileInfo.permission( QFileInfo::ExeGroup) | 669 | | fileInfo.permission( QFileInfo::ExeGroup) |
669 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 670 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
670 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 671 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
671 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 672 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
672 | e << curFile; | 673 | e << curFile; |
673 | } else { | 674 | } else { |
674 | curFile = currentDir.canonicalPath()+"/"+curFile; | 675 | curFile = currentDir.canonicalPath()+"/"+curFile; |
675 | DocLnk nf(curFile); | 676 | DocLnk nf(curFile); |
676 | QString execStr = nf.exec(); | 677 | QString execStr = nf.exec(); |
677 | qDebug( execStr); | 678 | qDebug( execStr); |
678 | if( execStr.isEmpty() ) { | 679 | if( execStr.isEmpty() ) { |
679 | } else { | 680 | } else { |
680 | nf.execute(); | 681 | nf.execute(); |
681 | } | 682 | } |
682 | } | 683 | } |
683 | } | 684 | } |
684 | } else { | 685 | } else { |
685 | QString curFile = Remote_View->currentItem()->text(0); | 686 | QString curFile = Remote_View->currentItem()->text(0); |
686 | if(curFile != "../") { | 687 | if(curFile != "../") { |
687 | 688 | ||
688 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 689 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
689 | qDebug("Filesystemtype is "+fs); | 690 | qDebug("Filesystemtype is "+fs); |
690 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); | 691 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
691 | if( (fileInfo.permission( QFileInfo::ExeUser) | 692 | if( (fileInfo.permission( QFileInfo::ExeUser) |
692 | | fileInfo.permission( QFileInfo::ExeGroup) | 693 | | fileInfo.permission( QFileInfo::ExeGroup) |
693 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 694 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
694 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 695 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
695 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 696 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
696 | e << curFile; | 697 | e << curFile; |
697 | } else { | 698 | } else { |
698 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 699 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
699 | DocLnk nf(curFile); | 700 | DocLnk nf(curFile); |
700 | QString execStr = nf.exec(); | 701 | QString execStr = nf.exec(); |
701 | qDebug(execStr); | 702 | qDebug(execStr); |
702 | if( execStr.isEmpty() ) { | 703 | if( execStr.isEmpty() ) { |
703 | } else { | 704 | } else { |
704 | nf.execute(); | 705 | nf.execute(); |
705 | } | 706 | } |
706 | } | 707 | } |
707 | } | 708 | } |
708 | } | 709 | } |
709 | } | 710 | } |
710 | 711 | ||
711 | void AdvancedFm::runText() { | 712 | void AdvancedFm::runText() { |
712 | if (TabWidget->currentPageIndex() == 0) { | 713 | if (TabWidget->currentPageIndex() == 0) { |
713 | QString curFile = Local_View->currentItem()->text(0); | 714 | QString curFile = Local_View->currentItem()->text(0); |
714 | if(curFile != "../") { | 715 | if(curFile != "../") { |
715 | curFile = currentDir.canonicalPath()+"/"+curFile; | 716 | curFile = currentDir.canonicalPath()+"/"+curFile; |
716 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 717 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
717 | e << curFile; | 718 | e << curFile; |
718 | } | 719 | } |
719 | } else { | 720 | } else { |
720 | QString curFile = Remote_View->currentItem()->text(0); | 721 | QString curFile = Remote_View->currentItem()->text(0); |
721 | if(curFile != "../") { | 722 | if(curFile != "../") { |
722 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 723 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
723 | DocLnk nf(curFile); | 724 | DocLnk nf(curFile); |
724 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 725 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
725 | e << curFile; | 726 | e << curFile; |
726 | } | 727 | } |
727 | } | 728 | } |
728 | } | 729 | } |
729 | 730 | ||
730 | void AdvancedFm::localMakDir() | 731 | void AdvancedFm::localMakDir() |
731 | { | 732 | { |
732 | InputDialog *fileDlg; | 733 | InputDialog *fileDlg; |
733 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 734 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
734 | fileDlg->exec(); | 735 | fileDlg->exec(); |
735 | if( fileDlg->result() == 1 ) { | 736 | if( fileDlg->result() == 1 ) { |
736 | QString filename = fileDlg->LineEdit1->text(); | 737 | QString filename = fileDlg->LineEdit1->text(); |
737 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 738 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
738 | } | 739 | } |
739 | populateLocalView(); | 740 | populateLocalView(); |
740 | } | 741 | } |
741 | 742 | ||
742 | void AdvancedFm::remoteMakDir() | 743 | void AdvancedFm::remoteMakDir() |
743 | { | 744 | { |
744 | InputDialog *fileDlg; | 745 | InputDialog *fileDlg; |
745 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 746 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
746 | fileDlg->exec(); | 747 | fileDlg->exec(); |
747 | if( fileDlg->result() == 1 ) { | 748 | if( fileDlg->result() == 1 ) { |
748 | QString filename = fileDlg->LineEdit1->text(); | 749 | QString filename = fileDlg->LineEdit1->text(); |
749 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); | 750 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); |
750 | } | 751 | } |
751 | populateRemoteView(); | 752 | populateRemoteView(); |
752 | } | 753 | } |
753 | 754 | ||
754 | void AdvancedFm::localDelete() | 755 | void AdvancedFm::localDelete() |
755 | { | 756 | { |
756 | QStringList curFileList = getPath(); | 757 | QStringList curFileList = getPath(); |
757 | if(curFileList.count() > 0) { | 758 | if(curFileList.count() > 0) { |
758 | QString myFile; | 759 | QString myFile; |
759 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 760 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
760 | myFile = (*it); | 761 | myFile = (*it); |
761 | if( myFile.find(" -> ",0,TRUE) != -1) | 762 | if( myFile.find(" -> ",0,TRUE) != -1) |
762 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 763 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
763 | 764 | ||
764 | QString f = currentDir.canonicalPath(); | 765 | QString f = currentDir.canonicalPath(); |
765 | if(f.right(1).find("/",0,TRUE) == -1) | 766 | if(f.right(1).find("/",0,TRUE) == -1) |
766 | f+="/"; | 767 | f+="/"; |
767 | f+=myFile; | 768 | f+=myFile; |
768 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 769 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
769 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 770 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
770 | "\nand all it's contents ?" | 771 | "\nand all it's contents ?" |
771 | ,tr("Yes"),tr("No"),0,0,1) ) { | 772 | ,tr("Yes"),tr("No"),0,0,1) ) { |
772 | case 0: { | 773 | case 0: { |
773 | f=f.left(f.length()-1); | 774 | f=f.left(f.length()-1); |
774 | QString cmd="rm -rf "+f; | 775 | QString cmd="rm -rf "+f; |
775 | system( cmd.latin1()); | 776 | system( cmd.latin1()); |
776 | populateLocalView(); | 777 | populateLocalView(); |
777 | } | 778 | } |
778 | break; | 779 | break; |
779 | case 1: | 780 | case 1: |
780 | // exit | 781 | // exit |
781 | break; | 782 | break; |
782 | }; | 783 | }; |
783 | 784 | ||
784 | } else { | 785 | } else { |
785 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 786 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
786 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 787 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
787 | case 0: { | 788 | case 0: { |
788 | QString cmd="rm "+f; | 789 | QString cmd="rm "+f; |
789 | QFile file(f); | 790 | QFile file(f); |
790 | file.remove(); | 791 | file.remove(); |
791 | // system( cmd.latin1()); | 792 | // system( cmd.latin1()); |
792 | populateLocalView(); | 793 | populateLocalView(); |
793 | } | 794 | } |
794 | break; | 795 | break; |
795 | case 1: | 796 | case 1: |
796 | // exit | 797 | // exit |
797 | break; | 798 | break; |
798 | }; | 799 | }; |
799 | } | 800 | } |
800 | } | 801 | } |
801 | } | 802 | } |
802 | } | 803 | } |
803 | 804 | ||
804 | void AdvancedFm::remoteDelete() | 805 | void AdvancedFm::remoteDelete() |
805 | { | 806 | { |
806 | QStringList curFileList = getPath(); | 807 | QStringList curFileList = getPath(); |
807 | if( curFileList.count() > 0) { | 808 | if( curFileList.count() > 0) { |
808 | QString myFile; | 809 | QString myFile; |
809 | 810 | ||
810 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 811 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
811 | myFile = (*it); | 812 | myFile = (*it); |
812 | if(myFile.find(" -> ",0,TRUE) != -1) | 813 | if(myFile.find(" -> ",0,TRUE) != -1) |
813 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); | 814 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); |
814 | QString f = currentRemoteDir.canonicalPath(); | 815 | QString f = currentRemoteDir.canonicalPath(); |
815 | if(f.right(1).find("/",0,TRUE) == -1) | 816 | if(f.right(1).find("/",0,TRUE) == -1) |
816 | f+="/"; | 817 | f+="/"; |
817 | f+=myFile; | 818 | f+=myFile; |
818 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 819 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
819 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 820 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
820 | "\nand all it's contents ?", | 821 | "\nand all it's contents ?", |
821 | tr("Yes"),tr("No"),0,0,1) ) { | 822 | tr("Yes"),tr("No"),0,0,1) ) { |
822 | case 0: { | 823 | case 0: { |
823 | f=f.left(f.length()-1); | 824 | f=f.left(f.length()-1); |
824 | QString cmd="rm -rf "+f; | 825 | QString cmd="rm -rf "+f; |
825 | system( cmd.latin1()); | 826 | system( cmd.latin1()); |
826 | populateRemoteView(); | 827 | populateRemoteView(); |
827 | } | 828 | } |
828 | break; | 829 | break; |
829 | case 1: | 830 | case 1: |
830 | // exit | 831 | // exit |
831 | break; | 832 | break; |
832 | }; | 833 | }; |
833 | 834 | ||
834 | } else { | 835 | } else { |
835 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 836 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
836 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 837 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
837 | case 0: { | 838 | case 0: { |
838 | QString cmd="rm "+f; | 839 | QString cmd="rm "+f; |
839 | QFile file(f); | 840 | QFile file(f); |
840 | file.remove(); | 841 | file.remove(); |
841 | // system( cmd.latin1()); | 842 | // system( cmd.latin1()); |
842 | populateRemoteView(); | 843 | populateRemoteView(); |
843 | } | 844 | } |
844 | break; | 845 | break; |
845 | case 1: | 846 | case 1: |
846 | // exit | 847 | // exit |
847 | break; | 848 | break; |
848 | }; | 849 | }; |
849 | } | 850 | } |
850 | } | 851 | } |
851 | } | 852 | } |
852 | } | 853 | } |
853 | 854 | ||
854 | void AdvancedFm::localRename() | 855 | void AdvancedFm::localRename() |
855 | { | 856 | { |
856 | QString curFile = Local_View->currentItem()->text(0); | 857 | QString curFile = Local_View->currentItem()->text(0); |
857 | qDebug("currentItem "+curFile); | 858 | qDebug("currentItem "+curFile); |
858 | if( curFile !="../") { | 859 | if( curFile !="../") { |
859 | InputDialog *fileDlg; | 860 | InputDialog *fileDlg; |
860 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 861 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
861 | fileDlg->setInputText((const QString &)curFile); | 862 | fileDlg->setInputText((const QString &)curFile); |
862 | fileDlg->exec(); | 863 | fileDlg->exec(); |
863 | if( fileDlg->result() == 1 ) { | 864 | if( fileDlg->result() == 1 ) { |
864 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 865 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
865 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 866 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
866 | if( rename(oldname.latin1(), newName.latin1())== -1) | 867 | if( rename(oldname.latin1(), newName.latin1())== -1) |
867 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 868 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
868 | } | 869 | } |
869 | populateLocalView(); | 870 | populateLocalView(); |
870 | } | 871 | } |
871 | } | 872 | } |
872 | 873 | ||
873 | void AdvancedFm::remoteRename() | 874 | void AdvancedFm::remoteRename() |
874 | { | 875 | { |
875 | QString curFile = Remote_View->currentItem()->text(0); | 876 | QString curFile = Remote_View->currentItem()->text(0); |
876 | if( curFile !="../") { | 877 | if( curFile !="../") { |
877 | InputDialog *fileDlg; | 878 | InputDialog *fileDlg; |
878 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 879 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
879 | fileDlg->setInputText((const QString &)curFile); | 880 | fileDlg->setInputText((const QString &)curFile); |
880 | fileDlg->exec(); | 881 | fileDlg->exec(); |
881 | if( fileDlg->result() == 1 ) { | 882 | if( fileDlg->result() == 1 ) { |
882 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; | 883 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; |
883 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 884 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
884 | if( rename(oldname.latin1(), newName.latin1())== -1) | 885 | if( rename(oldname.latin1(), newName.latin1())== -1) |
885 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 886 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
886 | } | 887 | } |
887 | populateRemoteView(); | 888 | populateRemoteView(); |
888 | } | 889 | } |
889 | } | 890 | } |
890 | 891 | ||
891 | void AdvancedFm::switchToLocalTab() | 892 | void AdvancedFm::switchToLocalTab() |
892 | { | 893 | { |
893 | TabWidget->setCurrentPage(0); | 894 | TabWidget->setCurrentPage(0); |
894 | Local_View->setFocus(); | 895 | Local_View->setFocus(); |
895 | } | 896 | } |
896 | 897 | ||
897 | void AdvancedFm::switchToRemoteTab() | 898 | void AdvancedFm::switchToRemoteTab() |
898 | { | 899 | { |
899 | TabWidget->setCurrentPage(1); | 900 | TabWidget->setCurrentPage(1); |
900 | Remote_View->setFocus(); | 901 | Remote_View->setFocus(); |
901 | } | 902 | } |
902 | 903 | ||
903 | void AdvancedFm::readConfig() | 904 | void AdvancedFm::readConfig() |
904 | { | 905 | { |
905 | Config cfg("AdvancedFm"); | 906 | Config cfg("AdvancedFm"); |
906 | } | 907 | } |
907 | 908 | ||
908 | void AdvancedFm::writeConfig() | 909 | void AdvancedFm::writeConfig() |
909 | { | 910 | { |
910 | Config cfg("AdvancedFm"); | 911 | Config cfg("AdvancedFm"); |
911 | } | 912 | } |
912 | 913 | ||
913 | void AdvancedFm::currentPathComboChanged() | 914 | void AdvancedFm::currentPathComboChanged() |
914 | { | 915 | { |
915 | if (TabWidget->currentPageIndex() == 0) { | 916 | if (TabWidget->currentPageIndex() == 0) { |
916 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 917 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
917 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); | 918 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
918 | populateLocalView(); | 919 | populateLocalView(); |
919 | } else { | 920 | } else { |
920 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 921 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
921 | } | 922 | } |
922 | } | 923 | } |
923 | if (TabWidget->currentPageIndex() == 0) { | 924 | if (TabWidget->currentPageIndex() == 0) { |
924 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 925 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
925 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); | 926 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); |
926 | populateRemoteView(); | 927 | populateRemoteView(); |
927 | } else { | 928 | } else { |
928 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 929 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
929 | } | 930 | } |
930 | } | 931 | } |
931 | } | 932 | } |
932 | 933 | ||
933 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 934 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
934 | 935 | ||
935 | if (TabWidget->currentPageIndex() == 0) { | 936 | if (TabWidget->currentPageIndex() == 0) { |
936 | currentPathCombo->lineEdit()->setText( currentPath); | 937 | currentPathCombo->lineEdit()->setText( currentPath); |
937 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 938 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
938 | currentPathCombo->clear(); | 939 | currentPathCombo->clear(); |
939 | localDirPathStringList.prepend( currentPath ); | 940 | localDirPathStringList.prepend( currentPath ); |
940 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 941 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
941 | } | 942 | } |
942 | } else { | 943 | } else { |
943 | currentPathCombo->lineEdit()->setText( currentPath); | 944 | currentPathCombo->lineEdit()->setText( currentPath); |
944 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 945 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
945 | currentPathCombo->clear(); | 946 | currentPathCombo->clear(); |
946 | remoteDirPathStringList.prepend( currentPath ); | 947 | remoteDirPathStringList.prepend( currentPath ); |
947 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 948 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
948 | } | 949 | } |
949 | } | 950 | } |
950 | } | 951 | } |
951 | 952 | ||
952 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 953 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
953 | if (TabWidget->currentPageIndex() == 0) { | 954 | if (TabWidget->currentPageIndex() == 0) { |
954 | chdir( currentPath.latin1() ); | 955 | chdir( currentPath.latin1() ); |
955 | currentDir.cd( currentPath, TRUE); | 956 | currentDir.cd( currentPath, TRUE); |
956 | populateLocalView(); | 957 | populateLocalView(); |
957 | update(); | 958 | update(); |
958 | } else { | 959 | } else { |
959 | chdir( currentPath.latin1() ); | 960 | chdir( currentPath.latin1() ); |
960 | currentRemoteDir.cd( currentPath, TRUE); | 961 | currentRemoteDir.cd( currentPath, TRUE); |
961 | populateRemoteView(); | 962 | populateRemoteView(); |
962 | update(); | 963 | update(); |
963 | } | 964 | } |
964 | } | 965 | } |
965 | 966 | ||
966 | void AdvancedFm::filePerms() { | 967 | void AdvancedFm::filePerms() { |
967 | 968 | ||
968 | QStringList curFileList = getPath(); | 969 | QStringList curFileList = getPath(); |
969 | QString filePath; | 970 | QString filePath; |
970 | 971 | ||
971 | if (TabWidget->currentPageIndex() == 0) { | 972 | if (TabWidget->currentPageIndex() == 0) { |
972 | filePath = currentDir.canonicalPath()+"/"; | 973 | filePath = currentDir.canonicalPath()+"/"; |
973 | } else { | 974 | } else { |
974 | filePath= currentRemoteDir.canonicalPath()+"/"; | 975 | filePath= currentRemoteDir.canonicalPath()+"/"; |
975 | } | 976 | } |
976 | 977 | ||
977 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 978 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
978 | filePermissions *filePerm; | 979 | filePermissions *filePerm; |
979 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 980 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
980 | filePerm->showMaximized(); | 981 | filePerm->showMaximized(); |
981 | filePerm->exec(); | 982 | filePerm->exec(); |
982 | if( filePerm) | 983 | if( filePerm) |
983 | delete filePerm; | 984 | delete filePerm; |
984 | } | 985 | } |
985 | if (TabWidget->currentPageIndex() == 0) { | 986 | if (TabWidget->currentPageIndex() == 0) { |
986 | populateLocalView(); | 987 | populateLocalView(); |
987 | } else { | 988 | } else { |
988 | populateRemoteView(); | 989 | populateRemoteView(); |
989 | } | 990 | } |
990 | } | 991 | } |
991 | 992 | ||
992 | void AdvancedFm::doProperties() { | 993 | void AdvancedFm::doProperties() { |
993 | QStringList curFileList = getPath(); | 994 | QStringList curFileList = getPath(); |
994 | QString filePath; | 995 | QString filePath; |
995 | if (TabWidget->currentPageIndex() == 0) { | 996 | if (TabWidget->currentPageIndex() == 0) { |
996 | filePath = currentDir.canonicalPath()+"/"; | 997 | filePath = currentDir.canonicalPath()+"/"; |
997 | } else { | 998 | } else { |
998 | filePath= currentRemoteDir.canonicalPath()+"/"; | 999 | filePath= currentRemoteDir.canonicalPath()+"/"; |
999 | } | 1000 | } |
1000 | // qDebug("%d",curFileList.count()); | 1001 | // qDebug("%d",curFileList.count()); |
1001 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1002 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1002 | qDebug((filePath+*it)); | 1003 | qDebug((filePath+*it)); |
1003 | DocLnk lnk( (filePath+*it)); | 1004 | DocLnk lnk( (filePath+*it)); |
1004 | LnkProperties prop( &lnk ); | 1005 | LnkProperties prop( &lnk ); |
1005 | prop.showMaximized(); | 1006 | prop.showMaximized(); |
1006 | prop.exec(); | 1007 | prop.exec(); |
1007 | } | 1008 | } |
1008 | } | 1009 | } |
1009 | 1010 | ||
1010 | QStringList AdvancedFm::getPath() { | 1011 | QStringList AdvancedFm::getPath() { |
1011 | QStringList strList; | 1012 | QStringList strList; |
1012 | if (TabWidget->currentPageIndex() == 0) { | 1013 | if (TabWidget->currentPageIndex() == 0) { |
1013 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 1014 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
1014 | QListViewItemIterator it( Local_View ); | 1015 | QListViewItemIterator it( Local_View ); |
1015 | for ( ; it.current(); ++it ) { | 1016 | for ( ; it.current(); ++it ) { |
1016 | if ( it.current()->isSelected() ) { | 1017 | if ( it.current()->isSelected() ) { |
1017 | strList << it.current()->text(0); | 1018 | strList << it.current()->text(0); |
1018 | qDebug(it.current()->text(0)); | 1019 | qDebug(it.current()->text(0)); |
1019 | } | 1020 | } |
1020 | } | 1021 | } |
1021 | return strList; | 1022 | return strList; |
1022 | } else { | 1023 | } else { |
1023 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 1024 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
1024 | QListViewItemIterator it( Remote_View ); | 1025 | QListViewItemIterator it( Remote_View ); |
1025 | for ( ; it.current(); ++it ) { | 1026 | for ( ; it.current(); ++it ) { |
1026 | if ( it.current()->isSelected() ) { | 1027 | if ( it.current()->isSelected() ) { |
1027 | strList << it.current()->text(0); | 1028 | strList << it.current()->text(0); |
1028 | qDebug(it.current()->text(0)); | 1029 | qDebug(it.current()->text(0)); |
1029 | } | 1030 | } |
1030 | } | 1031 | } |
1031 | return strList; | 1032 | return strList; |
1032 | } | 1033 | } |
1033 | return ""; | 1034 | return ""; |
1034 | } | 1035 | } |
1035 | 1036 | ||
1036 | void AdvancedFm::homeButtonPushed() { | 1037 | void AdvancedFm::homeButtonPushed() { |
1037 | QString current = QDir::homeDirPath(); | 1038 | QString current = QDir::homeDirPath(); |
1038 | chdir( current.latin1() ); | 1039 | chdir( current.latin1() ); |
1039 | if (TabWidget->currentPageIndex() == 0) { | 1040 | if (TabWidget->currentPageIndex() == 0) { |
1040 | currentDir.cd( current, TRUE); | 1041 | currentDir.cd( current, TRUE); |
1041 | populateLocalView(); | 1042 | populateLocalView(); |
1042 | } else { | 1043 | } else { |
1043 | currentRemoteDir.cd( current, TRUE); | 1044 | currentRemoteDir.cd( current, TRUE); |
1044 | populateRemoteView(); | 1045 | populateRemoteView(); |
1045 | } | 1046 | } |
1046 | update(); | 1047 | update(); |
1047 | } | 1048 | } |
1048 | 1049 | ||
1049 | void AdvancedFm::docButtonPushed() { | 1050 | void AdvancedFm::docButtonPushed() { |
1050 | QString current = QPEApplication::documentDir(); | 1051 | QString current = QPEApplication::documentDir(); |
1051 | chdir( current.latin1() ); | 1052 | chdir( current.latin1() ); |
1052 | if (TabWidget->currentPageIndex() == 0) { | 1053 | if (TabWidget->currentPageIndex() == 0) { |
1053 | currentDir.cd( current, TRUE); | 1054 | currentDir.cd( current, TRUE); |
1054 | populateLocalView(); | 1055 | populateLocalView(); |
1055 | } else { | 1056 | } else { |
1056 | currentRemoteDir.cd( current, TRUE); | 1057 | currentRemoteDir.cd( current, TRUE); |
1057 | populateRemoteView(); | 1058 | populateRemoteView(); |
1058 | } | 1059 | } |
1059 | update(); | 1060 | update(); |
1060 | } | 1061 | } |
1061 | 1062 | ||
1062 | void AdvancedFm::SDButtonPushed() { | 1063 | void AdvancedFm::SDButtonPushed() { |
1063 | QString current = "/mnt/card"; | 1064 | QString current = "/mnt/card"; |
1064 | chdir( current.latin1() ); | 1065 | chdir( current.latin1() ); |
1065 | if (TabWidget->currentPageIndex() == 0) { | 1066 | if (TabWidget->currentPageIndex() == 0) { |
1066 | currentDir.cd( current, TRUE); | 1067 | currentDir.cd( current, TRUE); |
1067 | populateLocalView(); | 1068 | populateLocalView(); |
1068 | } else { | 1069 | } else { |
1069 | currentRemoteDir.cd( current, TRUE); | 1070 | currentRemoteDir.cd( current, TRUE); |
1070 | populateRemoteView(); | 1071 | populateRemoteView(); |
1071 | } | 1072 | } |
1072 | update(); | 1073 | update(); |
1073 | 1074 | ||
1074 | } | 1075 | } |
1075 | 1076 | ||
1076 | void AdvancedFm::CFButtonPushed() { | 1077 | void AdvancedFm::CFButtonPushed() { |
1077 | QString current; | 1078 | QString current; |
1078 | if(zaurusDevice) | 1079 | if(zaurusDevice) |
1079 | current= "/mnt/cf"; | 1080 | current= "/mnt/cf"; |
1080 | else | 1081 | else |
1081 | current = "/mnt/hda"; | 1082 | current = "/mnt/hda"; |
1082 | 1083 | ||
1083 | chdir( current.latin1() ); | 1084 | chdir( current.latin1() ); |
1084 | if (TabWidget->currentPageIndex() == 0) { | 1085 | if (TabWidget->currentPageIndex() == 0) { |
1085 | currentDir.cd( current, TRUE); | 1086 | currentDir.cd( current, TRUE); |
1086 | populateLocalView(); | 1087 | populateLocalView(); |
1087 | } else { | 1088 | } else { |
1088 | currentRemoteDir.cd( current, TRUE); | 1089 | currentRemoteDir.cd( current, TRUE); |
1089 | populateRemoteView(); | 1090 | populateRemoteView(); |
1090 | } | 1091 | } |
1091 | update(); | 1092 | update(); |
1092 | 1093 | ||
1093 | } | 1094 | } |
1094 | 1095 | ||
1095 | 1096 | ||
1096 | void AdvancedFm::upDir() | 1097 | void AdvancedFm::upDir() |
1097 | { | 1098 | { |
1098 | if (TabWidget->currentPageIndex() == 0) { | 1099 | if (TabWidget->currentPageIndex() == 0) { |
1099 | QString current = currentDir.canonicalPath(); | 1100 | QString current = currentDir.canonicalPath(); |
1100 | QDir dir(current); | 1101 | QDir dir(current); |
1101 | dir.cdUp(); | 1102 | dir.cdUp(); |
1102 | current = dir.canonicalPath(); | 1103 | current = dir.canonicalPath(); |
1103 | chdir( current.latin1() ); | 1104 | chdir( current.latin1() ); |
1104 | currentDir.cd( current, TRUE); | 1105 | currentDir.cd( current, TRUE); |
1105 | populateLocalView(); | 1106 | populateLocalView(); |
1106 | update(); | 1107 | update(); |
1107 | } else { | 1108 | } else { |
1108 | QString current = currentRemoteDir.canonicalPath(); | 1109 | QString current = currentRemoteDir.canonicalPath(); |
1109 | QDir dir(current); | 1110 | QDir dir(current); |
1110 | dir.cdUp(); | 1111 | dir.cdUp(); |
1111 | current = dir.canonicalPath(); | 1112 | current = dir.canonicalPath(); |
1112 | chdir( current.latin1() ); | 1113 | chdir( current.latin1() ); |
1113 | currentRemoteDir.cd( current, TRUE); | 1114 | currentRemoteDir.cd( current, TRUE); |
1114 | populateRemoteView(); | 1115 | populateRemoteView(); |
1115 | update(); | 1116 | update(); |
1116 | } | 1117 | } |
1117 | } | 1118 | } |
1118 | 1119 | ||
1119 | void AdvancedFm::copy() | 1120 | void AdvancedFm::copy() |
1120 | { | 1121 | { |
1121 | qApp->processEvents(); | 1122 | qApp->processEvents(); |
1122 | QStringList curFileList = getPath(); | 1123 | QStringList curFileList = getPath(); |
1123 | if( curFileList.count() > 0) { | 1124 | if( curFileList.count() > 0) { |
1124 | QString curFile; | 1125 | QString curFile; |
1125 | if (TabWidget->currentPageIndex() == 0) { | 1126 | if (TabWidget->currentPageIndex() == 0) { |
1126 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1127 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1127 | 1128 | ||
1128 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1129 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1129 | qDebug("Destination file is "+destFile); | 1130 | qDebug("Destination file is "+destFile); |
1130 | 1131 | ||
1131 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1132 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1132 | qDebug("CurrentFile file is " + curFile); | 1133 | qDebug("CurrentFile file is " + curFile); |
1133 | 1134 | ||
1134 | QFile f(destFile); | 1135 | QFile f(destFile); |
1135 | if( f.exists()) { | 1136 | if( f.exists()) { |
1136 | switch ( QMessageBox::warning(this,tr("Delete"), | 1137 | switch ( QMessageBox::warning(this,tr("Delete"), |
1137 | destFile+tr(" already exists\nDo you really want to delete it?"), | 1138 | destFile+tr(" already exists\nDo you really want to delete it?"), |
1138 | tr("Yes"),tr("No"),0,0,1) ) { | 1139 | tr("Yes"),tr("No"),0,0,1) ) { |
1139 | case 0: | 1140 | case 0: |
1140 | f.remove(); | 1141 | f.remove(); |
1141 | break; | 1142 | break; |
1142 | case 1: | 1143 | case 1: |
1143 | return; | 1144 | return; |
1144 | break; | 1145 | break; |
1145 | }; | 1146 | }; |
1146 | } | 1147 | } |
1147 | if(!copyFile(destFile, curFile) ) { | 1148 | if(!copyFile(destFile, curFile) ) { |
1148 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 1149 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
1149 | qWarning("nothin doing"); | 1150 | qWarning("nothin doing"); |
1150 | } | 1151 | } |
1151 | } | 1152 | } |
1152 | populateRemoteView(); | 1153 | populateRemoteView(); |
1153 | TabWidget->setCurrentPage(1); | 1154 | TabWidget->setCurrentPage(1); |
1154 | 1155 | ||
1155 | } else { | 1156 | } else { |
1156 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1157 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1157 | 1158 | ||
1158 | QString destFile = currentDir.canonicalPath()+"/"+(*it); | 1159 | QString destFile = currentDir.canonicalPath()+"/"+(*it); |
1159 | qDebug("Destination file is "+destFile); | 1160 | qDebug("Destination file is "+destFile); |
1160 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1161 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1161 | qDebug("CurrentFile file is " + curFile); | 1162 | qDebug("CurrentFile file is " + curFile); |
1162 | 1163 | ||
1163 | QFile f(destFile); | 1164 | QFile f(destFile); |
1164 | if( f.exists()) { | 1165 | if( f.exists()) { |
1165 | switch ( QMessageBox::warning(this,tr("Delete"), | 1166 | switch ( QMessageBox::warning(this,tr("Delete"), |
1166 | destFile+tr(" already exists\nDo you really want to delete it?"), | 1167 | destFile+tr(" already exists\nDo you really want to delete it?"), |
1167 | tr("Yes"),tr("No"),0,0,1) ) { | 1168 | tr("Yes"),tr("No"),0,0,1) ) { |
1168 | case 0: | 1169 | case 0: |
1169 | f.remove(); | 1170 | f.remove(); |
1170 | break; | 1171 | break; |
1171 | case 1: | 1172 | case 1: |
1172 | return; | 1173 | return; |
1173 | break; | 1174 | break; |
1174 | }; | 1175 | }; |
1175 | } | 1176 | } |
1176 | if(!copyFile(destFile, curFile) ) { | 1177 | if(!copyFile(destFile, curFile) ) { |
1177 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); | 1178 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); |
1178 | 1179 | ||
1179 | qWarning("nothin doing"); | 1180 | qWarning("nothin doing"); |
1180 | } | 1181 | } |
1181 | } | 1182 | } |
1182 | populateLocalView(); | 1183 | populateLocalView(); |
1183 | TabWidget->setCurrentPage(0); | 1184 | TabWidget->setCurrentPage(0); |
1184 | } | 1185 | } |
1185 | 1186 | ||
1186 | } | 1187 | } |
1187 | } | 1188 | } |
1188 | 1189 | ||
1189 | void AdvancedFm::copyAs() { | 1190 | void AdvancedFm::copyAs() { |
1190 | qApp->processEvents(); | 1191 | qApp->processEvents(); |
1191 | 1192 | ||
1192 | QStringList curFileList = getPath(); | 1193 | QStringList curFileList = getPath(); |
1193 | QString curFile; | 1194 | QString curFile; |
1194 | InputDialog *fileDlg; | 1195 | InputDialog *fileDlg; |
1195 | if (TabWidget->currentPageIndex() == 0) { | 1196 | if (TabWidget->currentPageIndex() == 0) { |
1196 | qDebug("tab 1"); | 1197 | qDebug("tab 1"); |
1197 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1198 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1198 | QString destFile; | 1199 | QString destFile; |
1199 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1200 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1200 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 1201 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
1201 | 1202 | ||
1202 | fileDlg->setInputText((const QString &) destFile ); | 1203 | fileDlg->setInputText((const QString &) destFile ); |
1203 | fileDlg->exec(); | 1204 | fileDlg->exec(); |
1204 | 1205 | ||
1205 | if( fileDlg->result() == 1 ) { | 1206 | if( fileDlg->result() == 1 ) { |
1206 | QString filename = fileDlg->LineEdit1->text(); | 1207 | QString filename = fileDlg->LineEdit1->text(); |
1207 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; | 1208 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; |
1208 | 1209 | ||
1209 | QFile f(destFile); | 1210 | QFile f(destFile); |
1210 | if( f.exists()) { | 1211 | if( f.exists()) { |
1211 | switch (QMessageBox::warning(this,tr("Delete"), | 1212 | switch (QMessageBox::warning(this,tr("Delete"), |
1212 | destFile+tr(" already exists\nDo you really want to delete it?"), | 1213 | destFile+tr(" already exists\nDo you really want to delete it?"), |
1213 | tr("Yes"),tr("No"),0,0,1) ) { | 1214 | tr("Yes"),tr("No"),0,0,1) ) { |
1214 | case 0: | 1215 | case 0: |
1215 | f.remove(); | 1216 | f.remove(); |
1216 | break; | 1217 | break; |
1217 | case 1: | 1218 | case 1: |
1218 | return; | 1219 | return; |
1219 | break; | 1220 | break; |
1220 | }; | 1221 | }; |
1221 | } | 1222 | } |
1222 | if(!copyFile(destFile, curFile) ) { | 1223 | if(!copyFile(destFile, curFile) ) { |
1223 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); | 1224 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); |
1224 | qWarning("nothin doing"); | 1225 | qWarning("nothin doing"); |
1225 | } | 1226 | } |
1226 | } | 1227 | } |
1227 | delete fileDlg; | 1228 | delete fileDlg; |
1228 | 1229 | ||
1229 | } | 1230 | } |
1230 | populateRemoteView(); | 1231 | populateRemoteView(); |
1231 | TabWidget->setCurrentPage(1); | 1232 | TabWidget->setCurrentPage(1); |
1232 | 1233 | ||
1233 | } else { | 1234 | } else { |
1234 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1235 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1235 | 1236 | ||
1236 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1237 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1237 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 1238 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
1238 | 1239 | ||
1239 | QString destFile; | 1240 | QString destFile; |
1240 | fileDlg->setInputText((const QString &) destFile); | 1241 | fileDlg->setInputText((const QString &) destFile); |
1241 | fileDlg->exec(); | 1242 | fileDlg->exec(); |
1242 | 1243 | ||
1243 | if( fileDlg->result() == 1 ) { | 1244 | if( fileDlg->result() == 1 ) { |
1244 | QString filename = fileDlg->LineEdit1->text(); | 1245 | QString filename = fileDlg->LineEdit1->text(); |
1245 | destFile = currentDir.canonicalPath()+"/"+filename; | 1246 | destFile = currentDir.canonicalPath()+"/"+filename; |
1246 | 1247 | ||
1247 | QFile f( destFile); | 1248 | QFile f( destFile); |
1248 | if( f.exists()) { | 1249 | if( f.exists()) { |
1249 | switch ( QMessageBox::warning(this,tr("Delete"), | 1250 | switch ( QMessageBox::warning(this,tr("Delete"), |
1250 | destFile+tr(" already exists\nDo you really want to delete it?"), | 1251 | destFile+tr(" already exists\nDo you really want to delete it?"), |
1251 | tr("Yes"),tr("No"),0,0,1) ) { | 1252 | tr("Yes"),tr("No"),0,0,1) ) { |
1252 | case 0: | 1253 | case 0: |
1253 | f.remove(); | 1254 | f.remove(); |
1254 | break; | 1255 | break; |
1255 | case 1: | 1256 | case 1: |
1256 | return; | 1257 | return; |
1257 | break; | 1258 | break; |
1258 | }; | 1259 | }; |
1259 | } | 1260 | } |
1260 | if(!copyFile(destFile, curFile) ) { | 1261 | if(!copyFile(destFile, curFile) ) { |
1261 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); | 1262 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); |
1262 | qWarning("nothin doing"); | 1263 | qWarning("nothin doing"); |
1263 | } | 1264 | } |
1264 | 1265 | ||
1265 | } | 1266 | } |
1266 | delete fileDlg; | 1267 | delete fileDlg; |
1267 | 1268 | ||
1268 | } | 1269 | } |
1269 | populateLocalView(); | 1270 | populateLocalView(); |
1270 | TabWidget->setCurrentPage(0); | 1271 | TabWidget->setCurrentPage(0); |
1271 | } | 1272 | } |
1272 | } | 1273 | } |
1273 | 1274 | ||
1274 | void AdvancedFm::copySameDir() { | 1275 | void AdvancedFm::copySameDir() { |
1275 | qApp->processEvents(); | 1276 | qApp->processEvents(); |
1276 | QStringList curFileList = getPath(); | 1277 | QStringList curFileList = getPath(); |
1277 | QString curFile; | 1278 | QString curFile; |
1278 | InputDialog *fileDlg; | 1279 | InputDialog *fileDlg; |
1279 | 1280 | ||
1280 | if (TabWidget->currentPageIndex() == 0) { | 1281 | if (TabWidget->currentPageIndex() == 0) { |
1281 | 1282 | ||
1282 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1283 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1283 | 1284 | ||
1284 | QString destFile; | 1285 | QString destFile; |
1285 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1286 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1286 | 1287 | ||
1287 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | 1288 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); |
1288 | fileDlg->setInputText((const QString &) destFile ); | 1289 | fileDlg->setInputText((const QString &) destFile ); |
1289 | fileDlg->exec(); | 1290 | fileDlg->exec(); |
1290 | 1291 | ||
1291 | if( fileDlg->result() == 1 ) { | 1292 | if( fileDlg->result() == 1 ) { |
1292 | 1293 | ||
1293 | QString filename = fileDlg->LineEdit1->text(); | 1294 | QString filename = fileDlg->LineEdit1->text(); |
1294 | destFile = currentDir.canonicalPath()+"/"+filename; | 1295 | destFile = currentDir.canonicalPath()+"/"+filename; |
1295 | 1296 | ||
1296 | QFile f(destFile); | 1297 | QFile f(destFile); |
1297 | if( f.exists()) { | 1298 | if( f.exists()) { |
1298 | switch (QMessageBox::warning(this,tr("Delete"), | 1299 | switch (QMessageBox::warning(this,tr("Delete"), |
1299 | destFile+tr(" already exists\nDo you really want to delete it?"), | 1300 | destFile+tr(" already exists\nDo you really want to delete it?"), |
1300 | tr("Yes"),tr("No"),0,0,1) ) { | 1301 | tr("Yes"),tr("No"),0,0,1) ) { |
1301 | case 0: | 1302 | case 0: |
1302 | qDebug(""); | 1303 | |
1303 | f.remove(); | 1304 | f.remove(); |
1304 | break; | 1305 | break; |
1305 | case 1: | 1306 | case 1: |
1306 | return; | 1307 | return; |
1307 | break; | 1308 | break; |
1308 | }; | 1309 | }; |
1309 | } | 1310 | } |
1310 | if(!copyFile(destFile, curFile) ) { | 1311 | if(!copyFile(destFile, curFile) ) { |
1311 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); | 1312 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); |
1312 | qWarning("nothin doing"); | 1313 | qWarning("nothin doing"); |
1313 | } | 1314 | } |
1314 | 1315 | ||
1315 | qDebug("copy "+curFile+" as "+destFile); | 1316 | qDebug("copy "+curFile+" as "+destFile); |
1316 | } | 1317 | } |
1317 | delete fileDlg; | 1318 | delete fileDlg; |
1318 | } | 1319 | } |
1319 | populateLocalView(); | 1320 | populateLocalView(); |
1320 | 1321 | ||
1321 | } else { | 1322 | } else { |
1322 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1323 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1323 | 1324 | ||
1324 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1325 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1325 | 1326 | ||
1326 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | 1327 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); |
1327 | QString destFile; | 1328 | QString destFile; |
1328 | fileDlg->setInputText((const QString &) destFile); | 1329 | fileDlg->setInputText((const QString &) destFile); |
1329 | fileDlg->exec(); | 1330 | fileDlg->exec(); |
1330 | if( fileDlg->result() == 1 ) { | 1331 | if( fileDlg->result() == 1 ) { |
1331 | QString filename = fileDlg->LineEdit1->text(); | 1332 | QString filename = fileDlg->LineEdit1->text(); |
1332 | 1333 | ||
1333 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; | 1334 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; |
1334 | 1335 | ||
1335 | QFile f(destFile); | 1336 | QFile f(destFile); |
1336 | if( f.exists()) { | 1337 | if( f.exists()) { |
1337 | switch ( QMessageBox::warning(this,tr("Delete"), | 1338 | switch ( QMessageBox::warning(this,tr("Delete"), |
1338 | destFile+tr(" already exists\nDo you really want to delete it?"), | 1339 | destFile+tr(" already exists\nDo you really want to delete it?"), |
1339 | tr("Yes"),tr("No"),0,0,1) ) { | 1340 | tr("Yes"),tr("No"),0,0,1) ) { |
1340 | case 0: | 1341 | case 0: |
1341 | f.remove(); | 1342 | f.remove(); |
1342 | break; | 1343 | break; |
1343 | case 1: | 1344 | case 1: |
1344 | return; | 1345 | return; |
1345 | break; | 1346 | break; |
1346 | }; | 1347 | }; |
1347 | } | 1348 | } |
1348 | if(!copyFile(destFile, curFile) ) { | 1349 | if(!copyFile(destFile, curFile) ) { |
1349 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); | 1350 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); |
1350 | qWarning("nothin doing"); | 1351 | qWarning("nothin doing"); |
1351 | } | 1352 | } |
1352 | qDebug("copy "+curFile+" as "+destFile); | 1353 | qDebug("copy "+curFile+" as "+destFile); |
1353 | } | 1354 | } |
1354 | delete fileDlg; | 1355 | delete fileDlg; |
1355 | } | 1356 | } |
1356 | populateRemoteView(); | 1357 | populateRemoteView(); |
1357 | } | 1358 | } |
1358 | } | 1359 | } |
1359 | 1360 | ||
1360 | void AdvancedFm::move() { | 1361 | void AdvancedFm::move() { |
1361 | qApp->processEvents(); | 1362 | qApp->processEvents(); |
1362 | 1363 | ||
1363 | QStringList curFileList = getPath(); | 1364 | QStringList curFileList = getPath(); |
1364 | if( curFileList.count() > 0) { | 1365 | if( curFileList.count() > 0) { |
1365 | QString curFile; | 1366 | QString curFile; |
1366 | QString destFile; | 1367 | QString destFile; |
1367 | 1368 | ||
1368 | if (TabWidget->currentPageIndex() == 0) { | 1369 | if (TabWidget->currentPageIndex() == 0) { |
1369 | 1370 | ||
1370 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1371 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1371 | 1372 | ||
1372 | QString destFile = currentRemoteDir.canonicalPath(); | 1373 | QString destFile = currentRemoteDir.canonicalPath(); |
1373 | 1374 | ||
1374 | if(destFile.right(1).find("/",0,TRUE) == -1) | 1375 | if(destFile.right(1).find("/",0,TRUE) == -1) |
1375 | destFile+="/"; | 1376 | destFile+="/"; |
1376 | destFile +=(*it); | 1377 | destFile +=(*it); |
1377 | curFile = currentDir.canonicalPath(); | 1378 | curFile = currentDir.canonicalPath(); |
1378 | 1379 | ||
1379 | qDebug("Destination file is "+destFile); | 1380 | qDebug("Destination file is "+destFile); |
1380 | 1381 | ||
1381 | if(curFile.right(1).find("/",0,TRUE) == -1) | 1382 | if(curFile.right(1).find("/",0,TRUE) == -1) |
1382 | curFile +="/"; | 1383 | curFile +="/"; |
1383 | 1384 | ||
1384 | curFile+=(*it); | 1385 | curFile+=(*it); |
1385 | qDebug("CurrentFile file is " + curFile); | 1386 | qDebug("CurrentFile file is " + curFile); |
1386 | 1387 | ||
1387 | QFile f( curFile); | 1388 | QFile f( curFile); |
1388 | if( f.exists()) { | 1389 | if( f.exists()) { |
1389 | if(!copyFile( destFile, curFile) ) { | 1390 | if(!copyFile( destFile, curFile) ) { |
1390 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); | 1391 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); |
1391 | return; | 1392 | return; |
1392 | } else | 1393 | } else |
1393 | QFile::remove(curFile); | 1394 | QFile::remove(curFile); |
1394 | } | 1395 | } |
1395 | } | 1396 | } |
1396 | 1397 | ||
1397 | TabWidget->setCurrentPage(1); | 1398 | TabWidget->setCurrentPage(1); |
1398 | 1399 | ||
1399 | } else { //view 2 | 1400 | } else { //view 2 |
1400 | 1401 | ||
1401 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1402 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1402 | 1403 | ||
1403 | QString destFile = currentDir.canonicalPath(); | 1404 | QString destFile = currentDir.canonicalPath(); |
1404 | 1405 | ||
1405 | if(destFile.right(1).find("/",0,TRUE) == -1) | 1406 | if(destFile.right(1).find("/",0,TRUE) == -1) |
1406 | destFile+="/"; | 1407 | destFile+="/"; |
1407 | 1408 | ||
1408 | destFile +=(*it); | 1409 | destFile +=(*it); |
1409 | 1410 | ||
1410 | qDebug("Destination file is "+destFile); | 1411 | qDebug("Destination file is "+destFile); |
1411 | 1412 | ||
1412 | curFile = currentRemoteDir.canonicalPath(); | 1413 | curFile = currentRemoteDir.canonicalPath(); |
1413 | 1414 | ||
1414 | if(curFile.right(1).find("/",0,TRUE) == -1) | 1415 | if(curFile.right(1).find("/",0,TRUE) == -1) |
1415 | curFile +="/"; | 1416 | curFile +="/"; |
1416 | curFile+=(*it); | 1417 | curFile+=(*it); |
1417 | qDebug("CurrentFile file is " + curFile); | 1418 | qDebug("CurrentFile file is " + curFile); |
1418 | 1419 | ||
1419 | QFile f( curFile); | 1420 | QFile f( curFile); |
1420 | if( f.exists()) { | 1421 | if( f.exists()) { |
1421 | if(!copyFile( destFile, curFile) ) { | 1422 | if(!copyFile( destFile, curFile) ) { |
1422 | QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile); | 1423 | QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile); |
1423 | return; | 1424 | return; |
1424 | } else | 1425 | } else |
1425 | QFile::remove( curFile); | 1426 | QFile::remove( curFile); |
1426 | } | 1427 | } |
1427 | TabWidget->setCurrentPage(0); | 1428 | TabWidget->setCurrentPage(0); |
1428 | } | 1429 | } |
1429 | } | 1430 | } |
1430 | populateRemoteView(); | 1431 | populateRemoteView(); |
1431 | populateLocalView(); | 1432 | populateLocalView(); |
1432 | } | 1433 | } |
1433 | } | 1434 | } |
1434 | 1435 | ||
1435 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) { | 1436 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) { |
1436 | char bf[ 50000 ]; | 1437 | char bf[ 50000 ]; |
1437 | int bytesRead; | 1438 | int bytesRead; |
1438 | bool success = TRUE; | 1439 | bool success = TRUE; |
1439 | struct stat status; | 1440 | struct stat status; |
1440 | 1441 | ||
1441 | QFile s( src ); | 1442 | QFile s( src ); |
1442 | QFile d( dest ); | 1443 | QFile d( dest ); |
1443 | 1444 | ||
1444 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { | 1445 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { |
1445 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { | 1446 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { |
1446 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ | 1447 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ |
1447 | success = FALSE; | 1448 | success = FALSE; |
1448 | break; | 1449 | break; |
1449 | } | 1450 | } |
1450 | } | 1451 | } |
1451 | if( success && (bytesRead > 0) ){ | 1452 | if( success && (bytesRead > 0) ){ |
1452 | d.writeBlock( bf, bytesRead ); | 1453 | d.writeBlock( bf, bytesRead ); |
1453 | } | 1454 | } |
1454 | } else { | 1455 | } else { |
1455 | success = FALSE; | 1456 | success = FALSE; |
1456 | } | 1457 | } |
1457 | 1458 | ||
1458 | // Set file permissions | 1459 | // Set file permissions |
1459 | if( stat( (const char *) src, &status ) == 0 ){ | 1460 | if( stat( (const char *) src, &status ) == 0 ){ |
1460 | chmod( (const char *) dest, status.st_mode ); | 1461 | chmod( (const char *) dest, status.st_mode ); |
1461 | } | 1462 | } |
1462 | 1463 | ||
1463 | return success; | 1464 | return success; |
1464 | } | 1465 | } |
1465 | 1466 | ||
1466 | void AdvancedFm::runCommand() { | 1467 | void AdvancedFm::runCommand() { |
1467 | QString curFile; | 1468 | QString curFile; |
1468 | if (TabWidget->currentPageIndex() == 0) { | 1469 | if (TabWidget->currentPageIndex() == 0) { |
1469 | if( Local_View->currentItem()) | 1470 | if( Local_View->currentItem()) |
1470 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); | 1471 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); |
1471 | } else { | 1472 | } else { |
1472 | if(Remote_View->currentItem()) | 1473 | if(Remote_View->currentItem()) |
1473 | curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); | 1474 | curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); |
1474 | } | 1475 | } |
1475 | 1476 | ||
1476 | InputDialog *fileDlg; | 1477 | InputDialog *fileDlg; |
1477 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 1478 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
1478 | fileDlg->setInputText(curFile); | 1479 | fileDlg->setInputText(curFile); |
1479 | fileDlg->exec(); | 1480 | fileDlg->exec(); |
1480 | QString command; | 1481 | QString command; |
1481 | if( fileDlg->result() == 1 ) { | 1482 | if( fileDlg->result() == 1 ) { |
1482 | command = fileDlg->LineEdit1->text(); | 1483 | command = fileDlg->LineEdit1->text(); |
1483 | 1484 | ||
1484 | Output *outDlg; | 1485 | Output *outDlg; |
1485 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1486 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1486 | outDlg->showMaximized(); | 1487 | outDlg->showMaximized(); |
1487 | outDlg->show(); | 1488 | outDlg->show(); |
1488 | qApp->processEvents(); | 1489 | qApp->processEvents(); |
1489 | FILE *fp; | 1490 | FILE *fp; |
1490 | char line[130]; | 1491 | char line[130]; |
1491 | sleep(1); | 1492 | sleep(1); |
1492 | command +=" 2>&1"; | 1493 | command +=" 2>&1"; |
1493 | fp = popen( (const char *) command, "r"); | 1494 | fp = popen( (const char *) command, "r"); |
1494 | if ( !fp ) { | 1495 | if ( !fp ) { |
1495 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 1496 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
1496 | QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); | 1497 | QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); |
1497 | pclose(fp); | 1498 | pclose(fp); |
1498 | return; | 1499 | return; |
1499 | } else { | 1500 | } else { |
1500 | while ( fgets( line, sizeof line, fp)) { | 1501 | while ( fgets( line, sizeof line, fp)) { |
1501 | QString lineStr = line; | 1502 | QString lineStr = line; |
1502 | lineStr=lineStr.left(lineStr.length()-1); | 1503 | lineStr=lineStr.left(lineStr.length()-1); |
1503 | outDlg->OutputEdit->append(lineStr); | 1504 | outDlg->OutputEdit->append(lineStr); |
1504 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 1505 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
1505 | } | 1506 | } |
1506 | } | 1507 | } |
1507 | pclose(fp); | 1508 | pclose(fp); |
1508 | 1509 | ||
1509 | } | 1510 | } |
1510 | } | 1511 | } |
1511 | 1512 | ||
1512 | void AdvancedFm::runCommandStd() { | 1513 | void AdvancedFm::runCommandStd() { |
1513 | QString curFile; | 1514 | QString curFile; |
1514 | if (TabWidget->currentPageIndex() == 0) { | 1515 | if (TabWidget->currentPageIndex() == 0) { |
1515 | if( Local_View->currentItem()) | 1516 | if( Local_View->currentItem()) |
1516 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); | 1517 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); |
1517 | } else { | 1518 | } else { |
1518 | if(Remote_View->currentItem()) | 1519 | if(Remote_View->currentItem()) |
1519 | curFile = currentRemoteDir.canonicalPath() +"/"+ Remote_View->currentItem()->text(0); | 1520 | curFile = currentRemoteDir.canonicalPath() +"/"+ Remote_View->currentItem()->text(0); |
1520 | } | 1521 | } |
1521 | 1522 | ||
1522 | InputDialog *fileDlg; | 1523 | InputDialog *fileDlg; |
1523 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 1524 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
1524 | fileDlg->setInputText(curFile); | 1525 | fileDlg->setInputText(curFile); |
1525 | fileDlg->exec(); | 1526 | fileDlg->exec(); |
1526 | QString command; | 1527 | QString command; |
1527 | if( fileDlg->result() == 1 ) { | 1528 | if( fileDlg->result() == 1 ) { |
1528 | qApp->processEvents(); | 1529 | qApp->processEvents(); |
1529 | command = fileDlg->LineEdit1->text() + " &"; | 1530 | command = fileDlg->LineEdit1->text() + " &"; |
1530 | system(command.latin1()); | 1531 | system(command.latin1()); |
1531 | } | 1532 | } |
1532 | } | 1533 | } |
1533 | 1534 | ||
1534 | void AdvancedFm::fileStatus() { | 1535 | void AdvancedFm::fileStatus() { |
1535 | QString curFile; | 1536 | QString curFile; |
1536 | if (TabWidget->currentPageIndex() == 0) { | 1537 | if (TabWidget->currentPageIndex() == 0) { |
1537 | curFile = Local_View->currentItem()->text(0); | 1538 | curFile = Local_View->currentItem()->text(0); |
1538 | } else { | 1539 | } else { |
1539 | curFile = Remote_View->currentItem()->text(0); | 1540 | curFile = Remote_View->currentItem()->text(0); |
1540 | } | 1541 | } |
1541 | QString command = " stat -l "+ curFile +" 2>&1"; | 1542 | QString command = " stat -l "+ curFile +" 2>&1"; |
1542 | Output *outDlg; | 1543 | Output *outDlg; |
1543 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1544 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1544 | outDlg->showMaximized(); | 1545 | outDlg->showMaximized(); |
1545 | outDlg->show(); | 1546 | outDlg->show(); |
1546 | qApp->processEvents(); | 1547 | qApp->processEvents(); |
1547 | FILE *fp; | 1548 | FILE *fp; |
1548 | char line[130]; | 1549 | char line[130]; |
1549 | sleep(1); | 1550 | sleep(1); |
1550 | fp = popen( (const char *) command, "r"); | 1551 | fp = popen( (const char *) command, "r"); |
1551 | if ( !fp ) { | 1552 | if ( !fp ) { |
1552 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 1553 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
1553 | QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); | 1554 | QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); |
1554 | pclose(fp); | 1555 | pclose(fp); |
1555 | return; | 1556 | return; |
1556 | } else { | 1557 | } else { |
1557 | while ( fgets( line, sizeof line, fp)) { | 1558 | while ( fgets( line, sizeof line, fp)) { |
1558 | outDlg->OutputEdit->append(line); | 1559 | outDlg->OutputEdit->append(line); |
1559 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 1560 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
1560 | 1561 | ||
1561 | } | 1562 | } |
1562 | 1563 | ||
1563 | } | 1564 | } |
1564 | pclose(fp); | 1565 | pclose(fp); |
1565 | } | 1566 | } |
1566 | 1567 | ||
1567 | void AdvancedFm::mkDir() { | 1568 | void AdvancedFm::mkDir() { |
1568 | if (TabWidget->currentPageIndex() == 0) | 1569 | if (TabWidget->currentPageIndex() == 0) |
1569 | localMakDir(); | 1570 | localMakDir(); |
1570 | else | 1571 | else |
1571 | remoteMakDir(); | 1572 | remoteMakDir(); |
1572 | 1573 | ||
1573 | } | 1574 | } |
1574 | 1575 | ||
1575 | void AdvancedFm::rn() { | 1576 | void AdvancedFm::rn() { |
1576 | if (TabWidget->currentPageIndex() == 0) | 1577 | if (TabWidget->currentPageIndex() == 0) |
1577 | localRename(); | 1578 | localRename(); |
1578 | else | 1579 | else |
1579 | remoteRename(); | 1580 | remoteRename(); |
1580 | 1581 | ||
1581 | } | 1582 | } |
1582 | 1583 | ||
1583 | void AdvancedFm::del() { | 1584 | void AdvancedFm::del() { |
1584 | if (TabWidget->currentPageIndex() == 0) | 1585 | if (TabWidget->currentPageIndex() == 0) |
1585 | localDelete(); | 1586 | localDelete(); |
1586 | else | 1587 | else |
1587 | remoteDelete(); | 1588 | remoteDelete(); |
1588 | } | 1589 | } |
1589 | 1590 | ||
1590 | void AdvancedFm::doAbout() { | 1591 | void AdvancedFm::doAbout() { |
1591 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" | 1592 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" |
1592 | "is copyright 2002 by\n" | 1593 | "is copyright 2002 by\n" |
1593 | "L.J.Potter<llornkcor@handhelds.org>\n" | 1594 | "L.J.Potter<llornkcor@handhelds.org>\n" |
1594 | "and is licensed by the GPL")); | 1595 | "and is licensed by the GPL")); |
1595 | } | 1596 | } |
1596 | 1597 | ||
1597 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) | 1598 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) |
1598 | { | 1599 | { |
1599 | if( TabWidget->hasFocus()) | 1600 | if( TabWidget->hasFocus()) |
1600 | switch ( e->key() ) { | 1601 | switch ( e->key() ) { |
1601 | case Key_Delete: | 1602 | case Key_Delete: |
1602 | del(); | 1603 | del(); |
1603 | break; | 1604 | break; |
1604 | case Key_H: | 1605 | case Key_H: |
1605 | showHidden(); | 1606 | showHidden(); |
1606 | break; | 1607 | break; |
1607 | case Key_E: | 1608 | case Key_E: |
1608 | runThis(); | 1609 | runThis(); |
1609 | break; | 1610 | break; |
1610 | case Key_C: | 1611 | case Key_C: |
1611 | copy(); | 1612 | copy(); |
1612 | break; | 1613 | break; |
1613 | case Key_A: | 1614 | case Key_A: |
1614 | copyAs(); | 1615 | copyAs(); |
1615 | break; | 1616 | break; |
1616 | case Key_M: | 1617 | case Key_M: |
1617 | move(); | 1618 | move(); |
1618 | break; | 1619 | break; |
1619 | case Key_R: | 1620 | case Key_R: |
1620 | rn(); | 1621 | rn(); |
1621 | break; | 1622 | break; |
1622 | case Key_I: | 1623 | case Key_I: |
1623 | fileStatus(); | 1624 | fileStatus(); |
1624 | break; | 1625 | break; |
1625 | case Key_U: | 1626 | case Key_U: |
1626 | upDir(); | 1627 | upDir(); |
1627 | break; | 1628 | break; |
1628 | case Key_P: | 1629 | case Key_P: |
1629 | filePerms(); | 1630 | filePerms(); |
1630 | break; | 1631 | break; |
1631 | case Key_N: | 1632 | case Key_N: |
1632 | mkDir(); | 1633 | mkDir(); |
1633 | break; | 1634 | break; |
1634 | case Key_1: | 1635 | case Key_1: |
1635 | switchToLocalTab(); | 1636 | switchToLocalTab(); |
1636 | break; | 1637 | break; |
1637 | case Key_2: | 1638 | case Key_2: |
1638 | switchToRemoteTab(); | 1639 | switchToRemoteTab(); |
1639 | break; | 1640 | break; |
1640 | case Key_3: | 1641 | case Key_3: |
1641 | CFButtonPushed(); | 1642 | CFButtonPushed(); |
1642 | break; | 1643 | break; |
1643 | case Key_4: | 1644 | case Key_4: |
1644 | SDButtonPushed(); | 1645 | SDButtonPushed(); |
1645 | break; | 1646 | break; |
1646 | case Key_5: | 1647 | case Key_5: |
1647 | homeButtonPushed(); | 1648 | homeButtonPushed(); |
1648 | break; | 1649 | break; |
1649 | case Key_6: | 1650 | case Key_6: |
1650 | docButtonPushed(); | 1651 | docButtonPushed(); |
1651 | break; | 1652 | break; |
1652 | case Key_7: | 1653 | case Key_7: |
1653 | break; | 1654 | break; |
1654 | case Key_8: | 1655 | case Key_8: |
1655 | break; | 1656 | break; |
1656 | case Key_9: | 1657 | case Key_9: |
1657 | break; | 1658 | break; |
1658 | case Key_0: | 1659 | case Key_0: |
1659 | break; | 1660 | break; |
1660 | } | 1661 | } |
1661 | } | 1662 | } |
1662 | 1663 | ||
1663 | void AdvancedFm::mkSym() { | 1664 | void AdvancedFm::mkSym() { |
1664 | QString cmd; | 1665 | QString cmd; |
1665 | QStringList curFileList = getPath(); | 1666 | QStringList curFileList = getPath(); |
1666 | if( curFileList.count() > 0) { | 1667 | if( curFileList.count() > 0) { |
1667 | 1668 | ||
1668 | if (TabWidget->currentPageIndex() == 0) { | 1669 | if (TabWidget->currentPageIndex() == 0) { |
1669 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1670 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1670 | 1671 | ||
1671 | QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); | 1672 | QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); |
1672 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); | 1673 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); |
1673 | QString curFile = currentDir.canonicalPath()+"/"+(*it); | 1674 | QString curFile = currentDir.canonicalPath()+"/"+(*it); |
1674 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1675 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1675 | cmd = "ln -s "+curFile+" "+destName; | 1676 | cmd = "ln -s "+curFile+" "+destName; |
1676 | qDebug(cmd); | 1677 | qDebug(cmd); |
1677 | system(cmd.latin1() ); | 1678 | system(cmd.latin1() ); |
1678 | } | 1679 | } |
1679 | populateRemoteView(); | 1680 | populateRemoteView(); |
1680 | TabWidget->setCurrentPage(1); | 1681 | TabWidget->setCurrentPage(1); |
1681 | } else { | 1682 | } else { |
1682 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1683 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1683 | 1684 | ||
1684 | QString destName = currentDir.canonicalPath()+"/"+(*it); | 1685 | QString destName = currentDir.canonicalPath()+"/"+(*it); |
1685 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); | 1686 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); |
1686 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1687 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1687 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1688 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1688 | 1689 | ||
1689 | cmd = "ln -s "+curFile+" "+destName; | 1690 | cmd = "ln -s "+curFile+" "+destName; |
1690 | qDebug(cmd); | 1691 | qDebug(cmd); |
1691 | system(cmd.latin1() ); | 1692 | system(cmd.latin1() ); |
1692 | } | 1693 | } |
1693 | populateLocalView(); | 1694 | populateLocalView(); |
1694 | TabWidget->setCurrentPage(0); | 1695 | TabWidget->setCurrentPage(0); |
1695 | } | 1696 | } |
1696 | } | 1697 | } |
1697 | } | 1698 | } |
1698 | 1699 | ||
1699 | void AdvancedFm::QPEButtonPushed() { | 1700 | void AdvancedFm::QPEButtonPushed() { |
1700 | QString current = QPEApplication::qpeDir(); | 1701 | QString current = QPEApplication::qpeDir(); |
1701 | chdir( current.latin1() ); | 1702 | chdir( current.latin1() ); |
1702 | if (TabWidget->currentPageIndex() == 0) { | 1703 | if (TabWidget->currentPageIndex() == 0) { |
1703 | currentDir.cd( current, TRUE); | 1704 | currentDir.cd( current, TRUE); |
1704 | populateLocalView(); | 1705 | populateLocalView(); |
1705 | } else { | 1706 | } else { |
1706 | currentRemoteDir.cd( current, TRUE); | 1707 | currentRemoteDir.cd( current, TRUE); |
1707 | populateRemoteView(); | 1708 | populateRemoteView(); |
1708 | } | 1709 | } |
1709 | update(); | 1710 | update(); |
1710 | } | 1711 | } |
1711 | 1712 | ||
1712 | void AdvancedFm::parsetab(const QString &fileName) { | 1713 | void AdvancedFm::parsetab(const QString &fileName) { |
1713 | 1714 | ||
1714 | fileSystemTypeList.clear(); | 1715 | fileSystemTypeList.clear(); |
1715 | fsList.clear(); | 1716 | fsList.clear(); |
1716 | struct mntent *me; | 1717 | struct mntent *me; |
1717 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); | 1718 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); |
1718 | if ( mntfp ) { | 1719 | if ( mntfp ) { |
1719 | while ( (me = getmntent( mntfp )) != 0 ) { | 1720 | while ( (me = getmntent( mntfp )) != 0 ) { |
1720 | QString deviceName = me->mnt_fsname; | 1721 | QString deviceName = me->mnt_fsname; |
1721 | QString filesystemType = me->mnt_type; | 1722 | QString filesystemType = me->mnt_type; |
1722 | QString mountDir = me->mnt_dir; | 1723 | QString mountDir = me->mnt_dir; |
1723 | if(deviceName != "none") { | 1724 | if(deviceName != "none") { |
1724 | if( fsList.contains(filesystemType) == 0 | 1725 | if( fsList.contains(filesystemType) == 0 |
1725 | & filesystemType.find("proc",0,TRUE) == -1 | 1726 | & filesystemType.find("proc",0,TRUE) == -1 |
1726 | & filesystemType.find("cramfs",0,TRUE) == -1 | 1727 | & filesystemType.find("cramfs",0,TRUE) == -1 |
1727 | & filesystemType.find("auto",0,TRUE) == -1) | 1728 | & filesystemType.find("auto",0,TRUE) == -1) |
1728 | fsList << filesystemType; | 1729 | fsList << filesystemType; |
1729 | fileSystemTypeList << mountDir+"::"+filesystemType; | 1730 | fileSystemTypeList << mountDir+"::"+filesystemType; |
1730 | } | 1731 | } |
1731 | } | 1732 | } |
1732 | } | 1733 | } |
1733 | endmntent( mntfp ); | 1734 | endmntent( mntfp ); |
1734 | } | 1735 | } |
1735 | 1736 | ||
1736 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { | 1737 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { |
1737 | parsetab("/etc/mtab"); //why did TT forget filesystem type? | 1738 | parsetab("/etc/mtab"); //why did TT forget filesystem type? |
1738 | QString current = currentText;//.right( currentText.length()-1); | 1739 | QString current = currentText;//.right( currentText.length()-1); |
1739 | QString baseFs; | 1740 | QString baseFs; |
1740 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { | 1741 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { |
1741 | QString temp = (*it); | 1742 | QString temp = (*it); |
1742 | QString path = temp.left(temp.find("::",0,TRUE) ); | 1743 | QString path = temp.left(temp.find("::",0,TRUE) ); |
1743 | path = path.right( path.length()-1); | 1744 | path = path.right( path.length()-1); |
1744 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 1745 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
1745 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { | 1746 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { |
1746 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 1747 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
1747 | } | 1748 | } |
1748 | } | 1749 | } |
1749 | return baseFs; | 1750 | return baseFs; |
1750 | } | 1751 | } |
1751 | 1752 | ||
1752 | QString AdvancedFm::getDiskSpace( const QString &path) { | 1753 | QString AdvancedFm::getDiskSpace( const QString &path) { |
1753 | struct statfs fss; | 1754 | struct statfs fss; |
1754 | if ( !statfs( path.latin1(), &fss ) ) { | 1755 | if ( !statfs( path.latin1(), &fss ) ) { |
1755 | int blkSize = fss.f_bsize; | 1756 | int blkSize = fss.f_bsize; |
1756 | // int totalBlks = fs.f_blocks; | 1757 | // int totalBlks = fs.f_blocks; |
1757 | int availBlks = fss.f_bavail; | 1758 | int availBlks = fss.f_bavail; |
1758 | 1759 | ||
1759 | long mult = blkSize / 1024; | 1760 | long mult = blkSize / 1024; |
1760 | long div = 1024 / blkSize; | 1761 | long div = 1024 / blkSize; |
1761 | if ( !mult ) mult = 1; | 1762 | if ( !mult ) mult = 1; |
1762 | if ( !div ) div = 1; | 1763 | if ( !div ) div = 1; |
1763 | 1764 | ||
1764 | return QString::number(availBlks * mult / div); | 1765 | return QString::number(availBlks * mult / div); |
1765 | } | 1766 | } |
1766 | return ""; | 1767 | return ""; |
1767 | } | 1768 | } |
1768 | 1769 | ||
1769 | void AdvancedFm::doBeam() { | 1770 | void AdvancedFm::doBeam() { |
1770 | Ir ir; | 1771 | Ir ir; |
1771 | if(!ir.supported()){ | 1772 | if(!ir.supported()){ |
1772 | } else { | 1773 | } else { |
1773 | 1774 | ||
1774 | QStringList curFileList = getPath(); | 1775 | QStringList curFileList = getPath(); |
1775 | if( curFileList.count() > 0) { | 1776 | if( curFileList.count() > 0) { |
1776 | 1777 | ||
1777 | if (TabWidget->currentPageIndex() == 0) { | 1778 | if (TabWidget->currentPageIndex() == 0) { |
1778 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1779 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1779 | 1780 | ||
1780 | QString curFile = currentDir.canonicalPath()+"/"+(*it); | 1781 | QString curFile = currentDir.canonicalPath()+"/"+(*it); |
1781 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1782 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1782 | Ir *file = new Ir(this, "IR"); | 1783 | Ir *file = new Ir(this, "IR"); |
1783 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 1784 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); |
1784 | file->send( curFile, curFile ); | 1785 | file->send( curFile, curFile ); |
1785 | } | 1786 | } |
1786 | 1787 | ||
1787 | } else { | 1788 | } else { |
1788 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1789 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1789 | 1790 | ||
1790 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1791 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1791 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1792 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1792 | Ir *file = new Ir(this, "IR"); | 1793 | Ir *file = new Ir(this, "IR"); |
1793 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 1794 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); |
1794 | file->send( curFile, curFile ); | 1795 | file->send( curFile, curFile ); |
1795 | 1796 | ||
1796 | } | 1797 | } |
1797 | } | 1798 | } |
1798 | } | 1799 | } |
1799 | } | 1800 | } |
1800 | 1801 | ||
1801 | } | 1802 | } |
1802 | 1803 | ||
1803 | void AdvancedFm::fileBeamFinished( Ir *ir) { | 1804 | void AdvancedFm::fileBeamFinished( Ir *) { |
1804 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); | 1805 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); |
1805 | 1806 | ||
1806 | } | 1807 | } |
1807 | 1808 | ||
1808 | void AdvancedFm::showFileMenu() { | 1809 | void AdvancedFm::showFileMenu() { |
1809 | 1810 | ||
1810 | QString curApp; | 1811 | QString curApp; |
1811 | bool isLocalView = false; | 1812 | bool isLocalView = false; |
1812 | if (TabWidget->currentPageIndex() == 0) { | 1813 | if (TabWidget->currentPageIndex() == 0) { |
1813 | isLocalView = TRUE; | 1814 | isLocalView = TRUE; |
1814 | curApp = Local_View->currentItem()->text(0); | 1815 | curApp = Local_View->currentItem()->text(0); |
1815 | } else { | 1816 | } else { |
1816 | curApp = Remote_View->currentItem()->text(0); | 1817 | curApp = Remote_View->currentItem()->text(0); |
1817 | } | 1818 | } |
1818 | 1819 | ||
1819 | MimeType mt( curApp ); | 1820 | MimeType mt( curApp ); |
1820 | const AppLnk* app = mt.application(); | 1821 | const AppLnk* app = mt.application(); |
1821 | QFile fi(curApp); | 1822 | QFile fi(curApp); |
1822 | 1823 | ||
1823 | QPopupMenu *m = new QPopupMenu(0); | 1824 | QPopupMenu *m = new QPopupMenu(0); |
1824 | 1825 | ||
1825 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 1826 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
1826 | m->insertSeparator(); | 1827 | m->insertSeparator(); |
1827 | if ( QFileInfo(fi).isDir() ) { | 1828 | if ( QFileInfo(fi).isDir() ) { |
1828 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 1829 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
1829 | } else { | 1830 | } else { |
1830 | 1831 | ||
1831 | if ( app ) | 1832 | if ( app ) |
1832 | m->insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( runThis() ) ); | 1833 | m->insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( runThis() ) ); |
1833 | else if( QFileInfo(fi).isExecutable() ) | 1834 | else if( QFileInfo(fi).isExecutable() ) |
1834 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); | 1835 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); |
1835 | 1836 | ||
1836 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); | 1837 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); |
1837 | } | 1838 | } |
1838 | m->insertSeparator(); | 1839 | m->insertSeparator(); |
1839 | 1840 | ||
1840 | 1841 | ||
1841 | if(isLocalView) | 1842 | if(isLocalView) |
1842 | m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 1843 | m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
1843 | else | 1844 | else |
1844 | m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 1845 | m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
1845 | 1846 | ||
1846 | m->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 1847 | m->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
1847 | m->insertSeparator(); | 1848 | m->insertSeparator(); |
1848 | 1849 | ||
1849 | if(isLocalView) | 1850 | if(isLocalView) |
1850 | m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 1851 | m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
1851 | else | 1852 | else |
1852 | m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 1853 | m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
1853 | 1854 | ||
1854 | m->insertItem( tr( "Copy" ), this, SLOT( copy() )); | 1855 | m->insertItem( tr( "Copy" ), this, SLOT( copy() )); |
1855 | m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 1856 | m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
1856 | m->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); | 1857 | m->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); |
1857 | m->insertItem( tr( "Move" ), this, SLOT( move() )); | 1858 | m->insertItem( tr( "Move" ), this, SLOT( move() )); |
1858 | m->insertSeparator(); | 1859 | m->insertSeparator(); |
1860 | m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | ||
1859 | 1861 | ||
1860 | if(isLocalView) | 1862 | // if(isLocalView) |
1861 | m->insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); | 1863 | // m->insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); |
1862 | else | 1864 | // else |
1863 | m->insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); | 1865 | // m->insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); |
1864 | 1866 | ||
1865 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 1867 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
1866 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 1868 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
1867 | m->insertSeparator(); | 1869 | m->insertSeparator(); |
1868 | 1870 | ||
1869 | if(isLocalView) | 1871 | if(isLocalView) |
1870 | m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 1872 | m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
1871 | else | 1873 | else |
1872 | m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 1874 | m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
1873 | 1875 | ||
1874 | m->insertSeparator(); | 1876 | m->insertSeparator(); |
1875 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 1877 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
1876 | 1878 | ||
1877 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings | 1879 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings |
1878 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 1880 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
1879 | m->setCheckable(TRUE); | 1881 | m->setCheckable(TRUE); |
1880 | if (!b) | 1882 | if (!b) |
1881 | m->setItemChecked(m->idAt(0),TRUE); | 1883 | m->setItemChecked(m->idAt(0),TRUE); |
1882 | else | 1884 | else |
1883 | m->setItemChecked(m->idAt(0),FALSE); | 1885 | m->setItemChecked(m->idAt(0),FALSE); |
1886 | |||
1884 | if(Ir::supported()) | 1887 | if(Ir::supported()) |
1885 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); | 1888 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); |
1886 | m->setFocus(); | 1889 | m->setFocus(); |
1887 | m->exec( QCursor::pos() ); | 1890 | m->exec( QCursor::pos() ); |
1888 | sleep(1); | 1891 | sleep(1); |
1889 | if(m) delete m; | 1892 | if(m) delete m; |
1890 | } | 1893 | } |
1891 | 1894 | ||
1892 | 1895 | ||
1893 | void AdvancedFm::cancelMenuTimer() { | 1896 | void AdvancedFm::cancelMenuTimer() { |
1894 | 1897 | ||
1895 | qDebug("selectionChanged: cancel menu timer"); | 1898 | qDebug("selectionChanged: cancel menu timer"); |
1896 | if( menuTimer.isActive() ) | 1899 | if( menuTimer.isActive() ) |
1897 | menuTimer.stop(); | 1900 | menuTimer.stop(); |
1898 | } | 1901 | } |
1899 | 1902 | ||
1900 | QString AdvancedFm::checkDiskSpace(const QString &path) { | 1903 | QString AdvancedFm::checkDiskSpace(const QString &path) { |
1901 | struct statfs fss; | 1904 | struct statfs fss; |
1902 | if ( !statfs( path.latin1(), &fss ) ) { | 1905 | if ( !statfs( path.latin1(), &fss ) ) { |
1903 | int blkSize = fss.f_bsize; | 1906 | int blkSize = fss.f_bsize; |
1904 | // int totalBlks = fs.f_blocks; | 1907 | // int totalBlks = fs.f_blocks; |
1905 | int availBlks = fss.f_bavail; | 1908 | int availBlks = fss.f_bavail; |
1906 | 1909 | ||
1907 | long mult = blkSize / 1024; | 1910 | long mult = blkSize / 1024; |
1908 | long div = 1024 / blkSize; | 1911 | long div = 1024 / blkSize; |
1909 | if ( !mult ) mult = 1; | 1912 | if ( !mult ) mult = 1; |
1910 | if ( !div ) div = 1; | 1913 | if ( !div ) div = 1; |
1911 | 1914 | ||
1912 | 1915 | ||
1913 | return QString::number(availBlks * mult / div); | 1916 | return QString::number(availBlks * mult / div); |
1914 | } | 1917 | } |
1915 | return ""; | 1918 | return ""; |
1916 | } | 1919 | } |
1917 | 1920 | ||
1921 | void AdvancedFm::addToDocs() { | ||
1922 | QStringList strListPaths = getPath(); | ||
1923 | if( strListPaths.count() > 0) { | ||
1924 | QString curFile; | ||
1925 | if (TabWidget->currentPageIndex() == 0) { | ||
1926 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { | ||
1927 | curFile = currentDir.canonicalPath()+"/"+(*it); | ||
1928 | qDebug(curFile); | ||
1929 | DocLnk f; | ||
1930 | // curFile.replace(QRegExp("\\..*"),""); | ||
1931 | f.setName((*it)); | ||
1932 | f.setFile( curFile); | ||
1933 | f.writeLink(); | ||
1934 | } | ||
1935 | } else { | ||
1936 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { | ||
1937 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | ||
1938 | qDebug(curFile); | ||
1939 | |||
1940 | DocLnk f; | ||
1941 | // curFile.replace(QRegExp("\\..*"),""); | ||
1942 | f.setName((*it)); | ||
1943 | f.setFile( curFile); | ||
1944 | f.writeLink(); | ||
1945 | } | ||
1946 | } | ||
1947 | } | ||
1948 | } | ||
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 5b714ae..53dad50 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -1,144 +1,145 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | opieftp.h | 2 | opieftp.h |
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 | #ifndef ADVANCEDFM_H | 12 | #ifndef ADVANCEDFM_H |
13 | #define ADVANCEDFM_H | 13 | #define ADVANCEDFM_H |
14 | 14 | ||
15 | #include <qpe/ir.h> | 15 | #include <qpe/ir.h> |
16 | 16 | ||
17 | #include <qvariant.h> | 17 | #include <qvariant.h> |
18 | #include <qdialog.h> | 18 | #include <qdialog.h> |
19 | #include <qmainwindow.h> | 19 | #include <qmainwindow.h> |
20 | #include <qstringlist.h> | 20 | #include <qstringlist.h> |
21 | #include <qdir.h> | 21 | #include <qdir.h> |
22 | #include <qstring.h> | 22 | #include <qstring.h> |
23 | #include <qpoint.h> | 23 | #include <qpoint.h> |
24 | #include <qtimer.h> | 24 | #include <qtimer.h> |
25 | 25 | ||
26 | class QVBoxLayout; | 26 | class QVBoxLayout; |
27 | class QHBoxLayout; | 27 | class QHBoxLayout; |
28 | class QGridLayout; | 28 | class QGridLayout; |
29 | class QComboBox; | 29 | class QComboBox; |
30 | class QListView; | 30 | class QListView; |
31 | class QListviewItem; | 31 | class QListviewItem; |
32 | class QLabel; | 32 | class QLabel; |
33 | class QProgressBar; | 33 | class QProgressBar; |
34 | class QSpinBox; | 34 | class QSpinBox; |
35 | class QTabWidget; | 35 | class QTabWidget; |
36 | class QWidget; | 36 | class QWidget; |
37 | class QPEToolBar; | 37 | class QPEToolBar; |
38 | class QPEMenuBar; | 38 | class QPEMenuBar; |
39 | class QPopupMenu; | 39 | class QPopupMenu; |
40 | class QFile; | 40 | class QFile; |
41 | class QListViewItem; | 41 | class QListViewItem; |
42 | class QLineEdit; | 42 | class QLineEdit; |
43 | //class QPushButton; | 43 | //class QPushButton; |
44 | class QToolButton; | 44 | class QToolButton; |
45 | class Ir; | 45 | class Ir; |
46 | 46 | ||
47 | class AdvancedFm : public QMainWindow | 47 | class AdvancedFm : public QMainWindow |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | public: | 50 | public: |
51 | AdvancedFm(); | 51 | AdvancedFm(); |
52 | ~AdvancedFm(); | 52 | ~AdvancedFm(); |
53 | 53 | ||
54 | QTabWidget *TabWidget; | 54 | QTabWidget *TabWidget; |
55 | QWidget *tab, *tab_2, *tab_3; | 55 | QWidget *tab, *tab_2, *tab_3; |
56 | QListView *Local_View, *Remote_View; | 56 | QListView *Local_View, *Remote_View; |
57 | 57 | ||
58 | QLineEdit *currentPathEdit; | 58 | QLineEdit *currentPathEdit; |
59 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; | 59 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; |
60 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 60 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
61 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 61 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
62 | QDir currentDir, currentRemoteDir; | 62 | QDir currentDir, currentRemoteDir; |
63 | QComboBox *currentPathCombo; | 63 | QComboBox *currentPathCombo; |
64 | QString filterStr; | 64 | QString filterStr; |
65 | QListViewItem * item; | 65 | QListViewItem * item; |
66 | bool b; | 66 | bool b; |
67 | QStringList fileSystemTypeList, fsList; | 67 | QStringList fileSystemTypeList, fsList; |
68 | int currentServerConfig; | 68 | int currentServerConfig; |
69 | protected slots: | 69 | protected slots: |
70 | void addToDocs(); | ||
70 | void doLocalCd(); | 71 | void doLocalCd(); |
71 | void doRemoteCd(); | 72 | void doRemoteCd(); |
72 | // void copy(); | 73 | // void copy(); |
73 | void mkDir(); | 74 | void mkDir(); |
74 | void del(); | 75 | void del(); |
75 | void rn(); | 76 | void rn(); |
76 | void populateLocalView(); | 77 | void populateLocalView(); |
77 | void populateRemoteView(); | 78 | void populateRemoteView(); |
78 | void showHidden(); | 79 | void showHidden(); |
79 | void showRemoteHidden(); | 80 | void showRemoteHidden(); |
80 | void writeConfig(); | 81 | void writeConfig(); |
81 | void readConfig(); | 82 | void readConfig(); |
82 | void localListClicked(QListViewItem *); | 83 | void localListClicked(QListViewItem *); |
83 | void remoteListClicked(QListViewItem *); | 84 | void remoteListClicked(QListViewItem *); |
84 | void localListPressed( int, QListViewItem *, const QPoint&, int); | 85 | void localListPressed( int, QListViewItem *, const QPoint&, int); |
85 | void remoteListPressed( int, QListViewItem *, const QPoint&, int); | 86 | void remoteListPressed( int, QListViewItem *, const QPoint&, int); |
86 | void localMakDir(); | 87 | void localMakDir(); |
87 | void localDelete(); | 88 | void localDelete(); |
88 | void remoteMakDir(); | 89 | void remoteMakDir(); |
89 | void remoteDelete(); | 90 | void remoteDelete(); |
90 | /* bool remoteDirList(const QString &); */ | 91 | /* bool remoteDirList(const QString &); */ |
91 | /* bool remoteChDir(const QString &); */ | 92 | /* bool remoteChDir(const QString &); */ |
92 | void tabChanged(QWidget*); | 93 | void tabChanged(QWidget*); |
93 | void cleanUp(); | 94 | void cleanUp(); |
94 | void remoteRename(); | 95 | void remoteRename(); |
95 | void localRename(); | 96 | void localRename(); |
96 | void runThis(); | 97 | void runThis(); |
97 | void runText(); | 98 | void runText(); |
98 | void filePerms(); | 99 | void filePerms(); |
99 | void doProperties(); | 100 | void doProperties(); |
100 | void runCommand(); | 101 | void runCommand(); |
101 | void runCommandStd(); | 102 | void runCommandStd(); |
102 | QStringList getPath(); | 103 | QStringList getPath(); |
103 | void mkSym(); | 104 | void mkSym(); |
104 | void switchToLocalTab(); | 105 | void switchToLocalTab(); |
105 | void switchToRemoteTab(); | 106 | void switchToRemoteTab(); |
106 | 107 | ||
107 | protected: | 108 | protected: |
108 | bool zaurusDevice; | 109 | bool zaurusDevice; |
109 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 110 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
110 | QStringList remoteDirPathStringList, localDirPathStringList; | 111 | QStringList remoteDirPathStringList, localDirPathStringList; |
111 | 112 | ||
112 | void keyReleaseEvent( QKeyEvent *); | 113 | void keyReleaseEvent( QKeyEvent *); |
113 | QString getFileSystemType(const QString &); | 114 | QString getFileSystemType(const QString &); |
114 | QString getDiskSpace(const QString &); | 115 | QString getDiskSpace(const QString &); |
115 | 116 | ||
116 | void parsetab(const QString &fileName); | 117 | void parsetab(const QString &fileName); |
117 | QString checkDiskSpace(const QString &); | 118 | QString checkDiskSpace(const QString &); |
118 | protected slots: | 119 | protected slots: |
119 | void showFileMenu(); | 120 | void showFileMenu(); |
120 | void cancelMenuTimer(); | 121 | void cancelMenuTimer(); |
121 | void homeButtonPushed(); | 122 | void homeButtonPushed(); |
122 | void docButtonPushed(); | 123 | void docButtonPushed(); |
123 | void SDButtonPushed(); | 124 | void SDButtonPushed(); |
124 | void CFButtonPushed(); | 125 | void CFButtonPushed(); |
125 | void QPEButtonPushed(); | 126 | void QPEButtonPushed(); |
126 | void upDir(); | 127 | void upDir(); |
127 | void currentPathComboChanged(); | 128 | void currentPathComboChanged(); |
128 | void copy(); | 129 | void copy(); |
129 | void copyAs(); | 130 | void copyAs(); |
130 | void copySameDir(); | 131 | void copySameDir(); |
131 | void currentPathComboActivated(const QString &); | 132 | void currentPathComboActivated(const QString &); |
132 | void fillCombo(const QString &); | 133 | void fillCombo(const QString &); |
133 | bool copyFile( const QString & , const QString & ); | 134 | bool copyFile( const QString & , const QString & ); |
134 | void move(); | 135 | void move(); |
135 | void fileStatus(); | 136 | void fileStatus(); |
136 | void doAbout(); | 137 | void doAbout(); |
137 | void doBeam(); | 138 | void doBeam(); |
138 | void fileBeamFinished( Ir *); | 139 | void fileBeamFinished( Ir *); |
139 | 140 | ||
140 | private: | 141 | private: |
141 | QTimer menuTimer; | 142 | QTimer menuTimer; |
142 | }; | 143 | }; |
143 | 144 | ||
144 | #endif // ADVANCEDFM_H | 145 | #endif // ADVANCEDFM_H |