Diffstat (limited to 'noncore/games/backgammon/filedialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/backgammon/filedialog.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/games/backgammon/filedialog.cpp b/noncore/games/backgammon/filedialog.cpp index e0a2914..f185188 100644 --- a/noncore/games/backgammon/filedialog.cpp +++ b/noncore/games/backgammon/filedialog.cpp | |||
@@ -1,61 +1,61 @@ | |||
1 | #include "filedialog.h" | 1 | #include "filedialog.h" |
2 | 2 | ||
3 | #include <qdir.h> | 3 | #include <qdir.h> |
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | 5 | ||
6 | FileDialog::FileDialog(QWidget* parent,QString header,QString extension,const char* name,bool modal,WFlags f) | 6 | FileDialog::FileDialog(QWidget* parent,QString header,QString extension,const char* name,bool modal,WFlags f) |
7 | :QDialog(parent,name,modal,f) | 7 | :QDialog(parent,name,modal,f) |
8 | { | 8 | { |
9 | setCaption(header); | 9 | setCaption(header); |
10 | ext=extension; | 10 | ext=extension; |
11 | dirselector=new QListView(this); | 11 | dirselector=new QListView(this); |
12 | dirselector->setGeometry(1,10,235,200); | 12 | dirselector->setGeometry(1,10,235,200); |
13 | dirselector->addColumn("Files"); | 13 | dirselector->addColumn("Files"); |
14 | connect(dirselector,SIGNAL(clicked(QListViewItem*)),this,SLOT(selectorclicked(QListViewItem*))); | 14 | connect(dirselector,SIGNAL(clicked(QListViewItem*)),this,SLOT(selectorclicked(QListViewItem*))); |
15 | 15 | ||
16 | getCurrentDir(); | 16 | getCurrentDir(); |
17 | 17 | ||
18 | file_name="user"; | 18 | file_name="user"; |
19 | fileinput=new QLineEdit(file_name,this); | 19 | fileinput=new QLineEdit(file_name,this); |
20 | fileinput->setGeometry(1,220,235,20); | 20 | fileinput->setGeometry(1,220,235,20); |
21 | 21 | ||
22 | QPEApplication::showDialog( this ); | 22 | QPEApplication::showDialog( this ); |
23 | } | 23 | } |
24 | 24 | ||
25 | FileDialog::~FileDialog() | 25 | FileDialog::~FileDialog() |
26 | {} | 26 | {} |
27 | 27 | ||
28 | 28 | ||
29 | void FileDialog::selectorclicked(QListViewItem* entry) | 29 | void FileDialog::selectorclicked(QListViewItem* entry) |
30 | { | 30 | { |
31 | if(entry==NULL) | 31 | if(entry==NULL) |
32 | return; | 32 | return; |
33 | file_name=entry->text(0); | 33 | file_name=entry->text(0); |
34 | fileinput->setText(file_name); | 34 | fileinput->setText(file_name); |
35 | } | 35 | } |
36 | 36 | ||
37 | void FileDialog::getCurrentDir() | 37 | void FileDialog::getCurrentDir() |
38 | { | 38 | { |
39 | dirselector->clear(); | 39 | dirselector->clear(); |
40 | QDir dir(QPEApplication::qpeDir()+"/backgammon"); | 40 | QDir dir(QPEApplication::qpeDir()+"backgammon"); |
41 | dir.setFilter(QDir::Files); | 41 | dir.setFilter(QDir::Files); |
42 | QFileInfoListIterator it(*(dir.entryInfoList())); | 42 | QFileInfoListIterator it(*(dir.entryInfoList())); |
43 | QFileInfo* fi; | 43 | QFileInfo* fi; |
44 | 44 | ||
45 | int ext_length=ext.length(); | 45 | int ext_length=ext.length(); |
46 | while((fi=it.current())) // go through all file and subdirs | 46 | while((fi=it.current())) // go through all file and subdirs |
47 | { | 47 | { |
48 | QString file=fi->fileName(); | 48 | QString file=fi->fileName(); |
49 | if(file.right(ext_length)==ext && file) | 49 | if(file.right(ext_length)==ext && file) |
50 | { | 50 | { |
51 | file=file.left(file.length()-ext_length); | 51 | file=file.left(file.length()-ext_length); |
52 | new QListViewItem(dirselector,file); | 52 | new QListViewItem(dirselector,file); |
53 | } | 53 | } |
54 | ++it; | 54 | ++it; |
55 | } | 55 | } |
56 | } | 56 | } |
57 | 57 | ||
58 | QString FileDialog::filename() | 58 | QString FileDialog::filename() |
59 | { | 59 | { |
60 | return file_name; | 60 | return file_name; |
61 | } | 61 | } |