-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 6 | ||||
-rw-r--r-- | core/apps/textedit/fileSaver.cpp | 3 |
2 files changed, 4 insertions, 5 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index 3e3cc3a..b029e5b 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp | |||
@@ -50,74 +50,74 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags | |||
50 | ListView->setColumnAlignment(1,QListView::AlignRight); | 50 | ListView->setColumnAlignment(1,QListView::AlignRight); |
51 | // ListView->setMultiSelection(true); | 51 | // ListView->setMultiSelection(true); |
52 | // ListView->setSelectionMode(QListView::Extended); | 52 | // ListView->setSelectionMode(QListView::Extended); |
53 | 53 | ||
54 | ListView->setAllColumnsShowFocus( TRUE ); | 54 | ListView->setAllColumnsShowFocus( TRUE ); |
55 | ListView->setGeometry( QRect( 10, 35, 220, 240 ) ); | 55 | ListView->setGeometry( QRect( 10, 35, 220, 240 ) ); |
56 | 56 | ||
57 | // signals and slots connections | 57 | // signals and slots connections |
58 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); | 58 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); |
59 | connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); | 59 | connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); |
60 | currentDir.setPath(QDir::currentDirPath()); | 60 | currentDir.setPath(QDir::currentDirPath()); |
61 | populateList(); | 61 | populateList(); |
62 | move(0,15); | 62 | move(0,15); |
63 | } | 63 | } |
64 | 64 | ||
65 | fileBrowser::~fileBrowser() | 65 | fileBrowser::~fileBrowser() |
66 | { | 66 | { |
67 | } | 67 | } |
68 | 68 | ||
69 | 69 | ||
70 | void fileBrowser::populateList() | 70 | void fileBrowser::populateList() |
71 | { | 71 | { |
72 | ListView->clear(); | 72 | ListView->clear(); |
73 | //qDebug(currentDir.canonicalPath()); | 73 | //qDebug(currentDir.canonicalPath()); |
74 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden ); | 74 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
75 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 75 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
76 | currentDir.setMatchAllDirs(TRUE); | 76 | currentDir.setMatchAllDirs(TRUE); |
77 | 77 | ||
78 | currentDir.setNameFilter(filterStr); | 78 | currentDir.setNameFilter(filterStr); |
79 | // currentDir.setNameFilter("*.txt;*.etx"); | 79 | // currentDir.setNameFilter("*.txt;*.etx"); |
80 | QString fileL, fileS; | 80 | QString fileL, fileS; |
81 | const QFileInfoList *list = currentDir.entryInfoList(QDir::All /*, QDir::SortByMask*/); | 81 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
82 | QFileInfoListIterator it(*list); | 82 | QFileInfoListIterator it(*list); |
83 | QFileInfo *fi; | 83 | QFileInfo *fi; |
84 | while ( (fi=it.current()) ) { | 84 | while ( (fi=it.current()) ) { |
85 | 85 | ||
86 | if (fi->isSymLink() ){ | 86 | if (fi->isSymLink() ){ |
87 | QString symLink=fi->readLink(); | 87 | QString symLink=fi->readLink(); |
88 | // qDebug("Symlink detected "+symLink); | 88 | // qDebug("Symlink detected "+symLink); |
89 | QFileInfo sym( symLink); | 89 | QFileInfo sym( symLink); |
90 | fileS.sprintf( "%10li", sym.size() ); | 90 | fileS.sprintf( "%10li", sym.size() ); |
91 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 91 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
92 | 92 | ||
93 | } else { | 93 | } else { |
94 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 94 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
95 | fileS.sprintf( "%10li", fi->size() ); | 95 | fileS.sprintf( "%10li", fi->size() ); |
96 | fileL.sprintf( "%s",fi->fileName().data() ); | 96 | fileL.sprintf( "%s",fi->fileName().data() ); |
97 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 97 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
98 | fileL+="/"; | 98 | fileL+="/"; |
99 | // qDebug(currentDir.canonicalPath()+fileL); | 99 | // qDebug( fileL); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | item= new QListViewItem( ListView,fileL,fileS ); | 102 | item= new QListViewItem( ListView,fileL,fileS ); |
103 | ++it; | 103 | ++it; |
104 | } | 104 | } |
105 | ListView->setSorting( 2, FALSE); | 105 | ListView->setSorting( 2, FALSE); |
106 | dirLabel->setText(currentDir.canonicalPath()); | 106 | dirLabel->setText(currentDir.canonicalPath()); |
107 | } | 107 | } |
108 | 108 | ||
109 | void fileBrowser::upDir() | 109 | void fileBrowser::upDir() |
110 | { | 110 | { |
111 | // qDebug(currentDir.canonicalPath()); | 111 | // qDebug(currentDir.canonicalPath()); |
112 | } | 112 | } |
113 | 113 | ||
114 | void fileBrowser::listDoubleClicked(QListViewItem *selectedItem) | 114 | void fileBrowser::listDoubleClicked(QListViewItem *selectedItem) |
115 | { | 115 | { |
116 | } | 116 | } |
117 | 117 | ||
118 | // you may want to switch these 2 functions. I like single clicks | 118 | // you may want to switch these 2 functions. I like single clicks |
119 | void fileBrowser::listClicked(QListViewItem *selectedItem) | 119 | void fileBrowser::listClicked(QListViewItem *selectedItem) |
120 | { | 120 | { |
121 | QString strItem=selectedItem->text(0); | 121 | QString strItem=selectedItem->text(0); |
122 | QString strSize=selectedItem->text(1); | 122 | QString strSize=selectedItem->text(1); |
123 | // qDebug("strItem is "+strItem); | 123 | // qDebug("strItem is "+strItem); |
diff --git a/core/apps/textedit/fileSaver.cpp b/core/apps/textedit/fileSaver.cpp index de594aa..f3be914 100644 --- a/core/apps/textedit/fileSaver.cpp +++ b/core/apps/textedit/fileSaver.cpp | |||
@@ -61,59 +61,58 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl | |||
61 | fileEdit= new QLineEdit(this); | 61 | fileEdit= new QLineEdit(this); |
62 | fileEdit->setGeometry( QRect( 10, 162, 205, 17)); | 62 | fileEdit->setGeometry( QRect( 10, 162, 205, 17)); |
63 | 63 | ||
64 | fileEdit->setText( tmpFileName); | 64 | fileEdit->setText( tmpFileName); |
65 | 65 | ||
66 | filePermCheck = new QCheckBox( this, "SetFilePerms" ); | 66 | filePermCheck = new QCheckBox( this, "SetFilePerms" ); |
67 | filePermCheck->setText("set file permissions"); | 67 | filePermCheck->setText("set file permissions"); |
68 | filePermCheck->setGeometry(10, 178, 150,17); | 68 | filePermCheck->setGeometry(10, 178, 150,17); |
69 | // signals and slots connections | 69 | // signals and slots connections |
70 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); | 70 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); |
71 | connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); | 71 | connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); |
72 | 72 | ||
73 | // tmpFileName=fi.FilePath(); | 73 | // tmpFileName=fi.FilePath(); |
74 | // qDebug( tmpFileName); | 74 | // qDebug( tmpFileName); |
75 | currentDir.setPath( QDir::currentDirPath() ); | 75 | currentDir.setPath( QDir::currentDirPath() ); |
76 | populateList(); | 76 | populateList(); |
77 | move(0,15); | 77 | move(0,15); |
78 | 78 | ||
79 | } | 79 | } |
80 | 80 | ||
81 | fileSaver::~fileSaver() | 81 | fileSaver::~fileSaver() |
82 | { | 82 | { |
83 | } | 83 | } |
84 | 84 | ||
85 | |||
86 | void fileSaver::populateList() | 85 | void fileSaver::populateList() |
87 | { | 86 | { |
88 | ListView->clear(); | 87 | ListView->clear(); |
89 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden ); | 88 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden ); |
90 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 89 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
91 | currentDir.setMatchAllDirs(TRUE); | 90 | currentDir.setMatchAllDirs(TRUE); |
92 | 91 | ||
93 | currentDir.setNameFilter("*"); | 92 | currentDir.setNameFilter("*"); |
94 | QString fileL, fileS; | 93 | QString fileL, fileS; |
95 | const QFileInfoList *list = currentDir.entryInfoList(QDir::All /*, QDir::SortByMask*/); | 94 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
96 | QFileInfoListIterator it(*list); | 95 | QFileInfoListIterator it(*list); |
97 | QFileInfo *fi; | 96 | QFileInfo *fi; |
98 | while ( (fi=it.current()) ) { | 97 | while ( (fi=it.current()) ) { |
99 | 98 | ||
100 | if (fi->isSymLink() ){ | 99 | if (fi->isSymLink() ){ |
101 | QString symLink=fi->readLink(); | 100 | QString symLink=fi->readLink(); |
102 | // qDebug("Symlink detected "+symLink); | 101 | // qDebug("Symlink detected "+symLink); |
103 | QFileInfo sym( symLink); | 102 | QFileInfo sym( symLink); |
104 | fileS.sprintf( "%10li", sym.size() ); | 103 | fileS.sprintf( "%10li", sym.size() ); |
105 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 104 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
106 | 105 | ||
107 | } else { | 106 | } else { |
108 | // // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 107 | // // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
109 | fileS.sprintf( "%10li", fi->size() ); | 108 | fileS.sprintf( "%10li", fi->size() ); |
110 | fileL.sprintf( "%s",fi->fileName().data() ); | 109 | fileL.sprintf( "%s",fi->fileName().data() ); |
111 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 110 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
112 | fileL+="/"; | 111 | fileL+="/"; |
113 | // qDebug(currentDir.canonicalPath()+fileL); | 112 | // qDebug(currentDir.canonicalPath()+fileL); |
114 | } | 113 | } |
115 | } | 114 | } |
116 | item= new QListViewItem( ListView,fileL,fileS ); | 115 | item= new QListViewItem( ListView,fileL,fileS ); |
117 | ++it; | 116 | ++it; |
118 | } | 117 | } |
119 | ListView->setSorting( 2, FALSE); | 118 | ListView->setSorting( 2, FALSE); |