summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-05-22 14:45:47 (UTC)
committer llornkcor <llornkcor>2002-05-22 14:45:47 (UTC)
commitd7c7e0a272996ef3ae386e939d25737d3060e427 (patch) (unidiff)
treee39e2b2591ff4dfdd3928a4171e0c5bf1cbf0c78
parent7535b4d2d300c32fd50218a652c32ab4bb5886ab (diff)
downloadopie-d7c7e0a272996ef3ae386e939d25737d3060e427.zip
opie-d7c7e0a272996ef3ae386e939d25737d3060e427.tar.gz
opie-d7c7e0a272996ef3ae386e939d25737d3060e427.tar.bz2
fixed rampant mt thing
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp
index 9ad0d69..3798f90 100644
--- a/core/apps/textedit/fileBrowser.cpp
+++ b/core/apps/textedit/fileBrowser.cpp
@@ -1,634 +1,634 @@
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
41static int u_id = 1; 41static int u_id = 1;
42static int get_unique_id() 42static int get_unique_id()
43{ 43{
44 return u_id++; 44 return u_id++;
45} 45}
46 46
47fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString mimeFilter ) 47fileBrowser::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 53
54// getMimeTypes(); 54// getMimeTypes();
55 55
56// mimeType = mimeFilter; 56// mimeType = mimeFilter;
57// MimeType mt( mimeType); 57// MimeType mt( mimeType);
58 58
59// if( mt.extension().isEmpty()) { 59// if( mt.extension().isEmpty()) {
60 60
61// QStringList filterList; 61// QStringList filterList;
62// filterList=QStringList::split(";",mimeFilter,FALSE); 62// filterList=QStringList::split(";",mimeFilter,FALSE);
63 63
64// for ( QStringList::Iterator it = filterList.begin(); it != filterList.end(); ++it ) { 64// for ( QStringList::Iterator it = filterList.begin(); it != filterList.end(); ++it ) {
65// printf( "%s \n", (*it).latin1() ); 65// printf( "%s \n", (*it).latin1() );
66// } 66// }
67 67
68// filterStr = mimeFilter.right(mimeFilter.length() - mimeFilter.find("/",0,TRUE) - 1);// "*"; 68// filterStr = mimeFilter.right(mimeFilter.length() - mimeFilter.find("/",0,TRUE) - 1);// "*";
69 69
70// qDebug(filterStr); 70// qDebug(filterStr);
71// } else { 71// } else {
72 filterStr = "*."+ mt.extension(); 72 filterStr = "*";//+ mt.extension();
73// qDebug("description "+mt.description()); 73// qDebug("description "+mt.description());
74// qDebug( "id "+mt.id()); 74// qDebug( "id "+mt.id());
75// qDebug("extension "+mt.extension()); 75// qDebug("extension "+mt.extension());
76// } 76// }
77// channel = new QCopChannel( "QPE/fileDialog", this ); 77// channel = new QCopChannel( "QPE/fileDialog", this );
78// connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 78// connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
79// this, SLOT(receive(const QCString&, const QByteArray&)) ); 79// this, SLOT(receive(const QCString&, const QByteArray&)) );
80 80
81 QGridLayout *layout = new QGridLayout( this ); 81 QGridLayout *layout = new QGridLayout( this );
82 layout->setSpacing( 4 ); 82 layout->setSpacing( 4 );
83 layout->setMargin( 4 ); 83 layout->setMargin( 4 );
84 84
85 dirPathCombo = new QComboBox( FALSE, this, "dirPathCombo" ); 85 dirPathCombo = new QComboBox( FALSE, this, "dirPathCombo" );
86 dirPathCombo->setEditable(TRUE); 86 dirPathCombo->setEditable(TRUE);
87 87
88 connect( dirPathCombo, SIGNAL( activated( const QString & ) ), 88 connect( dirPathCombo, SIGNAL( activated( const QString & ) ),
89 this, SLOT( dirPathComboActivated( const QString & ) ) ); 89 this, SLOT( dirPathComboActivated( const QString & ) ) );
90 90
91 connect( dirPathCombo->lineEdit(), SIGNAL( returnPressed( ) ), 91 connect( dirPathCombo->lineEdit(), SIGNAL( returnPressed( ) ),
92 this, SLOT( dirPathEditPressed( ) ) ); 92 this, SLOT( dirPathEditPressed( ) ) );
93 93
94 dirPathStringList << "/"; 94 dirPathStringList << "/";
95// we can get the storage here 95// we can get the storage here
96 96
97 layout->addMultiCellWidget( dirPathCombo, 0, 0, 0, 4 ); 97 layout->addMultiCellWidget( dirPathCombo, 0, 0, 0, 4 );
98 98
99 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); 99 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton");
100 cdUpButton ->setMinimumSize( QSize( 20, 20 ) ); 100 cdUpButton ->setMinimumSize( QSize( 20, 20 ) );
101 cdUpButton ->setMaximumSize( QSize( 20, 20 ) ); 101 cdUpButton ->setMaximumSize( QSize( 20, 20 ) );
102 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 102 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
103 cdUpButton ->setFlat(TRUE); 103 cdUpButton ->setFlat(TRUE);
104 layout->addMultiCellWidget( cdUpButton, 0, 0, 5, 5 ); 104 layout->addMultiCellWidget( cdUpButton, 0, 0, 5, 5 );
105 105
106 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); 106 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
107 docButton->setMinimumSize( QSize( 20, 20 ) ); 107 docButton->setMinimumSize( QSize( 20, 20 ) );
108 docButton->setMaximumSize( QSize( 20, 20 ) ); 108 docButton->setMaximumSize( QSize( 20, 20 ) );
109 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 109 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
110 docButton->setFlat(TRUE); 110 docButton->setFlat(TRUE);
111 layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); 111 layout->addMultiCellWidget( docButton, 0, 0, 6, 6 );
112 112
113 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); 113 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton");
114 homeButton->setMinimumSize( QSize( 20, 20 ) ); 114 homeButton->setMinimumSize( QSize( 20, 20 ) );
115 homeButton->setMaximumSize( QSize( 20, 20 ) ); 115 homeButton->setMaximumSize( QSize( 20, 20 ) );
116 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 116 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
117 homeButton->setFlat(TRUE); 117 homeButton->setFlat(TRUE);
118 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7 ); 118 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7 );
119 119
120 FileStack = new QWidgetStack( this ); 120 FileStack = new QWidgetStack( this );
121 121
122 ListView = new QListView( this, "ListView" ); 122 ListView = new QListView( this, "ListView" );
123// ListView->setMinimumSize( QSize( 100, 25 ) ); 123// ListView->setMinimumSize( QSize( 100, 25 ) );
124 ListView->addColumn( tr( "Name" ) ); 124 ListView->addColumn( tr( "Name" ) );
125 ListView->setColumnWidth(0,120); 125 ListView->setColumnWidth(0,120);
126 ListView->setSorting( 2, FALSE); 126 ListView->setSorting( 2, FALSE);
127 ListView->addColumn( tr( "Size" ) ); 127 ListView->addColumn( tr( "Size" ) );
128 ListView->setColumnWidth(1,-1); 128 ListView->setColumnWidth(1,-1);
129 ListView->addColumn( "Date",-1); 129 ListView->addColumn( "Date",-1);
130 130
131 ListView->setColumnWidthMode(0,QListView::Manual); 131 ListView->setColumnWidthMode(0,QListView::Manual);
132 ListView->setColumnAlignment(1,QListView::AlignRight); 132 ListView->setColumnAlignment(1,QListView::AlignRight);
133 ListView->setColumnAlignment(2,QListView::AlignRight); 133 ListView->setColumnAlignment(2,QListView::AlignRight);
134 ListView->setAllColumnsShowFocus( TRUE ); 134 ListView->setAllColumnsShowFocus( TRUE );
135 135
136 QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); 136 QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold);
137 connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 137 connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
138 this, SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 138 this, SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
139 139
140 connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); 140 connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
141 141
142 FileStack->addWidget( ListView, get_unique_id() ); 142 FileStack->addWidget( ListView, get_unique_id() );
143mimeType="text/plain"; 143mimeType="text/plain";
144 fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy 144 fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy
145// connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); 145// connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) );
146// connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); 146// connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
147 connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), 147 connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ),
148 this, SLOT( docOpen( const DocLnk & ) ) ); 148 this, SLOT( docOpen( const DocLnk & ) ) );
149 layout->addMultiCellWidget( FileStack, 1, 1, 0, 7 ); 149 layout->addMultiCellWidget( FileStack, 1, 1, 0, 7 );
150 150
151 SelectionCombo = new QComboBox( FALSE, this, "SelectionCombo" ); 151 SelectionCombo = new QComboBox( FALSE, this, "SelectionCombo" );
152 SelectionCombo->insertItem( tr( "Documents" ) ); 152 SelectionCombo->insertItem( tr( "Documents" ) );
153 SelectionCombo->insertItem( tr( "All files" ) ); 153 SelectionCombo->insertItem( tr( "All files" ) );
154 SelectionCombo->insertItem( tr( "Hidden files" ) ); 154 SelectionCombo->insertItem( tr( "Hidden files" ) );
155// SelectionCombo->setMaximumWidth(120); 155// SelectionCombo->setMaximumWidth(120);
156 layout->addMultiCellWidget( SelectionCombo, 2, 2, 0, 3 ); 156 layout->addMultiCellWidget( SelectionCombo, 2, 2, 0, 3 );
157 157
158 connect( SelectionCombo, SIGNAL( activated( const QString & ) ), 158 connect( SelectionCombo, SIGNAL( activated( const QString & ) ),
159 this, SLOT( selectionChanged( const QString & ) ) ); 159 this, SLOT( selectionChanged( const QString & ) ) );
160 160
161 typemb = new MenuButton(this); 161 typemb = new MenuButton(this);
162 typemb->setLabel(tr("Type: %1")); 162 typemb->setLabel(tr("Type: %1"));
163 typemb->setMinimumWidth(110); 163 typemb->setMinimumWidth(110);
164 typemb->setFixedHeight(22); 164 typemb->setFixedHeight(22);
165 layout->addMultiCellWidget( typemb, 2, 2, 4, 7 ); 165 layout->addMultiCellWidget( typemb, 2, 2, 4, 7 );
166 updateMimeTypeMenu() ; 166 updateMimeTypeMenu() ;
167 167
168 currentDir.setPath(QDir::currentDirPath()); 168 currentDir.setPath(QDir::currentDirPath());
169 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); 169 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All);
170 currentDir.setNameFilter(filterStr); 170 currentDir.setNameFilter(filterStr);
171 171
172 populateList(); 172 populateList();
173 move(0,15); 173 move(0,15);
174} 174}
175 175
176fileBrowser::~fileBrowser() 176fileBrowser::~fileBrowser()
177{ 177{
178} 178}
179 179
180void fileBrowser::setFileView( int selection ) 180void fileBrowser::setFileView( int selection )
181{ 181{
182 SelectionCombo->setCurrentItem( selection ); 182 SelectionCombo->setCurrentItem( selection );
183 selectionChanged( SelectionCombo->currentText() ); 183 selectionChanged( SelectionCombo->currentText() );
184} 184}
185 185
186void fileBrowser::populateList() 186void fileBrowser::populateList()
187{ 187{
188 ListView->clear(); 188 ListView->clear();
189 QListViewItem * item; 189 QListViewItem * item;
190 bool isDir=FALSE; 190 bool isDir=FALSE;
191//qDebug(currentDir.canonicalPath()); 191//qDebug(currentDir.canonicalPath());
192 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 192 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
193 currentDir.setMatchAllDirs(TRUE); 193 currentDir.setMatchAllDirs(TRUE);
194 194
195// currentDir.setNameFilter("*.txt;*.etx"); 195// currentDir.setNameFilter("*.txt;*.etx");
196 QString fileL, fileS, fileDate; 196 QString fileL, fileS, fileDate;
197 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 197 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
198 QFileInfoListIterator it(*list); 198 QFileInfoListIterator it(*list);
199 QFileInfo *fi; 199 QFileInfo *fi;
200 while ( (fi=it.current()) ) { 200 while ( (fi=it.current()) ) {
201 if (fi->isSymLink() ){ 201 if (fi->isSymLink() ){
202 QString symLink=fi->readLink(); 202 QString symLink=fi->readLink();
203// qDebug("Symlink detected "+symLink); 203// qDebug("Symlink detected "+symLink);
204 QFileInfo sym( symLink); 204 QFileInfo sym( symLink);
205 fileS.sprintf( "%10li", sym.size() ); 205 fileS.sprintf( "%10li", sym.size() );
206 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); 206 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() );
207 fileDate = sym.lastModified().toString(); 207 fileDate = sym.lastModified().toString();
208 } else { 208 } else {
209// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 209// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
210 fileS.sprintf( "%10li", fi->size() ); 210 fileS.sprintf( "%10li", fi->size() );
211 fileL.sprintf( "%s",fi->fileName().data() ); 211 fileL.sprintf( "%s",fi->fileName().data() );
212 fileDate= fi->lastModified().toString(); 212 fileDate= fi->lastModified().toString();
213 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 213 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
214 fileL+="/"; 214 fileL+="/";
215 isDir=TRUE; 215 isDir=TRUE;
216// qDebug( fileL); 216// qDebug( fileL);
217 } 217 }
218 } 218 }
219 if(fileL !="./" && fi->exists()) { 219 if(fileL !="./" && fi->exists()) {
220 item= new QListViewItem( ListView,fileL,fileS , fileDate); 220 item= new QListViewItem( ListView,fileL,fileS , fileDate);
221 QPixmap pm; 221 QPixmap pm;
222 222
223 if(isDir || fileL.find("/",0,TRUE) != -1) { 223 if(isDir || fileL.find("/",0,TRUE) != -1) {
224 if( !QDir( fi->filePath() ).isReadable()) 224 if( !QDir( fi->filePath() ).isReadable())
225 pm = Resource::loadPixmap( "lockedfolder" ); 225 pm = Resource::loadPixmap( "lockedfolder" );
226 else 226 else
227 pm= Resource::loadPixmap( "folder" ); 227 pm= Resource::loadPixmap( "folder" );
228 item->setPixmap( 0,pm ); 228 item->setPixmap( 0,pm );
229 } else { 229 } else {
230 if( !fi->isReadable() ) 230 if( !fi->isReadable() )
231 pm = Resource::loadPixmap( "locked" ); 231 pm = Resource::loadPixmap( "locked" );
232 else { 232 else {
233 MimeType mt(fi->filePath()); 233 MimeType mt(fi->filePath());
234 pm=mt.pixmap();// sets the pixmap for the mimetype 234 pm=mt.pixmap();// sets the pixmap for the mimetype
235 if(pm.isNull()) 235 if(pm.isNull())
236 pm = Resource::loadPixmap( "UnknownDocument-14" ); 236 pm = Resource::loadPixmap( "UnknownDocument-14" );
237 item->setPixmap( 0,pm); 237 item->setPixmap( 0,pm);
238 } 238 }
239 } 239 }
240 if( fileL.find("->",0,TRUE) != -1) { 240 if( fileL.find("->",0,TRUE) != -1) {
241 // overlay link image 241 // overlay link image
242 pm= Resource::loadPixmap( "folder" ); 242 pm= Resource::loadPixmap( "folder" );
243 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 243 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
244 QPainter painter( &pm ); 244 QPainter painter( &pm );
245 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 245 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
246 pm.setMask( pm.createHeuristicMask( FALSE ) ); 246 pm.setMask( pm.createHeuristicMask( FALSE ) );
247 item->setPixmap( 0, pm); 247 item->setPixmap( 0, pm);
248 } 248 }
249 } 249 }
250 isDir=FALSE; 250 isDir=FALSE;
251 ++it; 251 ++it;
252// } 252// }
253 } 253 }
254 ListView->setSorting( 3, FALSE); 254 ListView->setSorting( 3, FALSE);
255 QString currentPath = currentDir.canonicalPath(); 255 QString currentPath = currentDir.canonicalPath();
256 256
257 fillCombo( (const QString &)currentPath); 257 fillCombo( (const QString &)currentPath);
258// dirPathCombo->lineEdit()->setText(currentPath); 258// dirPathCombo->lineEdit()->setText(currentPath);
259 259
260// if( dirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 260// if( dirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
261// dirPathCombo->clear(); 261// dirPathCombo->clear();
262// dirPathStringList.prepend(currentPath ); 262// dirPathStringList.prepend(currentPath );
263// dirPathCombo->insertStringList( dirPathStringList,-1); 263// dirPathCombo->insertStringList( dirPathStringList,-1);
264// } 264// }
265} 265}
266 266
267void fileBrowser::upDir() 267void fileBrowser::upDir()
268{ 268{
269 QString current = currentDir.canonicalPath(); 269 QString current = currentDir.canonicalPath();
270 QDir dir(current); 270 QDir dir(current);
271 dir.cdUp(); 271 dir.cdUp();
272 current = dir.canonicalPath(); 272 current = dir.canonicalPath();
273 chdir( current.latin1() ); 273 chdir( current.latin1() );
274 currentDir.cd( current, TRUE); 274 currentDir.cd( current, TRUE);
275 populateList(); 275 populateList();
276 update(); 276 update();
277} 277}
278 278
279// you may want to switch these 2 functions. I like single clicks 279// you may want to switch these 2 functions. I like single clicks
280void fileBrowser::listClicked(QListViewItem *selectedItem) 280void fileBrowser::listClicked(QListViewItem *selectedItem)
281{ 281{
282 if(selectedItem) { 282 if(selectedItem) {
283 QString strItem=selectedItem->text(0); 283 QString strItem=selectedItem->text(0);
284 QString strSize=selectedItem->text(1); 284 QString strSize=selectedItem->text(1);
285// qDebug("strItem is "+strItem); 285// qDebug("strItem is "+strItem);
286 strSize.stripWhiteSpace(); 286 strSize.stripWhiteSpace();
287// qDebug(strSize); 287// qDebug(strSize);
288 288
289 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 289 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
290 // is symlink 290 // is symlink
291 QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4); 291 QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4);
292// qDebug("strItem symlink is "+strItem2); 292// qDebug("strItem symlink is "+strItem2);
293 if(QDir(strItem2).exists() ) { 293 if(QDir(strItem2).exists() ) {
294 currentDir.cd(strItem2, TRUE); 294 currentDir.cd(strItem2, TRUE);
295 populateList(); 295 populateList();
296 } 296 }
297 } else { // not a symlink 297 } else { // not a symlink
298 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 298 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
299 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 299 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
300 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 300 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
301 currentDir.cd(strItem,FALSE); 301 currentDir.cd(strItem,FALSE);
302// qDebug("Path is "+strItem); 302// qDebug("Path is "+strItem);
303 populateList(); 303 populateList();
304 } else { 304 } else {
305 currentDir.cdUp(); 305 currentDir.cdUp();
306 populateList(); 306 populateList();
307 } 307 }
308 if(QDir(strItem).exists()){ 308 if(QDir(strItem).exists()){
309 currentDir.cd(strItem, TRUE); 309 currentDir.cd(strItem, TRUE);
310 populateList(); 310 populateList();
311 } 311 }
312 } else { 312 } else {
313 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 313 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
314 if( QFile::exists(strItem ) ) { 314 if( QFile::exists(strItem ) ) {
315//currentDir.canonicalPath() 315//currentDir.canonicalPath()
316 qDebug("We found our files!!"+strItem); 316 qDebug("We found our files!!"+strItem);
317 OnOK(); 317 OnOK();
318 } 318 }
319 } //end not symlink 319 } //end not symlink
320 chdir(strItem.latin1()); 320 chdir(strItem.latin1());
321 } 321 }
322 } 322 }
323} 323}
324 324
325void fileBrowser::OnOK() 325void fileBrowser::OnOK()
326{ 326{
327 QListViewItemIterator it1( ListView); 327 QListViewItemIterator it1( ListView);
328 for ( ; it1.current(); ++it1 ) { 328 for ( ; it1.current(); ++it1 ) {
329 if ( it1.current()->isSelected() ) { 329 if ( it1.current()->isSelected() ) {
330 selectedFileName=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+it1.current()->text(0)); 330 selectedFileName=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+it1.current()->text(0));
331 qDebug("selected filename is "+selectedFileName); 331 qDebug("selected filename is "+selectedFileName);
332 fileList.append( selectedFileName ); 332 fileList.append( selectedFileName );
333 } 333 }
334 } 334 }
335 accept(); 335 accept();
336} 336}
337 337
338void fileBrowser::homeButtonPushed() { 338void fileBrowser::homeButtonPushed() {
339 QString current = QDir::homeDirPath(); 339 QString current = QDir::homeDirPath();
340 chdir( current.latin1() ); 340 chdir( current.latin1() );
341 currentDir.cd( current, TRUE); 341 currentDir.cd( current, TRUE);
342 populateList(); 342 populateList();
343 update(); 343 update();
344} 344}
345 345
346void fileBrowser::docButtonPushed() { 346void fileBrowser::docButtonPushed() {
347 QString current = QPEApplication::documentDir(); 347 QString current = QPEApplication::documentDir();
348 chdir( current.latin1() ); 348 chdir( current.latin1() );
349 currentDir.cd( current, TRUE); 349 currentDir.cd( current, TRUE);
350 populateList(); 350 populateList();
351 update(); 351 update();
352 352
353} 353}
354 354
355void fileBrowser::selectionChanged( const QString &select ) 355void fileBrowser::selectionChanged( const QString &select )
356{ 356{
357 if ( select == "Documents") { 357 if ( select == "Documents") {
358 FileStack->raiseWidget( fileSelector ); 358 FileStack->raiseWidget( fileSelector );
359 dirPathCombo->hide(); 359 dirPathCombo->hide();
360 cdUpButton->hide(); 360 cdUpButton->hide();
361 docButton->hide(); 361 docButton->hide();
362 homeButton->hide(); 362 homeButton->hide();
363 } else { 363 } else {
364 if ( select == "All files" ) 364 if ( select == "All files" )
365 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::All); 365 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::All);
366 else 366 else
367 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 367 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
368 368
369 populateList(); 369 populateList();
370 update(); 370 update();
371 dirPathCombo->show(); 371 dirPathCombo->show();
372 cdUpButton->show(); 372 cdUpButton->show();
373 docButton->show(); 373 docButton->show();
374 homeButton->show(); 374 homeButton->show();
375 FileStack->raiseWidget( ListView ); 375 FileStack->raiseWidget( ListView );
376 } 376 }
377} 377}
378 378
379void fileBrowser::docOpen( const DocLnk &doc ) 379void fileBrowser::docOpen( const DocLnk &doc )
380{ 380{
381 fileList.append( doc.file().latin1() ); 381 fileList.append( doc.file().latin1() );
382 accept(); 382 accept();
383} 383}
384 384
385void fileBrowser::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 385void fileBrowser::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
386{ 386{
387 switch (mouse) { 387 switch (mouse) {
388 case 1: 388 case 1:
389 break; 389 break;
390 case 2: 390 case 2:
391 showListMenu(item); 391 showListMenu(item);
392 break; 392 break;
393 }; 393 };
394} 394}
395 395
396void fileBrowser::showListMenu(QListViewItem *item) { 396void fileBrowser::showListMenu(QListViewItem *item) {
397 397
398 QPopupMenu m;// = new QPopupMenu( Local_View ); 398 QPopupMenu m;// = new QPopupMenu( Local_View );
399 if(item) { 399 if(item) {
400 if( item->text(0).find("/",0,TRUE)) 400 if( item->text(0).find("/",0,TRUE))
401 m.insertItem( tr( "Change Directory" ), this, SLOT( doCd() )); 401 m.insertItem( tr( "Change Directory" ), this, SLOT( doCd() ));
402 m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() )); 402 m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() ));
403 m.insertItem( tr( "Rescan" ), this, SLOT( populateList() )); 403 m.insertItem( tr( "Rescan" ), this, SLOT( populateList() ));
404 m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); 404 m.insertItem( tr( "Rename" ), this, SLOT( localRename() ));
405 m.insertSeparator(); 405 m.insertSeparator();
406 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 406 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
407 } else { 407 } else {
408 m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() )); 408 m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() ));
409 m.insertItem( tr( "Rescan" ), this, SLOT( populateList() )); 409 m.insertItem( tr( "Rescan" ), this, SLOT( populateList() ));
410 410
411 } 411 }
412 m.exec( QCursor::pos() ); 412 m.exec( QCursor::pos() );
413} 413}
414 414
415void fileBrowser::doCd() { 415void fileBrowser::doCd() {
416 listClicked( ListView->currentItem()); 416 listClicked( ListView->currentItem());
417} 417}
418 418
419void fileBrowser::makDir() { 419void fileBrowser::makDir() {
420 InputDialog *fileDlg; 420 InputDialog *fileDlg;
421 fileDlg = new InputDialog(this,"Make Directory",TRUE, 0); 421 fileDlg = new InputDialog(this,"Make Directory",TRUE, 0);
422 fileDlg->exec(); 422 fileDlg->exec();
423 if( fileDlg->result() == 1 ) { 423 if( fileDlg->result() == 1 ) {
424 QString filename = fileDlg->LineEdit1->text(); 424 QString filename = fileDlg->LineEdit1->text();
425 qDebug("Make dir"); 425 qDebug("Make dir");
426 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); 426 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
427 } 427 }
428 populateList(); 428 populateList();
429} 429}
430 430
431void fileBrowser::localRename() { 431void fileBrowser::localRename() {
432 QString curFile = ListView->currentItem()->text(0); 432 QString curFile = ListView->currentItem()->text(0);
433 InputDialog *fileDlg; 433 InputDialog *fileDlg;
434 fileDlg = new InputDialog(this,"Rename",TRUE, 0); 434 fileDlg = new InputDialog(this,"Rename",TRUE, 0);
435 fileDlg->setTextEdit((const QString &) curFile); 435 fileDlg->setTextEdit((const QString &) curFile);
436 fileDlg->exec(); 436 fileDlg->exec();
437 if( fileDlg->result() == 1 ) { 437 if( fileDlg->result() == 1 ) {
438 QString oldname = currentDir.canonicalPath() + "/" + curFile; 438 QString oldname = currentDir.canonicalPath() + "/" + curFile;
439 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 439 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
440 if( rename(oldname.latin1(), newName.latin1())== -1) 440 if( rename(oldname.latin1(), newName.latin1())== -1)
441 QMessageBox::message("Note","Could not rename"); 441 QMessageBox::message("Note","Could not rename");
442 } 442 }
443 populateList(); 443 populateList();
444} 444}
445 445
446void fileBrowser::localDelete() { 446void fileBrowser::localDelete() {
447 QString f = ListView->currentItem()->text(0); 447 QString f = ListView->currentItem()->text(0);
448 if(QDir(f).exists() ) { 448 if(QDir(f).exists() ) {
449 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+ 449 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+
450 " ?\nIt must be empty","Yes","No",0,0,1) ) { 450 " ?\nIt must be empty","Yes","No",0,0,1) ) {
451 case 0: { 451 case 0: {
452 f=currentDir.canonicalPath()+"/"+f; 452 f=currentDir.canonicalPath()+"/"+f;
453 QString cmd="rmdir "+f; 453 QString cmd="rmdir "+f;
454 system( cmd.latin1()); 454 system( cmd.latin1());
455 populateList(); 455 populateList();
456 } 456 }
457 break; 457 break;
458 case 1: 458 case 1:
459 // exit 459 // exit
460 break; 460 break;
461 }; 461 };
462 } else { 462 } else {
463 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f 463 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f
464 +" ?","Yes","No",0,0,1) ) { 464 +" ?","Yes","No",0,0,1) ) {
465 case 0: { 465 case 0: {
466 f=currentDir.canonicalPath()+"/"+f; 466 f=currentDir.canonicalPath()+"/"+f;
467 QString cmd="rm "+f; 467 QString cmd="rm "+f;
468 system( cmd.latin1()); 468 system( cmd.latin1());
469 populateList(); 469 populateList();
470 } 470 }
471 break; 471 break;
472 case 1: 472 case 1:
473 // exit 473 // exit
474 break; 474 break;
475 }; 475 };
476 } 476 }
477} 477}
478 478
479void fileBrowser::updateMimeTypeMenu() { 479void fileBrowser::updateMimeTypeMenu() {
480 480
481 disconnect( typemb, SIGNAL(selected(const QString&)), 481 disconnect( typemb, SIGNAL(selected(const QString&)),
482 this, SLOT(showType(const QString&)) ); 482 this, SLOT(showType(const QString&)) );
483 483
484 QString prev; 484 QString prev;
485 485
486 // Type filter 486 // Type filter
487 QStringList types; 487 QStringList types;
488 types << tr("All"); 488 types << tr("All");
489 types << "--"; 489 types << "--";
490 types += getMimeTypes(); 490 types += getMimeTypes();
491 prev = typemb->currentText(); 491 prev = typemb->currentText();
492 typemb->clear(); 492 typemb->clear();
493 typemb->insertItems(types); 493 typemb->insertItems(types);
494 // typemb->select(prev); 494 // typemb->select(prev);
495 495
496 connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&))); 496 connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&)));
497} 497}
498 498
499void fileBrowser::showType(const QString &t) { 499void fileBrowser::showType(const QString &t) {
500 500
501// qDebug("Show type "+t); 501// qDebug("Show type "+t);
502 if(t.find("All",0,TRUE) != -1) { 502 if(t.find("All",0,TRUE) != -1) {
503 filterStr = "*"; 503 filterStr = "*";
504 } else { 504 } else {
505 QStringList list = mimetypes.grep( t,TRUE); 505 QStringList list = mimetypes.grep( t,TRUE);
506 QString ext; 506 QString ext;
507 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 507 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
508 mimeType =(*it); 508 mimeType =(*it);
509 MimeType mt(mimeType); 509 MimeType mt(mimeType);
510 510
511// qDebug("mime "+mimeType); 511// qDebug("mime "+mimeType);
512// qDebug("description "+mt.description()); 512// qDebug("description "+mt.description());
513// qDebug( "id "+mt.id()); 513// qDebug( "id "+mt.id());
514// qDebug("extension "+mt.extension()); 514// qDebug("extension "+mt.extension());
515 515
516 if( mt.extension().isEmpty()) 516 if( mt.extension().isEmpty())
517 filterStr = "*"; 517 filterStr = "*";
518 else 518 else
519 filterStr = "*."+ mt.extension()+" "; 519 filterStr = "*."+ mt.extension()+" ";
520// printf( "%s \n", (*it).latin1() ); 520// printf( "%s \n", (*it).latin1() );
521 } 521 }
522 } 522 }
523 currentDir.setNameFilter(filterStr); 523 currentDir.setNameFilter(filterStr);
524 524
525 populateList(); 525 populateList();
526 update(); 526 update();
527// if(fileSelector) { 527// if(fileSelector) {
528// disconnect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); 528// disconnect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) );
529// delete fileSelector; 529// delete fileSelector;
530 // } 530 // }
531 // fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy 531 // fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy
532// connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); 532// connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) );
533// connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); 533// connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
534 // connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); 534 // connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) );
535// fileSelector->reread(); 535// fileSelector->reread();
536// if ( t == tr("All") ) { 536// if ( t == tr("All") ) {
537// icons->setTypeFilter("",TRUE); 537// icons->setTypeFilter("",TRUE);
538// } else { 538// } else {
539// icons->setTypeFilter(t+"/*",TRUE); 539// icons->setTypeFilter(t+"/*",TRUE);
540// } 540// }
541 541
542} 542}
543 543
544QStringList fileBrowser::getMimeTypes() { 544QStringList fileBrowser::getMimeTypes() {
545 545
546 QStringList r; 546 QStringList r;
547 AppLnkSet apps( QPEApplication::qpeDir() + "apps" ); 547 AppLnkSet apps( QPEApplication::qpeDir() + "apps" );
548 QFile file( QPEApplication::qpeDir()+"etc/available.mime"); 548 QFile file( QPEApplication::qpeDir()+"etc/available.mime");
549 file.open( IO_WriteOnly|IO_Truncate);//) 549 file.open( IO_WriteOnly|IO_Truncate);//)
550 for ( QListIterator<AppLnk> it( apps.children() ); it.current(); ++it ) { 550 for ( QListIterator<AppLnk> it( apps.children() ); it.current(); ++it ) {
551 AppLnk* l; 551 AppLnk* l;
552 l = it.current(); 552 l = it.current();
553 QStringList maj = l->mimeTypes(); 553 QStringList maj = l->mimeTypes();
554 QStringList::ConstIterator f; 554 QStringList::ConstIterator f;
555 for ( f = maj.begin(); f != maj.end(); f++ ) { 555 for ( f = maj.begin(); f != maj.end(); f++ ) {
556 QString temp = *f; 556 QString temp = *f;
557 qDebug("type "+temp); 557 qDebug("type "+temp);
558 mimetypes << temp; 558 mimetypes << temp;
559 int sl = temp.find('/'); 559 int sl = temp.find('/');
560 if (sl >= 0) { 560 if (sl >= 0) {
561 QString k = temp;//.left(sl); 561 QString k = temp;//.left(sl);
562 if( r.grep(k,TRUE).isEmpty() ) { 562 if( r.grep(k,TRUE).isEmpty() ) {
563 r << k; 563 r << k;
564 k+="\n"; 564 k+="\n";
565 file.writeBlock( k.latin1(), k.length()); 565 file.writeBlock( k.latin1(), k.length());
566 } 566 }
567 } 567 }
568 } 568 }
569 } 569 }
570 r.sort(); 570 r.sort();
571 file.close(); 571 file.close();
572 return r; 572 return r;
573} 573}
574 574
575void fileBrowser::receive( const QCString &msg, const QByteArray &data ) { 575void fileBrowser::receive( const QCString &msg, const QByteArray &data ) {
576// QDataStream stream( data, IO_ReadOnly ); 576// QDataStream stream( data, IO_ReadOnly );
577// if (msg == "keyRegister(int key, QString channel, QString message)") 577// if (msg == "keyRegister(int key, QString channel, QString message)")
578// { 578// {
579// int k; 579// int k;
580// QString c, m; 580// QString c, m;
581// stream >> k; 581// stream >> k;
582// stream >> c; 582// stream >> c;
583// stream >> m; 583// stream >> m;
584} 584}
585 585
586void fileBrowser::dirPathComboActivated( const QString & current) { 586void fileBrowser::dirPathComboActivated( const QString & current) {
587 chdir( current.latin1() ); 587 chdir( current.latin1() );
588 currentDir.cd( current, TRUE); 588 currentDir.cd( current, TRUE);
589 populateList(); 589 populateList();
590 update(); 590 update();
591} 591}
592 592
593void fileBrowser::dirPathEditPressed() { 593void fileBrowser::dirPathEditPressed() {
594 QString current = dirPathCombo->lineEdit()->text(); 594 QString current = dirPathCombo->lineEdit()->text();
595 chdir( current.latin1() ); 595 chdir( current.latin1() );
596 currentDir.cd( current, TRUE); 596 currentDir.cd( current, TRUE);
597 populateList(); 597 populateList();
598 update(); 598 update();
599} 599}
600 600
601void fileBrowser::fillCombo(const QString &currentPath) { 601void fileBrowser::fillCombo(const QString &currentPath) {
602 602
603 dirPathCombo->lineEdit()->setText(currentPath); 603 dirPathCombo->lineEdit()->setText(currentPath);
604 604
605 if( dirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 605 if( dirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
606 dirPathCombo->clear(); 606 dirPathCombo->clear();
607 dirPathStringList.prepend(currentPath ); 607 dirPathStringList.prepend(currentPath );
608 dirPathCombo->insertStringList( dirPathStringList,-1); 608 dirPathCombo->insertStringList( dirPathStringList,-1);
609 } 609 }
610} 610}
611 611
612 612
613InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 613InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
614 : QDialog( parent, name, modal, fl ) 614 : QDialog( parent, name, modal, fl )
615{ 615{
616 if ( !name ) 616 if ( !name )
617 setName( "InputDialog" ); 617 setName( "InputDialog" );
618 resize( 234, 50 ); 618 resize( 234, 50 );
619 setMaximumSize( QSize( 240, 50 ) ); 619 setMaximumSize( QSize( 240, 50 ) );
620 setCaption( tr(name ) ); 620 setCaption( tr(name ) );
621 621
622 LineEdit1 = new QLineEdit( this, "LineEdit1" ); 622 LineEdit1 = new QLineEdit( this, "LineEdit1" );
623 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); 623 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) );
624} 624}
625 625
626InputDialog::~InputDialog() 626InputDialog::~InputDialog()
627{ 627{
628 inputText= LineEdit1->text(); 628 inputText= LineEdit1->text();
629 629
630} 630}
631 631
632void InputDialog::setTextEdit(const QString &string) { 632void InputDialog::setTextEdit(const QString &string) {
633 LineEdit1->setText(string); 633 LineEdit1->setText(string);
634} 634}