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
6 bool PBFileSelector::duplicate()
8 - const DocLnk *selection = selected();
9 - if (selection == 0) {
10 + DocLnk selection(selectedDocument());
11 + if (!selection.isValid()) {
17 configureDocLnk(copy, name);
19 - ok = fm.copyFile(*selection, copy);
20 + ok = fm.copyFile(selection, copy);
25 QMessageBox::warning(this, QQDialog::tr("PortaBase"),
26 tr("Unable to create new file"));
32 bool PBFileSelector::rename()
34 - const DocLnk *selection = selected();
35 - if (selection == 0) {
36 + DocLnk selection(selectedDocument());
37 + if (!selection.isValid()) {
42 configureDocLnk(copy, name);
43 // actual moving would be more efficient, but harder to implement...
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());
55 QMessageBox::warning(this, QQDialog::tr("PortaBase"),
56 tr("Unable to rename the file"));
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
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();
71 + DocLnk f(selector->selectedDocument());
73 return QDialog::Rejected;
75 - if (!import(f->file())) {
76 + if (!import(f.file())) {
77 result = QDialog::Rejected;
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
88 void PortaBase::openFile()
90 - const DocLnk *selection = fileSelector->selected();
91 - if (selection == 0) {
92 + DocLnk selection (fileSelector->selectedDocument());
93 + if (!selection.isValid()) {
96 - openFile(*selection);
98 + openFile(selection);
101 void PortaBase::openFile(const QString &f)
102 @@ -591,21 +590,19 @@
104 void PortaBase::deleteFile()
106 - const DocLnk *selection = fileSelector->selected();
107 - if (selection == 0) {
108 + DocLnk selection(fileSelector->selectedDocument());
109 + if (!selection.isValid()) {
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) {
121 - QFile::remove(selection->file());
122 - QFile::remove(selection->linkFile());
124 + QFile::remove(selection.file());
125 + QFile::remove(selection.linkFile());
126 fileSelector->reread();