author | llornkcor <llornkcor> | 2002-04-25 18:23:16 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-25 18:23:16 (UTC) |
commit | a4e419f939f4f4237b56e117edaa7dc0d93dd396 (patch) (unidiff) | |
tree | 3d6914ab34e11e9d4de1d2c4c7e56096c1845d6c | |
parent | 42cb3d115a46637f4c46f4b3f3821075a2c18f02 (diff) | |
download | opie-a4e419f939f4f4237b56e117edaa7dc0d93dd396.zip opie-a4e419f939f4f4237b56e117edaa7dc0d93dd396.tar.gz opie-a4e419f939f4f4237b56e117edaa7dc0d93dd396.tar.bz2 |
changed bool to reflect new gizmo thingymabobber
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 4289fcf..5f47b9b 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,1295 +1,1295 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | AdvancedFm.cpp | 2 | AdvancedFm.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #define DEVELOPERS_VERSION | 12 | #define DEVELOPERS_VERSION |
13 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties | 13 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties |
14 | 14 | ||
15 | #include "advancedfm.h" | 15 | #include "advancedfm.h" |
16 | #include "inputDialog.h" | 16 | #include "inputDialog.h" |
17 | #include "filePermissions.h" | 17 | #include "filePermissions.h" |
18 | #include "output.h" | 18 | #include "output.h" |
19 | 19 | ||
20 | #include <qpe/lnkproperties.h> | 20 | #include <qpe/lnkproperties.h> |
21 | #include <qpe/filemanager.h> | 21 | #include <qpe/filemanager.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/qpemenubar.h> | 23 | #include <qpe/qpemenubar.h> |
24 | #include <qpe/qpetoolbar.h> | 24 | #include <qpe/qpetoolbar.h> |
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qcopenvelope_qws.h> | 27 | #include <qpe/qcopenvelope_qws.h> |
28 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
29 | #include <qpe/mimetype.h> | 29 | #include <qpe/mimetype.h> |
30 | #include <qpe/applnk.h> | 30 | #include <qpe/applnk.h> |
31 | 31 | ||
32 | //#include <opie/ofileselector.h> | 32 | //#include <opie/ofileselector.h> |
33 | #include <qmultilineedit.h> | 33 | #include <qmultilineedit.h> |
34 | 34 | ||
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | #include <qpushbutton.h> | 36 | #include <qpushbutton.h> |
37 | #include <qtoolbutton.h> | 37 | #include <qtoolbutton.h> |
38 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
39 | #include <qdir.h> | 39 | #include <qdir.h> |
40 | #include <qfile.h> | 40 | #include <qfile.h> |
41 | #include <qstring.h> | 41 | #include <qstring.h> |
42 | #include <qcombobox.h> | 42 | #include <qcombobox.h> |
43 | #include <qpopupmenu.h> | 43 | #include <qpopupmenu.h> |
44 | #include <qlistview.h> | 44 | #include <qlistview.h> |
45 | #include <qmainwindow.h> | 45 | #include <qmainwindow.h> |
46 | #include <qlabel.h> | 46 | #include <qlabel.h> |
47 | #include <qprogressbar.h> | 47 | #include <qprogressbar.h> |
48 | #include <qspinbox.h> | 48 | #include <qspinbox.h> |
49 | #include <qtabwidget.h> | 49 | #include <qtabwidget.h> |
50 | #include <qwidget.h> | 50 | #include <qwidget.h> |
51 | #include <qlayout.h> | 51 | #include <qlayout.h> |
52 | #include <qimage.h> | 52 | #include <qimage.h> |
53 | #include <qpixmap.h> | 53 | #include <qpixmap.h> |
54 | #include <qmessagebox.h> | 54 | #include <qmessagebox.h> |
55 | #include <qlineedit.h> | 55 | #include <qlineedit.h> |
56 | #include <qregexp.h> | 56 | #include <qregexp.h> |
57 | 57 | ||
58 | #include <unistd.h> | 58 | #include <unistd.h> |
59 | #include <stdlib.h> | 59 | #include <stdlib.h> |
60 | #include <sys/stat.h> | 60 | #include <sys/stat.h> |
61 | #include <dirent.h> | 61 | #include <dirent.h> |
62 | #include <stdio.h> | 62 | #include <stdio.h> |
63 | #include <time.h> | 63 | #include <time.h> |
64 | #include <fcntl.h> | 64 | #include <fcntl.h> |
65 | 65 | ||
66 | AdvancedFm::AdvancedFm( ) | 66 | AdvancedFm::AdvancedFm( ) |
67 | : QMainWindow( ) | 67 | : QMainWindow( ) |
68 | { | 68 | { |
69 | setCaption( tr( "AdvancedFm" ) ); | 69 | setCaption( tr( "AdvancedFm" ) ); |
70 | 70 | ||
71 | QGridLayout *layout = new QGridLayout( this ); | 71 | QGridLayout *layout = new QGridLayout( this ); |
72 | layout->setSpacing( 2); | 72 | layout->setSpacing( 2); |
73 | layout->setMargin( 2); | 73 | layout->setMargin( 2); |
74 | 74 | ||
75 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 75 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
76 | 76 | ||
77 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 77 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
78 | // fileMenu = new QPopupMenu( this ); | 78 | // fileMenu = new QPopupMenu( this ); |
79 | fileMenu = new QPopupMenu( this ); | 79 | fileMenu = new QPopupMenu( this ); |
80 | viewMenu = new QPopupMenu( this ); | 80 | viewMenu = new QPopupMenu( this ); |
81 | 81 | ||
82 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); | 82 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); |
83 | 83 | ||
84 | menuBar->insertItem( tr( "File" ), fileMenu); | 84 | menuBar->insertItem( tr( "File" ), fileMenu); |
85 | menuBar->insertItem( tr( "View" ), viewMenu); | 85 | menuBar->insertItem( tr( "View" ), viewMenu); |
86 | 86 | ||
87 | cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); | 87 | cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); |
88 | cfButton ->setFixedSize( QSize( 20, 20 ) ); | 88 | cfButton ->setFixedSize( QSize( 20, 20 ) ); |
89 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); | 89 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); |
90 | cfButton->setFlat(TRUE); | 90 | cfButton->setFlat(TRUE); |
91 | layout->addMultiCellWidget( cfButton , 0, 0, 2, 2); | 91 | layout->addMultiCellWidget( cfButton , 0, 0, 2, 2); |
92 | 92 | ||
93 | sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); | 93 | sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); |
94 | sdButton->setFixedSize( QSize( 20, 20 ) ); | 94 | sdButton->setFixedSize( QSize( 20, 20 ) ); |
95 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); | 95 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); |
96 | sdButton->setFlat(TRUE); | 96 | sdButton->setFlat(TRUE); |
97 | layout->addMultiCellWidget( sdButton , 0, 0, 3, 3); | 97 | layout->addMultiCellWidget( sdButton , 0, 0, 3, 3); |
98 | 98 | ||
99 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); | 99 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); |
100 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 100 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
101 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 101 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
102 | cdUpButton ->setFlat(TRUE); | 102 | cdUpButton ->setFlat(TRUE); |
103 | layout->addMultiCellWidget( cdUpButton , 0, 0, 4, 4); | 103 | layout->addMultiCellWidget( cdUpButton , 0, 0, 4, 4); |
104 | 104 | ||
105 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); | 105 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); |
106 | docButton->setFixedSize( QSize( 20, 20 ) ); | 106 | docButton->setFixedSize( QSize( 20, 20 ) ); |
107 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 107 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
108 | docButton->setFlat(TRUE); | 108 | docButton->setFlat(TRUE); |
109 | layout->addMultiCellWidget( docButton, 0, 0, 5, 5); | 109 | layout->addMultiCellWidget( docButton, 0, 0, 5, 5); |
110 | 110 | ||
111 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); | 111 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); |
112 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 112 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
113 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 113 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
114 | homeButton->setFlat(TRUE); | 114 | homeButton->setFlat(TRUE); |
115 | layout->addMultiCellWidget( homeButton, 0, 0, 6, 6); | 115 | layout->addMultiCellWidget( homeButton, 0, 0, 6, 6); |
116 | // fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 116 | // fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
117 | // fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 117 | // fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
118 | // fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 118 | // fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
119 | 119 | ||
120 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 120 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
121 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 121 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
122 | fileMenu->insertSeparator(); | 122 | fileMenu->insertSeparator(); |
123 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 123 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
124 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 124 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
125 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 125 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
126 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 126 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
127 | fileMenu->insertSeparator(); | 127 | fileMenu->insertSeparator(); |
128 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 128 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
129 | fileMenu->setCheckable(TRUE); | 129 | fileMenu->setCheckable(TRUE); |
130 | 130 | ||
131 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 131 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
132 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 132 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
133 | viewMenu->insertSeparator(); | 133 | viewMenu->insertSeparator(); |
134 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 134 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
135 | viewMenu->setCheckable(TRUE); | 135 | viewMenu->setCheckable(TRUE); |
136 | 136 | ||
137 | TabWidget = new QTabWidget( this, "TabWidget" ); | 137 | TabWidget = new QTabWidget( this, "TabWidget" ); |
138 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 6); | 138 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 6); |
139 | 139 | ||
140 | tab = new QWidget( TabWidget, "tab" ); | 140 | tab = new QWidget( TabWidget, "tab" ); |
141 | tabLayout = new QGridLayout( tab ); | 141 | tabLayout = new QGridLayout( tab ); |
142 | tabLayout->setSpacing( 2); | 142 | tabLayout->setSpacing( 2); |
143 | tabLayout->setMargin( 2); | 143 | tabLayout->setMargin( 2); |
144 | 144 | ||
145 | Local_View = new QListView( tab, "Local_View" ); | 145 | Local_View = new QListView( tab, "Local_View" ); |
146 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 146 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
147 | Local_View->addColumn( tr("File"),130); | 147 | Local_View->addColumn( tr("File"),130); |
148 | Local_View->addColumn( tr("Size"),-1); | 148 | Local_View->addColumn( tr("Size"),-1); |
149 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 149 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
150 | Local_View->addColumn( tr("Date"),-1); | 150 | Local_View->addColumn( tr("Date"),-1); |
151 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 151 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
152 | Local_View->setAllColumnsShowFocus(TRUE); | 152 | Local_View->setAllColumnsShowFocus(TRUE); |
153 | // Local_View->setMultiSelection( TRUE ); | 153 | // Local_View->setMultiSelection( TRUE ); |
154 | // Local_View->setSelectionMode(QListView::Extended); | 154 | // Local_View->setSelectionMode(QListView::Extended); |
155 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 155 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
156 | 156 | ||
157 | tabLayout->addWidget( Local_View, 0, 0 ); | 157 | tabLayout->addWidget( Local_View, 0, 0 ); |
158 | 158 | ||
159 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 159 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
160 | this,SLOT( localListClicked(QListViewItem *)) ); | 160 | this,SLOT( localListClicked(QListViewItem *)) ); |
161 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 161 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
162 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); | 162 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); |
163 | 163 | ||
164 | TabWidget->insertTab( tab, tr("1")); | 164 | TabWidget->insertTab( tab, tr("1")); |
165 | 165 | ||
166 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 166 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
167 | tabLayout_2 = new QGridLayout( tab_2 ); | 167 | tabLayout_2 = new QGridLayout( tab_2 ); |
168 | tabLayout_2->setSpacing( 2); | 168 | tabLayout_2->setSpacing( 2); |
169 | tabLayout_2->setMargin( 2); | 169 | tabLayout_2->setMargin( 2); |
170 | 170 | ||
171 | Remote_View = new QListView( tab_2, "Remote_View" ); | 171 | Remote_View = new QListView( tab_2, "Remote_View" ); |
172 | Remote_View->addColumn( tr("File"),130); | 172 | Remote_View->addColumn( tr("File"),130); |
173 | Remote_View->addColumn( tr("Size"),-1); | 173 | Remote_View->addColumn( tr("Size"),-1); |
174 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 174 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
175 | Remote_View->addColumn( tr("Date"),-1); | 175 | Remote_View->addColumn( tr("Date"),-1); |
176 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 176 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
177 | Remote_View->setAllColumnsShowFocus(TRUE); | 177 | Remote_View->setAllColumnsShowFocus(TRUE); |
178 | // Remote_View->setMultiSelection( TRUE ); | 178 | // Remote_View->setMultiSelection( TRUE ); |
179 | // Remote_View->setSelectionMode(QListView::Extended); | 179 | // Remote_View->setSelectionMode(QListView::Extended); |
180 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 180 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
181 | 181 | ||
182 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 182 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
183 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 183 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
184 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 184 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
185 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 185 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
186 | 186 | ||
187 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 187 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
188 | 188 | ||
189 | TabWidget->insertTab( tab_2, tr( "2")); | 189 | TabWidget->insertTab( tab_2, tr( "2")); |
190 | 190 | ||
191 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 191 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
192 | this,SLOT(tabChanged(QWidget*))); | 192 | this,SLOT(tabChanged(QWidget*))); |
193 | 193 | ||
194 | // tab_3 = new QWidget( TabWidget, "tab_3" ); | 194 | // tab_3 = new QWidget( TabWidget, "tab_3" ); |
195 | // tabLayout_3 = new QGridLayout( tab_3 ); | 195 | // tabLayout_3 = new QGridLayout( tab_3 ); |
196 | // tabLayout_3->setSpacing( 2); | 196 | // tabLayout_3->setSpacing( 2); |
197 | // tabLayout_3->setMargin( 2); | 197 | // tabLayout_3->setMargin( 2); |
198 | 198 | ||
199 | // OFileSelector *fileSelector; | 199 | // OFileSelector *fileSelector; |
200 | // fileSelector = new OFileSelector(tab_3,0,0,"/","","*"); | 200 | // fileSelector = new OFileSelector(tab_3,0,0,"/","","*"); |
201 | // tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 ); | 201 | // tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 ); |
202 | 202 | ||
203 | // TabWidget->insertTab( tab_3, tr( "Files" ) ); | 203 | // TabWidget->insertTab( tab_3, tr( "Files" ) ); |
204 | 204 | ||
205 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 205 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
206 | currentDir.setPath( QDir::currentDirPath()); | 206 | currentDir.setPath( QDir::currentDirPath()); |
207 | 207 | ||
208 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 208 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
209 | currentRemoteDir.setPath( QDir::currentDirPath()); | 209 | currentRemoteDir.setPath( QDir::currentDirPath()); |
210 | 210 | ||
211 | b = TRUE; | 211 | b = TRUE; |
212 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 212 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
213 | currentPathCombo->setEditable(TRUE); | 213 | currentPathCombo->setEditable(TRUE); |
214 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6); | 214 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6); |
215 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 215 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
216 | 216 | ||
217 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 217 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
218 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 218 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
219 | 219 | ||
220 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 220 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
221 | this,SLOT(currentPathComboChanged())); | 221 | this,SLOT(currentPathComboChanged())); |
222 | 222 | ||
223 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 223 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
224 | 224 | ||
225 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6); | 225 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6); |
226 | 226 | ||
227 | filterStr="*"; | 227 | filterStr="*"; |
228 | b=FALSE; | 228 | b=FALSE; |
229 | populateLocalView(); | 229 | populateLocalView(); |
230 | populateRemoteView(); | 230 | populateRemoteView(); |
231 | } | 231 | } |
232 | 232 | ||
233 | AdvancedFm::~AdvancedFm() | 233 | AdvancedFm::~AdvancedFm() |
234 | { | 234 | { |
235 | } | 235 | } |
236 | 236 | ||
237 | void AdvancedFm::cleanUp() | 237 | void AdvancedFm::cleanUp() |
238 | { | 238 | { |
239 | QString sfile=QDir::homeDirPath(); | 239 | QString sfile=QDir::homeDirPath(); |
240 | if(sfile.right(1) != "/") | 240 | if(sfile.right(1) != "/") |
241 | sfile+="/._temp"; | 241 | sfile+="/._temp"; |
242 | else | 242 | else |
243 | sfile+="._temp"; | 243 | sfile+="._temp"; |
244 | QFile file( sfile); | 244 | QFile file( sfile); |
245 | if(file.exists()) | 245 | if(file.exists()) |
246 | file.remove(); | 246 | file.remove(); |
247 | } | 247 | } |
248 | 248 | ||
249 | void AdvancedFm::tabChanged(QWidget *w) | 249 | void AdvancedFm::tabChanged(QWidget *w) |
250 | { | 250 | { |
251 | if (TabWidget->currentPageIndex() == 0) { | 251 | if (TabWidget->currentPageIndex() == 0) { |
252 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 252 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
253 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 253 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
254 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 254 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
255 | } | 255 | } |
256 | if (TabWidget->currentPageIndex() == 1) { | 256 | if (TabWidget->currentPageIndex() == 1) { |
257 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); | 257 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); |
258 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); | 258 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); |
259 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); | 259 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); |
260 | } | 260 | } |
261 | } | 261 | } |
262 | 262 | ||
263 | 263 | ||
264 | void AdvancedFm::populateLocalView() | 264 | void AdvancedFm::populateLocalView() |
265 | { | 265 | { |
266 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 266 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
267 | // QListViewItemIterator it( Local_View ); | 267 | // QListViewItemIterator it( Local_View ); |
268 | // for ( ; it.current(); ++it ) { | 268 | // for ( ; it.current(); ++it ) { |
269 | // if ( it.current()->isSelected() ) { | 269 | // if ( it.current()->isSelected() ) { |
270 | // QString strItem = it.current()->text(0); | 270 | // QString strItem = it.current()->text(0); |
271 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 271 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
272 | // QFileInfo fi(localFile); | 272 | // QFileInfo fi(localFile); |
273 | // } | 273 | // } |
274 | // } | 274 | // } |
275 | QPixmap pm; | 275 | QPixmap pm; |
276 | Local_View->clear(); | 276 | Local_View->clear(); |
277 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 277 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
278 | currentDir.setMatchAllDirs(TRUE); | 278 | currentDir.setMatchAllDirs(TRUE); |
279 | currentDir.setNameFilter(filterStr); | 279 | currentDir.setNameFilter(filterStr); |
280 | QString fileL, fileS, fileDate; | 280 | QString fileL, fileS, fileDate; |
281 | // qDebug(currentDir.canonicalPath()); | 281 | // qDebug(currentDir.canonicalPath()); |
282 | 282 | ||
283 | bool isDir=FALSE; | 283 | bool isDir=FALSE; |
284 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 284 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
285 | QFileInfoListIterator it(*list); | 285 | QFileInfoListIterator it(*list); |
286 | QFileInfo *fi; | 286 | QFileInfo *fi; |
287 | while ( (fi=it.current()) ) { | 287 | while ( (fi=it.current()) ) { |
288 | if (fi->isSymLink() ) { | 288 | if (fi->isSymLink() ) { |
289 | QString symLink=fi->readLink(); | 289 | QString symLink=fi->readLink(); |
290 | // qDebug("Symlink detected "+symLink); | 290 | // qDebug("Symlink detected "+symLink); |
291 | QFileInfo sym( symLink); | 291 | QFileInfo sym( symLink); |
292 | fileS.sprintf( "%10li", sym.size() ); | 292 | fileS.sprintf( "%10li", sym.size() ); |
293 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 293 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
294 | fileDate = sym.lastModified().toString(); | 294 | fileDate = sym.lastModified().toString(); |
295 | } else { | 295 | } else { |
296 | fileS.sprintf( "%10li", fi->size() ); | 296 | fileS.sprintf( "%10li", fi->size() ); |
297 | fileL.sprintf( "%s",fi->fileName().data() ); | 297 | fileL.sprintf( "%s",fi->fileName().data() ); |
298 | fileDate= fi->lastModified().toString(); | 298 | fileDate= fi->lastModified().toString(); |
299 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 299 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
300 | fileL+="/"; | 300 | fileL+="/"; |
301 | isDir=TRUE; | 301 | isDir=TRUE; |
302 | // qDebug( fileL); | 302 | // qDebug( fileL); |
303 | } | 303 | } |
304 | } | 304 | } |
305 | if(fileL !="./" && fi->exists()) { | 305 | if(fileL !="./" && fi->exists()) { |
306 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); | 306 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); |
307 | 307 | ||
308 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 308 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
309 | if( !QDir( fi->filePath() ).isReadable()) | 309 | if( !QDir( fi->filePath() ).isReadable()) |
310 | pm = Resource::loadPixmap( "lockedfolder" ); | 310 | pm = Resource::loadPixmap( "lockedfolder" ); |
311 | else | 311 | else |
312 | pm= Resource::loadPixmap( "folder" ); | 312 | pm= Resource::loadPixmap( "folder" ); |
313 | item->setPixmap( 0,pm ); | 313 | item->setPixmap( 0,pm ); |
314 | } else { | 314 | } else { |
315 | if( !fi->isReadable() ) | 315 | if( !fi->isReadable() ) |
316 | pm = Resource::loadPixmap( "locked" ); | 316 | pm = Resource::loadPixmap( "locked" ); |
317 | else { | 317 | else { |
318 | MimeType mt(fi->filePath()); | 318 | MimeType mt(fi->filePath()); |
319 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 319 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
320 | if(pm.isNull()) | 320 | if(pm.isNull()) |
321 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 321 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
322 | item->setPixmap( 0,pm); | 322 | item->setPixmap( 0,pm); |
323 | } | 323 | } |
324 | } | 324 | } |
325 | if( fileL.find("->",0,TRUE) != -1) { | 325 | if( fileL.find("->",0,TRUE) != -1) { |
326 | // overlay link image | 326 | // overlay link image |
327 | pm= Resource::loadPixmap( "folder" ); | 327 | pm= Resource::loadPixmap( "folder" ); |
328 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 328 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
329 | QPainter painter( &pm ); | 329 | QPainter painter( &pm ); |
330 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 330 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
331 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 331 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
332 | item->setPixmap( 0, pm); | 332 | item->setPixmap( 0, pm); |
333 | } | 333 | } |
334 | } isDir=FALSE; | 334 | } isDir=FALSE; |
335 | ++it; | 335 | ++it; |
336 | } | 336 | } |
337 | 337 | ||
338 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { | 338 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { |
339 | struct stat buf; | 339 | struct stat buf; |
340 | struct stat st; | 340 | struct stat st; |
341 | dev_t devT; | 341 | dev_t devT; |
342 | mode_t mode; | 342 | mode_t mode; |
343 | DIR *dir; | 343 | DIR *dir; |
344 | int fd = 0; | 344 | int fd = 0; |
345 | struct dirent *mydirent; | 345 | struct dirent *mydirent; |
346 | int i = 1; | 346 | int i = 1; |
347 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) | 347 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) |
348 | while ((mydirent = readdir(dir)) != NULL) { | 348 | while ((mydirent = readdir(dir)) != NULL) { |
349 | lstat( mydirent->d_name, &buf); | 349 | lstat( mydirent->d_name, &buf); |
350 | qDebug(mydirent->d_name); | 350 | qDebug(mydirent->d_name); |
351 | // mode = buf.st_mode; | 351 | // mode = buf.st_mode; |
352 | fileL.sprintf("%s", mydirent->d_name); | 352 | fileL.sprintf("%s", mydirent->d_name); |
353 | // fileS.sprintf("%d, %d", ); //this isn't correct | 353 | // fileS.sprintf("%d, %d", ); //this isn't correct |
354 | devT = buf.st_dev; | 354 | devT = buf.st_dev; |
355 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 355 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
356 | // fileS.sprintf("%d,%d", devT, devT); | 356 | // fileS.sprintf("%d,%d", devT, devT); |
357 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 357 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
358 | if( fileL.find(".") == -1 ){ | 358 | if( fileL.find(".") == -1 ){ |
359 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); | 359 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); |
360 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 360 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
361 | item->setPixmap( 0,pm); | 361 | item->setPixmap( 0,pm); |
362 | } | 362 | } |
363 | } | 363 | } |
364 | 364 | ||
365 | closedir(dir); | 365 | closedir(dir); |
366 | } | 366 | } |
367 | 367 | ||
368 | Local_View->setSorting( 3,FALSE); | 368 | Local_View->setSorting( 3,FALSE); |
369 | fillCombo( (const QString &) currentDir.canonicalPath()); | 369 | fillCombo( (const QString &) currentDir.canonicalPath()); |
370 | } | 370 | } |
371 | 371 | ||
372 | void AdvancedFm::populateRemoteView() | 372 | void AdvancedFm::populateRemoteView() |
373 | { | 373 | { |
374 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 374 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
375 | // QListViewItemIterator it( Remote_View ); | 375 | // QListViewItemIterator it( Remote_View ); |
376 | // for ( ; it.current(); ++it ) { | 376 | // for ( ; it.current(); ++it ) { |
377 | // if ( it.current()->isSelected() ) { | 377 | // if ( it.current()->isSelected() ) { |
378 | // QString strItem = it.current()->text(0); | 378 | // QString strItem = it.current()->text(0); |
379 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; | 379 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; |
380 | // QFileInfo fi(localFile); | 380 | // QFileInfo fi(localFile); |
381 | // } | 381 | // } |
382 | // } | 382 | // } |
383 | QPixmap pm; | 383 | QPixmap pm; |
384 | Remote_View->clear(); | 384 | Remote_View->clear(); |
385 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 385 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
386 | currentRemoteDir.setMatchAllDirs(TRUE); | 386 | currentRemoteDir.setMatchAllDirs(TRUE); |
387 | currentRemoteDir.setNameFilter(filterStr); | 387 | currentRemoteDir.setNameFilter(filterStr); |
388 | QString fileL, fileS, fileDate; | 388 | QString fileL, fileS, fileDate; |
389 | bool isDir=FALSE; | 389 | bool isDir=FALSE; |
390 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 390 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
391 | QFileInfoListIterator it(*list); | 391 | QFileInfoListIterator it(*list); |
392 | QFileInfo *fi; | 392 | QFileInfo *fi; |
393 | while ( (fi=it.current()) ) { | 393 | while ( (fi=it.current()) ) { |
394 | if (fi->isSymLink() ){ | 394 | if (fi->isSymLink() ){ |
395 | QString symLink=fi->readLink(); | 395 | QString symLink=fi->readLink(); |
396 | // qDebug("Symlink detected "+symLink); | 396 | // qDebug("Symlink detected "+symLink); |
397 | QFileInfo sym( symLink); | 397 | QFileInfo sym( symLink); |
398 | fileS.sprintf( "%10li", sym.size() ); | 398 | fileS.sprintf( "%10li", sym.size() ); |
399 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 399 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
400 | fileDate = sym.lastModified().toString(); | 400 | fileDate = sym.lastModified().toString(); |
401 | } else { | 401 | } else { |
402 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 402 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
403 | fileS.sprintf( "%10li", fi->size() ); | 403 | fileS.sprintf( "%10li", fi->size() ); |
404 | fileL.sprintf( "%s",fi->fileName().data() ); | 404 | fileL.sprintf( "%s",fi->fileName().data() ); |
405 | fileDate= fi->lastModified().toString(); | 405 | fileDate= fi->lastModified().toString(); |
406 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { | 406 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { |
407 | fileL+="/"; | 407 | fileL+="/"; |
408 | isDir=TRUE; | 408 | isDir=TRUE; |
409 | // qDebug( fileL); | 409 | // qDebug( fileL); |
410 | } | 410 | } |
411 | } | 411 | } |
412 | if(fileL !="./" && fi->exists()) { | 412 | if(fileL !="./" && fi->exists()) { |
413 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 413 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
414 | QPixmap pm; | 414 | QPixmap pm; |
415 | 415 | ||
416 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 416 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
417 | if( !QDir( fi->filePath() ).isReadable()) | 417 | if( !QDir( fi->filePath() ).isReadable()) |
418 | pm = Resource::loadPixmap( "lockedfolder" ); | 418 | pm = Resource::loadPixmap( "lockedfolder" ); |
419 | else | 419 | else |
420 | pm= Resource::loadPixmap( "folder" ); | 420 | pm= Resource::loadPixmap( "folder" ); |
421 | item->setPixmap( 0,pm ); | 421 | item->setPixmap( 0,pm ); |
422 | } else { | 422 | } else { |
423 | if( !fi->isReadable() ) | 423 | if( !fi->isReadable() ) |
424 | pm = Resource::loadPixmap( "locked" ); | 424 | pm = Resource::loadPixmap( "locked" ); |
425 | else { | 425 | else { |
426 | MimeType mt(fi->filePath()); | 426 | MimeType mt(fi->filePath()); |
427 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 427 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
428 | if(pm.isNull()) | 428 | if(pm.isNull()) |
429 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 429 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
430 | item->setPixmap( 0,pm); | 430 | item->setPixmap( 0,pm); |
431 | } | 431 | } |
432 | } | 432 | } |
433 | if( fileL.find("->",0,TRUE) != -1) { | 433 | if( fileL.find("->",0,TRUE) != -1) { |
434 | // overlay link image | 434 | // overlay link image |
435 | pm= Resource::loadPixmap( "folder" ); | 435 | pm= Resource::loadPixmap( "folder" ); |
436 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 436 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
437 | QPainter painter( &pm ); | 437 | QPainter painter( &pm ); |
438 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 438 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
439 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 439 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
440 | item->setPixmap( 0, pm); | 440 | item->setPixmap( 0, pm); |
441 | } | 441 | } |
442 | } isDir=FALSE; | 442 | } isDir=FALSE; |
443 | ++it; | 443 | ++it; |
444 | } | 444 | } |
445 | 445 | ||
446 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { | 446 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { |
447 | struct stat buf; | 447 | struct stat buf; |
448 | struct stat st; | 448 | struct stat st; |
449 | mode_t mode; | 449 | mode_t mode; |
450 | DIR *dir; | 450 | DIR *dir; |
451 | int fd = 0; | 451 | int fd = 0; |
452 | struct dirent *mydirent; | 452 | struct dirent *mydirent; |
453 | int i = 1; | 453 | int i = 1; |
454 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) | 454 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) |
455 | while ((mydirent = readdir(dir)) != NULL) { | 455 | while ((mydirent = readdir(dir)) != NULL) { |
456 | lstat( mydirent->d_name, &buf); | 456 | lstat( mydirent->d_name, &buf); |
457 | qDebug(mydirent->d_name); | 457 | qDebug(mydirent->d_name); |
458 | // mode = buf.st_mode; | 458 | // mode = buf.st_mode; |
459 | fileL.sprintf("%s", mydirent->d_name); | 459 | fileL.sprintf("%s", mydirent->d_name); |
460 | // fileS.sprintf("%d, %d", ); //this isn't correct | 460 | // fileS.sprintf("%d, %d", ); //this isn't correct |
461 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); | 461 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); |
462 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 462 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
463 | if( fileL.find(".") == -1 ){ | 463 | if( fileL.find(".") == -1 ){ |
464 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 464 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
465 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 465 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
466 | item->setPixmap( 0,pm); | 466 | item->setPixmap( 0,pm); |
467 | } | 467 | } |
468 | } | 468 | } |
469 | 469 | ||
470 | closedir(dir); | 470 | closedir(dir); |
471 | } | 471 | } |
472 | 472 | ||
473 | Remote_View->setSorting( 3,FALSE); | 473 | Remote_View->setSorting( 3,FALSE); |
474 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); | 474 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); |
475 | } | 475 | } |
476 | 476 | ||
477 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) | 477 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) |
478 | { | 478 | { |
479 | if(selectedItem) { | 479 | if(selectedItem) { |
480 | QString strItem=selectedItem->text(0); | 480 | QString strItem=selectedItem->text(0); |
481 | QString strSize=selectedItem->text(1); | 481 | QString strSize=selectedItem->text(1); |
482 | strSize=strSize.stripWhiteSpace(); | 482 | strSize=strSize.stripWhiteSpace(); |
483 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 483 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
484 | // is symlink | 484 | // is symlink |
485 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 485 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
486 | if(QDir(strItem2).exists() ) { | 486 | if(QDir(strItem2).exists() ) { |
487 | currentDir.cd(strItem2, TRUE); | 487 | currentDir.cd(strItem2, TRUE); |
488 | populateLocalView(); | 488 | populateLocalView(); |
489 | } | 489 | } |
490 | } else { // not a symlink | 490 | } else { // not a symlink |
491 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 491 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
492 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 492 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
493 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 493 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
494 | currentDir.cd(strItem,FALSE); | 494 | currentDir.cd(strItem,FALSE); |
495 | populateLocalView(); | 495 | populateLocalView(); |
496 | } else { | 496 | } else { |
497 | currentDir.cdUp(); | 497 | currentDir.cdUp(); |
498 | populateLocalView(); | 498 | populateLocalView(); |
499 | } | 499 | } |
500 | if(QDir(strItem).exists()){ | 500 | if(QDir(strItem).exists()){ |
501 | currentDir.cd(strItem, TRUE); | 501 | currentDir.cd(strItem, TRUE); |
502 | populateLocalView(); | 502 | populateLocalView(); |
503 | } | 503 | } |
504 | } else { | 504 | } else { |
505 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 505 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
506 | if( QFile::exists(strItem ) ) { | 506 | if( QFile::exists(strItem ) ) { |
507 | // qDebug("upload "+strItem); | 507 | // qDebug("upload "+strItem); |
508 | } | 508 | } |
509 | } //end not symlink | 509 | } //end not symlink |
510 | chdir(strItem.latin1()); | 510 | chdir(strItem.latin1()); |
511 | } | 511 | } |
512 | } | 512 | } |
513 | } | 513 | } |
514 | 514 | ||
515 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) | 515 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) |
516 | { | 516 | { |
517 | if(selectedItem) { | 517 | if(selectedItem) { |
518 | QString strItem=selectedItem->text(0); | 518 | QString strItem=selectedItem->text(0); |
519 | QString strSize=selectedItem->text(1); | 519 | QString strSize=selectedItem->text(1); |
520 | strSize=strSize.stripWhiteSpace(); | 520 | strSize=strSize.stripWhiteSpace(); |
521 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 521 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
522 | // is symlink | 522 | // is symlink |
523 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 523 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
524 | if(QDir(strItem2).exists() ) { | 524 | if(QDir(strItem2).exists() ) { |
525 | currentRemoteDir.cd(strItem2, TRUE); | 525 | currentRemoteDir.cd(strItem2, TRUE); |
526 | populateRemoteView(); | 526 | populateRemoteView(); |
527 | } | 527 | } |
528 | } else { // not a symlink | 528 | } else { // not a symlink |
529 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 529 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
530 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { | 530 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { |
531 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 531 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
532 | currentRemoteDir.cd(strItem,FALSE); | 532 | currentRemoteDir.cd(strItem,FALSE); |
533 | populateRemoteView(); | 533 | populateRemoteView(); |
534 | } else { | 534 | } else { |
535 | currentRemoteDir.cdUp(); | 535 | currentRemoteDir.cdUp(); |
536 | populateRemoteView(); | 536 | populateRemoteView(); |
537 | } | 537 | } |
538 | if(QDir(strItem).exists()){ | 538 | if(QDir(strItem).exists()){ |
539 | currentRemoteDir.cd(strItem, TRUE); | 539 | currentRemoteDir.cd(strItem, TRUE); |
540 | populateRemoteView(); | 540 | populateRemoteView(); |
541 | } | 541 | } |
542 | } else { | 542 | } else { |
543 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 543 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
544 | if( QFile::exists(strItem ) ) { | 544 | if( QFile::exists(strItem ) ) { |
545 | // qDebug("upload "+strItem); | 545 | // qDebug("upload "+strItem); |
546 | } | 546 | } |
547 | } //end not symlink | 547 | } //end not symlink |
548 | chdir(strItem.latin1()); | 548 | chdir(strItem.latin1()); |
549 | } | 549 | } |
550 | } | 550 | } |
551 | } | 551 | } |
552 | 552 | ||
553 | void AdvancedFm::doLocalCd() | 553 | void AdvancedFm::doLocalCd() |
554 | { | 554 | { |
555 | localListClicked( Local_View->currentItem()); | 555 | localListClicked( Local_View->currentItem()); |
556 | } | 556 | } |
557 | 557 | ||
558 | void AdvancedFm::doRemoteCd() | 558 | void AdvancedFm::doRemoteCd() |
559 | { | 559 | { |
560 | localListClicked( Remote_View->currentItem()); | 560 | localListClicked( Remote_View->currentItem()); |
561 | } | 561 | } |
562 | 562 | ||
563 | void AdvancedFm::showHidden() | 563 | void AdvancedFm::showHidden() |
564 | { | 564 | { |
565 | if (!b) { | 565 | if (b) { |
566 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 566 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
567 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); | 567 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); |
568 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 568 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
569 | b=TRUE; | 569 | b=TRUE; |
570 | 570 | ||
571 | } else { | 571 | } else { |
572 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 572 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
573 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 573 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
574 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 574 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
575 | b=FALSE; | 575 | b=FALSE; |
576 | } | 576 | } |
577 | populateLocalView(); | 577 | populateLocalView(); |
578 | } | 578 | } |
579 | 579 | ||
580 | void AdvancedFm::showRemoteHidden() | 580 | void AdvancedFm::showRemoteHidden() |
581 | { | 581 | { |
582 | if (!b) { | 582 | if (b) { |
583 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 583 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
584 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); | 584 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); |
585 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 585 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
586 | b=TRUE; | 586 | b=TRUE; |
587 | 587 | ||
588 | } else { | 588 | } else { |
589 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 589 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
590 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 590 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
591 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 591 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
592 | b=FALSE; | 592 | b=FALSE; |
593 | } | 593 | } |
594 | populateRemoteView(); | 594 | populateRemoteView(); |
595 | } | 595 | } |
596 | 596 | ||
597 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 597 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
598 | { | 598 | { |
599 | switch (mouse) { | 599 | switch (mouse) { |
600 | case 1: | 600 | case 1: |
601 | break; | 601 | break; |
602 | case 2: | 602 | case 2: |
603 | showLocalMenu(item); | 603 | showLocalMenu(item); |
604 | Local_View->clearSelection(); | 604 | Local_View->clearSelection(); |
605 | break; | 605 | break; |
606 | }; | 606 | }; |
607 | } | 607 | } |
608 | 608 | ||
609 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 609 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
610 | { | 610 | { |
611 | switch (mouse) { | 611 | switch (mouse) { |
612 | case 1: | 612 | case 1: |
613 | break; | 613 | break; |
614 | case 2: | 614 | case 2: |
615 | showRemoteMenu(item); | 615 | showRemoteMenu(item); |
616 | Remote_View->clearSelection(); | 616 | Remote_View->clearSelection(); |
617 | break; | 617 | break; |
618 | }; | 618 | }; |
619 | } | 619 | } |
620 | 620 | ||
621 | void AdvancedFm::showLocalMenu(QListViewItem * item) | 621 | void AdvancedFm::showLocalMenu(QListViewItem * item) |
622 | { | 622 | { |
623 | if(item) { | 623 | if(item) { |
624 | QPopupMenu m; | 624 | QPopupMenu m; |
625 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 625 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
626 | m.insertSeparator(); | 626 | m.insertSeparator(); |
627 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 627 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
628 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 628 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
629 | else | 629 | else |
630 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); | 630 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); |
631 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | 631 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); |
632 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 632 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
633 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 633 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
634 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 634 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
635 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 635 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
636 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 636 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
637 | m.insertSeparator(); | 637 | m.insertSeparator(); |
638 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 638 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
639 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 639 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
640 | m.insertSeparator(); | 640 | m.insertSeparator(); |
641 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 641 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
642 | m.insertSeparator(); | 642 | m.insertSeparator(); |
643 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 643 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
644 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 644 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
645 | m.setCheckable(TRUE); | 645 | m.setCheckable(TRUE); |
646 | if (b) | 646 | if (!b) |
647 | m.setItemChecked(m.idAt(0),TRUE); | 647 | m.setItemChecked(m.idAt(0),TRUE); |
648 | else | 648 | else |
649 | m.setItemChecked(m.idAt(0),FALSE); | 649 | m.setItemChecked(m.idAt(0),FALSE); |
650 | m.exec( QCursor::pos() ); | 650 | m.exec( QCursor::pos() ); |
651 | } | 651 | } |
652 | } | 652 | } |
653 | 653 | ||
654 | void AdvancedFm::showRemoteMenu(QListViewItem * item) | 654 | void AdvancedFm::showRemoteMenu(QListViewItem * item) |
655 | { | 655 | { |
656 | if(item) { | 656 | if(item) { |
657 | QPopupMenu m; | 657 | QPopupMenu m; |
658 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); | 658 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); |
659 | m.insertSeparator(); | 659 | m.insertSeparator(); |
660 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 660 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
661 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); | 661 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); |
662 | else | 662 | else |
663 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); | 663 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); |
664 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | 664 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); |
665 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 665 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
666 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 666 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
667 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 667 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
668 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 668 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
669 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 669 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
670 | m.insertSeparator(); | 670 | m.insertSeparator(); |
671 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 671 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
672 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 672 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
673 | m.insertSeparator(); | 673 | m.insertSeparator(); |
674 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 674 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
675 | m.insertSeparator(); | 675 | m.insertSeparator(); |
676 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 676 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
677 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 677 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
678 | m.setCheckable(TRUE); | 678 | m.setCheckable(TRUE); |
679 | if (b) | 679 | if (!b) |
680 | m.setItemChecked(m.idAt(0),TRUE); | 680 | m.setItemChecked(m.idAt(0),TRUE); |
681 | else | 681 | else |
682 | m.setItemChecked(m.idAt(0),FALSE); | 682 | m.setItemChecked(m.idAt(0),FALSE); |
683 | m.exec( QCursor::pos() ); | 683 | m.exec( QCursor::pos() ); |
684 | } | 684 | } |
685 | } | 685 | } |
686 | 686 | ||
687 | void AdvancedFm::runThis() { | 687 | void AdvancedFm::runThis() { |
688 | // QFileInfo *fi; | 688 | // QFileInfo *fi; |
689 | if (TabWidget->currentPageIndex() == 0) { | 689 | if (TabWidget->currentPageIndex() == 0) { |
690 | QString curFile = Local_View->currentItem()->text(0); | 690 | QString curFile = Local_View->currentItem()->text(0); |
691 | curFile = currentDir.canonicalPath()+"/"+curFile; | 691 | curFile = currentDir.canonicalPath()+"/"+curFile; |
692 | DocLnk nf(curFile); | 692 | DocLnk nf(curFile); |
693 | QString execStr = nf.exec(); | 693 | QString execStr = nf.exec(); |
694 | qDebug( execStr); | 694 | qDebug( execStr); |
695 | if( execStr.isEmpty() ) { | 695 | if( execStr.isEmpty() ) { |
696 | } else { | 696 | } else { |
697 | nf.execute(); | 697 | nf.execute(); |
698 | } | 698 | } |
699 | // MimeType mt( curFile); | 699 | // MimeType mt( curFile); |
700 | } else { | 700 | } else { |
701 | QString curFile = Remote_View->currentItem()->text(0); | 701 | QString curFile = Remote_View->currentItem()->text(0); |
702 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 702 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
703 | DocLnk nf(curFile); | 703 | DocLnk nf(curFile); |
704 | QString execStr = nf.exec(); | 704 | QString execStr = nf.exec(); |
705 | qDebug(execStr); | 705 | qDebug(execStr); |
706 | if( execStr.isEmpty() ) { | 706 | if( execStr.isEmpty() ) { |
707 | } else { | 707 | } else { |
708 | nf.execute(); | 708 | nf.execute(); |
709 | } | 709 | } |
710 | // MimeType mt( curFile); | 710 | // MimeType mt( curFile); |
711 | } | 711 | } |
712 | } | 712 | } |
713 | 713 | ||
714 | void AdvancedFm::runText() { | 714 | void AdvancedFm::runText() { |
715 | if (TabWidget->currentPageIndex() == 0) { | 715 | if (TabWidget->currentPageIndex() == 0) { |
716 | QString curFile = Local_View->currentItem()->text(0); | 716 | QString curFile = Local_View->currentItem()->text(0); |
717 | curFile = currentDir.canonicalPath()+"/"+curFile; | 717 | curFile = currentDir.canonicalPath()+"/"+curFile; |
718 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 718 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
719 | e << curFile; | 719 | e << curFile; |
720 | } else { | 720 | } else { |
721 | QString curFile = Remote_View->currentItem()->text(0); | 721 | QString curFile = Remote_View->currentItem()->text(0); |
722 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 722 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
723 | DocLnk nf(curFile); | 723 | DocLnk nf(curFile); |
724 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 724 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
725 | e << curFile; | 725 | e << curFile; |
726 | } | 726 | } |
727 | } | 727 | } |
728 | 728 | ||
729 | void AdvancedFm::localMakDir() | 729 | void AdvancedFm::localMakDir() |
730 | { | 730 | { |
731 | InputDialog *fileDlg; | 731 | InputDialog *fileDlg; |
732 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 732 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
733 | fileDlg->exec(); | 733 | fileDlg->exec(); |
734 | if( fileDlg->result() == 1 ) { | 734 | if( fileDlg->result() == 1 ) { |
735 | QString filename = fileDlg->LineEdit1->text(); | 735 | QString filename = fileDlg->LineEdit1->text(); |
736 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 736 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
737 | } | 737 | } |
738 | populateLocalView(); | 738 | populateLocalView(); |
739 | } | 739 | } |
740 | 740 | ||
741 | void AdvancedFm::remoteMakDir() | 741 | void AdvancedFm::remoteMakDir() |
742 | { | 742 | { |
743 | InputDialog *fileDlg; | 743 | InputDialog *fileDlg; |
744 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 744 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
745 | fileDlg->exec(); | 745 | fileDlg->exec(); |
746 | if( fileDlg->result() == 1 ) { | 746 | if( fileDlg->result() == 1 ) { |
747 | QString filename = fileDlg->LineEdit1->text(); | 747 | QString filename = fileDlg->LineEdit1->text(); |
748 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); | 748 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); |
749 | } | 749 | } |
750 | populateRemoteView(); | 750 | populateRemoteView(); |
751 | } | 751 | } |
752 | 752 | ||
753 | void AdvancedFm::localDelete() | 753 | void AdvancedFm::localDelete() |
754 | { | 754 | { |
755 | QString f = Local_View->currentItem()->text(0); | 755 | QString f = Local_View->currentItem()->text(0); |
756 | if(QDir(f).exists() ) { | 756 | if(QDir(f).exists() ) { |
757 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 757 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
758 | tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { | 758 | tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { |
759 | case 0: { | 759 | case 0: { |
760 | f=currentDir.canonicalPath()+"/"+f; | 760 | f=currentDir.canonicalPath()+"/"+f; |
761 | QString cmd="rmdir "+f; | 761 | QString cmd="rmdir "+f; |
762 | system( cmd.latin1()); | 762 | system( cmd.latin1()); |
763 | populateLocalView(); | 763 | populateLocalView(); |
764 | } | 764 | } |
765 | break; | 765 | break; |
766 | case 1: | 766 | case 1: |
767 | // exit | 767 | // exit |
768 | break; | 768 | break; |
769 | }; | 769 | }; |
770 | 770 | ||
771 | } else { | 771 | } else { |
772 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 772 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
773 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 773 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
774 | case 0: { | 774 | case 0: { |
775 | f=currentDir.canonicalPath()+"/"+f; | 775 | f=currentDir.canonicalPath()+"/"+f; |
776 | QString cmd="rm "+f; | 776 | QString cmd="rm "+f; |
777 | system( cmd.latin1()); | 777 | system( cmd.latin1()); |
778 | populateLocalView(); | 778 | populateLocalView(); |
779 | } | 779 | } |
780 | break; | 780 | break; |
781 | case 1: | 781 | case 1: |
782 | // exit | 782 | // exit |
783 | break; | 783 | break; |
784 | }; | 784 | }; |
785 | } | 785 | } |
786 | } | 786 | } |
787 | 787 | ||
788 | void AdvancedFm::remoteDelete() | 788 | void AdvancedFm::remoteDelete() |
789 | { | 789 | { |
790 | QString f = Remote_View->currentItem()->text(0); | 790 | QString f = Remote_View->currentItem()->text(0); |
791 | if(QDir(f).exists() ) { | 791 | if(QDir(f).exists() ) { |
792 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 792 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
793 | tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { | 793 | tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { |
794 | case 0: { | 794 | case 0: { |
795 | f = currentRemoteDir.canonicalPath()+"/"+f; | 795 | f = currentRemoteDir.canonicalPath()+"/"+f; |
796 | QString cmd="rmdir "+f; | 796 | QString cmd="rmdir "+f; |
797 | system( cmd.latin1()); | 797 | system( cmd.latin1()); |
798 | populateRemoteView(); | 798 | populateRemoteView(); |
799 | } | 799 | } |
800 | break; | 800 | break; |
801 | case 1: | 801 | case 1: |
802 | // exit | 802 | // exit |
803 | break; | 803 | break; |
804 | }; | 804 | }; |
805 | 805 | ||
806 | } else { | 806 | } else { |
807 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 807 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
808 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 808 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
809 | case 0: { | 809 | case 0: { |
810 | f = currentRemoteDir.canonicalPath()+"/"+f; | 810 | f = currentRemoteDir.canonicalPath()+"/"+f; |
811 | QString cmd="rm "+f; | 811 | QString cmd="rm "+f; |
812 | system( cmd.latin1()); | 812 | system( cmd.latin1()); |
813 | populateRemoteView(); | 813 | populateRemoteView(); |
814 | } | 814 | } |
815 | break; | 815 | break; |
816 | case 1: | 816 | case 1: |
817 | // exit | 817 | // exit |
818 | break; | 818 | break; |
819 | }; | 819 | }; |
820 | } | 820 | } |
821 | } | 821 | } |
822 | 822 | ||
823 | void AdvancedFm::localRename() | 823 | void AdvancedFm::localRename() |
824 | { | 824 | { |
825 | QString curFile = Local_View->currentItem()->text(0); | 825 | QString curFile = Local_View->currentItem()->text(0); |
826 | InputDialog *fileDlg; | 826 | InputDialog *fileDlg; |
827 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 827 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
828 | fileDlg->setInputText((const QString &)curFile); | 828 | fileDlg->setInputText((const QString &)curFile); |
829 | fileDlg->exec(); | 829 | fileDlg->exec(); |
830 | if( fileDlg->result() == 1 ) { | 830 | if( fileDlg->result() == 1 ) { |
831 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 831 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
832 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 832 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
833 | if( rename(oldname.latin1(), newName.latin1())== -1) | 833 | if( rename(oldname.latin1(), newName.latin1())== -1) |
834 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 834 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
835 | } | 835 | } |
836 | populateLocalView(); | 836 | populateLocalView(); |
837 | } | 837 | } |
838 | 838 | ||
839 | void AdvancedFm::remoteRename() | 839 | void AdvancedFm::remoteRename() |
840 | { | 840 | { |
841 | QString curFile = Local_View->currentItem()->text(0); | 841 | QString curFile = Local_View->currentItem()->text(0); |
842 | InputDialog *fileDlg; | 842 | InputDialog *fileDlg; |
843 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 843 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
844 | fileDlg->setInputText((const QString &)curFile); | 844 | fileDlg->setInputText((const QString &)curFile); |
845 | fileDlg->exec(); | 845 | fileDlg->exec(); |
846 | if( fileDlg->result() == 1 ) { | 846 | if( fileDlg->result() == 1 ) { |
847 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; | 847 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; |
848 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 848 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
849 | if( rename(oldname.latin1(), newName.latin1())== -1) | 849 | if( rename(oldname.latin1(), newName.latin1())== -1) |
850 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 850 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
851 | } | 851 | } |
852 | populateRemoteView(); | 852 | populateRemoteView(); |
853 | } | 853 | } |
854 | 854 | ||
855 | void AdvancedFm::switchToLocalTab() | 855 | void AdvancedFm::switchToLocalTab() |
856 | { | 856 | { |
857 | TabWidget->setCurrentPage(0); | 857 | TabWidget->setCurrentPage(0); |
858 | } | 858 | } |
859 | 859 | ||
860 | void AdvancedFm::switchToRemoteTab() | 860 | void AdvancedFm::switchToRemoteTab() |
861 | { | 861 | { |
862 | TabWidget->setCurrentPage(1); | 862 | TabWidget->setCurrentPage(1); |
863 | } | 863 | } |
864 | 864 | ||
865 | void AdvancedFm::readConfig() | 865 | void AdvancedFm::readConfig() |
866 | { | 866 | { |
867 | Config cfg("AdvancedFm"); | 867 | Config cfg("AdvancedFm"); |
868 | } | 868 | } |
869 | 869 | ||
870 | void AdvancedFm::writeConfig() | 870 | void AdvancedFm::writeConfig() |
871 | { | 871 | { |
872 | Config cfg("AdvancedFm"); | 872 | Config cfg("AdvancedFm"); |
873 | } | 873 | } |
874 | 874 | ||
875 | void AdvancedFm::currentPathComboChanged() | 875 | void AdvancedFm::currentPathComboChanged() |
876 | { | 876 | { |
877 | if (TabWidget->currentPageIndex() == 0) { | 877 | if (TabWidget->currentPageIndex() == 0) { |
878 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 878 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
879 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); | 879 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
880 | populateLocalView(); | 880 | populateLocalView(); |
881 | } else { | 881 | } else { |
882 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 882 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
883 | } | 883 | } |
884 | } | 884 | } |
885 | if (TabWidget->currentPageIndex() == 0) { | 885 | if (TabWidget->currentPageIndex() == 0) { |
886 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 886 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
887 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); | 887 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); |
888 | populateRemoteView(); | 888 | populateRemoteView(); |
889 | } else { | 889 | } else { |
890 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 890 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
891 | } | 891 | } |
892 | } | 892 | } |
893 | } | 893 | } |
894 | 894 | ||
895 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 895 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
896 | 896 | ||
897 | if (TabWidget->currentPageIndex() == 0) { | 897 | if (TabWidget->currentPageIndex() == 0) { |
898 | currentPathCombo->lineEdit()->setText( currentPath); | 898 | currentPathCombo->lineEdit()->setText( currentPath); |
899 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 899 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
900 | currentPathCombo->clear(); | 900 | currentPathCombo->clear(); |
901 | localDirPathStringList.prepend( currentPath ); | 901 | localDirPathStringList.prepend( currentPath ); |
902 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 902 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
903 | } | 903 | } |
904 | } else { | 904 | } else { |
905 | currentPathCombo->lineEdit()->setText( currentPath); | 905 | currentPathCombo->lineEdit()->setText( currentPath); |
906 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 906 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
907 | currentPathCombo->clear(); | 907 | currentPathCombo->clear(); |
908 | remoteDirPathStringList.prepend( currentPath ); | 908 | remoteDirPathStringList.prepend( currentPath ); |
909 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 909 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
910 | } | 910 | } |
911 | } | 911 | } |
912 | } | 912 | } |
913 | 913 | ||
914 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 914 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
915 | if (TabWidget->currentPageIndex() == 0) { | 915 | if (TabWidget->currentPageIndex() == 0) { |
916 | chdir( currentPath.latin1() ); | 916 | chdir( currentPath.latin1() ); |
917 | currentDir.cd( currentPath, TRUE); | 917 | currentDir.cd( currentPath, TRUE); |
918 | populateLocalView(); | 918 | populateLocalView(); |
919 | update(); | 919 | update(); |
920 | } else { | 920 | } else { |
921 | chdir( currentPath.latin1() ); | 921 | chdir( currentPath.latin1() ); |
922 | currentRemoteDir.cd( currentPath, TRUE); | 922 | currentRemoteDir.cd( currentPath, TRUE); |
923 | populateRemoteView(); | 923 | populateRemoteView(); |
924 | update(); | 924 | update(); |
925 | } | 925 | } |
926 | } | 926 | } |
927 | 927 | ||
928 | void AdvancedFm::filePerms() { | 928 | void AdvancedFm::filePerms() { |
929 | QString curFile = getPath(); | 929 | QString curFile = getPath(); |
930 | filePermissions *filePerm; | 930 | filePermissions *filePerm; |
931 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(curFile)); | 931 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(curFile)); |
932 | filePerm->showMaximized(); | 932 | filePerm->showMaximized(); |
933 | filePerm->exec(); | 933 | filePerm->exec(); |
934 | if( filePerm) | 934 | if( filePerm) |
935 | delete filePerm; | 935 | delete filePerm; |
936 | } | 936 | } |
937 | 937 | ||
938 | void AdvancedFm::doProperties() { | 938 | void AdvancedFm::doProperties() { |
939 | 939 | ||
940 | DocLnk lnk( getPath()); | 940 | DocLnk lnk( getPath()); |
941 | LnkProperties prop( &lnk ); | 941 | LnkProperties prop( &lnk ); |
942 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 942 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
943 | prop.showMaximized(); | 943 | prop.showMaximized(); |
944 | prop.exec(); | 944 | prop.exec(); |
945 | } | 945 | } |
946 | 946 | ||
947 | QString AdvancedFm::getPath() { | 947 | QString AdvancedFm::getPath() { |
948 | if (TabWidget->currentPageIndex() == 0) { | 948 | if (TabWidget->currentPageIndex() == 0) { |
949 | return currentDir.canonicalPath()+"/"+ Local_View->currentItem()->text(0); | 949 | return currentDir.canonicalPath()+"/"+ Local_View->currentItem()->text(0); |
950 | } else { | 950 | } else { |
951 | return currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); | 951 | return currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); |
952 | } | 952 | } |
953 | } | 953 | } |
954 | 954 | ||
955 | void AdvancedFm::homeButtonPushed() { | 955 | void AdvancedFm::homeButtonPushed() { |
956 | QString current = QDir::homeDirPath(); | 956 | QString current = QDir::homeDirPath(); |
957 | chdir( current.latin1() ); | 957 | chdir( current.latin1() ); |
958 | if (TabWidget->currentPageIndex() == 0) { | 958 | if (TabWidget->currentPageIndex() == 0) { |
959 | currentDir.cd( current, TRUE); | 959 | currentDir.cd( current, TRUE); |
960 | populateLocalView(); | 960 | populateLocalView(); |
961 | } else { | 961 | } else { |
962 | currentRemoteDir.cd( current, TRUE); | 962 | currentRemoteDir.cd( current, TRUE); |
963 | populateRemoteView(); | 963 | populateRemoteView(); |
964 | } | 964 | } |
965 | update(); | 965 | update(); |
966 | } | 966 | } |
967 | 967 | ||
968 | void AdvancedFm::docButtonPushed() { | 968 | void AdvancedFm::docButtonPushed() { |
969 | QString current = QPEApplication::documentDir(); | 969 | QString current = QPEApplication::documentDir(); |
970 | chdir( current.latin1() ); | 970 | chdir( current.latin1() ); |
971 | if (TabWidget->currentPageIndex() == 0) { | 971 | if (TabWidget->currentPageIndex() == 0) { |
972 | currentDir.cd( current, TRUE); | 972 | currentDir.cd( current, TRUE); |
973 | populateLocalView(); | 973 | populateLocalView(); |
974 | } else { | 974 | } else { |
975 | currentRemoteDir.cd( current, TRUE); | 975 | currentRemoteDir.cd( current, TRUE); |
976 | populateRemoteView(); | 976 | populateRemoteView(); |
977 | } | 977 | } |
978 | update(); | 978 | update(); |
979 | } | 979 | } |
980 | 980 | ||
981 | void AdvancedFm::SDButtonPushed() { | 981 | void AdvancedFm::SDButtonPushed() { |
982 | QString current = "/mnt/card"; | 982 | QString current = "/mnt/card"; |
983 | chdir( current.latin1() ); | 983 | chdir( current.latin1() ); |
984 | if (TabWidget->currentPageIndex() == 0) { | 984 | if (TabWidget->currentPageIndex() == 0) { |
985 | currentDir.cd( current, TRUE); | 985 | currentDir.cd( current, TRUE); |
986 | populateLocalView(); | 986 | populateLocalView(); |
987 | } else { | 987 | } else { |
988 | currentRemoteDir.cd( current, TRUE); | 988 | currentRemoteDir.cd( current, TRUE); |
989 | populateRemoteView(); | 989 | populateRemoteView(); |
990 | } | 990 | } |
991 | update(); | 991 | update(); |
992 | 992 | ||
993 | } | 993 | } |
994 | 994 | ||
995 | void AdvancedFm::CFButtonPushed() { | 995 | void AdvancedFm::CFButtonPushed() { |
996 | QString current = "/mnt/cf"; | 996 | QString current = "/mnt/cf"; |
997 | chdir( current.latin1() ); | 997 | chdir( current.latin1() ); |
998 | if (TabWidget->currentPageIndex() == 0) { | 998 | if (TabWidget->currentPageIndex() == 0) { |
999 | currentDir.cd( current, TRUE); | 999 | currentDir.cd( current, TRUE); |
1000 | populateLocalView(); | 1000 | populateLocalView(); |
1001 | } else { | 1001 | } else { |
1002 | currentRemoteDir.cd( current, TRUE); | 1002 | currentRemoteDir.cd( current, TRUE); |
1003 | populateRemoteView(); | 1003 | populateRemoteView(); |
1004 | } | 1004 | } |
1005 | update(); | 1005 | update(); |
1006 | 1006 | ||
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | 1009 | ||
1010 | void AdvancedFm::upDir() | 1010 | void AdvancedFm::upDir() |
1011 | { | 1011 | { |
1012 | if (TabWidget->currentPageIndex() == 0) { | 1012 | if (TabWidget->currentPageIndex() == 0) { |
1013 | QString current = currentDir.canonicalPath(); | 1013 | QString current = currentDir.canonicalPath(); |
1014 | QDir dir(current); | 1014 | QDir dir(current); |
1015 | dir.cdUp(); | 1015 | dir.cdUp(); |
1016 | current = dir.canonicalPath(); | 1016 | current = dir.canonicalPath(); |
1017 | chdir( current.latin1() ); | 1017 | chdir( current.latin1() ); |
1018 | currentDir.cd( current, TRUE); | 1018 | currentDir.cd( current, TRUE); |
1019 | populateLocalView(); | 1019 | populateLocalView(); |
1020 | update(); | 1020 | update(); |
1021 | } else { | 1021 | } else { |
1022 | QString current = currentRemoteDir.canonicalPath(); | 1022 | QString current = currentRemoteDir.canonicalPath(); |
1023 | QDir dir(current); | 1023 | QDir dir(current); |
1024 | dir.cdUp(); | 1024 | dir.cdUp(); |
1025 | current = dir.canonicalPath(); | 1025 | current = dir.canonicalPath(); |
1026 | chdir( current.latin1() ); | 1026 | chdir( current.latin1() ); |
1027 | currentRemoteDir.cd( current, TRUE); | 1027 | currentRemoteDir.cd( current, TRUE); |
1028 | populateRemoteView(); | 1028 | populateRemoteView(); |
1029 | update(); | 1029 | update(); |
1030 | } | 1030 | } |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | void AdvancedFm::copy() | 1033 | void AdvancedFm::copy() |
1034 | { | 1034 | { |
1035 | QString curFile = getPath(); | 1035 | QString curFile = getPath(); |
1036 | if (TabWidget->currentPageIndex() == 0) { | 1036 | if (TabWidget->currentPageIndex() == 0) { |
1037 | QString destFile = currentRemoteDir.canonicalPath()+"/"+Local_View->currentItem()->text(0); | 1037 | QString destFile = currentRemoteDir.canonicalPath()+"/"+Local_View->currentItem()->text(0); |
1038 | QFile f(destFile); | 1038 | QFile f(destFile); |
1039 | if( f.exists()) | 1039 | if( f.exists()) |
1040 | f.remove(); | 1040 | f.remove(); |
1041 | if(!copyFile(destFile, curFile) ) | 1041 | if(!copyFile(destFile, curFile) ) |
1042 | qWarning("nothin doing"); | 1042 | qWarning("nothin doing"); |
1043 | populateRemoteView(); | 1043 | populateRemoteView(); |
1044 | TabWidget->setCurrentPage(1); | 1044 | TabWidget->setCurrentPage(1); |
1045 | } else { | 1045 | } else { |
1046 | QString destFile = currentDir.canonicalPath()+"/"+Remote_View->currentItem()->text(0); | 1046 | QString destFile = currentDir.canonicalPath()+"/"+Remote_View->currentItem()->text(0); |
1047 | QFile f(destFile); | 1047 | QFile f(destFile); |
1048 | if( f.exists()) | 1048 | if( f.exists()) |
1049 | f.remove(); | 1049 | f.remove(); |
1050 | if(!copyFile(destFile, curFile) ) | 1050 | if(!copyFile(destFile, curFile) ) |
1051 | qWarning("nothin doing"); | 1051 | qWarning("nothin doing"); |
1052 | populateLocalView(); | 1052 | populateLocalView(); |
1053 | TabWidget->setCurrentPage(0); | 1053 | TabWidget->setCurrentPage(0); |
1054 | } | 1054 | } |
1055 | } | 1055 | } |
1056 | 1056 | ||
1057 | void AdvancedFm::copyAs() | 1057 | void AdvancedFm::copyAs() |
1058 | { | 1058 | { |
1059 | QString curFile = getPath(); | 1059 | QString curFile = getPath(); |
1060 | if (TabWidget->currentPageIndex() == 0) { | 1060 | if (TabWidget->currentPageIndex() == 0) { |
1061 | QString destFile = Local_View->currentItem()->text(0); | 1061 | QString destFile = Local_View->currentItem()->text(0); |
1062 | InputDialog *fileDlg; | 1062 | InputDialog *fileDlg; |
1063 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | 1063 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); |
1064 | fileDlg->setInputText((const QString &) destFile ); | 1064 | fileDlg->setInputText((const QString &) destFile ); |
1065 | fileDlg->exec(); | 1065 | fileDlg->exec(); |
1066 | if( fileDlg->result() == 1 ) { | 1066 | if( fileDlg->result() == 1 ) { |
1067 | QString filename = fileDlg->LineEdit1->text(); | 1067 | QString filename = fileDlg->LineEdit1->text(); |
1068 | destFile = currentRemoteDir.canonicalPath()+"/"+destFile; | 1068 | destFile = currentRemoteDir.canonicalPath()+"/"+destFile; |
1069 | 1069 | ||
1070 | QFile f(destFile); | 1070 | QFile f(destFile); |
1071 | if( f.exists()) | 1071 | if( f.exists()) |
1072 | f.remove(); | 1072 | f.remove(); |
1073 | if(!copyFile(destFile, curFile) ) | 1073 | if(!copyFile(destFile, curFile) ) |
1074 | qWarning("nothin doing"); | 1074 | qWarning("nothin doing"); |
1075 | } | 1075 | } |
1076 | populateRemoteView(); | 1076 | populateRemoteView(); |
1077 | TabWidget->setCurrentPage(1); | 1077 | TabWidget->setCurrentPage(1); |
1078 | } else { | 1078 | } else { |
1079 | QString destFile = Remote_View->currentItem()->text(0); | 1079 | QString destFile = Remote_View->currentItem()->text(0); |
1080 | InputDialog *fileDlg; | 1080 | InputDialog *fileDlg; |
1081 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | 1081 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); |
1082 | fileDlg->setInputText((const QString &) destFile); | 1082 | fileDlg->setInputText((const QString &) destFile); |
1083 | fileDlg->exec(); | 1083 | fileDlg->exec(); |
1084 | if( fileDlg->result() == 1 ) { | 1084 | if( fileDlg->result() == 1 ) { |
1085 | QString filename = fileDlg->LineEdit1->text(); | 1085 | QString filename = fileDlg->LineEdit1->text(); |
1086 | destFile = currentDir.canonicalPath()+"/"+destFile; | 1086 | destFile = currentDir.canonicalPath()+"/"+destFile; |
1087 | 1087 | ||
1088 | QFile f(destFile); | 1088 | QFile f(destFile); |
1089 | if( f.exists()) | 1089 | if( f.exists()) |
1090 | f.remove(); | 1090 | f.remove(); |
1091 | if(!copyFile(destFile, curFile) ) | 1091 | if(!copyFile(destFile, curFile) ) |
1092 | qWarning("nothin doing"); | 1092 | qWarning("nothin doing"); |
1093 | } | 1093 | } |
1094 | populateLocalView(); | 1094 | populateLocalView(); |
1095 | TabWidget->setCurrentPage(0); | 1095 | TabWidget->setCurrentPage(0); |
1096 | } | 1096 | } |
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | void AdvancedFm::move() { | 1099 | void AdvancedFm::move() { |
1100 | QString curFile = getPath(); | 1100 | QString curFile = getPath(); |
1101 | // qDebug(curFile); | 1101 | // qDebug(curFile); |
1102 | QString destFile; | 1102 | QString destFile; |
1103 | if (TabWidget->currentPageIndex() == 0) { | 1103 | if (TabWidget->currentPageIndex() == 0) { |
1104 | QString destFile = currentRemoteDir.canonicalPath() + "/" + Local_View->currentItem()->text(0); | 1104 | QString destFile = currentRemoteDir.canonicalPath() + "/" + Local_View->currentItem()->text(0); |
1105 | qDebug("Destination file is "+destFile); | 1105 | qDebug("Destination file is "+destFile); |
1106 | 1106 | ||
1107 | QFile f(destFile); | 1107 | QFile f(destFile); |
1108 | if( f.exists()) | 1108 | if( f.exists()) |
1109 | f.remove(); | 1109 | f.remove(); |
1110 | if(!copyFile( destFile, curFile) ) { | 1110 | if(!copyFile( destFile, curFile) ) { |
1111 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); | 1111 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); |
1112 | return; | 1112 | return; |
1113 | } | 1113 | } |
1114 | QFile::remove(curFile); | 1114 | QFile::remove(curFile); |
1115 | TabWidget->setCurrentPage(1); | 1115 | TabWidget->setCurrentPage(1); |
1116 | } else { | 1116 | } else { |
1117 | QString destFile = currentDir.canonicalPath() + "/" + Remote_View->currentItem()->text(0); | 1117 | QString destFile = currentDir.canonicalPath() + "/" + Remote_View->currentItem()->text(0); |
1118 | qDebug("Destination file is "+destFile); | 1118 | qDebug("Destination file is "+destFile); |
1119 | 1119 | ||
1120 | QFile f(destFile); | 1120 | QFile f(destFile); |
1121 | if( f.exists()) | 1121 | if( f.exists()) |
1122 | f.remove(); | 1122 | f.remove(); |
1123 | if(!copyFile(destFile, curFile) ) { | 1123 | if(!copyFile(destFile, curFile) ) { |
1124 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); | 1124 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); |
1125 | return; | 1125 | return; |
1126 | } | 1126 | } |
1127 | QFile::remove(curFile); | 1127 | QFile::remove(curFile); |
1128 | TabWidget->setCurrentPage(0); | 1128 | TabWidget->setCurrentPage(0); |
1129 | } | 1129 | } |
1130 | populateRemoteView(); | 1130 | populateRemoteView(); |
1131 | populateLocalView(); | 1131 | populateLocalView(); |
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) | 1134 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) |
1135 | { | 1135 | { |
1136 | char bf[ 50000 ]; | 1136 | char bf[ 50000 ]; |
1137 | int bytesRead; | 1137 | int bytesRead; |
1138 | bool success = TRUE; | 1138 | bool success = TRUE; |
1139 | struct stat status; | 1139 | struct stat status; |
1140 | 1140 | ||
1141 | QFile s( src ); | 1141 | QFile s( src ); |
1142 | QFile d( dest ); | 1142 | QFile d( dest ); |
1143 | 1143 | ||
1144 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { | 1144 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { |
1145 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { | 1145 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { |
1146 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ | 1146 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ |
1147 | success = FALSE; | 1147 | success = FALSE; |
1148 | break; | 1148 | break; |
1149 | } | 1149 | } |
1150 | } | 1150 | } |
1151 | if( success && (bytesRead > 0) ){ | 1151 | if( success && (bytesRead > 0) ){ |
1152 | d.writeBlock( bf, bytesRead ); | 1152 | d.writeBlock( bf, bytesRead ); |
1153 | } | 1153 | } |
1154 | } else { | 1154 | } else { |
1155 | success = FALSE; | 1155 | success = FALSE; |
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | // Set file permissions | 1158 | // Set file permissions |
1159 | if( stat( (const char *) src, &status ) == 0 ){ | 1159 | if( stat( (const char *) src, &status ) == 0 ){ |
1160 | chmod( (const char *) dest, status.st_mode ); | 1160 | chmod( (const char *) dest, status.st_mode ); |
1161 | } | 1161 | } |
1162 | 1162 | ||
1163 | return success; | 1163 | return success; |
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | void AdvancedFm::runCommand() { | 1166 | void AdvancedFm::runCommand() { |
1167 | QString curFile; | 1167 | QString curFile; |
1168 | if (TabWidget->currentPageIndex() == 0) { | 1168 | if (TabWidget->currentPageIndex() == 0) { |
1169 | if( Local_View->currentItem()) | 1169 | if( Local_View->currentItem()) |
1170 | curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); | 1170 | curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); |
1171 | } else { | 1171 | } else { |
1172 | if(Remote_View->currentItem()) | 1172 | if(Remote_View->currentItem()) |
1173 | curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); | 1173 | curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); |
1174 | } | 1174 | } |
1175 | 1175 | ||
1176 | InputDialog *fileDlg; | 1176 | InputDialog *fileDlg; |
1177 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 1177 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
1178 | fileDlg->setInputText(curFile); | 1178 | fileDlg->setInputText(curFile); |
1179 | fileDlg->exec(); | 1179 | fileDlg->exec(); |
1180 | QString command; | 1180 | QString command; |
1181 | if( fileDlg->result() == 1 ) { | 1181 | if( fileDlg->result() == 1 ) { |
1182 | command = fileDlg->LineEdit1->text(); | 1182 | command = fileDlg->LineEdit1->text(); |
1183 | 1183 | ||
1184 | int err=0; | 1184 | int err=0; |
1185 | Output *outDlg; | 1185 | Output *outDlg; |
1186 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1186 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1187 | outDlg->showMaximized(); | 1187 | outDlg->showMaximized(); |
1188 | outDlg->show(); | 1188 | outDlg->show(); |
1189 | qApp->processEvents(); | 1189 | qApp->processEvents(); |
1190 | FILE *fp; | 1190 | FILE *fp; |
1191 | char line[130]; | 1191 | char line[130]; |
1192 | sleep(1); | 1192 | sleep(1); |
1193 | // if(command.find("2>",0,TRUE) != -1) | 1193 | // if(command.find("2>",0,TRUE) != -1) |
1194 | command +=" 2>&1"; | 1194 | command +=" 2>&1"; |
1195 | fp = popen( (const char *) command, "r"); | 1195 | fp = popen( (const char *) command, "r"); |
1196 | if ( !fp ) { | 1196 | if ( !fp ) { |
1197 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 1197 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
1198 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); | 1198 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); |
1199 | pclose(fp); | 1199 | pclose(fp); |
1200 | return; | 1200 | return; |
1201 | } else { | 1201 | } else { |
1202 | while ( fgets( line, sizeof line, fp)) { | 1202 | while ( fgets( line, sizeof line, fp)) { |
1203 | QString lineStr = line; | 1203 | QString lineStr = line; |
1204 | lineStr=lineStr.left(lineStr.length()-1); | 1204 | lineStr=lineStr.left(lineStr.length()-1); |
1205 | outDlg->OutputEdit->append(lineStr); | 1205 | outDlg->OutputEdit->append(lineStr); |
1206 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 1206 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
1207 | } | 1207 | } |
1208 | } | 1208 | } |
1209 | } | 1209 | } |
1210 | } | 1210 | } |
1211 | 1211 | ||
1212 | void AdvancedFm::runCommandStd() { | 1212 | void AdvancedFm::runCommandStd() { |
1213 | QString curFile; | 1213 | QString curFile; |
1214 | if (TabWidget->currentPageIndex() == 0) { | 1214 | if (TabWidget->currentPageIndex() == 0) { |
1215 | if( Local_View->currentItem()) | 1215 | if( Local_View->currentItem()) |
1216 | curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); | 1216 | curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); |
1217 | } else { | 1217 | } else { |
1218 | if(Remote_View->currentItem()) | 1218 | if(Remote_View->currentItem()) |
1219 | curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); | 1219 | curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); |
1220 | } | 1220 | } |
1221 | 1221 | ||
1222 | InputDialog *fileDlg; | 1222 | InputDialog *fileDlg; |
1223 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 1223 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
1224 | fileDlg->setInputText(curFile); | 1224 | fileDlg->setInputText(curFile); |
1225 | fileDlg->exec(); | 1225 | fileDlg->exec(); |
1226 | QString command; | 1226 | QString command; |
1227 | if( fileDlg->result() == 1 ) { | 1227 | if( fileDlg->result() == 1 ) { |
1228 | qApp->processEvents(); | 1228 | qApp->processEvents(); |
1229 | command = fileDlg->LineEdit1->text() + " &"; | 1229 | command = fileDlg->LineEdit1->text() + " &"; |
1230 | system(command.latin1()); | 1230 | system(command.latin1()); |
1231 | } | 1231 | } |
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | void AdvancedFm::fileStatus() { | 1234 | void AdvancedFm::fileStatus() { |
1235 | QString curFile; | 1235 | QString curFile; |
1236 | if (TabWidget->currentPageIndex() == 0) { | 1236 | if (TabWidget->currentPageIndex() == 0) { |
1237 | curFile = Local_View->currentItem()->text(0); | 1237 | curFile = Local_View->currentItem()->text(0); |
1238 | } else { | 1238 | } else { |
1239 | curFile = Remote_View->currentItem()->text(0); | 1239 | curFile = Remote_View->currentItem()->text(0); |
1240 | } | 1240 | } |
1241 | QString command = " stat -l "+ curFile +" 2>&1"; | 1241 | QString command = " stat -l "+ curFile +" 2>&1"; |
1242 | int err=0; | 1242 | int err=0; |
1243 | Output *outDlg; | 1243 | Output *outDlg; |
1244 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1244 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1245 | outDlg->showMaximized(); | 1245 | outDlg->showMaximized(); |
1246 | outDlg->show(); | 1246 | outDlg->show(); |
1247 | qApp->processEvents(); | 1247 | qApp->processEvents(); |
1248 | FILE *fp; | 1248 | FILE *fp; |
1249 | char line[130]; | 1249 | char line[130]; |
1250 | sleep(1); | 1250 | sleep(1); |
1251 | fp = popen( (const char *) command, "r"); | 1251 | fp = popen( (const char *) command, "r"); |
1252 | if ( !fp ) { | 1252 | if ( !fp ) { |
1253 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 1253 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
1254 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); | 1254 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); |
1255 | pclose(fp); | 1255 | pclose(fp); |
1256 | return; | 1256 | return; |
1257 | } else { | 1257 | } else { |
1258 | while ( fgets( line, sizeof line, fp)) { | 1258 | while ( fgets( line, sizeof line, fp)) { |
1259 | outDlg->OutputEdit->append(line); | 1259 | outDlg->OutputEdit->append(line); |
1260 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 1260 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
1261 | 1261 | ||
1262 | } | 1262 | } |
1263 | 1263 | ||
1264 | } | 1264 | } |
1265 | } | 1265 | } |
1266 | 1266 | ||
1267 | void AdvancedFm::mkDir() { | 1267 | void AdvancedFm::mkDir() { |
1268 | if (TabWidget->currentPageIndex() == 0) | 1268 | if (TabWidget->currentPageIndex() == 0) |
1269 | localMakDir(); | 1269 | localMakDir(); |
1270 | else | 1270 | else |
1271 | remoteMakDir(); | 1271 | remoteMakDir(); |
1272 | 1272 | ||
1273 | } | 1273 | } |
1274 | 1274 | ||
1275 | void AdvancedFm::rn() { | 1275 | void AdvancedFm::rn() { |
1276 | if (TabWidget->currentPageIndex() == 0) | 1276 | if (TabWidget->currentPageIndex() == 0) |
1277 | localRename(); | 1277 | localRename(); |
1278 | else | 1278 | else |
1279 | remoteRename(); | 1279 | remoteRename(); |
1280 | 1280 | ||
1281 | } | 1281 | } |
1282 | 1282 | ||
1283 | void AdvancedFm::del() { | 1283 | void AdvancedFm::del() { |
1284 | if (TabWidget->currentPageIndex() == 0) | 1284 | if (TabWidget->currentPageIndex() == 0) |
1285 | localDelete(); | 1285 | localDelete(); |
1286 | else | 1286 | else |
1287 | remoteDelete(); | 1287 | remoteDelete(); |
1288 | } | 1288 | } |
1289 | 1289 | ||
1290 | void AdvancedFm::doAbout() { | 1290 | void AdvancedFm::doAbout() { |
1291 | QMessageBox::message("AdvancedFm","Advanced FileManager\n" | 1291 | QMessageBox::message("AdvancedFm","Advanced FileManager\n" |
1292 | "is copyright 2002 by\n" | 1292 | "is copyright 2002 by\n" |
1293 | "L.J.Potter<llornkcor@handhelds.org>\n" | 1293 | "L.J.Potter<llornkcor@handhelds.org>\n" |
1294 | "and is licensed by the GPL"); | 1294 | "and is licensed by the GPL"); |
1295 | } | 1295 | } |