-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 39 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 1 |
2 files changed, 29 insertions, 11 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 7ee78c0..0f2555d 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,1586 +1,1603 @@ | |||
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 | 76 | ||
76 | AdvancedFm::AdvancedFm( ) | 77 | AdvancedFm::AdvancedFm( ) |
77 | : QMainWindow( ) | 78 | : QMainWindow( ) |
78 | { | 79 | { |
79 | setCaption( tr( "AdvancedFm" ) ); | 80 | setCaption( tr( "AdvancedFm" ) ); |
80 | 81 | ||
81 | QGridLayout *layout = new QGridLayout( this ); | 82 | QGridLayout *layout = new QGridLayout( this ); |
82 | layout->setSpacing( 2); | 83 | layout->setSpacing( 2); |
83 | layout->setMargin( 2); | 84 | layout->setMargin( 2); |
84 | 85 | ||
85 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 86 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
86 | 87 | ||
87 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 88 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
88 | fileMenu = new QPopupMenu( this ); | 89 | fileMenu = new QPopupMenu( this ); |
89 | viewMenu = new QPopupMenu( this ); | 90 | viewMenu = new QPopupMenu( this ); |
90 | 91 | ||
91 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); | 92 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); |
92 | 93 | ||
93 | menuBar->insertItem( tr( "File" ), fileMenu); | 94 | menuBar->insertItem( tr( "File" ), fileMenu); |
94 | menuBar->insertItem( tr( "View" ), viewMenu); | 95 | menuBar->insertItem( tr( "View" ), viewMenu); |
95 | 96 | ||
96 | qpeDirButton= new QToolButton(this,"QPEButton"); | 97 | qpeDirButton= new QToolButton(this,"QPEButton"); |
97 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); | 98 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); |
98 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); | 99 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); |
99 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); | 100 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); |
100 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); | 101 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); |
101 | 102 | ||
102 | cfButton = new QToolButton( this,"CFButton"); | 103 | cfButton = new QToolButton( this,"CFButton"); |
103 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); | 104 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); |
104 | cfButton ->setFixedSize( QSize( 20, 20 ) ); | 105 | cfButton ->setFixedSize( QSize( 20, 20 ) ); |
105 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); | 106 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); |
106 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); | 107 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); |
107 | 108 | ||
108 | sdButton = new QToolButton( this,"SDButton"); | 109 | sdButton = new QToolButton( this,"SDButton"); |
109 | sdButton->setPixmap(Resource::loadPixmap("sdmon/sdcard")); | 110 | sdButton->setPixmap(Resource::loadPixmap("sdmon/sdcard")); |
110 | sdButton->setFixedSize( QSize( 20, 20 ) ); | 111 | sdButton->setFixedSize( QSize( 20, 20 ) ); |
111 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); | 112 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); |
112 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); | 113 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); |
113 | 114 | ||
114 | cdUpButton = new QToolButton( this,"cdUpButton"); | 115 | cdUpButton = new QToolButton( this,"cdUpButton"); |
115 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | 116 | cdUpButton->setPixmap(Resource::loadPixmap("up")); |
116 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 117 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
117 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 118 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
118 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); | 119 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); |
119 | 120 | ||
120 | docButton = new QToolButton( this,"docsButton"); | 121 | docButton = new QToolButton( this,"docsButton"); |
121 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); | 122 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); |
122 | docButton->setFixedSize( QSize( 20, 20 ) ); | 123 | docButton->setFixedSize( QSize( 20, 20 ) ); |
123 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 124 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
124 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); | 125 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); |
125 | 126 | ||
126 | homeButton = new QToolButton( this,"homeButton"); | 127 | homeButton = new QToolButton( this,"homeButton"); |
127 | homeButton->setPixmap(Resource::loadPixmap("home")); | 128 | homeButton->setPixmap(Resource::loadPixmap("home")); |
128 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 129 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
129 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 130 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
130 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); | 131 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); |
131 | 132 | ||
132 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 133 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
133 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 134 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
134 | fileMenu->insertSeparator(); | 135 | fileMenu->insertSeparator(); |
135 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 136 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
136 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 137 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
137 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 138 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
138 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 139 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
139 | fileMenu->insertSeparator(); | 140 | fileMenu->insertSeparator(); |
140 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 141 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
141 | fileMenu->setCheckable(TRUE); | 142 | fileMenu->setCheckable(TRUE); |
142 | 143 | ||
143 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 144 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
144 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 145 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
145 | viewMenu->insertSeparator(); | 146 | viewMenu->insertSeparator(); |
146 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 147 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
147 | viewMenu->setCheckable(TRUE); | 148 | viewMenu->setCheckable(TRUE); |
148 | 149 | ||
149 | 150 | ||
150 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 151 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
151 | currentPathCombo->setEditable(TRUE); | 152 | currentPathCombo->setEditable(TRUE); |
152 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 153 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); |
153 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 154 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
154 | 155 | ||
155 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 156 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
156 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 157 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
157 | 158 | ||
158 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 159 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
159 | this,SLOT(currentPathComboChanged())); | 160 | this,SLOT(currentPathComboChanged())); |
160 | 161 | ||
161 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 162 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
162 | 163 | ||
163 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 164 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); |
164 | 165 | ||
165 | 166 | ||
166 | TabWidget = new QTabWidget( this, "TabWidget" ); | 167 | TabWidget = new QTabWidget( this, "TabWidget" ); |
167 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); | 168 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); |
168 | 169 | ||
169 | tab = new QWidget( TabWidget, "tab" ); | 170 | tab = new QWidget( TabWidget, "tab" ); |
170 | tabLayout = new QGridLayout( tab ); | 171 | tabLayout = new QGridLayout( tab ); |
171 | tabLayout->setSpacing( 2); | 172 | tabLayout->setSpacing( 2); |
172 | tabLayout->setMargin( 2); | 173 | tabLayout->setMargin( 2); |
173 | 174 | ||
174 | Local_View = new QListView( tab, "Local_View" ); | 175 | Local_View = new QListView( tab, "Local_View" ); |
175 | Local_View->addColumn( tr("File"),130); | 176 | Local_View->addColumn( tr("File"),130); |
176 | Local_View->addColumn( tr("Size"),-1); | 177 | Local_View->addColumn( tr("Size"),-1); |
177 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 178 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
178 | Local_View->addColumn( tr("Date"),-1); | 179 | Local_View->addColumn( tr("Date"),-1); |
179 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 180 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
180 | Local_View->setAllColumnsShowFocus(TRUE); | 181 | Local_View->setAllColumnsShowFocus(TRUE); |
181 | Local_View->setMultiSelection( TRUE ); | 182 | Local_View->setMultiSelection( TRUE ); |
182 | Local_View->setSelectionMode(QListView::Extended); | 183 | Local_View->setSelectionMode(QListView::Extended); |
183 | 184 | ||
184 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 185 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
185 | 186 | ||
186 | tabLayout->addWidget( Local_View, 0, 0 ); | 187 | tabLayout->addWidget( Local_View, 0, 0 ); |
187 | 188 | ||
188 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 189 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
189 | this,SLOT( localListClicked(QListViewItem *)) ); | 190 | this,SLOT( localListClicked(QListViewItem *)) ); |
190 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 191 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
191 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); | 192 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); |
192 | 193 | ||
193 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | 194 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); |
194 | 195 | ||
195 | TabWidget->insertTab( tab, tr("1")); | 196 | TabWidget->insertTab( tab, tr("1")); |
196 | 197 | ||
197 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 198 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
198 | tabLayout_2 = new QGridLayout( tab_2 ); | 199 | tabLayout_2 = new QGridLayout( tab_2 ); |
199 | tabLayout_2->setSpacing( 2); | 200 | tabLayout_2->setSpacing( 2); |
200 | tabLayout_2->setMargin( 2); | 201 | tabLayout_2->setMargin( 2); |
201 | 202 | ||
202 | Remote_View = new QListView( tab_2, "Remote_View" ); | 203 | Remote_View = new QListView( tab_2, "Remote_View" ); |
203 | Remote_View->addColumn( tr("File"),130); | 204 | Remote_View->addColumn( tr("File"),130); |
204 | Remote_View->addColumn( tr("Size"),-1); | 205 | Remote_View->addColumn( tr("Size"),-1); |
205 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 206 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
206 | Remote_View->addColumn( tr("Date"),-1); | 207 | Remote_View->addColumn( tr("Date"),-1); |
207 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 208 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
208 | Remote_View->setAllColumnsShowFocus(TRUE); | 209 | Remote_View->setAllColumnsShowFocus(TRUE); |
209 | Remote_View->setMultiSelection( TRUE ); | 210 | Remote_View->setMultiSelection( TRUE ); |
210 | Remote_View->setSelectionMode(QListView::Extended); | 211 | Remote_View->setSelectionMode(QListView::Extended); |
211 | 212 | ||
212 | 213 | ||
213 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 214 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
214 | 215 | ||
215 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 216 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
216 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 217 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
217 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 218 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
218 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 219 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
219 | 220 | ||
220 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 221 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
221 | 222 | ||
222 | 223 | ||
223 | TabWidget->insertTab( tab_2, tr( "2")); | 224 | TabWidget->insertTab( tab_2, tr( "2")); |
224 | 225 | ||
225 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 226 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
226 | this,SLOT(tabChanged(QWidget*))); | 227 | this,SLOT(tabChanged(QWidget*))); |
227 | 228 | ||
228 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); | 229 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); |
229 | tabLayout_3 = new QGridLayout( tab_3 ); | 230 | tabLayout_3 = new QGridLayout( tab_3 ); |
230 | tabLayout_3->setSpacing( 2); | 231 | tabLayout_3->setSpacing( 2); |
231 | tabLayout_3->setMargin( 2); | 232 | tabLayout_3->setMargin( 2); |
232 | 233 | ||
233 | 234 | ||
234 | // OFileDialog fileDialog; | 235 | // OFileDialog fileDialog; |
235 | // fileDialog; | 236 | // fileDialog; |
236 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy | 237 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy |
237 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); | 238 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); |
238 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); | 239 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); |
239 | 240 | ||
240 | QListView *fileTree; | 241 | QListView *fileTree; |
241 | fileTree = new QListView( tab_3, "tree" ); | 242 | fileTree = new QListView( tab_3, "tree" ); |
242 | 243 | ||
243 | 244 | ||
244 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | 245 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); |
245 | 246 | ||
246 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | 247 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); |
247 | */ | 248 | */ |
248 | 249 | ||
249 | /////////////// | 250 | /////////////// |
250 | 251 | ||
252 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | ||
253 | if (uname(&name) != -1) { | ||
254 | QString release=name.release; | ||
255 | if(release.find("embedix",0,TRUE) !=-1) { | ||
256 | zaurusDevice=TRUE; | ||
257 | } else { | ||
258 | zaurusDevice=FALSE; | ||
259 | sdButton->hide(); | ||
260 | } | ||
261 | } | ||
262 | |||
251 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 263 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
252 | currentDir.setPath( QDir::currentDirPath()); | 264 | currentDir.setPath( QDir::currentDirPath()); |
253 | 265 | ||
254 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 266 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
255 | currentRemoteDir.setPath( QDir::currentDirPath()); | 267 | currentRemoteDir.setPath( QDir::currentDirPath()); |
256 | 268 | ||
257 | b = TRUE; | 269 | b = TRUE; |
258 | 270 | ||
259 | filterStr="*"; | 271 | filterStr="*"; |
260 | b=FALSE; | 272 | b=FALSE; |
261 | 273 | ||
262 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); | 274 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); |
263 | 275 | ||
264 | populateLocalView(); | 276 | populateLocalView(); |
265 | populateRemoteView(); | 277 | populateRemoteView(); |
266 | currentPathCombo->setFocus(); | 278 | currentPathCombo->setFocus(); |
267 | } | 279 | } |
268 | 280 | ||
269 | AdvancedFm::~AdvancedFm() | 281 | AdvancedFm::~AdvancedFm() |
270 | { | 282 | { |
271 | } | 283 | } |
272 | 284 | ||
273 | void AdvancedFm::cleanUp() | 285 | void AdvancedFm::cleanUp() |
274 | { | 286 | { |
275 | QString sfile=QDir::homeDirPath(); | 287 | QString sfile=QDir::homeDirPath(); |
276 | if(sfile.right(1) != "/") | 288 | if(sfile.right(1) != "/") |
277 | sfile+="/._temp"; | 289 | sfile+="/._temp"; |
278 | else | 290 | else |
279 | sfile+="._temp"; | 291 | sfile+="._temp"; |
280 | QFile file( sfile); | 292 | QFile file( sfile); |
281 | if(file.exists()) | 293 | if(file.exists()) |
282 | file.remove(); | 294 | file.remove(); |
283 | } | 295 | } |
284 | 296 | ||
285 | void AdvancedFm::tabChanged(QWidget *w) | 297 | void AdvancedFm::tabChanged(QWidget *w) |
286 | { | 298 | { |
287 | if (TabWidget->currentPageIndex() == 0) { | 299 | if (TabWidget->currentPageIndex() == 0) { |
288 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 300 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
289 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 301 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
290 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 302 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
291 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 303 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
292 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); | 304 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); |
293 | 305 | ||
294 | } | 306 | } |
295 | if (TabWidget->currentPageIndex() == 1) { | 307 | if (TabWidget->currentPageIndex() == 1) { |
296 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); | 308 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); |
297 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); | 309 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); |
298 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); | 310 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); |
299 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 311 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
300 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); | 312 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); |
301 | } | 313 | } |
302 | } | 314 | } |
303 | 315 | ||
304 | 316 | ||
305 | void AdvancedFm::populateLocalView() | 317 | void AdvancedFm::populateLocalView() |
306 | { | 318 | { |
307 | QPixmap pm; | 319 | QPixmap pm; |
308 | Local_View->clear(); | 320 | Local_View->clear(); |
309 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 321 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
310 | currentDir.setMatchAllDirs(TRUE); | 322 | currentDir.setMatchAllDirs(TRUE); |
311 | currentDir.setNameFilter(filterStr); | 323 | currentDir.setNameFilter(filterStr); |
312 | QString fileL, fileS, fileDate; | 324 | QString fileL, fileS, fileDate; |
313 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 325 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
314 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); | 326 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); |
315 | bool isDir=FALSE; | 327 | bool isDir=FALSE; |
316 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 328 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
317 | QFileInfoListIterator it(*list); | 329 | QFileInfoListIterator it(*list); |
318 | QFileInfo *fi; | 330 | QFileInfo *fi; |
319 | while ( (fi=it.current()) ) { | 331 | while ( (fi=it.current()) ) { |
320 | if (fi->isSymLink() ) { | 332 | if (fi->isSymLink() ) { |
321 | QString symLink=fi->readLink(); | 333 | QString symLink=fi->readLink(); |
322 | QFileInfo sym( symLink); | 334 | QFileInfo sym( symLink); |
323 | fileS.sprintf( "%10li", sym.size() ); | 335 | fileS.sprintf( "%10li", sym.size() ); |
324 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); | 336 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
325 | fileDate = sym.lastModified().toString(); | 337 | fileDate = sym.lastModified().toString(); |
326 | } else { | 338 | } else { |
327 | fileS.sprintf( "%10li", fi->size() ); | 339 | fileS.sprintf( "%10li", fi->size() ); |
328 | fileL.sprintf( "%s",fi->fileName().data() ); | 340 | fileL.sprintf( "%s",fi->fileName().data() ); |
329 | fileDate= fi->lastModified().toString(); | 341 | fileDate= fi->lastModified().toString(); |
330 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 342 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
331 | fileL+="/"; | 343 | fileL+="/"; |
332 | isDir=TRUE; | 344 | isDir=TRUE; |
333 | } | 345 | } |
334 | } | 346 | } |
335 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); | 347 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); |
336 | if(fileL !="./" && fi->exists()) { | 348 | if(fileL !="./" && fi->exists()) { |
337 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); | 349 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); |
338 | 350 | ||
339 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 351 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
340 | 352 | ||
341 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 353 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
342 | pm = Resource::loadPixmap( "lockedfolder" ); | 354 | pm = Resource::loadPixmap( "lockedfolder" ); |
343 | else | 355 | else |
344 | pm= Resource::loadPixmap( "folder" ); | 356 | pm= Resource::loadPixmap( "folder" ); |
345 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 357 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
346 | pm = Resource::loadPixmap( "exec"); | 358 | pm = Resource::loadPixmap( "exec"); |
347 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 359 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
348 | | fileInfo.permission( QFileInfo::ExeGroup) | 360 | | fileInfo.permission( QFileInfo::ExeGroup) |
349 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 361 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
350 | pm = Resource::loadPixmap( "exec"); | 362 | pm = Resource::loadPixmap( "exec"); |
351 | } else if( !fi->isReadable() ) { | 363 | } else if( !fi->isReadable() ) { |
352 | pm = Resource::loadPixmap( "locked" ); | 364 | pm = Resource::loadPixmap( "locked" ); |
353 | } else { //everything else goes by mimetype | 365 | } else { //everything else goes by mimetype |
354 | MimeType mt(fi->filePath()); | 366 | MimeType mt(fi->filePath()); |
355 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 367 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
356 | if(pm.isNull()) | 368 | if(pm.isNull()) |
357 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 369 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
358 | } | 370 | } |
359 | item->setPixmap( 0,pm); | 371 | item->setPixmap( 0,pm); |
360 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 372 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
361 | // overlay link image | 373 | // overlay link image |
362 | pm= Resource::loadPixmap( "folder" ); | 374 | pm= Resource::loadPixmap( "folder" ); |
363 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 375 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
364 | QPainter painter( &pm ); | 376 | QPainter painter( &pm ); |
365 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 377 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
366 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 378 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
367 | item->setPixmap( 0, pm); | 379 | item->setPixmap( 0, pm); |
368 | } | 380 | } |
369 | } | 381 | } |
370 | isDir=FALSE; | 382 | isDir=FALSE; |
371 | ++it; | 383 | ++it; |
372 | } | 384 | } |
373 | 385 | ||
374 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { | 386 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { |
375 | struct stat buf; | 387 | struct stat buf; |
376 | dev_t devT; | 388 | dev_t devT; |
377 | DIR *dir; | 389 | DIR *dir; |
378 | struct dirent *mydirent; | 390 | struct dirent *mydirent; |
379 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) | 391 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) |
380 | while ((mydirent = readdir(dir)) != NULL) { | 392 | while ((mydirent = readdir(dir)) != NULL) { |
381 | lstat( mydirent->d_name, &buf); | 393 | lstat( mydirent->d_name, &buf); |
382 | qDebug(mydirent->d_name); | 394 | qDebug(mydirent->d_name); |
383 | fileL.sprintf("%s", mydirent->d_name); | 395 | fileL.sprintf("%s", mydirent->d_name); |
384 | devT = buf.st_dev; | 396 | devT = buf.st_dev; |
385 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 397 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
386 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 398 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
387 | if( fileL.find(".") == -1 ){ | 399 | if( fileL.find(".") == -1 ){ |
388 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); | 400 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); |
389 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 401 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
390 | item->setPixmap( 0,pm); | 402 | item->setPixmap( 0,pm); |
391 | } | 403 | } |
392 | } | 404 | } |
393 | 405 | ||
394 | closedir(dir); | 406 | closedir(dir); |
395 | } | 407 | } |
396 | 408 | ||
397 | Local_View->setSorting( 3,FALSE); | 409 | Local_View->setSorting( 3,FALSE); |
398 | fillCombo( (const QString &) currentDir.canonicalPath()); | 410 | fillCombo( (const QString &) currentDir.canonicalPath()); |
399 | } | 411 | } |
400 | 412 | ||
401 | 413 | ||
402 | void AdvancedFm::populateRemoteView() | 414 | void AdvancedFm::populateRemoteView() |
403 | { | 415 | { |
404 | QPixmap pm; | 416 | QPixmap pm; |
405 | Remote_View->clear(); | 417 | Remote_View->clear(); |
406 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 418 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
407 | currentRemoteDir.setMatchAllDirs(TRUE); | 419 | currentRemoteDir.setMatchAllDirs(TRUE); |
408 | currentRemoteDir.setNameFilter(filterStr); | 420 | currentRemoteDir.setNameFilter(filterStr); |
409 | QString fileL, fileS, fileDate; | 421 | QString fileL, fileS, fileDate; |
410 | 422 | ||
411 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 423 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
412 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); | 424 | setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); |
413 | bool isDir=FALSE; | 425 | bool isDir=FALSE; |
414 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 426 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
415 | QFileInfoListIterator it(*list); | 427 | QFileInfoListIterator it(*list); |
416 | QFileInfo *fi; | 428 | QFileInfo *fi; |
417 | while ( (fi=it.current()) ) { | 429 | while ( (fi=it.current()) ) { |
418 | if (fi->isSymLink() ){ | 430 | if (fi->isSymLink() ){ |
419 | QString symLink=fi->readLink(); | 431 | QString symLink=fi->readLink(); |
420 | // qDebug("Symlink detected "+symLink); | 432 | // qDebug("Symlink detected "+symLink); |
421 | QFileInfo sym( symLink); | 433 | QFileInfo sym( symLink); |
422 | fileS.sprintf( "%10li", sym.size() ); | 434 | fileS.sprintf( "%10li", sym.size() ); |
423 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); | 435 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
424 | fileDate = sym.lastModified().toString(); | 436 | fileDate = sym.lastModified().toString(); |
425 | } else { | 437 | } else { |
426 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 438 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
427 | fileS.sprintf( "%10li", fi->size() ); | 439 | fileS.sprintf( "%10li", fi->size() ); |
428 | fileL.sprintf( "%s",fi->fileName().data() ); | 440 | fileL.sprintf( "%s",fi->fileName().data() ); |
429 | fileDate= fi->lastModified().toString(); | 441 | fileDate= fi->lastModified().toString(); |
430 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { | 442 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { |
431 | fileL+="/"; | 443 | fileL+="/"; |
432 | isDir=TRUE; | 444 | isDir=TRUE; |
433 | // qDebug( fileL); | 445 | // qDebug( fileL); |
434 | } | 446 | } |
435 | } | 447 | } |
436 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); | 448 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); |
437 | if(fileL !="./" && fi->exists()) { | 449 | if(fileL !="./" && fi->exists()) { |
438 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 450 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
439 | QPixmap pm; | 451 | QPixmap pm; |
440 | 452 | ||
441 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 453 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
442 | if( !QDir( fi->filePath() ).isReadable()) | 454 | if( !QDir( fi->filePath() ).isReadable()) |
443 | pm = Resource::loadPixmap( "lockedfolder" ); | 455 | pm = Resource::loadPixmap( "lockedfolder" ); |
444 | else | 456 | else |
445 | pm= Resource::loadPixmap( "folder" ); | 457 | pm= Resource::loadPixmap( "folder" ); |
446 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 458 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
447 | pm = Resource::loadPixmap( "exec"); | 459 | pm = Resource::loadPixmap( "exec"); |
448 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 460 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
449 | | fileInfo.permission( QFileInfo::ExeGroup) | 461 | | fileInfo.permission( QFileInfo::ExeGroup) |
450 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 462 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
451 | pm = Resource::loadPixmap( "exec"); | 463 | pm = Resource::loadPixmap( "exec"); |
452 | } else if( !fi->isReadable() ) { | 464 | } else if( !fi->isReadable() ) { |
453 | pm = Resource::loadPixmap( "locked" ); | 465 | pm = Resource::loadPixmap( "locked" ); |
454 | } else { | 466 | } else { |
455 | MimeType mt(fi->filePath()); | 467 | MimeType mt(fi->filePath()); |
456 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 468 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
457 | if(pm.isNull()) | 469 | if(pm.isNull()) |
458 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 470 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
459 | } | 471 | } |
460 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 472 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
461 | // overlay link image | 473 | // overlay link image |
462 | pm= Resource::loadPixmap( "folder" ); | 474 | pm= Resource::loadPixmap( "folder" ); |
463 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 475 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
464 | QPainter painter( &pm ); | 476 | QPainter painter( &pm ); |
465 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 477 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
466 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 478 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
467 | } | 479 | } |
468 | item->setPixmap( 0, pm); | 480 | item->setPixmap( 0, pm); |
469 | } | 481 | } |
470 | isDir=FALSE; | 482 | isDir=FALSE; |
471 | ++it; | 483 | ++it; |
472 | } | 484 | } |
473 | 485 | ||
474 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { | 486 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { |
475 | struct stat buf; | 487 | struct stat buf; |
476 | DIR *dir; | 488 | DIR *dir; |
477 | struct dirent *mydirent; | 489 | struct dirent *mydirent; |
478 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) | 490 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) |
479 | while ((mydirent = readdir(dir)) != NULL) { | 491 | while ((mydirent = readdir(dir)) != NULL) { |
480 | lstat( mydirent->d_name, &buf); | 492 | lstat( mydirent->d_name, &buf); |
481 | qDebug(mydirent->d_name); | 493 | qDebug(mydirent->d_name); |
482 | fileL.sprintf("%s", mydirent->d_name); | 494 | fileL.sprintf("%s", mydirent->d_name); |
483 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); | 495 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); |
484 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 496 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
485 | if( fileL.find(".") == -1 ){ | 497 | if( fileL.find(".") == -1 ){ |
486 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 498 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
487 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 499 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
488 | item->setPixmap( 0,pm); | 500 | item->setPixmap( 0,pm); |
489 | } | 501 | } |
490 | } | 502 | } |
491 | 503 | ||
492 | closedir(dir); | 504 | closedir(dir); |
493 | } | 505 | } |
494 | 506 | ||
495 | Remote_View->setSorting( 3,FALSE); | 507 | Remote_View->setSorting( 3,FALSE); |
496 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); | 508 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); |
497 | } | 509 | } |
498 | 510 | ||
499 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) | 511 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) |
500 | { | 512 | { |
501 | if(selectedItem) { | 513 | if(selectedItem) { |
502 | QString strItem=selectedItem->text(0); | 514 | QString strItem=selectedItem->text(0); |
503 | QString strSize=selectedItem->text(1); | 515 | QString strSize=selectedItem->text(1); |
504 | strSize=strSize.stripWhiteSpace(); | 516 | strSize=strSize.stripWhiteSpace(); |
505 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 517 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
506 | // is symlink | 518 | // is symlink |
507 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 519 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
508 | if(QDir(strItem2).exists() ) { | 520 | if(QDir(strItem2).exists() ) { |
509 | currentDir.cd(strItem2, TRUE); | 521 | currentDir.cd(strItem2, TRUE); |
510 | populateLocalView(); | 522 | populateLocalView(); |
511 | } | 523 | } |
512 | } else { // not a symlink | 524 | } else { // not a symlink |
513 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 525 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
514 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 526 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
515 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 527 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
516 | currentDir.cd(strItem,FALSE); | 528 | currentDir.cd(strItem,FALSE); |
517 | populateLocalView(); | 529 | populateLocalView(); |
518 | } else { | 530 | } else { |
519 | currentDir.cdUp(); | 531 | currentDir.cdUp(); |
520 | populateLocalView(); | 532 | populateLocalView(); |
521 | } | 533 | } |
522 | if(QDir(strItem).exists()){ | 534 | if(QDir(strItem).exists()){ |
523 | currentDir.cd(strItem, TRUE); | 535 | currentDir.cd(strItem, TRUE); |
524 | populateLocalView(); | 536 | populateLocalView(); |
525 | } | 537 | } |
526 | } else { | 538 | } else { |
527 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 539 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
528 | if( QFile::exists(strItem ) ) { | 540 | if( QFile::exists(strItem ) ) { |
529 | // qDebug("clicked item "+strItem); | 541 | // qDebug("clicked item "+strItem); |
530 | // DocLnk doc( strItem, FALSE ); | 542 | // DocLnk doc( strItem, FALSE ); |
531 | // doc.execute(); | 543 | // doc.execute(); |
532 | // Local_View->clearSelection(); | 544 | // Local_View->clearSelection(); |
533 | } | 545 | } |
534 | } //end not symlink | 546 | } //end not symlink |
535 | chdir(strItem.latin1()); | 547 | chdir(strItem.latin1()); |
536 | } | 548 | } |
537 | } | 549 | } |
538 | } | 550 | } |
539 | 551 | ||
540 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) | 552 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) |
541 | { | 553 | { |
542 | if(selectedItem) { | 554 | if(selectedItem) { |
543 | QString strItem=selectedItem->text(0); | 555 | QString strItem=selectedItem->text(0); |
544 | QString strSize=selectedItem->text(1); | 556 | QString strSize=selectedItem->text(1); |
545 | strSize=strSize.stripWhiteSpace(); | 557 | strSize=strSize.stripWhiteSpace(); |
546 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 558 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
547 | // is symlink | 559 | // is symlink |
548 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 560 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
549 | if(QDir(strItem2).exists() ) { | 561 | if(QDir(strItem2).exists() ) { |
550 | currentRemoteDir.cd(strItem2, TRUE); | 562 | currentRemoteDir.cd(strItem2, TRUE); |
551 | populateRemoteView(); | 563 | populateRemoteView(); |
552 | } | 564 | } |
553 | } else { // not a symlink | 565 | } else { // not a symlink |
554 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 566 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
555 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { | 567 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { |
556 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 568 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
557 | currentRemoteDir.cd(strItem,FALSE); | 569 | currentRemoteDir.cd(strItem,FALSE); |
558 | populateRemoteView(); | 570 | populateRemoteView(); |
559 | } else { | 571 | } else { |
560 | currentRemoteDir.cdUp(); | 572 | currentRemoteDir.cdUp(); |
561 | populateRemoteView(); | 573 | populateRemoteView(); |
562 | } | 574 | } |
563 | if(QDir(strItem).exists()){ | 575 | if(QDir(strItem).exists()){ |
564 | currentRemoteDir.cd(strItem, TRUE); | 576 | currentRemoteDir.cd(strItem, TRUE); |
565 | populateRemoteView(); | 577 | populateRemoteView(); |
566 | } | 578 | } |
567 | } else { | 579 | } else { |
568 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 580 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
569 | if( QFile::exists(strItem ) ) { | 581 | if( QFile::exists(strItem ) ) { |
570 | // qDebug("clicked item "+strItem); | 582 | // qDebug("clicked item "+strItem); |
571 | // DocLnk doc( strItem, FALSE ); | 583 | // DocLnk doc( strItem, FALSE ); |
572 | // doc.execute(); | 584 | // doc.execute(); |
573 | // Remote_View->clearSelection(); | 585 | // Remote_View->clearSelection(); |
574 | } | 586 | } |
575 | } //end not symlink | 587 | } //end not symlink |
576 | chdir(strItem.latin1()); | 588 | chdir(strItem.latin1()); |
577 | } | 589 | } |
578 | } | 590 | } |
579 | } | 591 | } |
580 | 592 | ||
581 | void AdvancedFm::doLocalCd() | 593 | void AdvancedFm::doLocalCd() |
582 | { | 594 | { |
583 | localListClicked( Local_View->currentItem()); | 595 | localListClicked( Local_View->currentItem()); |
584 | } | 596 | } |
585 | 597 | ||
586 | void AdvancedFm::doRemoteCd() | 598 | void AdvancedFm::doRemoteCd() |
587 | { | 599 | { |
588 | localListClicked( Remote_View->currentItem()); | 600 | localListClicked( Remote_View->currentItem()); |
589 | } | 601 | } |
590 | 602 | ||
591 | void AdvancedFm::showHidden() | 603 | void AdvancedFm::showHidden() |
592 | { | 604 | { |
593 | if (b) { | 605 | if (b) { |
594 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 606 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
595 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 607 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
596 | b=FALSE; | 608 | b=FALSE; |
597 | 609 | ||
598 | } else { | 610 | } else { |
599 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 611 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
600 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 612 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
601 | b=TRUE; | 613 | b=TRUE; |
602 | } | 614 | } |
603 | populateLocalView(); | 615 | populateLocalView(); |
604 | 616 | ||
605 | } | 617 | } |
606 | 618 | ||
607 | void AdvancedFm::showRemoteHidden() | 619 | void AdvancedFm::showRemoteHidden() |
608 | { | 620 | { |
609 | if (b) { | 621 | if (b) { |
610 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 622 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
611 | b=TRUE; | 623 | b=TRUE; |
612 | 624 | ||
613 | } else { | 625 | } else { |
614 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 626 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
615 | b=FALSE; | 627 | b=FALSE; |
616 | } | 628 | } |
617 | populateRemoteView(); | 629 | populateRemoteView(); |
618 | } | 630 | } |
619 | 631 | ||
620 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 632 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
621 | { | 633 | { |
622 | qDebug("list pressed"); | 634 | qDebug("list pressed"); |
623 | switch (mouse) { | 635 | switch (mouse) { |
624 | case 1: | 636 | case 1: |
625 | break; | 637 | break; |
626 | case 2: | 638 | case 2: |
627 | menuTimer.start( 750, TRUE ); | 639 | menuTimer.start( 750, TRUE ); |
628 | qDebug("Start menu timer\n"); | 640 | qDebug("Start menu timer\n"); |
629 | break; | 641 | break; |
630 | }; | 642 | }; |
631 | } | 643 | } |
632 | 644 | ||
633 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 645 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
634 | { | 646 | { |
635 | 647 | ||
636 | switch (mouse) { | 648 | switch (mouse) { |
637 | case 1: | 649 | case 1: |
638 | break; | 650 | break; |
639 | case 2: | 651 | case 2: |
640 | menuTimer.start( 750, TRUE ); | 652 | menuTimer.start( 750, TRUE ); |
641 | qDebug("Start menu timer"); | 653 | qDebug("Start menu timer"); |
642 | break; | 654 | break; |
643 | }; | 655 | }; |
644 | } | 656 | } |
645 | 657 | ||
646 | void AdvancedFm::runThis() { | 658 | void AdvancedFm::runThis() { |
647 | QString fs; | 659 | QString fs; |
648 | if (TabWidget->currentPageIndex() == 0) { | 660 | if (TabWidget->currentPageIndex() == 0) { |
649 | QString curFile = Local_View->currentItem()->text(0); | 661 | QString curFile = Local_View->currentItem()->text(0); |
650 | if(curFile != "../") { | 662 | if(curFile != "../") { |
651 | 663 | ||
652 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 664 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
653 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); | 665 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
654 | qDebug( fileInfo.owner()); | 666 | qDebug( fileInfo.owner()); |
655 | if( (fileInfo.permission( QFileInfo::ExeUser) | 667 | if( (fileInfo.permission( QFileInfo::ExeUser) |
656 | | fileInfo.permission( QFileInfo::ExeGroup) | 668 | | fileInfo.permission( QFileInfo::ExeGroup) |
657 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 669 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
658 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 670 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
659 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 671 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
660 | e << curFile; | 672 | e << curFile; |
661 | } else { | 673 | } else { |
662 | curFile = currentDir.canonicalPath()+"/"+curFile; | 674 | curFile = currentDir.canonicalPath()+"/"+curFile; |
663 | DocLnk nf(curFile); | 675 | DocLnk nf(curFile); |
664 | QString execStr = nf.exec(); | 676 | QString execStr = nf.exec(); |
665 | qDebug( execStr); | 677 | qDebug( execStr); |
666 | if( execStr.isEmpty() ) { | 678 | if( execStr.isEmpty() ) { |
667 | } else { | 679 | } else { |
668 | nf.execute(); | 680 | nf.execute(); |
669 | } | 681 | } |
670 | } | 682 | } |
671 | } | 683 | } |
672 | } else { | 684 | } else { |
673 | QString curFile = Remote_View->currentItem()->text(0); | 685 | QString curFile = Remote_View->currentItem()->text(0); |
674 | if(curFile != "../") { | 686 | if(curFile != "../") { |
675 | 687 | ||
676 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 688 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
677 | qDebug("Filesystemtype is "+fs); | 689 | qDebug("Filesystemtype is "+fs); |
678 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); | 690 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
679 | if( (fileInfo.permission( QFileInfo::ExeUser) | 691 | if( (fileInfo.permission( QFileInfo::ExeUser) |
680 | | fileInfo.permission( QFileInfo::ExeGroup) | 692 | | fileInfo.permission( QFileInfo::ExeGroup) |
681 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 693 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
682 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 694 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
683 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 695 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
684 | e << curFile; | 696 | e << curFile; |
685 | } else { | 697 | } else { |
686 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 698 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
687 | DocLnk nf(curFile); | 699 | DocLnk nf(curFile); |
688 | QString execStr = nf.exec(); | 700 | QString execStr = nf.exec(); |
689 | qDebug(execStr); | 701 | qDebug(execStr); |
690 | if( execStr.isEmpty() ) { | 702 | if( execStr.isEmpty() ) { |
691 | } else { | 703 | } else { |
692 | nf.execute(); | 704 | nf.execute(); |
693 | } | 705 | } |
694 | } | 706 | } |
695 | } | 707 | } |
696 | } | 708 | } |
697 | } | 709 | } |
698 | 710 | ||
699 | void AdvancedFm::runText() { | 711 | void AdvancedFm::runText() { |
700 | if (TabWidget->currentPageIndex() == 0) { | 712 | if (TabWidget->currentPageIndex() == 0) { |
701 | QString curFile = Local_View->currentItem()->text(0); | 713 | QString curFile = Local_View->currentItem()->text(0); |
702 | if(curFile != "../") { | 714 | if(curFile != "../") { |
703 | curFile = currentDir.canonicalPath()+"/"+curFile; | 715 | curFile = currentDir.canonicalPath()+"/"+curFile; |
704 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 716 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
705 | e << curFile; | 717 | e << curFile; |
706 | } | 718 | } |
707 | } else { | 719 | } else { |
708 | QString curFile = Remote_View->currentItem()->text(0); | 720 | QString curFile = Remote_View->currentItem()->text(0); |
709 | if(curFile != "../") { | 721 | if(curFile != "../") { |
710 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 722 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
711 | DocLnk nf(curFile); | 723 | DocLnk nf(curFile); |
712 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 724 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
713 | e << curFile; | 725 | e << curFile; |
714 | } | 726 | } |
715 | } | 727 | } |
716 | } | 728 | } |
717 | 729 | ||
718 | void AdvancedFm::localMakDir() | 730 | void AdvancedFm::localMakDir() |
719 | { | 731 | { |
720 | InputDialog *fileDlg; | 732 | InputDialog *fileDlg; |
721 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 733 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
722 | fileDlg->exec(); | 734 | fileDlg->exec(); |
723 | if( fileDlg->result() == 1 ) { | 735 | if( fileDlg->result() == 1 ) { |
724 | QString filename = fileDlg->LineEdit1->text(); | 736 | QString filename = fileDlg->LineEdit1->text(); |
725 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 737 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
726 | } | 738 | } |
727 | populateLocalView(); | 739 | populateLocalView(); |
728 | } | 740 | } |
729 | 741 | ||
730 | void AdvancedFm::remoteMakDir() | 742 | void AdvancedFm::remoteMakDir() |
731 | { | 743 | { |
732 | InputDialog *fileDlg; | 744 | InputDialog *fileDlg; |
733 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 745 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
734 | fileDlg->exec(); | 746 | fileDlg->exec(); |
735 | if( fileDlg->result() == 1 ) { | 747 | if( fileDlg->result() == 1 ) { |
736 | QString filename = fileDlg->LineEdit1->text(); | 748 | QString filename = fileDlg->LineEdit1->text(); |
737 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); | 749 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); |
738 | } | 750 | } |
739 | populateRemoteView(); | 751 | populateRemoteView(); |
740 | } | 752 | } |
741 | 753 | ||
742 | void AdvancedFm::localDelete() | 754 | void AdvancedFm::localDelete() |
743 | { | 755 | { |
744 | QStringList curFileList = getPath(); | 756 | QStringList curFileList = getPath(); |
745 | if(curFileList.count() > 0) { | 757 | if(curFileList.count() > 0) { |
746 | QString myFile; | 758 | QString myFile; |
747 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 759 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
748 | myFile = (*it); | 760 | myFile = (*it); |
749 | if( myFile.find(" -> ",0,TRUE) != -1) | 761 | if( myFile.find(" -> ",0,TRUE) != -1) |
750 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 762 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
751 | 763 | ||
752 | QString f = currentDir.canonicalPath(); | 764 | QString f = currentDir.canonicalPath(); |
753 | if(f.right(1).find("/",0,TRUE) == -1) | 765 | if(f.right(1).find("/",0,TRUE) == -1) |
754 | f+="/"; | 766 | f+="/"; |
755 | f+=myFile; | 767 | f+=myFile; |
756 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 768 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
757 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 769 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
758 | "\nand all it's contents ?" | 770 | "\nand all it's contents ?" |
759 | ,tr("Yes"),tr("No"),0,0,1) ) { | 771 | ,tr("Yes"),tr("No"),0,0,1) ) { |
760 | case 0: { | 772 | case 0: { |
761 | f=f.left(f.length()-1); | 773 | f=f.left(f.length()-1); |
762 | QString cmd="rm -rf "+f; | 774 | QString cmd="rm -rf "+f; |
763 | system( cmd.latin1()); | 775 | system( cmd.latin1()); |
764 | populateLocalView(); | 776 | populateLocalView(); |
765 | } | 777 | } |
766 | break; | 778 | break; |
767 | case 1: | 779 | case 1: |
768 | // exit | 780 | // exit |
769 | break; | 781 | break; |
770 | }; | 782 | }; |
771 | 783 | ||
772 | } else { | 784 | } else { |
773 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 785 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
774 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 786 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
775 | case 0: { | 787 | case 0: { |
776 | QString cmd="rm "+f; | 788 | QString cmd="rm "+f; |
777 | QFile file(f); | 789 | QFile file(f); |
778 | file.remove(); | 790 | file.remove(); |
779 | // system( cmd.latin1()); | 791 | // system( cmd.latin1()); |
780 | populateLocalView(); | 792 | populateLocalView(); |
781 | } | 793 | } |
782 | break; | 794 | break; |
783 | case 1: | 795 | case 1: |
784 | // exit | 796 | // exit |
785 | break; | 797 | break; |
786 | }; | 798 | }; |
787 | } | 799 | } |
788 | } | 800 | } |
789 | } | 801 | } |
790 | } | 802 | } |
791 | 803 | ||
792 | void AdvancedFm::remoteDelete() | 804 | void AdvancedFm::remoteDelete() |
793 | { | 805 | { |
794 | QStringList curFileList = getPath(); | 806 | QStringList curFileList = getPath(); |
795 | if( curFileList.count() > 0) { | 807 | if( curFileList.count() > 0) { |
796 | QString myFile; | 808 | QString myFile; |
797 | 809 | ||
798 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 810 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
799 | myFile = (*it); | 811 | myFile = (*it); |
800 | if(myFile.find(" -> ",0,TRUE) != -1) | 812 | if(myFile.find(" -> ",0,TRUE) != -1) |
801 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); | 813 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); |
802 | QString f = currentRemoteDir.canonicalPath(); | 814 | QString f = currentRemoteDir.canonicalPath(); |
803 | if(f.right(1).find("/",0,TRUE) == -1) | 815 | if(f.right(1).find("/",0,TRUE) == -1) |
804 | f+="/"; | 816 | f+="/"; |
805 | f+=myFile; | 817 | f+=myFile; |
806 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 818 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
807 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 819 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
808 | "\nand all it's contents ?", | 820 | "\nand all it's contents ?", |
809 | tr("Yes"),tr("No"),0,0,1) ) { | 821 | tr("Yes"),tr("No"),0,0,1) ) { |
810 | case 0: { | 822 | case 0: { |
811 | f=f.left(f.length()-1); | 823 | f=f.left(f.length()-1); |
812 | QString cmd="rm -rf "+f; | 824 | QString cmd="rm -rf "+f; |
813 | system( cmd.latin1()); | 825 | system( cmd.latin1()); |
814 | populateRemoteView(); | 826 | populateRemoteView(); |
815 | } | 827 | } |
816 | break; | 828 | break; |
817 | case 1: | 829 | case 1: |
818 | // exit | 830 | // exit |
819 | break; | 831 | break; |
820 | }; | 832 | }; |
821 | 833 | ||
822 | } else { | 834 | } else { |
823 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 835 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
824 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 836 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
825 | case 0: { | 837 | case 0: { |
826 | QString cmd="rm "+f; | 838 | QString cmd="rm "+f; |
827 | QFile file(f); | 839 | QFile file(f); |
828 | file.remove(); | 840 | file.remove(); |
829 | // system( cmd.latin1()); | 841 | // system( cmd.latin1()); |
830 | populateRemoteView(); | 842 | populateRemoteView(); |
831 | } | 843 | } |
832 | break; | 844 | break; |
833 | case 1: | 845 | case 1: |
834 | // exit | 846 | // exit |
835 | break; | 847 | break; |
836 | }; | 848 | }; |
837 | } | 849 | } |
838 | } | 850 | } |
839 | } | 851 | } |
840 | } | 852 | } |
841 | 853 | ||
842 | void AdvancedFm::localRename() | 854 | void AdvancedFm::localRename() |
843 | { | 855 | { |
844 | QString curFile = Local_View->currentItem()->text(0); | 856 | QString curFile = Local_View->currentItem()->text(0); |
845 | qDebug("currentItem "+curFile); | 857 | qDebug("currentItem "+curFile); |
846 | if( curFile !="../") { | 858 | if( curFile !="../") { |
847 | InputDialog *fileDlg; | 859 | InputDialog *fileDlg; |
848 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 860 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
849 | fileDlg->setInputText((const QString &)curFile); | 861 | fileDlg->setInputText((const QString &)curFile); |
850 | fileDlg->exec(); | 862 | fileDlg->exec(); |
851 | if( fileDlg->result() == 1 ) { | 863 | if( fileDlg->result() == 1 ) { |
852 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 864 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
853 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 865 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
854 | if( rename(oldname.latin1(), newName.latin1())== -1) | 866 | if( rename(oldname.latin1(), newName.latin1())== -1) |
855 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 867 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
856 | } | 868 | } |
857 | populateLocalView(); | 869 | populateLocalView(); |
858 | } | 870 | } |
859 | } | 871 | } |
860 | 872 | ||
861 | void AdvancedFm::remoteRename() | 873 | void AdvancedFm::remoteRename() |
862 | { | 874 | { |
863 | QString curFile = Remote_View->currentItem()->text(0); | 875 | QString curFile = Remote_View->currentItem()->text(0); |
864 | if( curFile !="../") { | 876 | if( curFile !="../") { |
865 | InputDialog *fileDlg; | 877 | InputDialog *fileDlg; |
866 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 878 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
867 | fileDlg->setInputText((const QString &)curFile); | 879 | fileDlg->setInputText((const QString &)curFile); |
868 | fileDlg->exec(); | 880 | fileDlg->exec(); |
869 | if( fileDlg->result() == 1 ) { | 881 | if( fileDlg->result() == 1 ) { |
870 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; | 882 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; |
871 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 883 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
872 | if( rename(oldname.latin1(), newName.latin1())== -1) | 884 | if( rename(oldname.latin1(), newName.latin1())== -1) |
873 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 885 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
874 | } | 886 | } |
875 | populateRemoteView(); | 887 | populateRemoteView(); |
876 | } | 888 | } |
877 | } | 889 | } |
878 | 890 | ||
879 | void AdvancedFm::switchToLocalTab() | 891 | void AdvancedFm::switchToLocalTab() |
880 | { | 892 | { |
881 | TabWidget->setCurrentPage(0); | 893 | TabWidget->setCurrentPage(0); |
882 | Local_View->setFocus(); | 894 | Local_View->setFocus(); |
883 | } | 895 | } |
884 | 896 | ||
885 | void AdvancedFm::switchToRemoteTab() | 897 | void AdvancedFm::switchToRemoteTab() |
886 | { | 898 | { |
887 | TabWidget->setCurrentPage(1); | 899 | TabWidget->setCurrentPage(1); |
888 | Remote_View->setFocus(); | 900 | Remote_View->setFocus(); |
889 | } | 901 | } |
890 | 902 | ||
891 | void AdvancedFm::readConfig() | 903 | void AdvancedFm::readConfig() |
892 | { | 904 | { |
893 | Config cfg("AdvancedFm"); | 905 | Config cfg("AdvancedFm"); |
894 | } | 906 | } |
895 | 907 | ||
896 | void AdvancedFm::writeConfig() | 908 | void AdvancedFm::writeConfig() |
897 | { | 909 | { |
898 | Config cfg("AdvancedFm"); | 910 | Config cfg("AdvancedFm"); |
899 | } | 911 | } |
900 | 912 | ||
901 | void AdvancedFm::currentPathComboChanged() | 913 | void AdvancedFm::currentPathComboChanged() |
902 | { | 914 | { |
903 | if (TabWidget->currentPageIndex() == 0) { | 915 | if (TabWidget->currentPageIndex() == 0) { |
904 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 916 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
905 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); | 917 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
906 | populateLocalView(); | 918 | populateLocalView(); |
907 | } else { | 919 | } else { |
908 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 920 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
909 | } | 921 | } |
910 | } | 922 | } |
911 | if (TabWidget->currentPageIndex() == 0) { | 923 | if (TabWidget->currentPageIndex() == 0) { |
912 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 924 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
913 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); | 925 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); |
914 | populateRemoteView(); | 926 | populateRemoteView(); |
915 | } else { | 927 | } else { |
916 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 928 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
917 | } | 929 | } |
918 | } | 930 | } |
919 | } | 931 | } |
920 | 932 | ||
921 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 933 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
922 | 934 | ||
923 | if (TabWidget->currentPageIndex() == 0) { | 935 | if (TabWidget->currentPageIndex() == 0) { |
924 | currentPathCombo->lineEdit()->setText( currentPath); | 936 | currentPathCombo->lineEdit()->setText( currentPath); |
925 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 937 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
926 | currentPathCombo->clear(); | 938 | currentPathCombo->clear(); |
927 | localDirPathStringList.prepend( currentPath ); | 939 | localDirPathStringList.prepend( currentPath ); |
928 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 940 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
929 | } | 941 | } |
930 | } else { | 942 | } else { |
931 | currentPathCombo->lineEdit()->setText( currentPath); | 943 | currentPathCombo->lineEdit()->setText( currentPath); |
932 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 944 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
933 | currentPathCombo->clear(); | 945 | currentPathCombo->clear(); |
934 | remoteDirPathStringList.prepend( currentPath ); | 946 | remoteDirPathStringList.prepend( currentPath ); |
935 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 947 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
936 | } | 948 | } |
937 | } | 949 | } |
938 | } | 950 | } |
939 | 951 | ||
940 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 952 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
941 | if (TabWidget->currentPageIndex() == 0) { | 953 | if (TabWidget->currentPageIndex() == 0) { |
942 | chdir( currentPath.latin1() ); | 954 | chdir( currentPath.latin1() ); |
943 | currentDir.cd( currentPath, TRUE); | 955 | currentDir.cd( currentPath, TRUE); |
944 | populateLocalView(); | 956 | populateLocalView(); |
945 | update(); | 957 | update(); |
946 | } else { | 958 | } else { |
947 | chdir( currentPath.latin1() ); | 959 | chdir( currentPath.latin1() ); |
948 | currentRemoteDir.cd( currentPath, TRUE); | 960 | currentRemoteDir.cd( currentPath, TRUE); |
949 | populateRemoteView(); | 961 | populateRemoteView(); |
950 | update(); | 962 | update(); |
951 | } | 963 | } |
952 | } | 964 | } |
953 | 965 | ||
954 | void AdvancedFm::filePerms() { | 966 | void AdvancedFm::filePerms() { |
955 | 967 | ||
956 | QStringList curFileList = getPath(); | 968 | QStringList curFileList = getPath(); |
957 | QString filePath; | 969 | QString filePath; |
958 | 970 | ||
959 | if (TabWidget->currentPageIndex() == 0) { | 971 | if (TabWidget->currentPageIndex() == 0) { |
960 | filePath = currentDir.canonicalPath()+"/"; | 972 | filePath = currentDir.canonicalPath()+"/"; |
961 | } else { | 973 | } else { |
962 | filePath= currentRemoteDir.canonicalPath()+"/"; | 974 | filePath= currentRemoteDir.canonicalPath()+"/"; |
963 | } | 975 | } |
964 | 976 | ||
965 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 977 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
966 | filePermissions *filePerm; | 978 | filePermissions *filePerm; |
967 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 979 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
968 | filePerm->showMaximized(); | 980 | filePerm->showMaximized(); |
969 | filePerm->exec(); | 981 | filePerm->exec(); |
970 | if( filePerm) | 982 | if( filePerm) |
971 | delete filePerm; | 983 | delete filePerm; |
972 | } | 984 | } |
973 | if (TabWidget->currentPageIndex() == 0) { | 985 | if (TabWidget->currentPageIndex() == 0) { |
974 | populateLocalView(); | 986 | populateLocalView(); |
975 | } else { | 987 | } else { |
976 | populateRemoteView(); | 988 | populateRemoteView(); |
977 | } | 989 | } |
978 | } | 990 | } |
979 | 991 | ||
980 | void AdvancedFm::doProperties() { | 992 | void AdvancedFm::doProperties() { |
981 | QStringList curFileList = getPath(); | 993 | QStringList curFileList = getPath(); |
982 | QString filePath; | 994 | QString filePath; |
983 | if (TabWidget->currentPageIndex() == 0) { | 995 | if (TabWidget->currentPageIndex() == 0) { |
984 | filePath = currentDir.canonicalPath()+"/"; | 996 | filePath = currentDir.canonicalPath()+"/"; |
985 | } else { | 997 | } else { |
986 | filePath= currentRemoteDir.canonicalPath()+"/"; | 998 | filePath= currentRemoteDir.canonicalPath()+"/"; |
987 | } | 999 | } |
988 | // qDebug("%d",curFileList.count()); | 1000 | // qDebug("%d",curFileList.count()); |
989 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1001 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
990 | qDebug((filePath+*it)); | 1002 | qDebug((filePath+*it)); |
991 | DocLnk lnk( (filePath+*it)); | 1003 | DocLnk lnk( (filePath+*it)); |
992 | LnkProperties prop( &lnk ); | 1004 | LnkProperties prop( &lnk ); |
993 | prop.showMaximized(); | 1005 | prop.showMaximized(); |
994 | prop.exec(); | 1006 | prop.exec(); |
995 | } | 1007 | } |
996 | } | 1008 | } |
997 | 1009 | ||
998 | QStringList AdvancedFm::getPath() { | 1010 | QStringList AdvancedFm::getPath() { |
999 | QStringList strList; | 1011 | QStringList strList; |
1000 | if (TabWidget->currentPageIndex() == 0) { | 1012 | if (TabWidget->currentPageIndex() == 0) { |
1001 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 1013 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
1002 | QListViewItemIterator it( Local_View ); | 1014 | QListViewItemIterator it( Local_View ); |
1003 | for ( ; it.current(); ++it ) { | 1015 | for ( ; it.current(); ++it ) { |
1004 | if ( it.current()->isSelected() ) { | 1016 | if ( it.current()->isSelected() ) { |
1005 | strList << it.current()->text(0); | 1017 | strList << it.current()->text(0); |
1006 | qDebug(it.current()->text(0)); | 1018 | qDebug(it.current()->text(0)); |
1007 | } | 1019 | } |
1008 | } | 1020 | } |
1009 | return strList; | 1021 | return strList; |
1010 | } else { | 1022 | } else { |
1011 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 1023 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
1012 | QListViewItemIterator it( Remote_View ); | 1024 | QListViewItemIterator it( Remote_View ); |
1013 | for ( ; it.current(); ++it ) { | 1025 | for ( ; it.current(); ++it ) { |
1014 | if ( it.current()->isSelected() ) { | 1026 | if ( it.current()->isSelected() ) { |
1015 | strList << it.current()->text(0); | 1027 | strList << it.current()->text(0); |
1016 | qDebug(it.current()->text(0)); | 1028 | qDebug(it.current()->text(0)); |
1017 | } | 1029 | } |
1018 | } | 1030 | } |
1019 | return strList; | 1031 | return strList; |
1020 | } | 1032 | } |
1021 | return ""; | 1033 | return ""; |
1022 | } | 1034 | } |
1023 | 1035 | ||
1024 | void AdvancedFm::homeButtonPushed() { | 1036 | void AdvancedFm::homeButtonPushed() { |
1025 | QString current = QDir::homeDirPath(); | 1037 | QString current = QDir::homeDirPath(); |
1026 | chdir( current.latin1() ); | 1038 | chdir( current.latin1() ); |
1027 | if (TabWidget->currentPageIndex() == 0) { | 1039 | if (TabWidget->currentPageIndex() == 0) { |
1028 | currentDir.cd( current, TRUE); | 1040 | currentDir.cd( current, TRUE); |
1029 | populateLocalView(); | 1041 | populateLocalView(); |
1030 | } else { | 1042 | } else { |
1031 | currentRemoteDir.cd( current, TRUE); | 1043 | currentRemoteDir.cd( current, TRUE); |
1032 | populateRemoteView(); | 1044 | populateRemoteView(); |
1033 | } | 1045 | } |
1034 | update(); | 1046 | update(); |
1035 | } | 1047 | } |
1036 | 1048 | ||
1037 | void AdvancedFm::docButtonPushed() { | 1049 | void AdvancedFm::docButtonPushed() { |
1038 | QString current = QPEApplication::documentDir(); | 1050 | QString current = QPEApplication::documentDir(); |
1039 | chdir( current.latin1() ); | 1051 | chdir( current.latin1() ); |
1040 | if (TabWidget->currentPageIndex() == 0) { | 1052 | if (TabWidget->currentPageIndex() == 0) { |
1041 | currentDir.cd( current, TRUE); | 1053 | currentDir.cd( current, TRUE); |
1042 | populateLocalView(); | 1054 | populateLocalView(); |
1043 | } else { | 1055 | } else { |
1044 | currentRemoteDir.cd( current, TRUE); | 1056 | currentRemoteDir.cd( current, TRUE); |
1045 | populateRemoteView(); | 1057 | populateRemoteView(); |
1046 | } | 1058 | } |
1047 | update(); | 1059 | update(); |
1048 | } | 1060 | } |
1049 | 1061 | ||
1050 | void AdvancedFm::SDButtonPushed() { | 1062 | void AdvancedFm::SDButtonPushed() { |
1051 | QString current = "/mnt/card"; | 1063 | QString current = "/mnt/card"; |
1052 | chdir( current.latin1() ); | 1064 | chdir( current.latin1() ); |
1053 | if (TabWidget->currentPageIndex() == 0) { | 1065 | if (TabWidget->currentPageIndex() == 0) { |
1054 | currentDir.cd( current, TRUE); | 1066 | currentDir.cd( current, TRUE); |
1055 | populateLocalView(); | 1067 | populateLocalView(); |
1056 | } else { | 1068 | } else { |
1057 | currentRemoteDir.cd( current, TRUE); | 1069 | currentRemoteDir.cd( current, TRUE); |
1058 | populateRemoteView(); | 1070 | populateRemoteView(); |
1059 | } | 1071 | } |
1060 | update(); | 1072 | update(); |
1061 | 1073 | ||
1062 | } | 1074 | } |
1063 | 1075 | ||
1064 | void AdvancedFm::CFButtonPushed() { | 1076 | void AdvancedFm::CFButtonPushed() { |
1065 | QString current = "/mnt/cf"; | 1077 | QString current; |
1066 | chdir( current.latin1() ); | 1078 | if(zaurusDevice) |
1067 | if (TabWidget->currentPageIndex() == 0) { | 1079 | current= "/mnt/cf"; |
1068 | currentDir.cd( current, TRUE); | 1080 | else |
1069 | populateLocalView(); | 1081 | current = "/mnt/hda"; |
1070 | } else { | 1082 | |
1071 | currentRemoteDir.cd( current, TRUE); | 1083 | chdir( current.latin1() ); |
1072 | populateRemoteView(); | 1084 | if (TabWidget->currentPageIndex() == 0) { |
1073 | } | 1085 | currentDir.cd( current, TRUE); |
1074 | update(); | 1086 | populateLocalView(); |
1087 | } else { | ||
1088 | currentRemoteDir.cd( current, TRUE); | ||
1089 | populateRemoteView(); | ||
1090 | } | ||
1091 | update(); | ||
1075 | 1092 | ||
1076 | } | 1093 | } |
1077 | 1094 | ||
1078 | 1095 | ||
1079 | void AdvancedFm::upDir() | 1096 | void AdvancedFm::upDir() |
1080 | { | 1097 | { |
1081 | if (TabWidget->currentPageIndex() == 0) { | 1098 | if (TabWidget->currentPageIndex() == 0) { |
1082 | QString current = currentDir.canonicalPath(); | 1099 | QString current = currentDir.canonicalPath(); |
1083 | QDir dir(current); | 1100 | QDir dir(current); |
1084 | dir.cdUp(); | 1101 | dir.cdUp(); |
1085 | current = dir.canonicalPath(); | 1102 | current = dir.canonicalPath(); |
1086 | chdir( current.latin1() ); | 1103 | chdir( current.latin1() ); |
1087 | currentDir.cd( current, TRUE); | 1104 | currentDir.cd( current, TRUE); |
1088 | populateLocalView(); | 1105 | populateLocalView(); |
1089 | update(); | 1106 | update(); |
1090 | } else { | 1107 | } else { |
1091 | QString current = currentRemoteDir.canonicalPath(); | 1108 | QString current = currentRemoteDir.canonicalPath(); |
1092 | QDir dir(current); | 1109 | QDir dir(current); |
1093 | dir.cdUp(); | 1110 | dir.cdUp(); |
1094 | current = dir.canonicalPath(); | 1111 | current = dir.canonicalPath(); |
1095 | chdir( current.latin1() ); | 1112 | chdir( current.latin1() ); |
1096 | currentRemoteDir.cd( current, TRUE); | 1113 | currentRemoteDir.cd( current, TRUE); |
1097 | populateRemoteView(); | 1114 | populateRemoteView(); |
1098 | update(); | 1115 | update(); |
1099 | } | 1116 | } |
1100 | } | 1117 | } |
1101 | 1118 | ||
1102 | void AdvancedFm::copy() | 1119 | void AdvancedFm::copy() |
1103 | { | 1120 | { |
1104 | qApp->processEvents(); | 1121 | qApp->processEvents(); |
1105 | QStringList curFileList = getPath(); | 1122 | QStringList curFileList = getPath(); |
1106 | if( curFileList.count() > 0) { | 1123 | if( curFileList.count() > 0) { |
1107 | QString curFile; | 1124 | QString curFile; |
1108 | if (TabWidget->currentPageIndex() == 0) { | 1125 | if (TabWidget->currentPageIndex() == 0) { |
1109 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1126 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1110 | 1127 | ||
1111 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1128 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1112 | qDebug("Destination file is "+destFile); | 1129 | qDebug("Destination file is "+destFile); |
1113 | 1130 | ||
1114 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1131 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1115 | qDebug("CurrentFile file is " + curFile); | 1132 | qDebug("CurrentFile file is " + curFile); |
1116 | 1133 | ||
1117 | QFile f(destFile); | 1134 | QFile f(destFile); |
1118 | if( f.exists()) { | 1135 | if( f.exists()) { |
1119 | switch ( QMessageBox::warning(this,tr("Delete"), | 1136 | switch ( QMessageBox::warning(this,tr("Delete"), |
1120 | destFile+tr(" already exists\nDo you really want to delete it?"), | 1137 | destFile+tr(" already exists\nDo you really want to delete it?"), |
1121 | tr("Yes"),tr("No"),0,0,1) ) { | 1138 | tr("Yes"),tr("No"),0,0,1) ) { |
1122 | case 0: | 1139 | case 0: |
1123 | f.remove(); | 1140 | f.remove(); |
1124 | break; | 1141 | break; |
1125 | case 1: | 1142 | case 1: |
1126 | return; | 1143 | return; |
1127 | break; | 1144 | break; |
1128 | }; | 1145 | }; |
1129 | } | 1146 | } |
1130 | if(!copyFile(destFile, curFile) ) { | 1147 | if(!copyFile(destFile, curFile) ) { |
1131 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 1148 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
1132 | qWarning("nothin doing"); | 1149 | qWarning("nothin doing"); |
1133 | } | 1150 | } |
1134 | } | 1151 | } |
1135 | populateRemoteView(); | 1152 | populateRemoteView(); |
1136 | TabWidget->setCurrentPage(1); | 1153 | TabWidget->setCurrentPage(1); |
1137 | 1154 | ||
1138 | } else { | 1155 | } else { |
1139 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1156 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1140 | 1157 | ||
1141 | QString destFile = currentDir.canonicalPath()+"/"+(*it); | 1158 | QString destFile = currentDir.canonicalPath()+"/"+(*it); |
1142 | qDebug("Destination file is "+destFile); | 1159 | qDebug("Destination file is "+destFile); |
1143 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1160 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1144 | qDebug("CurrentFile file is " + curFile); | 1161 | qDebug("CurrentFile file is " + curFile); |
1145 | 1162 | ||
1146 | QFile f(destFile); | 1163 | QFile f(destFile); |
1147 | if( f.exists()) { | 1164 | if( f.exists()) { |
1148 | switch ( QMessageBox::warning(this,tr("Delete"), | 1165 | switch ( QMessageBox::warning(this,tr("Delete"), |
1149 | destFile+tr(" already exists\nDo you really want to delete it?"), | 1166 | destFile+tr(" already exists\nDo you really want to delete it?"), |
1150 | tr("Yes"),tr("No"),0,0,1) ) { | 1167 | tr("Yes"),tr("No"),0,0,1) ) { |
1151 | case 0: | 1168 | case 0: |
1152 | f.remove(); | 1169 | f.remove(); |
1153 | break; | 1170 | break; |
1154 | case 1: | 1171 | case 1: |
1155 | return; | 1172 | return; |
1156 | break; | 1173 | break; |
1157 | }; | 1174 | }; |
1158 | } | 1175 | } |
1159 | if(!copyFile(destFile, curFile) ) { | 1176 | if(!copyFile(destFile, curFile) ) { |
1160 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); | 1177 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); |
1161 | 1178 | ||
1162 | qWarning("nothin doing"); | 1179 | qWarning("nothin doing"); |
1163 | } | 1180 | } |
1164 | } | 1181 | } |
1165 | populateLocalView(); | 1182 | populateLocalView(); |
1166 | TabWidget->setCurrentPage(0); | 1183 | TabWidget->setCurrentPage(0); |
1167 | } | 1184 | } |
1168 | 1185 | ||
1169 | } | 1186 | } |
1170 | } | 1187 | } |
1171 | 1188 | ||
1172 | void AdvancedFm::copyAs() { | 1189 | void AdvancedFm::copyAs() { |
1173 | qApp->processEvents(); | 1190 | qApp->processEvents(); |
1174 | 1191 | ||
1175 | QStringList curFileList = getPath(); | 1192 | QStringList curFileList = getPath(); |
1176 | QString curFile; | 1193 | QString curFile; |
1177 | InputDialog *fileDlg; | 1194 | InputDialog *fileDlg; |
1178 | if (TabWidget->currentPageIndex() == 0) { | 1195 | if (TabWidget->currentPageIndex() == 0) { |
1179 | qDebug("tab 1"); | 1196 | qDebug("tab 1"); |
1180 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1197 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1181 | QString destFile; | 1198 | QString destFile; |
1182 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1199 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1183 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 1200 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
1184 | 1201 | ||
1185 | fileDlg->setInputText((const QString &) destFile ); | 1202 | fileDlg->setInputText((const QString &) destFile ); |
1186 | fileDlg->exec(); | 1203 | fileDlg->exec(); |
1187 | 1204 | ||
1188 | if( fileDlg->result() == 1 ) { | 1205 | if( fileDlg->result() == 1 ) { |
1189 | QString filename = fileDlg->LineEdit1->text(); | 1206 | QString filename = fileDlg->LineEdit1->text(); |
1190 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; | 1207 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; |
1191 | 1208 | ||
1192 | QFile f(destFile); | 1209 | QFile f(destFile); |
1193 | if( f.exists()) { | 1210 | if( f.exists()) { |
1194 | switch (QMessageBox::warning(this,tr("Delete"), | 1211 | switch (QMessageBox::warning(this,tr("Delete"), |
1195 | destFile+tr(" already exists\nDo you really want to delete it?"), | 1212 | destFile+tr(" already exists\nDo you really want to delete it?"), |
1196 | tr("Yes"),tr("No"),0,0,1) ) { | 1213 | tr("Yes"),tr("No"),0,0,1) ) { |
1197 | case 0: | 1214 | case 0: |
1198 | f.remove(); | 1215 | f.remove(); |
1199 | break; | 1216 | break; |
1200 | case 1: | 1217 | case 1: |
1201 | return; | 1218 | return; |
1202 | break; | 1219 | break; |
1203 | }; | 1220 | }; |
1204 | } | 1221 | } |
1205 | if(!copyFile(destFile, curFile) ) { | 1222 | if(!copyFile(destFile, curFile) ) { |
1206 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); | 1223 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); |
1207 | qWarning("nothin doing"); | 1224 | qWarning("nothin doing"); |
1208 | } | 1225 | } |
1209 | } | 1226 | } |
1210 | delete fileDlg; | 1227 | delete fileDlg; |
1211 | 1228 | ||
1212 | } | 1229 | } |
1213 | populateRemoteView(); | 1230 | populateRemoteView(); |
1214 | TabWidget->setCurrentPage(1); | 1231 | TabWidget->setCurrentPage(1); |
1215 | 1232 | ||
1216 | } else { | 1233 | } else { |
1217 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1234 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1218 | 1235 | ||
1219 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1236 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1220 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 1237 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
1221 | 1238 | ||
1222 | QString destFile; | 1239 | QString destFile; |
1223 | fileDlg->setInputText((const QString &) destFile); | 1240 | fileDlg->setInputText((const QString &) destFile); |
1224 | fileDlg->exec(); | 1241 | fileDlg->exec(); |
1225 | 1242 | ||
1226 | if( fileDlg->result() == 1 ) { | 1243 | if( fileDlg->result() == 1 ) { |
1227 | QString filename = fileDlg->LineEdit1->text(); | 1244 | QString filename = fileDlg->LineEdit1->text(); |
1228 | destFile = currentDir.canonicalPath()+"/"+filename; | 1245 | destFile = currentDir.canonicalPath()+"/"+filename; |
1229 | 1246 | ||
1230 | QFile f( destFile); | 1247 | QFile f( destFile); |
1231 | if( f.exists()) { | 1248 | if( f.exists()) { |
1232 | switch ( QMessageBox::warning(this,tr("Delete"), | 1249 | switch ( QMessageBox::warning(this,tr("Delete"), |
1233 | destFile+tr(" already exists\nDo you really want to delete it?"), | 1250 | destFile+tr(" already exists\nDo you really want to delete it?"), |
1234 | tr("Yes"),tr("No"),0,0,1) ) { | 1251 | tr("Yes"),tr("No"),0,0,1) ) { |
1235 | case 0: | 1252 | case 0: |
1236 | f.remove(); | 1253 | f.remove(); |
1237 | break; | 1254 | break; |
1238 | case 1: | 1255 | case 1: |
1239 | return; | 1256 | return; |
1240 | break; | 1257 | break; |
1241 | }; | 1258 | }; |
1242 | } | 1259 | } |
1243 | if(!copyFile(destFile, curFile) ) { | 1260 | if(!copyFile(destFile, curFile) ) { |
1244 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); | 1261 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); |
1245 | qWarning("nothin doing"); | 1262 | qWarning("nothin doing"); |
1246 | } | 1263 | } |
1247 | 1264 | ||
1248 | } | 1265 | } |
1249 | delete fileDlg; | 1266 | delete fileDlg; |
1250 | 1267 | ||
1251 | } | 1268 | } |
1252 | populateLocalView(); | 1269 | populateLocalView(); |
1253 | TabWidget->setCurrentPage(0); | 1270 | TabWidget->setCurrentPage(0); |
1254 | } | 1271 | } |
1255 | } | 1272 | } |
1256 | 1273 | ||
1257 | void AdvancedFm::copySameDir() { | 1274 | void AdvancedFm::copySameDir() { |
1258 | qApp->processEvents(); | 1275 | qApp->processEvents(); |
1259 | QStringList curFileList = getPath(); | 1276 | QStringList curFileList = getPath(); |
1260 | QString curFile; | 1277 | QString curFile; |
1261 | InputDialog *fileDlg; | 1278 | InputDialog *fileDlg; |
1262 | 1279 | ||
1263 | if (TabWidget->currentPageIndex() == 0) { | 1280 | if (TabWidget->currentPageIndex() == 0) { |
1264 | 1281 | ||
1265 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1282 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1266 | 1283 | ||
1267 | QString destFile; | 1284 | QString destFile; |
1268 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1285 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1269 | 1286 | ||
1270 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | 1287 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); |
1271 | fileDlg->setInputText((const QString &) destFile ); | 1288 | fileDlg->setInputText((const QString &) destFile ); |
1272 | fileDlg->exec(); | 1289 | fileDlg->exec(); |
1273 | 1290 | ||
1274 | if( fileDlg->result() == 1 ) { | 1291 | if( fileDlg->result() == 1 ) { |
1275 | 1292 | ||
1276 | QString filename = fileDlg->LineEdit1->text(); | 1293 | QString filename = fileDlg->LineEdit1->text(); |
1277 | destFile = currentDir.canonicalPath()+"/"+filename; | 1294 | destFile = currentDir.canonicalPath()+"/"+filename; |
1278 | 1295 | ||
1279 | QFile f(destFile); | 1296 | QFile f(destFile); |
1280 | if( f.exists()) { | 1297 | if( f.exists()) { |
1281 | switch (QMessageBox::warning(this,tr("Delete"), | 1298 | switch (QMessageBox::warning(this,tr("Delete"), |
1282 | destFile+tr(" already exists\nDo you really want to delete it?"), | 1299 | destFile+tr(" already exists\nDo you really want to delete it?"), |
1283 | tr("Yes"),tr("No"),0,0,1) ) { | 1300 | tr("Yes"),tr("No"),0,0,1) ) { |
1284 | case 0: | 1301 | case 0: |
1285 | qDebug(""); | 1302 | qDebug(""); |
1286 | f.remove(); | 1303 | f.remove(); |
1287 | break; | 1304 | break; |
1288 | case 1: | 1305 | case 1: |
1289 | return; | 1306 | return; |
1290 | break; | 1307 | break; |
1291 | }; | 1308 | }; |
1292 | } | 1309 | } |
1293 | if(!copyFile(destFile, curFile) ) { | 1310 | if(!copyFile(destFile, curFile) ) { |
1294 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); | 1311 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); |
1295 | qWarning("nothin doing"); | 1312 | qWarning("nothin doing"); |
1296 | } | 1313 | } |
1297 | 1314 | ||
1298 | qDebug("copy "+curFile+" as "+destFile); | 1315 | qDebug("copy "+curFile+" as "+destFile); |
1299 | } | 1316 | } |
1300 | delete fileDlg; | 1317 | delete fileDlg; |
1301 | } | 1318 | } |
1302 | populateLocalView(); | 1319 | populateLocalView(); |
1303 | 1320 | ||
1304 | } else { | 1321 | } else { |
1305 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1322 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1306 | 1323 | ||
1307 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1324 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1308 | 1325 | ||
1309 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | 1326 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); |
1310 | QString destFile; | 1327 | QString destFile; |
1311 | fileDlg->setInputText((const QString &) destFile); | 1328 | fileDlg->setInputText((const QString &) destFile); |
1312 | fileDlg->exec(); | 1329 | fileDlg->exec(); |
1313 | if( fileDlg->result() == 1 ) { | 1330 | if( fileDlg->result() == 1 ) { |
1314 | QString filename = fileDlg->LineEdit1->text(); | 1331 | QString filename = fileDlg->LineEdit1->text(); |
1315 | 1332 | ||
1316 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; | 1333 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; |
1317 | 1334 | ||
1318 | QFile f(destFile); | 1335 | QFile f(destFile); |
1319 | if( f.exists()) { | 1336 | if( f.exists()) { |
1320 | switch ( QMessageBox::warning(this,tr("Delete"), | 1337 | switch ( QMessageBox::warning(this,tr("Delete"), |
1321 | destFile+tr(" already exists\nDo you really want to delete it?"), | 1338 | destFile+tr(" already exists\nDo you really want to delete it?"), |
1322 | tr("Yes"),tr("No"),0,0,1) ) { | 1339 | tr("Yes"),tr("No"),0,0,1) ) { |
1323 | case 0: | 1340 | case 0: |
1324 | f.remove(); | 1341 | f.remove(); |
1325 | break; | 1342 | break; |
1326 | case 1: | 1343 | case 1: |
1327 | return; | 1344 | return; |
1328 | break; | 1345 | break; |
1329 | }; | 1346 | }; |
1330 | } | 1347 | } |
1331 | if(!copyFile(destFile, curFile) ) { | 1348 | if(!copyFile(destFile, curFile) ) { |
1332 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); | 1349 | QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); |
1333 | qWarning("nothin doing"); | 1350 | qWarning("nothin doing"); |
1334 | } | 1351 | } |
1335 | qDebug("copy "+curFile+" as "+destFile); | 1352 | qDebug("copy "+curFile+" as "+destFile); |
1336 | } | 1353 | } |
1337 | delete fileDlg; | 1354 | delete fileDlg; |
1338 | } | 1355 | } |
1339 | populateRemoteView(); | 1356 | populateRemoteView(); |
1340 | } | 1357 | } |
1341 | } | 1358 | } |
1342 | 1359 | ||
1343 | void AdvancedFm::move() { | 1360 | void AdvancedFm::move() { |
1344 | qApp->processEvents(); | 1361 | qApp->processEvents(); |
1345 | 1362 | ||
1346 | QStringList curFileList = getPath(); | 1363 | QStringList curFileList = getPath(); |
1347 | if( curFileList.count() > 0) { | 1364 | if( curFileList.count() > 0) { |
1348 | QString curFile; | 1365 | QString curFile; |
1349 | QString destFile; | 1366 | QString destFile; |
1350 | 1367 | ||
1351 | if (TabWidget->currentPageIndex() == 0) { | 1368 | if (TabWidget->currentPageIndex() == 0) { |
1352 | 1369 | ||
1353 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1370 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1354 | 1371 | ||
1355 | QString destFile = currentRemoteDir.canonicalPath(); | 1372 | QString destFile = currentRemoteDir.canonicalPath(); |
1356 | 1373 | ||
1357 | if(destFile.right(1).find("/",0,TRUE) == -1) | 1374 | if(destFile.right(1).find("/",0,TRUE) == -1) |
1358 | destFile+="/"; | 1375 | destFile+="/"; |
1359 | destFile +=(*it); | 1376 | destFile +=(*it); |
1360 | curFile = currentDir.canonicalPath(); | 1377 | curFile = currentDir.canonicalPath(); |
1361 | 1378 | ||
1362 | qDebug("Destination file is "+destFile); | 1379 | qDebug("Destination file is "+destFile); |
1363 | 1380 | ||
1364 | if(curFile.right(1).find("/",0,TRUE) == -1) | 1381 | if(curFile.right(1).find("/",0,TRUE) == -1) |
1365 | curFile +="/"; | 1382 | curFile +="/"; |
1366 | 1383 | ||
1367 | curFile+=(*it); | 1384 | curFile+=(*it); |
1368 | qDebug("CurrentFile file is " + curFile); | 1385 | qDebug("CurrentFile file is " + curFile); |
1369 | 1386 | ||
1370 | QFile f( curFile); | 1387 | QFile f( curFile); |
1371 | if( f.exists()) { | 1388 | if( f.exists()) { |
1372 | if(!copyFile( destFile, curFile) ) { | 1389 | if(!copyFile( destFile, curFile) ) { |
1373 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); | 1390 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); |
1374 | return; | 1391 | return; |
1375 | } else | 1392 | } else |
1376 | QFile::remove(curFile); | 1393 | QFile::remove(curFile); |
1377 | } | 1394 | } |
1378 | } | 1395 | } |
1379 | 1396 | ||
1380 | TabWidget->setCurrentPage(1); | 1397 | TabWidget->setCurrentPage(1); |
1381 | 1398 | ||
1382 | } else { //view 2 | 1399 | } else { //view 2 |
1383 | 1400 | ||
1384 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1401 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1385 | 1402 | ||
1386 | QString destFile = currentDir.canonicalPath(); | 1403 | QString destFile = currentDir.canonicalPath(); |
1387 | 1404 | ||
1388 | if(destFile.right(1).find("/",0,TRUE) == -1) | 1405 | if(destFile.right(1).find("/",0,TRUE) == -1) |
1389 | destFile+="/"; | 1406 | destFile+="/"; |
1390 | 1407 | ||
1391 | destFile +=(*it); | 1408 | destFile +=(*it); |
1392 | 1409 | ||
1393 | qDebug("Destination file is "+destFile); | 1410 | qDebug("Destination file is "+destFile); |
1394 | 1411 | ||
1395 | curFile = currentRemoteDir.canonicalPath(); | 1412 | curFile = currentRemoteDir.canonicalPath(); |
1396 | 1413 | ||
1397 | if(curFile.right(1).find("/",0,TRUE) == -1) | 1414 | if(curFile.right(1).find("/",0,TRUE) == -1) |
1398 | curFile +="/"; | 1415 | curFile +="/"; |
1399 | curFile+=(*it); | 1416 | curFile+=(*it); |
1400 | qDebug("CurrentFile file is " + curFile); | 1417 | qDebug("CurrentFile file is " + curFile); |
1401 | 1418 | ||
1402 | QFile f( curFile); | 1419 | QFile f( curFile); |
1403 | if( f.exists()) { | 1420 | if( f.exists()) { |
1404 | if(!copyFile( destFile, curFile) ) { | 1421 | if(!copyFile( destFile, curFile) ) { |
1405 | QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile); | 1422 | QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile); |
1406 | return; | 1423 | return; |
1407 | } else | 1424 | } else |
1408 | QFile::remove( curFile); | 1425 | QFile::remove( curFile); |
1409 | } | 1426 | } |
1410 | TabWidget->setCurrentPage(0); | 1427 | TabWidget->setCurrentPage(0); |
1411 | } | 1428 | } |
1412 | } | 1429 | } |
1413 | populateRemoteView(); | 1430 | populateRemoteView(); |
1414 | populateLocalView(); | 1431 | populateLocalView(); |
1415 | } | 1432 | } |
1416 | } | 1433 | } |
1417 | 1434 | ||
1418 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) { | 1435 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) { |
1419 | char bf[ 50000 ]; | 1436 | char bf[ 50000 ]; |
1420 | int bytesRead; | 1437 | int bytesRead; |
1421 | bool success = TRUE; | 1438 | bool success = TRUE; |
1422 | struct stat status; | 1439 | struct stat status; |
1423 | 1440 | ||
1424 | QFile s( src ); | 1441 | QFile s( src ); |
1425 | QFile d( dest ); | 1442 | QFile d( dest ); |
1426 | 1443 | ||
1427 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { | 1444 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { |
1428 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { | 1445 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { |
1429 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ | 1446 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ |
1430 | success = FALSE; | 1447 | success = FALSE; |
1431 | break; | 1448 | break; |
1432 | } | 1449 | } |
1433 | } | 1450 | } |
1434 | if( success && (bytesRead > 0) ){ | 1451 | if( success && (bytesRead > 0) ){ |
1435 | d.writeBlock( bf, bytesRead ); | 1452 | d.writeBlock( bf, bytesRead ); |
1436 | } | 1453 | } |
1437 | } else { | 1454 | } else { |
1438 | success = FALSE; | 1455 | success = FALSE; |
1439 | } | 1456 | } |
1440 | 1457 | ||
1441 | // Set file permissions | 1458 | // Set file permissions |
1442 | if( stat( (const char *) src, &status ) == 0 ){ | 1459 | if( stat( (const char *) src, &status ) == 0 ){ |
1443 | chmod( (const char *) dest, status.st_mode ); | 1460 | chmod( (const char *) dest, status.st_mode ); |
1444 | } | 1461 | } |
1445 | 1462 | ||
1446 | return success; | 1463 | return success; |
1447 | } | 1464 | } |
1448 | 1465 | ||
1449 | void AdvancedFm::runCommand() { | 1466 | void AdvancedFm::runCommand() { |
1450 | QString curFile; | 1467 | QString curFile; |
1451 | if (TabWidget->currentPageIndex() == 0) { | 1468 | if (TabWidget->currentPageIndex() == 0) { |
1452 | if( Local_View->currentItem()) | 1469 | if( Local_View->currentItem()) |
1453 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); | 1470 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); |
1454 | } else { | 1471 | } else { |
1455 | if(Remote_View->currentItem()) | 1472 | if(Remote_View->currentItem()) |
1456 | curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); | 1473 | curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); |
1457 | } | 1474 | } |
1458 | 1475 | ||
1459 | InputDialog *fileDlg; | 1476 | InputDialog *fileDlg; |
1460 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 1477 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
1461 | fileDlg->setInputText(curFile); | 1478 | fileDlg->setInputText(curFile); |
1462 | fileDlg->exec(); | 1479 | fileDlg->exec(); |
1463 | QString command; | 1480 | QString command; |
1464 | if( fileDlg->result() == 1 ) { | 1481 | if( fileDlg->result() == 1 ) { |
1465 | command = fileDlg->LineEdit1->text(); | 1482 | command = fileDlg->LineEdit1->text(); |
1466 | 1483 | ||
1467 | Output *outDlg; | 1484 | Output *outDlg; |
1468 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1485 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1469 | outDlg->showMaximized(); | 1486 | outDlg->showMaximized(); |
1470 | outDlg->show(); | 1487 | outDlg->show(); |
1471 | qApp->processEvents(); | 1488 | qApp->processEvents(); |
1472 | FILE *fp; | 1489 | FILE *fp; |
1473 | char line[130]; | 1490 | char line[130]; |
1474 | sleep(1); | 1491 | sleep(1); |
1475 | command +=" 2>&1"; | 1492 | command +=" 2>&1"; |
1476 | fp = popen( (const char *) command, "r"); | 1493 | fp = popen( (const char *) command, "r"); |
1477 | if ( !fp ) { | 1494 | if ( !fp ) { |
1478 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 1495 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
1479 | QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); | 1496 | QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); |
1480 | pclose(fp); | 1497 | pclose(fp); |
1481 | return; | 1498 | return; |
1482 | } else { | 1499 | } else { |
1483 | while ( fgets( line, sizeof line, fp)) { | 1500 | while ( fgets( line, sizeof line, fp)) { |
1484 | QString lineStr = line; | 1501 | QString lineStr = line; |
1485 | lineStr=lineStr.left(lineStr.length()-1); | 1502 | lineStr=lineStr.left(lineStr.length()-1); |
1486 | outDlg->OutputEdit->append(lineStr); | 1503 | outDlg->OutputEdit->append(lineStr); |
1487 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 1504 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
1488 | } | 1505 | } |
1489 | } | 1506 | } |
1490 | pclose(fp); | 1507 | pclose(fp); |
1491 | 1508 | ||
1492 | } | 1509 | } |
1493 | } | 1510 | } |
1494 | 1511 | ||
1495 | void AdvancedFm::runCommandStd() { | 1512 | void AdvancedFm::runCommandStd() { |
1496 | QString curFile; | 1513 | QString curFile; |
1497 | if (TabWidget->currentPageIndex() == 0) { | 1514 | if (TabWidget->currentPageIndex() == 0) { |
1498 | if( Local_View->currentItem()) | 1515 | if( Local_View->currentItem()) |
1499 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); | 1516 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); |
1500 | } else { | 1517 | } else { |
1501 | if(Remote_View->currentItem()) | 1518 | if(Remote_View->currentItem()) |
1502 | curFile = currentRemoteDir.canonicalPath() +"/"+ Remote_View->currentItem()->text(0); | 1519 | curFile = currentRemoteDir.canonicalPath() +"/"+ Remote_View->currentItem()->text(0); |
1503 | } | 1520 | } |
1504 | 1521 | ||
1505 | InputDialog *fileDlg; | 1522 | InputDialog *fileDlg; |
1506 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 1523 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
1507 | fileDlg->setInputText(curFile); | 1524 | fileDlg->setInputText(curFile); |
1508 | fileDlg->exec(); | 1525 | fileDlg->exec(); |
1509 | QString command; | 1526 | QString command; |
1510 | if( fileDlg->result() == 1 ) { | 1527 | if( fileDlg->result() == 1 ) { |
1511 | qApp->processEvents(); | 1528 | qApp->processEvents(); |
1512 | command = fileDlg->LineEdit1->text() + " &"; | 1529 | command = fileDlg->LineEdit1->text() + " &"; |
1513 | system(command.latin1()); | 1530 | system(command.latin1()); |
1514 | } | 1531 | } |
1515 | } | 1532 | } |
1516 | 1533 | ||
1517 | void AdvancedFm::fileStatus() { | 1534 | void AdvancedFm::fileStatus() { |
1518 | QString curFile; | 1535 | QString curFile; |
1519 | if (TabWidget->currentPageIndex() == 0) { | 1536 | if (TabWidget->currentPageIndex() == 0) { |
1520 | curFile = Local_View->currentItem()->text(0); | 1537 | curFile = Local_View->currentItem()->text(0); |
1521 | } else { | 1538 | } else { |
1522 | curFile = Remote_View->currentItem()->text(0); | 1539 | curFile = Remote_View->currentItem()->text(0); |
1523 | } | 1540 | } |
1524 | QString command = " stat -l "+ curFile +" 2>&1"; | 1541 | QString command = " stat -l "+ curFile +" 2>&1"; |
1525 | Output *outDlg; | 1542 | Output *outDlg; |
1526 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1543 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1527 | outDlg->showMaximized(); | 1544 | outDlg->showMaximized(); |
1528 | outDlg->show(); | 1545 | outDlg->show(); |
1529 | qApp->processEvents(); | 1546 | qApp->processEvents(); |
1530 | FILE *fp; | 1547 | FILE *fp; |
1531 | char line[130]; | 1548 | char line[130]; |
1532 | sleep(1); | 1549 | sleep(1); |
1533 | fp = popen( (const char *) command, "r"); | 1550 | fp = popen( (const char *) command, "r"); |
1534 | if ( !fp ) { | 1551 | if ( !fp ) { |
1535 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 1552 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
1536 | QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); | 1553 | QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); |
1537 | pclose(fp); | 1554 | pclose(fp); |
1538 | return; | 1555 | return; |
1539 | } else { | 1556 | } else { |
1540 | while ( fgets( line, sizeof line, fp)) { | 1557 | while ( fgets( line, sizeof line, fp)) { |
1541 | outDlg->OutputEdit->append(line); | 1558 | outDlg->OutputEdit->append(line); |
1542 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 1559 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
1543 | 1560 | ||
1544 | } | 1561 | } |
1545 | 1562 | ||
1546 | } | 1563 | } |
1547 | pclose(fp); | 1564 | pclose(fp); |
1548 | } | 1565 | } |
1549 | 1566 | ||
1550 | void AdvancedFm::mkDir() { | 1567 | void AdvancedFm::mkDir() { |
1551 | if (TabWidget->currentPageIndex() == 0) | 1568 | if (TabWidget->currentPageIndex() == 0) |
1552 | localMakDir(); | 1569 | localMakDir(); |
1553 | else | 1570 | else |
1554 | remoteMakDir(); | 1571 | remoteMakDir(); |
1555 | 1572 | ||
1556 | } | 1573 | } |
1557 | 1574 | ||
1558 | void AdvancedFm::rn() { | 1575 | void AdvancedFm::rn() { |
1559 | if (TabWidget->currentPageIndex() == 0) | 1576 | if (TabWidget->currentPageIndex() == 0) |
1560 | localRename(); | 1577 | localRename(); |
1561 | else | 1578 | else |
1562 | remoteRename(); | 1579 | remoteRename(); |
1563 | 1580 | ||
1564 | } | 1581 | } |
1565 | 1582 | ||
1566 | void AdvancedFm::del() { | 1583 | void AdvancedFm::del() { |
1567 | if (TabWidget->currentPageIndex() == 0) | 1584 | if (TabWidget->currentPageIndex() == 0) |
1568 | localDelete(); | 1585 | localDelete(); |
1569 | else | 1586 | else |
1570 | remoteDelete(); | 1587 | remoteDelete(); |
1571 | } | 1588 | } |
1572 | 1589 | ||
1573 | void AdvancedFm::doAbout() { | 1590 | void AdvancedFm::doAbout() { |
1574 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" | 1591 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" |
1575 | "is copyright 2002 by\n" | 1592 | "is copyright 2002 by\n" |
1576 | "L.J.Potter<llornkcor@handhelds.org>\n" | 1593 | "L.J.Potter<llornkcor@handhelds.org>\n" |
1577 | "and is licensed by the GPL")); | 1594 | "and is licensed by the GPL")); |
1578 | } | 1595 | } |
1579 | 1596 | ||
1580 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) | 1597 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) |
1581 | { | 1598 | { |
1582 | if( TabWidget->hasFocus()) | 1599 | if( TabWidget->hasFocus()) |
1583 | switch ( e->key() ) { | 1600 | switch ( e->key() ) { |
1584 | case Key_Delete: | 1601 | case Key_Delete: |
1585 | del(); | 1602 | del(); |
1586 | break; | 1603 | break; |
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 78f0bad..5b714ae 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -1,143 +1,144 @@ | |||
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 doLocalCd(); | 70 | void doLocalCd(); |
71 | void doRemoteCd(); | 71 | void doRemoteCd(); |
72 | // void copy(); | 72 | // void copy(); |
73 | void mkDir(); | 73 | void mkDir(); |
74 | void del(); | 74 | void del(); |
75 | void rn(); | 75 | void rn(); |
76 | void populateLocalView(); | 76 | void populateLocalView(); |
77 | void populateRemoteView(); | 77 | void populateRemoteView(); |
78 | void showHidden(); | 78 | void showHidden(); |
79 | void showRemoteHidden(); | 79 | void showRemoteHidden(); |
80 | void writeConfig(); | 80 | void writeConfig(); |
81 | void readConfig(); | 81 | void readConfig(); |
82 | void localListClicked(QListViewItem *); | 82 | void localListClicked(QListViewItem *); |
83 | void remoteListClicked(QListViewItem *); | 83 | void remoteListClicked(QListViewItem *); |
84 | void localListPressed( int, QListViewItem *, const QPoint&, int); | 84 | void localListPressed( int, QListViewItem *, const QPoint&, int); |
85 | void remoteListPressed( int, QListViewItem *, const QPoint&, int); | 85 | void remoteListPressed( int, QListViewItem *, const QPoint&, int); |
86 | void localMakDir(); | 86 | void localMakDir(); |
87 | void localDelete(); | 87 | void localDelete(); |
88 | void remoteMakDir(); | 88 | void remoteMakDir(); |
89 | void remoteDelete(); | 89 | void remoteDelete(); |
90 | /* bool remoteDirList(const QString &); */ | 90 | /* bool remoteDirList(const QString &); */ |
91 | /* bool remoteChDir(const QString &); */ | 91 | /* bool remoteChDir(const QString &); */ |
92 | void tabChanged(QWidget*); | 92 | void tabChanged(QWidget*); |
93 | void cleanUp(); | 93 | void cleanUp(); |
94 | void remoteRename(); | 94 | void remoteRename(); |
95 | void localRename(); | 95 | void localRename(); |
96 | void runThis(); | 96 | void runThis(); |
97 | void runText(); | 97 | void runText(); |
98 | void filePerms(); | 98 | void filePerms(); |
99 | void doProperties(); | 99 | void doProperties(); |
100 | void runCommand(); | 100 | void runCommand(); |
101 | void runCommandStd(); | 101 | void runCommandStd(); |
102 | QStringList getPath(); | 102 | QStringList getPath(); |
103 | void mkSym(); | 103 | void mkSym(); |
104 | void switchToLocalTab(); | 104 | void switchToLocalTab(); |
105 | void switchToRemoteTab(); | 105 | void switchToRemoteTab(); |
106 | 106 | ||
107 | protected: | 107 | protected: |
108 | bool zaurusDevice; | ||
108 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 109 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
109 | QStringList remoteDirPathStringList, localDirPathStringList; | 110 | QStringList remoteDirPathStringList, localDirPathStringList; |
110 | 111 | ||
111 | void keyReleaseEvent( QKeyEvent *); | 112 | void keyReleaseEvent( QKeyEvent *); |
112 | QString getFileSystemType(const QString &); | 113 | QString getFileSystemType(const QString &); |
113 | QString getDiskSpace(const QString &); | 114 | QString getDiskSpace(const QString &); |
114 | 115 | ||
115 | void parsetab(const QString &fileName); | 116 | void parsetab(const QString &fileName); |
116 | QString checkDiskSpace(const QString &); | 117 | QString checkDiskSpace(const QString &); |
117 | protected slots: | 118 | protected slots: |
118 | void showFileMenu(); | 119 | void showFileMenu(); |
119 | void cancelMenuTimer(); | 120 | void cancelMenuTimer(); |
120 | void homeButtonPushed(); | 121 | void homeButtonPushed(); |
121 | void docButtonPushed(); | 122 | void docButtonPushed(); |
122 | void SDButtonPushed(); | 123 | void SDButtonPushed(); |
123 | void CFButtonPushed(); | 124 | void CFButtonPushed(); |
124 | void QPEButtonPushed(); | 125 | void QPEButtonPushed(); |
125 | void upDir(); | 126 | void upDir(); |
126 | void currentPathComboChanged(); | 127 | void currentPathComboChanged(); |
127 | void copy(); | 128 | void copy(); |
128 | void copyAs(); | 129 | void copyAs(); |
129 | void copySameDir(); | 130 | void copySameDir(); |
130 | void currentPathComboActivated(const QString &); | 131 | void currentPathComboActivated(const QString &); |
131 | void fillCombo(const QString &); | 132 | void fillCombo(const QString &); |
132 | bool copyFile( const QString & , const QString & ); | 133 | bool copyFile( const QString & , const QString & ); |
133 | void move(); | 134 | void move(); |
134 | void fileStatus(); | 135 | void fileStatus(); |
135 | void doAbout(); | 136 | void doAbout(); |
136 | void doBeam(); | 137 | void doBeam(); |
137 | void fileBeamFinished( Ir *); | 138 | void fileBeamFinished( Ir *); |
138 | 139 | ||
139 | private: | 140 | private: |
140 | QTimer menuTimer; | 141 | QTimer menuTimer; |
141 | }; | 142 | }; |
142 | 143 | ||
143 | #endif // ADVANCEDFM_H | 144 | #endif // ADVANCEDFM_H |