|
a/src/qtgui/multisave.cpp |
|
b/src/qtgui/multisave.cpp |
|
... |
|
... |
36 |
|
36 |
|
37 |
const unsigned int maxlen = 200;
|
37 |
const unsigned int maxlen = 200;
|
38 |
|
38 |
|
39 |
void multiSave(QWidget *p, vector<Rcl::Doc>& docs)
|
39 |
void multiSave(QWidget *p, vector<Rcl::Doc>& docs)
|
40 |
{
|
40 |
{
|
41 |
QFileDialog fdialog(p, p->tr("Create or choose save directory"));
|
41 |
QFileDialog fdialog(p, QWidget::tr("Create or choose save directory"));
|
42 |
fdialog.setAcceptMode(QFileDialog::AcceptSave);
|
42 |
fdialog.setAcceptMode(QFileDialog::AcceptSave);
|
43 |
fdialog.setFileMode(QFileDialog::Directory);
|
43 |
fdialog.setFileMode(QFileDialog::Directory);
|
44 |
fdialog.setOption(QFileDialog::ShowDirsOnly);
|
44 |
fdialog.setOption(QFileDialog::ShowDirsOnly);
|
45 |
if (fdialog.exec() == 0)
|
45 |
if (fdialog.exec() == 0)
|
46 |
return;
|
46 |
return;
|
47 |
QStringList dirl = fdialog.selectedFiles();
|
47 |
QStringList dirl = fdialog.selectedFiles();
|
48 |
if (dirl.size() != 1) {
|
48 |
if (dirl.size() != 1) {
|
49 |
// Can't happen ?
|
49 |
// Can't happen ?
|
50 |
QMessageBox::warning(0, "Recoll",
|
50 |
QMessageBox::warning(0, "Recoll",
|
51 |
p->tr("Choose exactly one directory"));
|
51 |
QWidget::tr("Choose exactly one directory"));
|
52 |
return;
|
52 |
return;
|
53 |
}
|
53 |
}
|
54 |
string dir((const char *)dirl[0].toLocal8Bit());
|
54 |
string dir((const char *)dirl[0].toLocal8Bit());
|
55 |
LOGDEB2(("multiSave: got dir %s\n", dir.c_str()));
|
55 |
LOGDEB2(("multiSave: got dir %s\n", dir.c_str()));
|
56 |
|
56 |
|
|
... |
|
... |
77 |
*/
|
77 |
*/
|
78 |
set<string> existingNames;
|
78 |
set<string> existingNames;
|
79 |
string reason;
|
79 |
string reason;
|
80 |
if (!readdir(dir, reason, existingNames)) {
|
80 |
if (!readdir(dir, reason, existingNames)) {
|
81 |
QMessageBox::warning(0, "Recoll",
|
81 |
QMessageBox::warning(0, "Recoll",
|
82 |
p->tr("Could not read directory: ") +
|
82 |
QWidget::tr("Could not read directory: ") +
|
83 |
QString::fromLocal8Bit(reason.c_str()));
|
83 |
QString::fromLocal8Bit(reason.c_str()));
|
84 |
return;
|
84 |
return;
|
85 |
}
|
85 |
}
|
86 |
|
86 |
|
87 |
set<string> toBeCreated;
|
87 |
set<string> toBeCreated;
|
|
... |
|
... |
123 |
|
123 |
|
124 |
for (unsigned int i = 0; i != docs.size(); i++) {
|
124 |
for (unsigned int i = 0; i != docs.size(); i++) {
|
125 |
string fn = path_cat(dir, filenames[i]);
|
125 |
string fn = path_cat(dir, filenames[i]);
|
126 |
if (access(fn.c_str(), 0) == 0) {
|
126 |
if (access(fn.c_str(), 0) == 0) {
|
127 |
QMessageBox::warning(0, "Recoll",
|
127 |
QMessageBox::warning(0, "Recoll",
|
128 |
p->tr("Unexpected file name collision, "
|
128 |
QWidget::tr("Unexpected file name collision, "
|
129 |
"cancelling."));
|
129 |
"cancelling."));
|
130 |
return;
|
130 |
return;
|
131 |
}
|
131 |
}
|
132 |
// There is still a race condition here, should we care ?
|
132 |
// There is still a race condition here, should we care ?
|
133 |
TempFile temp;// not used
|
133 |
TempFile temp;// not used
|
134 |
if (!FileInterner::idocToFile(temp, fn, theconfig, docs[i])) {
|
134 |
if (!FileInterner::idocToFile(temp, fn, theconfig, docs[i])) {
|
135 |
QMessageBox::warning(0, "Recoll",
|
135 |
QMessageBox::warning(0, "Recoll",
|
136 |
p->tr("Cannot extract document: ") +
|
136 |
QWidget::tr("Cannot extract document: ") +
|
137 |
QString::fromLocal8Bit(docs[i].url.c_str()) +
|
137 |
QString::fromLocal8Bit(docs[i].url.c_str()) +
|
138 |
" | " +
|
138 |
" | " +
|
139 |
QString::fromLocal8Bit(docs[i].ipath.c_str())
|
139 |
QString::fromLocal8Bit(docs[i].ipath.c_str())
|
140 |
);
|
140 |
);
|
141 |
}
|
141 |
}
|