-rw-r--r-- | core/apps/textedit/fileSaver.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/apps/textedit/fileSaver.cpp b/core/apps/textedit/fileSaver.cpp index fbf50cf..07fb5ba 100644 --- a/core/apps/textedit/fileSaver.cpp +++ b/core/apps/textedit/fileSaver.cpp | |||
@@ -1,116 +1,116 @@ | |||
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 fileSaver.cpp | 3 | ** Created: Fri Dec 14 08:16:46 2001 fileSaver.cpp |
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 | #include "fileSaver.h" | 14 | #include "fileSaver.h" |
15 | #include <qpe/config.h> | 15 | #include <qpe/config.h> |
16 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
17 | 17 | ||
18 | #include <qpe/qpeapplication.h> | 18 | #include <qpe/qpeapplication.h> |
19 | #include <qlistview.h> | 19 | #include <qlistview.h> |
20 | #include <qpushbutton.h> | 20 | #include <qpushbutton.h> |
21 | #include <qfile.h> | 21 | #include <qfile.h> |
22 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
23 | #include <qlineedit.h> | 23 | #include <qlineedit.h> |
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | 25 | ||
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | 27 | ||
28 | fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl , const QString currentFileName ) | 28 | fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl , const QString currentFileName ) |
29 | : QDialog( parent, name, modal, fl ) | 29 | : QDialog( parent, name, modal, fl ) |
30 | { | 30 | { |
31 | if ( !name ) | 31 | if ( !name ) |
32 | setName( "fileSaver" ); | 32 | setName( "fileSaver" ); |
33 | resize( 240, 280 ); | 33 | resize( 240, 280 ); |
34 | setCaption(tr( name ) ); | 34 | setCaption(tr( name ) ); |
35 | QFileInfo fi(currentFileName); | 35 | QFileInfo fi(currentFileName); |
36 | QString tmpFileName=fi.fileName(); | 36 | QString tmpFileName=fi.fileName(); |
37 | // qDebug( tmpFileName); | 37 | // qDebug( tmpFileName); |
38 | dirLabel = new QLabel(this, "DirLabel"); | 38 | dirLabel = new QLabel(this, "DirLabel"); |
39 | dirLabel->setText(currentDir.canonicalPath()); | 39 | dirLabel->setText(currentDir.canonicalPath()); |
40 | dirLabel->setGeometry(10,20,230,15); | 40 | dirLabel->setGeometry(10,20,230,15); |
41 | 41 | ||
42 | homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton"); | 42 | homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton"); |
43 | homeButton->setGeometry(200,4,25,25); | 43 | homeButton->setGeometry(200,4,25,25); |
44 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 44 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
45 | homeButton->setFlat(TRUE); | 45 | homeButton->setFlat(TRUE); |
46 | 46 | ||
47 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); | 47 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); |
48 | docButton->setGeometry(170,4,25,25); | 48 | docButton->setGeometry(170,4,25,25); |
49 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 49 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
50 | docButton->setFlat(TRUE); | 50 | docButton->setFlat(TRUE); |
51 | 51 | ||
52 | hideButton = new QPushButton( Resource::loadIconSet("s_hidden"),"",this,"hideButton"); | 52 | hideButton = new QPushButton( Resource::loadIconSet("textedit/s_hidden"),"",this,"hideButton"); |
53 | hideButton->setGeometry(140,4,25,25); | 53 | hideButton->setGeometry(140,4,25,25); |
54 | connect( hideButton,SIGNAL(toggled(bool)),this,SLOT( hideButtonPushed(bool)) ); | 54 | connect( hideButton,SIGNAL(toggled(bool)),this,SLOT( hideButtonPushed(bool)) ); |
55 | hideButton->setToggleButton(TRUE); | 55 | hideButton->setToggleButton(TRUE); |
56 | hideButton->setFlat(TRUE); | 56 | hideButton->setFlat(TRUE); |
57 | 57 | ||
58 | ListView = new QListView( this, "ListView" ); | 58 | ListView = new QListView( this, "ListView" ); |
59 | ListView->addColumn( tr( "Name" ) ); | 59 | ListView->addColumn( tr( "Name" ) ); |
60 | ListView->setColumnWidth(0,140); | 60 | ListView->setColumnWidth(0,140); |
61 | ListView->setSorting( 2, FALSE); | 61 | ListView->setSorting( 2, FALSE); |
62 | ListView->addColumn( tr( "Size" ) ); | 62 | ListView->addColumn( tr( "Size" ) ); |
63 | ListView->setColumnWidth(1,59); | 63 | ListView->setColumnWidth(1,59); |
64 | ListView->setColumnWidthMode(0,QListView::Manual); | 64 | ListView->setColumnWidthMode(0,QListView::Manual); |
65 | ListView->setColumnAlignment(1,QListView::AlignRight); | 65 | ListView->setColumnAlignment(1,QListView::AlignRight); |
66 | // ListView->setMultiSelection(true); | 66 | // ListView->setMultiSelection(true); |
67 | // ListView->setSelectionMode(QListView::Extended); | 67 | // ListView->setSelectionMode(QListView::Extended); |
68 | 68 | ||
69 | ListView->setAllColumnsShowFocus( TRUE ); | 69 | ListView->setAllColumnsShowFocus( TRUE ); |
70 | ListView->setGeometry( QRect( 10,35,220,125)); | 70 | ListView->setGeometry( QRect( 10,35,220,125)); |
71 | 71 | ||
72 | fileEdit= new QLineEdit(this); | 72 | fileEdit= new QLineEdit(this); |
73 | fileEdit->setGeometry( QRect( 10, 162, 205, 17)); | 73 | fileEdit->setGeometry( QRect( 10, 162, 205, 17)); |
74 | 74 | ||
75 | fileEdit->setText( tmpFileName); | 75 | fileEdit->setText( tmpFileName); |
76 | 76 | ||
77 | filePermCheck = new QCheckBox( this, "SetFilePerms" ); | 77 | filePermCheck = new QCheckBox( this, "SetFilePerms" ); |
78 | filePermCheck->setText("set file permissions"); | 78 | filePermCheck->setText("set file permissions"); |
79 | filePermCheck->setGeometry(10, 178, 150,17); | 79 | filePermCheck->setGeometry(10, 178, 150,17); |
80 | // signals and slots connections | 80 | // signals and slots connections |
81 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); | 81 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); |
82 | connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); | 82 | connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); |
83 | 83 | ||
84 | // tmpFileName=fi.FilePath(); | 84 | // tmpFileName=fi.FilePath(); |
85 | // qDebug( tmpFileName); | 85 | // qDebug( tmpFileName); |
86 | currentDir.setPath( QDir::currentDirPath() ); | 86 | currentDir.setPath( QDir::currentDirPath() ); |
87 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); | 87 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); |
88 | populateList(); | 88 | populateList(); |
89 | move(0,15); | 89 | move(0,15); |
90 | fileEdit->setFocus(); | 90 | fileEdit->setFocus(); |
91 | } | 91 | } |
92 | 92 | ||
93 | fileSaver::~fileSaver() | 93 | fileSaver::~fileSaver() |
94 | { | 94 | { |
95 | } | 95 | } |
96 | 96 | ||
97 | void fileSaver::populateList() | 97 | void fileSaver::populateList() |
98 | { | 98 | { |
99 | ListView->clear(); | 99 | ListView->clear(); |
100 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 100 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
101 | currentDir.setMatchAllDirs(TRUE); | 101 | currentDir.setMatchAllDirs(TRUE); |
102 | 102 | ||
103 | currentDir.setNameFilter("*"); | 103 | currentDir.setNameFilter("*"); |
104 | QString fileL, fileS; | 104 | QString fileL, fileS; |
105 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 105 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
106 | QFileInfoListIterator it(*list); | 106 | QFileInfoListIterator it(*list); |
107 | QFileInfo *fi; | 107 | QFileInfo *fi; |
108 | while ( (fi=it.current()) ) { | 108 | while ( (fi=it.current()) ) { |
109 | 109 | ||
110 | if (fi->isSymLink() ){ | 110 | if (fi->isSymLink() ){ |
111 | QString symLink=fi->readLink(); | 111 | QString symLink=fi->readLink(); |
112 | // qDebug("Symlink detected "+symLink); | 112 | // qDebug("Symlink detected "+symLink); |
113 | QFileInfo sym( symLink); | 113 | QFileInfo sym( symLink); |
114 | fileS.sprintf( "%10li", sym.size() ); | 114 | fileS.sprintf( "%10li", sym.size() ); |
115 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 115 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
116 | 116 | ||