author | llornkcor <llornkcor> | 2002-04-01 23:50:15 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-01 23:50:15 (UTC) |
commit | dd9e49cca8cd9a32a52edfc6b6a0683579612a75 (patch) (unidiff) | |
tree | ca4bdb7f60150ae147be009a2967721489a81d54 | |
parent | cf0ee2d22d3f31ba992df6735968d15b3653820b (diff) | |
download | opie-dd9e49cca8cd9a32a52edfc6b6a0683579612a75.zip opie-dd9e49cca8cd9a32a52edfc6b6a0683579612a75.tar.gz opie-dd9e49cca8cd9a32a52edfc6b6a0683579612a75.tar.bz2 |
input dialog
-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 43 | ||||
-rw-r--r-- | core/apps/textedit/fileBrowser.h | 2 | ||||
-rw-r--r-- | noncore/net/opieftp/inputDialog.cpp | 4 | ||||
-rw-r--r-- | noncore/net/opieftp/inputDialog.h | 2 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 4 |
5 files changed, 35 insertions, 20 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index 8ea8067..652f830 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp | |||
@@ -1,283 +1,291 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** copyright 2001 ljp ljp@llornkcor.com | 2 | ** copyright 2001 ljp ljp@llornkcor.com |
3 | ** Created: Fri Dec 14 08:16:46 2001 | 3 | ** Created: Fri Dec 14 08:16:46 2001 |
4 | ** | 4 | ** |
5 | ** This file may be distributed and/or modified under the terms of the | 5 | ** This file may be distributed and/or modified under the terms of the |
6 | ** GNU General Public License version 2 as published by the Free Software | 6 | ** GNU General Public License version 2 as published by the Free Software |
7 | ** Foundation and appearing in the file LICENSE.GPL included in the | 7 | ** Foundation and appearing in the file LICENSE.GPL included in the |
8 | ** packaging of this file. | 8 | ** packaging of this file. |
9 | ** | 9 | ** |
10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
12 | ** | 12 | ** |
13 | ****************************************************************************/ | 13 | ****************************************************************************/ |
14 | #define QTOPIA_INTERNAL_MIMEEXT | 14 | //#define QTOPIA_INTERNAL_MIMEEXT |
15 | #include "fileBrowser.h" | 15 | #include "fileBrowser.h" |
16 | //#include "inputDialog.h" | 16 | //#include "inputDialog.h" |
17 | 17 | ||
18 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
19 | #include <qpe/resource.h> | 19 | #include <qpe/resource.h> |
20 | #include <qpe/fileselector.h> | 20 | #include <qpe/fileselector.h> |
21 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
22 | #include <qpe/menubutton.h> | 22 | #include <qpe/menubutton.h> |
23 | #include <qpe/mimetype.h> | 23 | #include <qpe/mimetype.h> |
24 | 24 | ||
25 | #include <qdict.h> | 25 | #include <qdict.h> |
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | #include <qlistview.h> | 27 | #include <qlistview.h> |
28 | #include <qcombo.h> | 28 | #include <qcombo.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qfile.h> | 30 | #include <qfile.h> |
31 | #include <qmessagebox.h> | 31 | #include <qmessagebox.h> |
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | #include <unistd.h> | 33 | #include <unistd.h> |
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
36 | #include <qstringlist.h> | 36 | #include <qstringlist.h> |
37 | 37 | ||
38 | #include <unistd.h> | 38 | #include <unistd.h> |
39 | #include <stdlib.h> | 39 | #include <stdlib.h> |
40 | 40 | ||
41 | static int u_id = 1; | 41 | static int u_id = 1; |
42 | static int get_unique_id() | 42 | static int get_unique_id() |
43 | { | 43 | { |
44 | return u_id++; | 44 | return u_id++; |
45 | } | 45 | } |
46 | 46 | ||
47 | fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString mimeFilter ) | 47 | fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString mimeFilter ) |
48 | : QDialog( parent, name, modal, fl ) | 48 | : QDialog( parent, name, modal, fl ) |
49 | { | 49 | { |
50 | if ( !name ) | 50 | if ( !name ) |
51 | setName( "fileBrowser" ); | 51 | setName( "fileBrowser" ); |
52 | setCaption(tr( name ) ); | 52 | setCaption(tr( name ) ); |
53 | mimeType = mimeFilter; | 53 | // mimeType = mimeFilter; |
54 | MimeType mt( mimeType); | 54 | // MimeType mt( mimeType); |
55 | if( mt.extension().isEmpty()) | 55 | // if( mt.extension().isEmpty()) |
56 | filterStr = "*"; | 56 | QStringList filterList; |
57 | else | 57 | filterList=QStringList::split(";",mimeFilter,FALSE); |
58 | filterStr = "*."+ mt.extension(); | 58 | for ( QStringList::Iterator it = filterList.begin(); it != filterList.end(); ++it ) { |
59 | printf( "%s \n", (*it).latin1() ); | ||
60 | } | ||
61 | |||
62 | filterStr = mimeFilter.right(mimeFilter.length()- mimeFilter.find("/",0,TRUE) - 1);// "*"; | ||
63 | qDebug(filterStr); | ||
64 | // else | ||
65 | // filterStr = "*."+ mt.extension(); | ||
59 | // qDebug("description "+mt.description()); | 66 | // qDebug("description "+mt.description()); |
60 | // qDebug( "id "+mt.id()); | 67 | // qDebug( "id "+mt.id()); |
61 | // qDebug("extension "+mt.extension()); | 68 | // qDebug("extension "+mt.extension()); |
62 | 69 | ||
63 | // channel = new QCopChannel( "QPE/fileDialog", this ); | 70 | // channel = new QCopChannel( "QPE/fileDialog", this ); |
64 | // connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 71 | // connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
65 | // this, SLOT(receive(const QCString&, const QByteArray&)) ); | 72 | // this, SLOT(receive(const QCString&, const QByteArray&)) ); |
66 | 73 | ||
67 | QGridLayout *layout = new QGridLayout( this ); | 74 | QGridLayout *layout = new QGridLayout( this ); |
68 | layout->setSpacing( 4 ); | 75 | layout->setSpacing( 4 ); |
69 | layout->setMargin( 4 ); | 76 | layout->setMargin( 4 ); |
70 | 77 | ||
71 | dirPathCombo = new QComboBox( FALSE, this, "dorPathCombo" ); | 78 | dirPathCombo = new QComboBox( FALSE, this, "dirPathCombo" ); |
72 | dirPathCombo->setEditable(TRUE); | 79 | dirPathCombo->setEditable(TRUE); |
73 | 80 | ||
74 | connect( dirPathCombo, SIGNAL( activated( const QString & ) ), | 81 | connect( dirPathCombo, SIGNAL( activated( const QString & ) ), |
75 | this, SLOT( dirPathComboActivated( const QString & ) ) ); | 82 | this, SLOT( dirPathComboActivated( const QString & ) ) ); |
76 | 83 | ||
77 | connect( dirPathCombo->lineEdit(), SIGNAL( returnPressed( ) ), | 84 | connect( dirPathCombo->lineEdit(), SIGNAL( returnPressed( ) ), |
78 | this, SLOT( dirPathEditPressed( ) ) ); | 85 | this, SLOT( dirPathEditPressed( ) ) ); |
79 | 86 | ||
80 | dirPathStringList << "/"; | 87 | dirPathStringList << "/"; |
81 | // we can get the storage here | 88 | // we can get the storage here |
82 | 89 | ||
83 | layout->addMultiCellWidget( dirPathCombo, 0, 0, 0, 4 ); | 90 | layout->addMultiCellWidget( dirPathCombo, 0, 0, 0, 4 ); |
84 | 91 | ||
85 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); | 92 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); |
86 | cdUpButton ->setMinimumSize( QSize( 20, 20 ) ); | 93 | cdUpButton ->setMinimumSize( QSize( 20, 20 ) ); |
87 | cdUpButton ->setMaximumSize( QSize( 20, 20 ) ); | 94 | cdUpButton ->setMaximumSize( QSize( 20, 20 ) ); |
88 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 95 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
89 | cdUpButton ->setFlat(TRUE); | 96 | cdUpButton ->setFlat(TRUE); |
90 | layout->addMultiCellWidget( cdUpButton, 0, 0, 5, 5 ); | 97 | layout->addMultiCellWidget( cdUpButton, 0, 0, 5, 5 ); |
91 | 98 | ||
92 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); | 99 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); |
93 | docButton->setMinimumSize( QSize( 20, 20 ) ); | 100 | docButton->setMinimumSize( QSize( 20, 20 ) ); |
94 | docButton->setMaximumSize( QSize( 20, 20 ) ); | 101 | docButton->setMaximumSize( QSize( 20, 20 ) ); |
95 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 102 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
96 | docButton->setFlat(TRUE); | 103 | docButton->setFlat(TRUE); |
97 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); | 104 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); |
98 | 105 | ||
99 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); | 106 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); |
100 | homeButton->setMinimumSize( QSize( 20, 20 ) ); | 107 | homeButton->setMinimumSize( QSize( 20, 20 ) ); |
101 | homeButton->setMaximumSize( QSize( 20, 20 ) ); | 108 | homeButton->setMaximumSize( QSize( 20, 20 ) ); |
102 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 109 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
103 | homeButton->setFlat(TRUE); | 110 | homeButton->setFlat(TRUE); |
104 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7 ); | 111 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7 ); |
105 | 112 | ||
106 | FileStack = new QWidgetStack( this ); | 113 | FileStack = new QWidgetStack( this ); |
107 | 114 | ||
108 | ListView = new QListView( this, "ListView" ); | 115 | ListView = new QListView( this, "ListView" ); |
109 | // ListView->setMinimumSize( QSize( 100, 25 ) ); | 116 | // ListView->setMinimumSize( QSize( 100, 25 ) ); |
110 | ListView->addColumn( tr( "Name" ) ); | 117 | ListView->addColumn( tr( "Name" ) ); |
111 | ListView->setColumnWidth(0,120); | 118 | ListView->setColumnWidth(0,120); |
112 | ListView->setSorting( 2, FALSE); | 119 | ListView->setSorting( 2, FALSE); |
113 | ListView->addColumn( tr( "Size" ) ); | 120 | ListView->addColumn( tr( "Size" ) ); |
114 | ListView->setColumnWidth(1,-1); | 121 | ListView->setColumnWidth(1,-1); |
115 | ListView->addColumn( "Date",-1); | 122 | ListView->addColumn( "Date",-1); |
116 | 123 | ||
117 | ListView->setColumnWidthMode(0,QListView::Manual); | 124 | ListView->setColumnWidthMode(0,QListView::Manual); |
118 | ListView->setColumnAlignment(1,QListView::AlignRight); | 125 | ListView->setColumnAlignment(1,QListView::AlignRight); |
119 | ListView->setColumnAlignment(2,QListView::AlignRight); | 126 | ListView->setColumnAlignment(2,QListView::AlignRight); |
120 | ListView->setAllColumnsShowFocus( TRUE ); | 127 | ListView->setAllColumnsShowFocus( TRUE ); |
121 | 128 | ||
122 | QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); | 129 | QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); |
123 | connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 130 | connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
124 | this, SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 131 | this, SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
125 | 132 | ||
126 | connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); | 133 | connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); |
127 | 134 | ||
128 | FileStack->addWidget( ListView, get_unique_id() ); | 135 | FileStack->addWidget( ListView, get_unique_id() ); |
129 | 136 | ||
130 | fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy | 137 | fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy |
131 | // connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); | 138 | // connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); |
132 | // connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); | 139 | // connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); |
133 | connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); | 140 | connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), |
141 | this, SLOT( docOpen( const DocLnk & ) ) ); | ||
134 | layout->addMultiCellWidget( FileStack, 1, 1, 0, 7 ); | 142 | layout->addMultiCellWidget( FileStack, 1, 1, 0, 7 ); |
135 | 143 | ||
136 | SelectionCombo = new QComboBox( FALSE, this, "SelectionCombo" ); | 144 | SelectionCombo = new QComboBox( FALSE, this, "SelectionCombo" ); |
137 | SelectionCombo->insertItem( tr( "Documents" ) ); | 145 | SelectionCombo->insertItem( tr( "Documents" ) ); |
138 | SelectionCombo->insertItem( tr( "All files" ) ); | 146 | SelectionCombo->insertItem( tr( "All files" ) ); |
139 | SelectionCombo->insertItem( tr( "Hidden files" ) ); | 147 | SelectionCombo->insertItem( tr( "Hidden files" ) ); |
140 | // SelectionCombo->setMaximumWidth(120); | 148 | // SelectionCombo->setMaximumWidth(120); |
141 | layout->addMultiCellWidget( SelectionCombo, 2, 2, 0, 3 ); | 149 | layout->addMultiCellWidget( SelectionCombo, 2, 2, 0, 3 ); |
142 | 150 | ||
143 | connect( SelectionCombo, SIGNAL( activated( const QString & ) ), | 151 | connect( SelectionCombo, SIGNAL( activated( const QString & ) ), |
144 | this, SLOT( selectionChanged( const QString & ) ) ); | 152 | this, SLOT( selectionChanged( const QString & ) ) ); |
145 | 153 | ||
146 | typemb = new MenuButton(this); | 154 | typemb = new MenuButton(this); |
147 | typemb->setLabel(tr("Type: %1")); | 155 | typemb->setLabel(tr("Type: %1")); |
148 | typemb->setMinimumWidth(110); | 156 | typemb->setMinimumWidth(110); |
149 | typemb->setFixedHeight(22); | 157 | typemb->setFixedHeight(22); |
150 | layout->addMultiCellWidget( typemb, 2, 2, 4, 7 ); | 158 | layout->addMultiCellWidget( typemb, 2, 2, 4, 7 ); |
151 | updateMimeTypeMenu() ; | 159 | updateMimeTypeMenu() ; |
152 | 160 | ||
153 | currentDir.setPath(QDir::currentDirPath()); | 161 | currentDir.setPath(QDir::currentDirPath()); |
154 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); | 162 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); |
155 | currentDir.setNameFilter(filterStr); | 163 | currentDir.setNameFilter(filterStr); |
156 | 164 | ||
157 | populateList(); | 165 | populateList(); |
158 | move(0,15); | 166 | move(0,15); |
159 | } | 167 | } |
160 | 168 | ||
161 | fileBrowser::~fileBrowser() | 169 | fileBrowser::~fileBrowser() |
162 | { | 170 | { |
163 | } | 171 | } |
164 | 172 | ||
165 | void fileBrowser::setFileView( int selection ) | 173 | void fileBrowser::setFileView( int selection ) |
166 | { | 174 | { |
167 | SelectionCombo->setCurrentItem( selection ); | 175 | SelectionCombo->setCurrentItem( selection ); |
168 | selectionChanged( SelectionCombo->currentText() ); | 176 | selectionChanged( SelectionCombo->currentText() ); |
169 | } | 177 | } |
170 | 178 | ||
171 | void fileBrowser::populateList() | 179 | void fileBrowser::populateList() |
172 | { | 180 | { |
173 | ListView->clear(); | 181 | ListView->clear(); |
174 | QListViewItem * item; | 182 | QListViewItem * item; |
175 | bool isDir=FALSE; | 183 | bool isDir=FALSE; |
176 | //qDebug(currentDir.canonicalPath()); | 184 | //qDebug(currentDir.canonicalPath()); |
177 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 185 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
178 | currentDir.setMatchAllDirs(TRUE); | 186 | currentDir.setMatchAllDirs(TRUE); |
179 | 187 | ||
180 | // currentDir.setNameFilter("*.txt;*.etx"); | 188 | // currentDir.setNameFilter("*.txt;*.etx"); |
181 | QString fileL, fileS, fileDate; | 189 | QString fileL, fileS, fileDate; |
182 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 190 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
183 | QFileInfoListIterator it(*list); | 191 | QFileInfoListIterator it(*list); |
184 | QFileInfo *fi; | 192 | QFileInfo *fi; |
185 | while ( (fi=it.current()) ) { | 193 | while ( (fi=it.current()) ) { |
186 | if (fi->isSymLink() ){ | 194 | if (fi->isSymLink() ){ |
187 | QString symLink=fi->readLink(); | 195 | QString symLink=fi->readLink(); |
188 | // qDebug("Symlink detected "+symLink); | 196 | // qDebug("Symlink detected "+symLink); |
189 | QFileInfo sym( symLink); | 197 | QFileInfo sym( symLink); |
190 | fileS.sprintf( "%10li", sym.size() ); | 198 | fileS.sprintf( "%10li", sym.size() ); |
191 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 199 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
192 | fileDate = sym.lastModified().toString(); | 200 | fileDate = sym.lastModified().toString(); |
193 | } else { | 201 | } else { |
194 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 202 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
195 | fileS.sprintf( "%10li", fi->size() ); | 203 | fileS.sprintf( "%10li", fi->size() ); |
196 | fileL.sprintf( "%s",fi->fileName().data() ); | 204 | fileL.sprintf( "%s",fi->fileName().data() ); |
197 | fileDate= fi->lastModified().toString(); | 205 | fileDate= fi->lastModified().toString(); |
198 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 206 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
199 | fileL+="/"; | 207 | fileL+="/"; |
200 | isDir=TRUE; | 208 | isDir=TRUE; |
201 | // qDebug( fileL); | 209 | // qDebug( fileL); |
202 | } | 210 | } |
203 | } | 211 | } |
204 | if(fileL !="./" && fi->exists()) { | 212 | if(fileL !="./" && fi->exists()) { |
205 | item= new QListViewItem( ListView,fileL,fileS , fileDate); | 213 | item= new QListViewItem( ListView,fileL,fileS , fileDate); |
206 | QPixmap pm; | 214 | QPixmap pm; |
207 | 215 | ||
208 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 216 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
209 | if( !QDir( fi->filePath() ).isReadable()) | 217 | if( !QDir( fi->filePath() ).isReadable()) |
210 | pm = Resource::loadPixmap( "lockedfolder" ); | 218 | pm = Resource::loadPixmap( "lockedfolder" ); |
211 | else | 219 | else |
212 | pm= Resource::loadPixmap( "folder" ); | 220 | pm= Resource::loadPixmap( "folder" ); |
213 | item->setPixmap( 0,pm ); | 221 | item->setPixmap( 0,pm ); |
214 | } else { | 222 | } else { |
215 | if( !fi->isReadable() ) | 223 | if( !fi->isReadable() ) |
216 | pm = Resource::loadPixmap( "locked" ); | 224 | pm = Resource::loadPixmap( "locked" ); |
217 | else { | 225 | else { |
218 | MimeType mt(fi->filePath()); | 226 | MimeType mt(fi->filePath()); |
219 | pm=mt.pixmap(); | 227 | pm=mt.pixmap();// sets the pixmap for the mimetype |
220 | if(pm.isNull()) | 228 | if(pm.isNull()) |
221 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 229 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
222 | item->setPixmap( 0,pm); | 230 | item->setPixmap( 0,pm); |
223 | } | 231 | } |
224 | } | 232 | } |
225 | if( fileL.find("->",0,TRUE) != -1) { | 233 | if( fileL.find("->",0,TRUE) != -1) { |
226 | // overlay link image | 234 | // overlay link image |
227 | pm= Resource::loadPixmap( "folder" ); | 235 | pm= Resource::loadPixmap( "folder" ); |
228 | QPixmap lnk = Resource::loadPixmap( "symlink" ); | 236 | QPixmap lnk = Resource::loadPixmap( "symlink" ); |
229 | QPainter painter( &pm ); | 237 | QPainter painter( &pm ); |
230 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 238 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
231 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 239 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
232 | item->setPixmap( 0, pm); | 240 | item->setPixmap( 0, pm); |
233 | } | 241 | } |
234 | } | 242 | } |
235 | isDir=FALSE; | 243 | isDir=FALSE; |
236 | ++it; | 244 | ++it; |
237 | // } | 245 | // } |
238 | } | 246 | } |
239 | ListView->setSorting( 3, FALSE); | 247 | ListView->setSorting( 3, FALSE); |
240 | QString currentPath = currentDir.canonicalPath(); | 248 | QString currentPath = currentDir.canonicalPath(); |
241 | 249 | ||
242 | fillCombo( (const QString &)currentPath); | 250 | fillCombo( (const QString &)currentPath); |
243 | // dirPathCombo->lineEdit()->setText(currentPath); | 251 | // dirPathCombo->lineEdit()->setText(currentPath); |
244 | 252 | ||
245 | // if( dirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 253 | // if( dirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
246 | // dirPathCombo->clear(); | 254 | // dirPathCombo->clear(); |
247 | // dirPathStringList.prepend(currentPath ); | 255 | // dirPathStringList.prepend(currentPath ); |
248 | // dirPathCombo->insertStringList( dirPathStringList,-1); | 256 | // dirPathCombo->insertStringList( dirPathStringList,-1); |
249 | // } | 257 | // } |
250 | } | 258 | } |
251 | 259 | ||
252 | void fileBrowser::upDir() | 260 | void fileBrowser::upDir() |
253 | { | 261 | { |
254 | QString current = currentDir.canonicalPath(); | 262 | QString current = currentDir.canonicalPath(); |
255 | QDir dir(current); | 263 | QDir dir(current); |
256 | dir.cdUp(); | 264 | dir.cdUp(); |
257 | current = dir.canonicalPath(); | 265 | current = dir.canonicalPath(); |
258 | chdir( current.latin1() ); | 266 | chdir( current.latin1() ); |
259 | currentDir.cd( current, TRUE); | 267 | currentDir.cd( current, TRUE); |
260 | populateList(); | 268 | populateList(); |
261 | update(); | 269 | update(); |
262 | } | 270 | } |
263 | 271 | ||
264 | // you may want to switch these 2 functions. I like single clicks | 272 | // you may want to switch these 2 functions. I like single clicks |
265 | void fileBrowser::listClicked(QListViewItem *selectedItem) | 273 | void fileBrowser::listClicked(QListViewItem *selectedItem) |
266 | { | 274 | { |
267 | if(selectedItem) { | 275 | if(selectedItem) { |
268 | QString strItem=selectedItem->text(0); | 276 | QString strItem=selectedItem->text(0); |
269 | QString strSize=selectedItem->text(1); | 277 | QString strSize=selectedItem->text(1); |
270 | // qDebug("strItem is "+strItem); | 278 | // qDebug("strItem is "+strItem); |
271 | strSize.stripWhiteSpace(); | 279 | strSize.stripWhiteSpace(); |
272 | // qDebug(strSize); | 280 | // qDebug(strSize); |
273 | 281 | ||
274 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 282 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
275 | // is symlink | 283 | // is symlink |
276 | QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4); | 284 | QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4); |
277 | // qDebug("strItem symlink is "+strItem2); | 285 | // qDebug("strItem symlink is "+strItem2); |
278 | if(QDir(strItem2).exists() ) { | 286 | if(QDir(strItem2).exists() ) { |
279 | currentDir.cd(strItem2, TRUE); | 287 | currentDir.cd(strItem2, TRUE); |
280 | populateList(); | 288 | populateList(); |
281 | } | 289 | } |
282 | } else { // not a symlink | 290 | } else { // not a symlink |
283 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 291 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
@@ -356,258 +364,261 @@ void fileBrowser::selectionChanged( const QString &select ) | |||
356 | dirPathCombo->show(); | 364 | dirPathCombo->show(); |
357 | cdUpButton->show(); | 365 | cdUpButton->show(); |
358 | docButton->show(); | 366 | docButton->show(); |
359 | homeButton->show(); | 367 | homeButton->show(); |
360 | FileStack->raiseWidget( ListView ); | 368 | FileStack->raiseWidget( ListView ); |
361 | } | 369 | } |
362 | } | 370 | } |
363 | 371 | ||
364 | void fileBrowser::docOpen( const DocLnk &doc ) | 372 | void fileBrowser::docOpen( const DocLnk &doc ) |
365 | { | 373 | { |
366 | fileList.append( doc.file().latin1() ); | 374 | fileList.append( doc.file().latin1() ); |
367 | accept(); | 375 | accept(); |
368 | } | 376 | } |
369 | 377 | ||
370 | void fileBrowser::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 378 | void fileBrowser::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
371 | { | 379 | { |
372 | switch (mouse) { | 380 | switch (mouse) { |
373 | case 1: | 381 | case 1: |
374 | break; | 382 | break; |
375 | case 2: | 383 | case 2: |
376 | showListMenu(item); | 384 | showListMenu(item); |
377 | break; | 385 | break; |
378 | }; | 386 | }; |
379 | } | 387 | } |
380 | 388 | ||
381 | void fileBrowser::showListMenu(QListViewItem *item) { | 389 | void fileBrowser::showListMenu(QListViewItem *item) { |
382 | 390 | ||
383 | QPopupMenu m;// = new QPopupMenu( Local_View ); | 391 | QPopupMenu m;// = new QPopupMenu( Local_View ); |
384 | if(item) { | 392 | if(item) { |
385 | if( item->text(0).find("/",0,TRUE)) | 393 | if( item->text(0).find("/",0,TRUE)) |
386 | m.insertItem( tr( "Change Directory" ), this, SLOT( doCd() )); | 394 | m.insertItem( tr( "Change Directory" ), this, SLOT( doCd() )); |
387 | m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() )); | 395 | m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() )); |
388 | m.insertItem( tr( "Rescan" ), this, SLOT( populateList() )); | 396 | m.insertItem( tr( "Rescan" ), this, SLOT( populateList() )); |
389 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 397 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
390 | m.insertSeparator(); | 398 | m.insertSeparator(); |
391 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 399 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
392 | } else { | 400 | } else { |
393 | m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() )); | 401 | m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() )); |
394 | m.insertItem( tr( "Rescan" ), this, SLOT( populateList() )); | 402 | m.insertItem( tr( "Rescan" ), this, SLOT( populateList() )); |
395 | 403 | ||
396 | } | 404 | } |
397 | m.exec( QCursor::pos() ); | 405 | m.exec( QCursor::pos() ); |
398 | } | 406 | } |
399 | 407 | ||
400 | void fileBrowser::doCd() { | 408 | void fileBrowser::doCd() { |
401 | listClicked( ListView->currentItem()); | 409 | listClicked( ListView->currentItem()); |
402 | } | 410 | } |
403 | 411 | ||
404 | void fileBrowser::makDir() { | 412 | void fileBrowser::makDir() { |
405 | InputDialog *fileDlg; | 413 | InputDialog *fileDlg; |
406 | fileDlg = new InputDialog(this,"Make Directory",TRUE, 0); | 414 | fileDlg = new InputDialog(this,"Make Directory",TRUE, 0); |
407 | fileDlg->exec(); | 415 | fileDlg->exec(); |
408 | if( fileDlg->result() == 1 ) { | 416 | if( fileDlg->result() == 1 ) { |
409 | QString filename = fileDlg->LineEdit1->text(); | 417 | QString filename = fileDlg->LineEdit1->text(); |
410 | qDebug("Make dir"); | 418 | qDebug("Make dir"); |
411 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 419 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
412 | } | 420 | } |
413 | populateList(); | 421 | populateList(); |
414 | } | 422 | } |
415 | 423 | ||
416 | void fileBrowser::localRename() { | 424 | void fileBrowser::localRename() { |
417 | QString curFile = ListView->currentItem()->text(0); | 425 | QString curFile = ListView->currentItem()->text(0); |
418 | InputDialog *fileDlg; | 426 | InputDialog *fileDlg; |
419 | fileDlg = new InputDialog(this,"Rename",TRUE, 0); | 427 | fileDlg = new InputDialog(this,"Rename",TRUE, 0); |
420 | fileDlg->inputText = curFile; | 428 | fileDlg->setTextEdit((const QString &) curFile); |
421 | fileDlg->exec(); | 429 | fileDlg->exec(); |
422 | if( fileDlg->result() == 1 ) { | 430 | if( fileDlg->result() == 1 ) { |
423 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 431 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
424 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 432 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
425 | if( rename(oldname.latin1(), newName.latin1())== -1) | 433 | if( rename(oldname.latin1(), newName.latin1())== -1) |
426 | QMessageBox::message("Note","Could not rename"); | 434 | QMessageBox::message("Note","Could not rename"); |
427 | } | 435 | } |
428 | populateList(); | 436 | populateList(); |
429 | } | 437 | } |
430 | 438 | ||
431 | void fileBrowser::localDelete() { | 439 | void fileBrowser::localDelete() { |
432 | QString f = ListView->currentItem()->text(0); | 440 | QString f = ListView->currentItem()->text(0); |
433 | if(QDir(f).exists() ) { | 441 | if(QDir(f).exists() ) { |
434 | switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+ | 442 | switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+ |
435 | " ?\nIt must be empty","Yes","No",0,0,1) ) { | 443 | " ?\nIt must be empty","Yes","No",0,0,1) ) { |
436 | case 0: { | 444 | case 0: { |
437 | f=currentDir.canonicalPath()+"/"+f; | 445 | f=currentDir.canonicalPath()+"/"+f; |
438 | QString cmd="rmdir "+f; | 446 | QString cmd="rmdir "+f; |
439 | system( cmd.latin1()); | 447 | system( cmd.latin1()); |
440 | populateList(); | 448 | populateList(); |
441 | } | 449 | } |
442 | break; | 450 | break; |
443 | case 1: | 451 | case 1: |
444 | // exit | 452 | // exit |
445 | break; | 453 | break; |
446 | }; | 454 | }; |
447 | } else { | 455 | } else { |
448 | switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f | 456 | switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f |
449 | +" ?","Yes","No",0,0,1) ) { | 457 | +" ?","Yes","No",0,0,1) ) { |
450 | case 0: { | 458 | case 0: { |
451 | f=currentDir.canonicalPath()+"/"+f; | 459 | f=currentDir.canonicalPath()+"/"+f; |
452 | QString cmd="rm "+f; | 460 | QString cmd="rm "+f; |
453 | system( cmd.latin1()); | 461 | system( cmd.latin1()); |
454 | populateList(); | 462 | populateList(); |
455 | } | 463 | } |
456 | break; | 464 | break; |
457 | case 1: | 465 | case 1: |
458 | // exit | 466 | // exit |
459 | break; | 467 | break; |
460 | }; | 468 | }; |
461 | } | 469 | } |
462 | } | 470 | } |
463 | 471 | ||
464 | void fileBrowser::updateMimeTypeMenu() { | 472 | void fileBrowser::updateMimeTypeMenu() { |
465 | 473 | ||
466 | disconnect( typemb, SIGNAL(selected(const QString&)), | 474 | disconnect( typemb, SIGNAL(selected(const QString&)), |
467 | this, SLOT(showType(const QString&)) ); | 475 | this, SLOT(showType(const QString&)) ); |
468 | 476 | ||
469 | QString prev; | 477 | QString prev; |
470 | 478 | ||
471 | // Type filter | 479 | // Type filter |
472 | QStringList types; | 480 | QStringList types; |
473 | types << tr("All"); | 481 | types << tr("All"); |
474 | types << "--"; | 482 | types << "--"; |
475 | types += getMimeTypes(); | 483 | types += getMimeTypes(); |
476 | prev = typemb->currentText(); | 484 | prev = typemb->currentText(); |
477 | typemb->clear(); | 485 | typemb->clear(); |
478 | typemb->insertItems(types); | 486 | typemb->insertItems(types); |
479 | // typemb->select(prev); | 487 | // typemb->select(prev); |
480 | 488 | ||
481 | connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&))); | 489 | connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&))); |
482 | } | 490 | } |
483 | 491 | ||
484 | void fileBrowser::showType(const QString &t) { | 492 | void fileBrowser::showType(const QString &t) { |
485 | 493 | ||
486 | qDebug(t); | 494 | qDebug(t); |
487 | if(t.find("All",0,TRUE) != -1) { | 495 | if(t.find("All",0,TRUE) != -1) { |
488 | filterStr = "*"; | 496 | filterStr = "*"; |
489 | } else { | 497 | } else { |
490 | QStringList list = mimetypes.grep( t,TRUE); | 498 | QStringList list = mimetypes.grep( t,TRUE); |
491 | QString ext; | 499 | QString ext; |
492 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 500 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
493 | mimeType =(*it); | 501 | mimeType =(*it); |
494 | MimeType mt( mimeType); | 502 | MimeType mt( mimeType); |
495 | qDebug("mime "+mimeType); | 503 | // qDebug("mime "+mimeType); |
496 | // qDebug("description "+mt.description()); | 504 | // qDebug("description "+mt.description()); |
497 | // qDebug( "id "+mt.id()); | 505 | // qDebug( "id "+mt.id()); |
498 | qDebug("extension "+mt.extension()); | 506 | // qDebug("extension "+mt.extension()); |
499 | if( mt.extension().isEmpty()) | 507 | // if( mt.extension().isEmpty()) |
500 | filterStr = "*"; | 508 | filterStr = "*"; |
501 | else | 509 | // else |
502 | filterStr = "*."+ mt.extension()+" "; | 510 | // filterStr = "*."+ mt.extension()+" "; |
503 | // printf( "%s \n", (*it).latin1() ); | 511 | // printf( "%s \n", (*it).latin1() ); |
504 | } | 512 | } |
505 | } | 513 | } |
506 | currentDir.setNameFilter(filterStr); | 514 | currentDir.setNameFilter(filterStr); |
507 | 515 | ||
508 | populateList(); | 516 | populateList(); |
509 | update(); | 517 | update(); |
510 | // if(fileSelector) { | 518 | // if(fileSelector) { |
511 | // disconnect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); | 519 | // disconnect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); |
512 | // delete fileSelector; | 520 | // delete fileSelector; |
513 | // } | 521 | // } |
514 | // fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy | 522 | // fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy |
515 | // connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); | 523 | // connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); |
516 | // connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); | 524 | // connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); |
517 | // connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); | 525 | // connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); |
518 | // fileSelector->reread(); | 526 | // fileSelector->reread(); |
519 | // if ( t == tr("All") ) { | 527 | // if ( t == tr("All") ) { |
520 | // icons->setTypeFilter("",TRUE); | 528 | // icons->setTypeFilter("",TRUE); |
521 | // } else { | 529 | // } else { |
522 | // icons->setTypeFilter(t+"/*",TRUE); | 530 | // icons->setTypeFilter(t+"/*",TRUE); |
523 | // } | 531 | // } |
524 | 532 | ||
525 | } | 533 | } |
526 | 534 | ||
527 | QStringList fileBrowser::getMimeTypes() { | 535 | QStringList fileBrowser::getMimeTypes() { |
528 | 536 | ||
529 | QStringList r; | 537 | QStringList r; |
530 | AppLnkSet apps( QPEApplication::qpeDir() + "apps" ); | 538 | AppLnkSet apps( QPEApplication::qpeDir() + "apps" ); |
531 | QFile file( QPEApplication::qpeDir()+"etc/available.mime"); | 539 | QFile file( QPEApplication::qpeDir()+"etc/available.mime"); |
532 | file.open( IO_WriteOnly|IO_Truncate);//) | 540 | file.open( IO_WriteOnly|IO_Truncate);//) |
533 | for ( QListIterator<AppLnk> it( apps.children() ); it.current(); ++it ) { | 541 | for ( QListIterator<AppLnk> it( apps.children() ); it.current(); ++it ) { |
534 | AppLnk* l; | 542 | AppLnk* l; |
535 | l = it.current(); | 543 | l = it.current(); |
536 | QStringList maj = l->mimeTypes(); | 544 | QStringList maj = l->mimeTypes(); |
537 | QStringList::ConstIterator f; | 545 | QStringList::ConstIterator f; |
538 | for ( f = maj.begin(); f != maj.end(); f++ ) { | 546 | for ( f = maj.begin(); f != maj.end(); f++ ) { |
539 | QString temp = *f; | 547 | QString temp = *f; |
540 | mimetypes << temp; | 548 | mimetypes << temp; |
541 | int sl = temp.find('/'); | 549 | int sl = temp.find('/'); |
542 | if (sl >= 0) { | 550 | if (sl >= 0) { |
543 | QString k = temp.left(sl); | 551 | QString k = temp.left(sl); |
544 | if( r.grep(k,TRUE).isEmpty() ) { | 552 | if( r.grep(k,TRUE).isEmpty() ) { |
545 | r << k; | 553 | r << k; |
546 | k+="\n"; | 554 | k+="\n"; |
547 | file.writeBlock( k.latin1(), k.length()); | 555 | file.writeBlock( k.latin1(), k.length()); |
548 | } | 556 | } |
549 | } | 557 | } |
550 | } | 558 | } |
551 | } | 559 | } |
552 | r.sort(); | 560 | r.sort(); |
553 | file.close(); | 561 | file.close(); |
554 | return r; | 562 | return r; |
555 | } | 563 | } |
556 | 564 | ||
557 | void fileBrowser::receive( const QCString &msg, const QByteArray &data ) { | 565 | void fileBrowser::receive( const QCString &msg, const QByteArray &data ) { |
558 | // QDataStream stream( data, IO_ReadOnly ); | 566 | // QDataStream stream( data, IO_ReadOnly ); |
559 | // if (msg == "keyRegister(int key, QString channel, QString message)") | 567 | // if (msg == "keyRegister(int key, QString channel, QString message)") |
560 | // { | 568 | // { |
561 | // int k; | 569 | // int k; |
562 | // QString c, m; | 570 | // QString c, m; |
563 | // stream >> k; | 571 | // stream >> k; |
564 | // stream >> c; | 572 | // stream >> c; |
565 | // stream >> m; | 573 | // stream >> m; |
566 | } | 574 | } |
567 | 575 | ||
568 | void fileBrowser::dirPathComboActivated( const QString & current) { | 576 | void fileBrowser::dirPathComboActivated( const QString & current) { |
569 | chdir( current.latin1() ); | 577 | chdir( current.latin1() ); |
570 | currentDir.cd( current, TRUE); | 578 | currentDir.cd( current, TRUE); |
571 | populateList(); | 579 | populateList(); |
572 | update(); | 580 | update(); |
573 | } | 581 | } |
574 | 582 | ||
575 | void fileBrowser::dirPathEditPressed() { | 583 | void fileBrowser::dirPathEditPressed() { |
576 | QString current = dirPathCombo->lineEdit()->text(); | 584 | QString current = dirPathCombo->lineEdit()->text(); |
577 | chdir( current.latin1() ); | 585 | chdir( current.latin1() ); |
578 | currentDir.cd( current, TRUE); | 586 | currentDir.cd( current, TRUE); |
579 | populateList(); | 587 | populateList(); |
580 | update(); | 588 | update(); |
581 | } | 589 | } |
582 | 590 | ||
583 | void fileBrowser::fillCombo(const QString ¤tPath) { | 591 | void fileBrowser::fillCombo(const QString ¤tPath) { |
584 | 592 | ||
585 | dirPathCombo->lineEdit()->setText(currentPath); | 593 | dirPathCombo->lineEdit()->setText(currentPath); |
586 | 594 | ||
587 | if( dirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 595 | if( dirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
588 | dirPathCombo->clear(); | 596 | dirPathCombo->clear(); |
589 | dirPathStringList.prepend(currentPath ); | 597 | dirPathStringList.prepend(currentPath ); |
590 | dirPathCombo->insertStringList( dirPathStringList,-1); | 598 | dirPathCombo->insertStringList( dirPathStringList,-1); |
591 | } | 599 | } |
592 | } | 600 | } |
593 | 601 | ||
594 | 602 | ||
595 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 603 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
596 | : QDialog( parent, name, modal, fl ) | 604 | : QDialog( parent, name, modal, fl ) |
597 | { | 605 | { |
598 | if ( !name ) | 606 | if ( !name ) |
599 | setName( "InputDialog" ); | 607 | setName( "InputDialog" ); |
600 | resize( 234, 50 ); | 608 | resize( 234, 50 ); |
601 | setMaximumSize( QSize( 240, 50 ) ); | 609 | setMaximumSize( QSize( 240, 50 ) ); |
602 | setCaption( tr(name ) ); | 610 | setCaption( tr(name ) ); |
603 | 611 | ||
604 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 612 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
605 | LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); | 613 | LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); |
606 | } | 614 | } |
607 | 615 | ||
608 | InputDialog::~InputDialog() | 616 | InputDialog::~InputDialog() |
609 | { | 617 | { |
610 | inputText= LineEdit1->text(); | 618 | inputText= LineEdit1->text(); |
611 | 619 | ||
612 | } | 620 | } |
613 | 621 | ||
622 | void InputDialog::setTextEdit(const QString &string) { | ||
623 | LineEdit1->setText(string); | ||
624 | } | ||
diff --git a/core/apps/textedit/fileBrowser.h b/core/apps/textedit/fileBrowser.h index e76c7df..3db6a27 100644 --- a/core/apps/textedit/fileBrowser.h +++ b/core/apps/textedit/fileBrowser.h | |||
@@ -52,68 +52,68 @@ public: | |||
52 | fileBrowser( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ,const QString filter=0); | 52 | fileBrowser( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ,const QString filter=0); |
53 | ~fileBrowser(); | 53 | ~fileBrowser(); |
54 | 54 | ||
55 | QString selectedFileName; | 55 | QString selectedFileName; |
56 | QFile file; | 56 | QFile file; |
57 | QStringList fileList; | 57 | QStringList fileList; |
58 | QComboBox *SelectionCombo; | 58 | QComboBox *SelectionCombo; |
59 | public slots: | 59 | public slots: |
60 | void setFileView( int ); | 60 | void setFileView( int ); |
61 | 61 | ||
62 | private: | 62 | private: |
63 | // QDict<void> mimes; | 63 | // QDict<void> mimes; |
64 | QPushButton *buttonOk, *buttonCancel, *homeButton, *docButton, *hideButton, *cdUpButton; | 64 | QPushButton *buttonOk, *buttonCancel, *homeButton, *docButton, *hideButton, *cdUpButton; |
65 | QListView* ListView; | 65 | QListView* ListView; |
66 | QLabel *dirLabel; | 66 | QLabel *dirLabel; |
67 | QString filterStr, mimeType; | 67 | QString filterStr, mimeType; |
68 | QDir currentDir; | 68 | QDir currentDir; |
69 | QStringList dirPathStringList, mimetypes; | 69 | QStringList dirPathStringList, mimetypes; |
70 | /* QListViewItem * item; */ | 70 | /* QListViewItem * item; */ |
71 | QComboBox *dirPathCombo; | 71 | QComboBox *dirPathCombo; |
72 | MenuButton *typemb; | 72 | MenuButton *typemb; |
73 | QWidgetStack *FileStack; | 73 | QWidgetStack *FileStack; |
74 | FileSelector *fileSelector; | 74 | FileSelector *fileSelector; |
75 | QRegExp tf; | 75 | QRegExp tf; |
76 | QStringList getMimeTypes(); | 76 | QStringList getMimeTypes(); |
77 | void fillCombo( const QString&); | 77 | void fillCombo( const QString&); |
78 | 78 | ||
79 | private slots: | 79 | private slots: |
80 | void populateList(); | 80 | void populateList(); |
81 | void homeButtonPushed(); | 81 | void homeButtonPushed(); |
82 | void docButtonPushed(); | 82 | void docButtonPushed(); |
83 | void ListPressed( int, QListViewItem *, const QPoint&, int); | 83 | void ListPressed( int, QListViewItem *, const QPoint&, int); |
84 | void showListMenu(QListViewItem*); | 84 | void showListMenu(QListViewItem*); |
85 | void doCd(); | 85 | void doCd(); |
86 | void makDir(); | 86 | void makDir(); |
87 | void localRename(); | 87 | void localRename(); |
88 | void localDelete(); | 88 | void localDelete(); |
89 | void receive( const QCString &msg, const QByteArray &data ); | 89 | void receive( const QCString &msg, const QByteArray &data ); |
90 | void dirPathComboActivated( const QString & ); | 90 | void dirPathComboActivated( const QString & ); |
91 | void upDir(); | 91 | void upDir(); |
92 | void listClicked( QListViewItem * ); | 92 | void listClicked( QListViewItem * ); |
93 | void selectionChanged( const QString & ); | 93 | void selectionChanged( const QString & ); |
94 | void OnOK(); | 94 | void OnOK(); |
95 | void docOpen( const DocLnk & ); | 95 | void docOpen( const DocLnk & ); |
96 | void updateMimeTypeMenu(); | 96 | void updateMimeTypeMenu(); |
97 | void showType(const QString &); | 97 | void showType(const QString &); |
98 | void dirPathEditPressed(); | 98 | void dirPathEditPressed(); |
99 | 99 | ||
100 | protected slots: | 100 | protected slots: |
101 | 101 | ||
102 | protected: | 102 | protected: |
103 | 103 | ||
104 | }; | 104 | }; |
105 | 105 | ||
106 | 106 | ||
107 | class InputDialog : public QDialog | 107 | class InputDialog : public QDialog |
108 | { | 108 | { |
109 | Q_OBJECT | 109 | Q_OBJECT |
110 | 110 | ||
111 | public: | 111 | public: |
112 | InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 112 | InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
113 | ~InputDialog(); | 113 | ~InputDialog(); |
114 | QString inputText; | 114 | QString inputText; |
115 | QLineEdit* LineEdit1; | 115 | QLineEdit* LineEdit1; |
116 | 116 | void setTextEdit(const QString &); | |
117 | }; | 117 | }; |
118 | 118 | ||
119 | #endif // FILEBROWSER_H | 119 | #endif // FILEBROWSER_H |
diff --git a/noncore/net/opieftp/inputDialog.cpp b/noncore/net/opieftp/inputDialog.cpp index 89b345e..373db3b 100644 --- a/noncore/net/opieftp/inputDialog.cpp +++ b/noncore/net/opieftp/inputDialog.cpp | |||
@@ -1,40 +1,44 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | inputDialog.cpp | 2 | inputDialog.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 | 12 | ||
13 | #include "inputDialog.h" | 13 | #include "inputDialog.h" |
14 | 14 | ||
15 | #include <qlineedit.h> | 15 | #include <qlineedit.h> |
16 | #include <qlayout.h> | 16 | #include <qlayout.h> |
17 | #include <qvariant.h> | 17 | #include <qvariant.h> |
18 | #include <qtooltip.h> | 18 | #include <qtooltip.h> |
19 | #include <qwhatsthis.h> | 19 | #include <qwhatsthis.h> |
20 | 20 | ||
21 | 21 | ||
22 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 22 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
23 | : QDialog( parent, name, modal, fl ) | 23 | : QDialog( parent, name, modal, fl ) |
24 | { | 24 | { |
25 | if ( !name ) | 25 | if ( !name ) |
26 | setName( "InputDialog" ); | 26 | setName( "InputDialog" ); |
27 | resize( 234, 50 ); | 27 | resize( 234, 50 ); |
28 | setMaximumSize( QSize( 240, 50 ) ); | 28 | setMaximumSize( QSize( 240, 50 ) ); |
29 | setCaption( tr(name ) ); | 29 | setCaption( tr(name ) ); |
30 | 30 | ||
31 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 31 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
32 | LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); | 32 | LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); |
33 | } | 33 | } |
34 | 34 | ||
35 | InputDialog::~InputDialog() | 35 | InputDialog::~InputDialog() |
36 | { | 36 | { |
37 | inputText= LineEdit1->text(); | 37 | inputText= LineEdit1->text(); |
38 | 38 | ||
39 | } | 39 | } |
40 | 40 | ||
41 | void InputDialog::setTextEdit(const QString &string) | ||
42 | { | ||
43 | LineEdit1->setText(string); | ||
44 | } | ||
diff --git a/noncore/net/opieftp/inputDialog.h b/noncore/net/opieftp/inputDialog.h index 2cd8285..dfe0e8a 100644 --- a/noncore/net/opieftp/inputDialog.h +++ b/noncore/net/opieftp/inputDialog.h | |||
@@ -1,34 +1,34 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | inputDialog.h | 2 | inputDialog.h |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #ifndef INPUTDIALOG_H | 12 | #ifndef INPUTDIALOG_H |
13 | #define INPUTDIALOG_H | 13 | #define INPUTDIALOG_H |
14 | 14 | ||
15 | #include <qvariant.h> | 15 | #include <qvariant.h> |
16 | #include <qdialog.h> | 16 | #include <qdialog.h> |
17 | class QVBoxLayout; | 17 | class QVBoxLayout; |
18 | class QHBoxLayout; | 18 | class QHBoxLayout; |
19 | class QGridLayout; | 19 | class QGridLayout; |
20 | class QLineEdit; | 20 | class QLineEdit; |
21 | 21 | ||
22 | class InputDialog : public QDialog | 22 | class InputDialog : public QDialog |
23 | { | 23 | { |
24 | Q_OBJECT | 24 | Q_OBJECT |
25 | 25 | ||
26 | public: | 26 | public: |
27 | InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 27 | InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
28 | ~InputDialog(); | 28 | ~InputDialog(); |
29 | QString inputText; | 29 | QString inputText; |
30 | QLineEdit* LineEdit1; | 30 | QLineEdit* LineEdit1; |
31 | 31 | void setTextEdit(const QString &); | |
32 | }; | 32 | }; |
33 | 33 | ||
34 | #endif // INPUTDIALOG_H | 34 | #endif // INPUTDIALOG_H |
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index e64fd73..b451925 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -882,151 +882,151 @@ void OpieFtp::localDelete() | |||
882 | void OpieFtp::remoteMakDir() | 882 | void OpieFtp::remoteMakDir() |
883 | { | 883 | { |
884 | InputDialog *fileDlg; | 884 | InputDialog *fileDlg; |
885 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 885 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
886 | fileDlg->exec(); | 886 | fileDlg->exec(); |
887 | if( fileDlg->result() == 1 ) { | 887 | if( fileDlg->result() == 1 ) { |
888 | QString filename = fileDlg->LineEdit1->text();//+".playlist"; | 888 | QString filename = fileDlg->LineEdit1->text();//+".playlist"; |
889 | QString tmp=currentRemoteDir+filename; | 889 | QString tmp=currentRemoteDir+filename; |
890 | QCopEnvelope ( "QPE/System", "busy()" ); | 890 | QCopEnvelope ( "QPE/System", "busy()" ); |
891 | if(FtpMkdir( tmp.latin1(), conn) == 0) { | 891 | if(FtpMkdir( tmp.latin1(), conn) == 0) { |
892 | QString msg; | 892 | QString msg; |
893 | msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn)); | 893 | msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn)); |
894 | msg.replace(QRegExp(":"),"\n"); | 894 | msg.replace(QRegExp(":"),"\n"); |
895 | QMessageBox::message(tr("Note"),msg); | 895 | QMessageBox::message(tr("Note"),msg); |
896 | } | 896 | } |
897 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 897 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
898 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 898 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
899 | } | 899 | } |
900 | } | 900 | } |
901 | 901 | ||
902 | void OpieFtp::remoteDelete() | 902 | void OpieFtp::remoteDelete() |
903 | { | 903 | { |
904 | QString f = Remote_View->currentItem()->text(0); | 904 | QString f = Remote_View->currentItem()->text(0); |
905 | QCopEnvelope ( "QPE/System", "busy()" ); | 905 | QCopEnvelope ( "QPE/System", "busy()" ); |
906 | if( f.right(1) =="/") { | 906 | if( f.right(1) =="/") { |
907 | QString path= currentRemoteDir+f; | 907 | QString path= currentRemoteDir+f; |
908 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" | 908 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" |
909 | ,tr("Yes"),tr("No"),0,0,1) ) { | 909 | ,tr("Yes"),tr("No"),0,0,1) ) { |
910 | case 0: { | 910 | case 0: { |
911 | f=currentDir.canonicalPath()+"/"+f; | 911 | f=currentDir.canonicalPath()+"/"+f; |
912 | if(FtpRmdir( path.latin1(), conn) ==0) { | 912 | if(FtpRmdir( path.latin1(), conn) ==0) { |
913 | QString msg; | 913 | QString msg; |
914 | msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn)); | 914 | msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn)); |
915 | msg.replace(QRegExp(":"),"\n"); | 915 | msg.replace(QRegExp(":"),"\n"); |
916 | QMessageBox::message(tr("Note"),msg); | 916 | QMessageBox::message(tr("Note"),msg); |
917 | } | 917 | } |
918 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 918 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
919 | } | 919 | } |
920 | break; | 920 | break; |
921 | }; | 921 | }; |
922 | } else { | 922 | } else { |
923 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" | 923 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" |
924 | ,tr("Yes"),tr("No"),0,0,1) ) { | 924 | ,tr("Yes"),tr("No"),0,0,1) ) { |
925 | case 0: { | 925 | case 0: { |
926 | QString path= currentRemoteDir+f; | 926 | QString path= currentRemoteDir+f; |
927 | if(FtpDelete( path.latin1(), conn)==0) { | 927 | if(FtpDelete( path.latin1(), conn)==0) { |
928 | QString msg; | 928 | QString msg; |
929 | msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn)); | 929 | msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn)); |
930 | msg.replace(QRegExp(":"),"\n"); | 930 | msg.replace(QRegExp(":"),"\n"); |
931 | QMessageBox::message(tr("Note"),msg); | 931 | QMessageBox::message(tr("Note"),msg); |
932 | } | 932 | } |
933 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 933 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
934 | } | 934 | } |
935 | break; | 935 | break; |
936 | }; | 936 | }; |
937 | } | 937 | } |
938 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 938 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
939 | } | 939 | } |
940 | 940 | ||
941 | void OpieFtp::remoteRename() | 941 | void OpieFtp::remoteRename() |
942 | { | 942 | { |
943 | QString curFile = Remote_View->currentItem()->text(0); | 943 | QString curFile = Remote_View->currentItem()->text(0); |
944 | InputDialog *fileDlg; | 944 | InputDialog *fileDlg; |
945 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 945 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
946 | fileDlg->inputText = curFile; | 946 | fileDlg->setTextEdit((const QString &)curFile); |
947 | fileDlg->exec(); | 947 | fileDlg->exec(); |
948 | if( fileDlg->result() == 1 ) { | 948 | if( fileDlg->result() == 1 ) { |
949 | QString oldName = currentRemoteDir +"/"+ curFile; | 949 | QString oldName = currentRemoteDir +"/"+ curFile; |
950 | QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; | 950 | QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; |
951 | QCopEnvelope ( "QPE/System", "busy()" ); | 951 | QCopEnvelope ( "QPE/System", "busy()" ); |
952 | if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { | 952 | if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { |
953 | QString msg; | 953 | QString msg; |
954 | msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn)); | 954 | msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn)); |
955 | msg.replace(QRegExp(":"),"\n"); | 955 | msg.replace(QRegExp(":"),"\n"); |
956 | QMessageBox::message(tr("Note"),msg); | 956 | QMessageBox::message(tr("Note"),msg); |
957 | } | 957 | } |
958 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 958 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
959 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 959 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
960 | } | 960 | } |
961 | } | 961 | } |
962 | 962 | ||
963 | void OpieFtp::localRename() | 963 | void OpieFtp::localRename() |
964 | { | 964 | { |
965 | QString curFile = Local_View->currentItem()->text(0); | 965 | QString curFile = Local_View->currentItem()->text(0); |
966 | InputDialog *fileDlg; | 966 | InputDialog *fileDlg; |
967 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 967 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
968 | fileDlg->inputText = curFile; | 968 | fileDlg->setTextEdit((const QString &)curFile); |
969 | fileDlg->exec(); | 969 | fileDlg->exec(); |
970 | if( fileDlg->result() == 1 ) { | 970 | if( fileDlg->result() == 1 ) { |
971 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 971 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
972 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 972 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
973 | if( rename(oldname.latin1(), newName.latin1())== -1) | 973 | if( rename(oldname.latin1(), newName.latin1())== -1) |
974 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 974 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
975 | } | 975 | } |
976 | populateLocalView(); | 976 | populateLocalView(); |
977 | } | 977 | } |
978 | 978 | ||
979 | void OpieFtp::currentPathComboActivated(const QString & currentPath) { | 979 | void OpieFtp::currentPathComboActivated(const QString & currentPath) { |
980 | if (TabWidget->currentPageIndex() == 0) { | 980 | if (TabWidget->currentPageIndex() == 0) { |
981 | chdir( currentPath.latin1() ); | 981 | chdir( currentPath.latin1() ); |
982 | currentDir.cd( currentPath, TRUE); | 982 | currentDir.cd( currentPath, TRUE); |
983 | populateLocalView(); | 983 | populateLocalView(); |
984 | update(); | 984 | update(); |
985 | } else { | 985 | } else { |
986 | // chdir( currentPath.latin1() ); | 986 | // chdir( currentPath.latin1() ); |
987 | // currentDir.cd( currentPath, TRUE); | 987 | // currentDir.cd( currentPath, TRUE); |
988 | // populateList(); | 988 | // populateList(); |
989 | // update(); | 989 | // update(); |
990 | 990 | ||
991 | } | 991 | } |
992 | } | 992 | } |
993 | 993 | ||
994 | void OpieFtp::fillCombo(const QString ¤tPath) { | 994 | void OpieFtp::fillCombo(const QString ¤tPath) { |
995 | 995 | ||
996 | currentPathCombo->lineEdit()->setText(currentPath); | 996 | currentPathCombo->lineEdit()->setText(currentPath); |
997 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 997 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
998 | currentPathCombo->clear(); | 998 | currentPathCombo->clear(); |
999 | localDirPathStringList.prepend(currentPath ); | 999 | localDirPathStringList.prepend(currentPath ); |
1000 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 1000 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
1001 | } | 1001 | } |
1002 | currentPathCombo->lineEdit()->setText(currentPath); | 1002 | currentPathCombo->lineEdit()->setText(currentPath); |
1003 | if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 1003 | if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
1004 | currentPathCombo->clear(); | 1004 | currentPathCombo->clear(); |
1005 | remoteDirPathStringList.prepend(currentPath ); | 1005 | remoteDirPathStringList.prepend(currentPath ); |
1006 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 1006 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
1007 | } | 1007 | } |
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | void OpieFtp::fillRemoteCombo(const QString ¤tPath) { | 1010 | void OpieFtp::fillRemoteCombo(const QString ¤tPath) { |
1011 | 1011 | ||
1012 | currentPathCombo->lineEdit()->setText(currentPath); | 1012 | currentPathCombo->lineEdit()->setText(currentPath); |
1013 | if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 1013 | if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
1014 | currentPathCombo->clear(); | 1014 | currentPathCombo->clear(); |
1015 | remoteDirPathStringList.prepend(currentPath ); | 1015 | remoteDirPathStringList.prepend(currentPath ); |
1016 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 1016 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
1017 | } | 1017 | } |
1018 | } | 1018 | } |
1019 | 1019 | ||
1020 | void OpieFtp::currentPathComboChanged() | 1020 | void OpieFtp::currentPathComboChanged() |
1021 | { | 1021 | { |
1022 | QString oldRemoteCurrentDir = currentRemoteDir; | 1022 | QString oldRemoteCurrentDir = currentRemoteDir; |
1023 | // qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); | 1023 | // qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); |
1024 | if (TabWidget->currentPageIndex() == 0) { | 1024 | if (TabWidget->currentPageIndex() == 0) { |
1025 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 1025 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
1026 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); | 1026 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
1027 | populateLocalView(); | 1027 | populateLocalView(); |
1028 | } else { | 1028 | } else { |
1029 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 1029 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
1030 | } | 1030 | } |
1031 | } | 1031 | } |
1032 | if (TabWidget->currentPageIndex() == 1) { | 1032 | if (TabWidget->currentPageIndex() == 1) { |