|
a/src/qtgui/multisave.cpp |
|
b/src/qtgui/multisave.cpp |
|
... |
|
... |
88 |
vector<string> filenames;
|
88 |
vector<string> filenames;
|
89 |
for (vector<Rcl::Doc>::iterator it = docs.begin(); it != docs.end(); it++) {
|
89 |
for (vector<Rcl::Doc>::iterator it = docs.begin(); it != docs.end(); it++) {
|
90 |
string utf8fn;
|
90 |
string utf8fn;
|
91 |
it->getmeta(Rcl::Doc::keyfn, &utf8fn);
|
91 |
it->getmeta(Rcl::Doc::keyfn, &utf8fn);
|
92 |
string suffix = path_suffix(utf8fn);
|
92 |
string suffix = path_suffix(utf8fn);
|
|
|
93 |
LOGDEB(("Multisave: [%s] suff [%s]\n", utf8fn.c_str(), suffix.c_str()));
|
93 |
if (suffix.empty() || suffix.size() > 10) {
|
94 |
if (suffix.empty() || suffix.size() > 10) {
|
94 |
suffix = theconfig->getSuffixFromMimeType(it->mimetype);
|
95 |
suffix = theconfig->getSuffixFromMimeType(it->mimetype);
|
|
|
96 |
LOGDEB(("Multisave: suff from config [%s]\n", suffix.c_str()));
|
95 |
}
|
97 |
}
|
96 |
string simple = path_basename(utf8fn, suffix);
|
98 |
string simple = path_basename(utf8fn, string(".") + suffix);
|
|
|
99 |
LOGDEB(("Multisave: simple [%s]\n", simple.c_str()));
|
97 |
if (simple.empty())
|
100 |
if (simple.empty())
|
98 |
simple = "rclsave";
|
101 |
simple = "rclsave";
|
99 |
if (simple.size() > maxlen) {
|
102 |
if (simple.size() > maxlen) {
|
100 |
simple = simple.substr(0, maxlen);
|
103 |
simple = simple.substr(0, maxlen);
|
101 |
}
|
104 |
}
|
102 |
for (int vers = 0; ; vers++) {
|
105 |
for (int vers = 0; ; vers++) {
|
103 |
ostringstream ss;
|
106 |
ostringstream ss;
|
104 |
ss << simple;
|
107 |
ss << simple;
|
105 |
if (vers)
|
108 |
if (vers)
|
106 |
ss << "." << vers;
|
109 |
ss << "." << vers;
|
107 |
if (!suffix.empty())
|
110 |
if (!suffix.empty())
|
108 |
ss << suffix;
|
111 |
ss << "." << suffix;
|
109 |
|
112 |
|
110 |
string fn =
|
113 |
string fn =
|
111 |
(const char *)QString::fromUtf8(ss.str().c_str()).toLocal8Bit();
|
114 |
(const char *)QString::fromUtf8(ss.str().c_str()).toLocal8Bit();
|
112 |
if (existingNames.find(fn) == existingNames.end() &&
|
115 |
if (existingNames.find(fn) == existingNames.end() &&
|
113 |
toBeCreated.find(fn) == toBeCreated.end()) {
|
116 |
toBeCreated.find(fn) == toBeCreated.end()) {
|