]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/portabase/portabase-1.9/fileselector.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / portabase / portabase-1.9 / fileselector.patch
1 diff -urN portabase.orig/fileselector.cpp portabase/fileselector.cpp
2 --- portabase.orig/fileselector.cpp     2004-09-02 20:06:38.000000000 +0200
3 +++ portabase/fileselector.cpp  2004-09-02 20:59:22.000000000 +0200
4 @@ -43,8 +43,8 @@
5  
6  bool PBFileSelector::duplicate()
7  {
8 -    const DocLnk *selection = selected();
9 -    if (selection == 0) {
10 +    DocLnk selection(selectedDocument());
11 +    if (!selection.isValid()) {
12          return FALSE;
13      }
14      bool ok;
15 @@ -56,7 +56,7 @@
16          DocLnk copy;
17          configureDocLnk(copy, name);
18          FileManager fm;
19 -        ok = fm.copyFile(*selection, copy);
20 +        ok = fm.copyFile(selection, copy);
21      }
22      if (ok) {
23          reread();
24 @@ -65,14 +65,13 @@
25          QMessageBox::warning(this, QQDialog::tr("PortaBase"),
26                               tr("Unable to create new file"));
27      }
28 -    delete selection;
29      return ok;
30  }
31  
32  bool PBFileSelector::rename()
33  {
34 -    const DocLnk *selection = selected();
35 -    if (selection == 0) {
36 +    DocLnk selection(selectedDocument());
37 +    if (!selection.isValid()) {
38          return FALSE;
39      }
40      bool ok;
41 @@ -88,9 +87,9 @@
42          configureDocLnk(copy, name);
43          // actual moving would be more efficient, but harder to implement...
44          FileManager fm;
45 -        if (fm.copyFile(*selection, copy)) {
46 -            QFile::remove(selection->file());
47 -            QFile::remove(selection->linkFile());
48 +        if (fm.copyFile(selection, copy)) {
49 +            QFile::remove(selection.file());
50 +            QFile::remove(selection.linkFile());
51              ok = TRUE;
52          }
53          else {
54 @@ -104,7 +103,6 @@
55          QMessageBox::warning(this, QQDialog::tr("PortaBase"),
56                               tr("Unable to rename the file"));
57      }
58 -    delete selection;
59      return ok;
60  }
61  
62 diff -urN portabase.orig/importdialog.cpp portabase/importdialog.cpp
63 --- portabase.orig/importdialog.cpp     2004-09-02 20:06:38.000000000 +0200
64 +++ portabase/importdialog.cpp  2004-09-02 20:54:47.000000000 +0200
65 @@ -130,14 +130,13 @@
66      int result = QDialog::exec();
67      if (result && !importDone) {
68          // "OK" was clicked...see if there is a selected file
69 -        const DocLnk *f = selector->selected();
70 -        if (!f) {
71 +        DocLnk f(selector->selectedDocument());
72 +        if (!f.isValid()) {
73              return QDialog::Rejected;
74          }
75 -        if (!import(f->file())) {
76 +        if (!import(f.file())) {
77              result = QDialog::Rejected;
78          }
79 -        delete f;
80      }
81      return result;
82  }
83 diff -urN portabase.orig/portabase.cpp portabase/portabase.cpp
84 --- portabase.orig/portabase.cpp        2004-09-02 20:06:38.000000000 +0200
85 +++ portabase/portabase.cpp     2004-09-02 20:56:58.000000000 +0200
86 @@ -527,12 +527,11 @@
87  
88  void PortaBase::openFile()
89  {
90 -    const DocLnk *selection = fileSelector->selected();
91 -    if (selection == 0) {
92 +    DocLnk selection (fileSelector->selectedDocument());
93 +    if (!selection.isValid()) {
94          return;
95      }
96 -    openFile(*selection);
97 -    delete selection;
98 +    openFile(selection);
99  }
100  
101  void PortaBase::openFile(const QString &f)
102 @@ -591,21 +590,19 @@
103  
104  void PortaBase::deleteFile()
105  {
106 -    const DocLnk *selection = fileSelector->selected();
107 -    if (selection == 0) {
108 +    DocLnk selection(fileSelector->selectedDocument());
109 +    if (!selection.isValid()) {
110          return;
111      }
112      if (QMessageBox::warning(this, QQDialog::tr("PortaBase"), tr("Delete")
113 -                             + " \"" + selection->name() + "\"\n"
114 +                             + " \"" + selection.name() + "\"\n"
115                               + tr("Are you sure?"),
116                               QObject::tr("Yes"), QObject::tr("No"),
117                               QString::null, 1) > 0) {
118 -        delete selection;
119          return;
120      }
121 -    QFile::remove(selection->file());
122 -    QFile::remove(selection->linkFile());
123 -    delete selection;
124 +    QFile::remove(selection.file());
125 +    QFile::remove(selection.linkFile());
126      fileSelector->reread();
127  }
128