Changeset View
Standalone View
src/widgets/renamedialog.cpp
Show First 20 Lines • Show All 133 Lines • ▼ Show 20 Line(s) | 97 | public: | |||
---|---|---|---|---|---|
134 | QCheckBox *bApplyAll; | 134 | QCheckBox *bApplyAll; | ||
135 | QLineEdit *m_pLineEdit; | 135 | QLineEdit *m_pLineEdit; | ||
136 | QUrl src; | 136 | QUrl src; | ||
137 | QUrl dest; | 137 | QUrl dest; | ||
138 | bool m_srcPendingPreview; | 138 | bool m_srcPendingPreview; | ||
139 | bool m_destPendingPreview; | 139 | bool m_destPendingPreview; | ||
140 | QLabel *m_srcPreview; | 140 | QLabel *m_srcPreview; | ||
141 | QLabel *m_destPreview; | 141 | QLabel *m_destPreview; | ||
142 | QScrollArea *m_srcArea; | 142 | QScrollArea *m_srcArea; | ||
meven: You don't need a member variable for this. | |||||
ahmadsamir: Indeed, it's only used in one place (too much copy/paste...). | |||||
143 | QScrollArea *m_destArea; | 143 | QScrollArea *m_destArea; | ||
144 | KFileItem srcItem; | 144 | KFileItem srcItem; | ||
145 | KFileItem destItem; | 145 | KFileItem destItem; | ||
146 | }; | 146 | }; | ||
147 | 147 | | |||
148 | RenameDialog::RenameDialog(QWidget *parent, const QString &_caption, | 148 | RenameDialog::RenameDialog(QWidget *parent, const QString &_caption, | ||
149 | const QUrl &_src, const QUrl &_dest, | 149 | const QUrl &_src, const QUrl &_dest, | ||
150 | RenameDialog_Options _options, | 150 | RenameDialog_Options _options, | ||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Line(s) | 233 | } else { | |||
239 | destUds.fastInsert(UDSEntry::UDS_CREATION_TIME, ctimeDest.toMSecsSinceEpoch() / 1000); | 239 | destUds.fastInsert(UDSEntry::UDS_CREATION_TIME, ctimeDest.toMSecsSinceEpoch() / 1000); | ||
240 | destUds.fastInsert(UDSEntry::UDS_SIZE, sizeDest); | 240 | destUds.fastInsert(UDSEntry::UDS_SIZE, sizeDest); | ||
241 | 241 | | |||
242 | d->destItem = KFileItem(destUds, d->dest); | 242 | d->destItem = KFileItem(destUds, d->dest); | ||
243 | } | 243 | } | ||
244 | 244 | | |||
245 | d->m_srcPreview = createLabel(parent, QString()); | 245 | d->m_srcPreview = createLabel(parent, QString()); | ||
246 | d->m_destPreview = createLabel(parent, QString()); | 246 | d->m_destPreview = createLabel(parent, QString()); | ||
247 | QLabel *srcToDestArrow = createLabel(parent, QString()); | ||||
247 | 248 | | |||
248 | d->m_srcPreview->setMinimumHeight(KIconLoader::SizeEnormous); | 249 | d->m_srcPreview->setMinimumHeight(KIconLoader::SizeEnormous); | ||
249 | d->m_destPreview->setMinimumHeight(KIconLoader::SizeEnormous); | 250 | d->m_destPreview->setMinimumHeight(KIconLoader::SizeEnormous); | ||
251 | srcToDestArrow->setMinimumHeight(KIconLoader::SizeEnormous); | ||||
250 | 252 | | |||
251 | d->m_srcPreview->setAlignment(Qt::AlignCenter); | 253 | d->m_srcPreview->setAlignment(Qt::AlignCenter); | ||
252 | d->m_destPreview->setAlignment(Qt::AlignCenter); | 254 | d->m_destPreview->setAlignment(Qt::AlignCenter); | ||
255 | srcToDestArrow->setAlignment(Qt::AlignCenter); | ||||
253 | 256 | | |||
254 | d->m_srcPendingPreview = true; | 257 | d->m_srcPendingPreview = true; | ||
255 | d->m_destPendingPreview = true; | 258 | d->m_destPendingPreview = true; | ||
256 | 259 | | |||
257 | // widget | 260 | // widget | ||
258 | d->m_srcArea = createContainerLayout(parent, d->srcItem, d->m_srcPreview); | 261 | d->m_srcArea = createContainerLayout(parent, d->srcItem, d->m_srcPreview); | ||
259 | d->m_destArea = createContainerLayout(parent, d->destItem, d->m_destPreview); | 262 | d->m_destArea = createContainerLayout(parent, d->destItem, d->m_destPreview); | ||
260 | 263 | | |||
Show All 15 Lines | 277 | if (mtimeDest > mtimeSrc) { | |||
276 | 279 | | |||
277 | gridLayout->addWidget(warningLabel, ++gridRow, 0, 1, 2); | 280 | gridLayout->addWidget(warningLabel, ++gridRow, 0, 1, 2); | ||
278 | } | 281 | } | ||
279 | gridLayout->setRowMinimumHeight(++gridRow, 15); // spacer | 282 | gridLayout->setRowMinimumHeight(++gridRow, 15); // spacer | ||
280 | 283 | | |||
281 | QLabel *srcTitle = createLabel(parent, i18n("Source"), true); | 284 | QLabel *srcTitle = createLabel(parent, i18n("Source"), true); | ||
282 | gridLayout->addWidget(srcTitle, ++gridRow, 0); | 285 | gridLayout->addWidget(srcTitle, ++gridRow, 0); | ||
283 | QLabel *destTitle = createLabel(parent, i18n("Destination"), true); | 286 | QLabel *destTitle = createLabel(parent, i18n("Destination"), true); | ||
284 | gridLayout->addWidget(destTitle, gridRow, 1); | 287 | gridLayout->addWidget(destTitle, gridRow, 2); | ||
285 | 288 | | |||
286 | QLabel *srcUrlLabel = createSqueezedLabel(parent, d->src.toDisplayString(QUrl::PreferLocalFile)); | 289 | QLabel *srcUrlLabel = createSqueezedLabel(parent, d->src.toDisplayString(QUrl::PreferLocalFile)); | ||
287 | srcUrlLabel->setTextFormat(Qt::PlainText); | 290 | srcUrlLabel->setTextFormat(Qt::PlainText); | ||
288 | gridLayout->addWidget(srcUrlLabel, ++gridRow, 0); | 291 | gridLayout->addWidget(srcUrlLabel, ++gridRow, 0); | ||
289 | QLabel *destUrlLabel = createSqueezedLabel(parent, d->dest.toDisplayString(QUrl::PreferLocalFile)); | 292 | QLabel *destUrlLabel = createSqueezedLabel(parent, d->dest.toDisplayString(QUrl::PreferLocalFile)); | ||
290 | destUrlLabel->setTextFormat(Qt::PlainText); | 293 | destUrlLabel->setTextFormat(Qt::PlainText); | ||
291 | gridLayout->addWidget(destUrlLabel, gridRow, 1); | 294 | gridLayout->addWidget(destUrlLabel, gridRow, 2); | ||
292 | 295 | | |||
293 | // The labels containing previews or icons | 296 | | ||
297 | // The labels containing previews or icons, and an arrow icon indicating | ||||
298 | // direction from src to dest | ||||
299 | const QString arrowName = qApp->isRightToLeft() ? QStringLiteral("go-previous") | ||||
this is not right-to-left aware; please use the layout direction of the widget to use "go-next" or "go-previous" pino: this is not right-to-left aware; please use the layout direction of the widget to use "go-next"… | |||||
(go-next-rtl-symbolic, not go-previous; that would be semantically inaccurate.) ngraham: (`go-next-rtl-symbolic`, not `go-previous`; that would be semantically inaccurate.) | |||||
@pino, right; dolphin isn't rtl-aware (or if it is, I couldn't find out how to switch it to rtl). But I agree the code here should account for rtl anyway. @ngraham: I think we should stick to the icon naming spec[1], so that it works with themes other than breeze/oxygen; so it has to be go-previous. [1] https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html ahmadsamir: @pino, right; dolphin isn't rtl-aware (or if it is, I couldn't find out how to switch it to… | |||||
dolphin --reverse hpereiradacosta: dolphin --reverse
should run it in right-to-left mode
(or whatever the opposite of your… | |||||
hpereiradacosta: you can use qApp->isRightToLeft() to check the rtl direction
| |||||
$ dolphin --reverse it is provided directly by QApplication, it works also in Qt-only applications pino: > (or if it is, I couldn't find out how to switch it to rtl).
$ dolphin --reverse
it is… | |||||
The interface of Dolphin is RTL-aware, just the panels and the file view are not (for many usability reasons) safaalfulaij: The interface of Dolphin is RTL-aware, just the panels and the file view are not (for many… | |||||
300 | : QStringLiteral("go-next"); | ||||
If you figure out how to make it RTL aware, you could toggle between the go-next-symbolic and go-next-rtl-symbolic icons ngraham: If you figure out how to make it RTL aware, you could toggle between the `go-next-symbolic` and… | |||||
301 | const QPixmap pix = QIcon::fromTheme(arrowName).pixmap(d->m_srcPreview->height()); | ||||
302 | srcToDestArrow->setPixmap(pix); | ||||
294 | gridLayout->addWidget(d->m_srcArea, ++gridRow, 0); | 303 | gridLayout->addWidget(d->m_srcArea, ++gridRow, 0); | ||
295 | gridLayout->addWidget(d->m_destArea, gridRow, 1); | 304 | gridLayout->addWidget(srcToDestArrow, gridRow, 1); | ||
305 | gridLayout->addWidget(d->m_destArea, gridRow, 2); | ||||
296 | 306 | | |||
297 | QLabel *srcDateLabel = createDateLabel(parent, d->srcItem); | 307 | QLabel *srcDateLabel = createDateLabel(parent, d->srcItem); | ||
298 | gridLayout->addWidget(srcDateLabel, ++gridRow, 0); | 308 | gridLayout->addWidget(srcDateLabel, ++gridRow, 0); | ||
299 | QLabel *destDateLabel = createDateLabel(parent, d->destItem); | 309 | QLabel *destDateLabel = createDateLabel(parent, d->destItem); | ||
300 | gridLayout->addWidget(destDateLabel, gridRow, 1); | 310 | gridLayout->addWidget(destDateLabel, gridRow, 2); | ||
301 | 311 | | |||
302 | QLabel *srcSizeLabel = createSizeLabel(parent, d->srcItem); | 312 | QLabel *srcSizeLabel = createSizeLabel(parent, d->srcItem); | ||
303 | gridLayout->addWidget(srcSizeLabel, ++gridRow, 0); | 313 | gridLayout->addWidget(srcSizeLabel, ++gridRow, 0); | ||
304 | QLabel *destSizeLabel = createSizeLabel(parent, d->destItem); | 314 | QLabel *destSizeLabel = createSizeLabel(parent, d->destItem); | ||
305 | gridLayout->addWidget(destSizeLabel, gridRow, 1); | 315 | gridLayout->addWidget(destSizeLabel, gridRow, 2); | ||
306 | 316 | | |||
307 | } else { | 317 | } else { | ||
308 | // This is the case where we don't want to allow overwriting, the existing | 318 | // This is the case where we don't want to allow overwriting, the existing | ||
309 | // file must be preserved (e.g. when renaming). | 319 | // file must be preserved (e.g. when renaming). | ||
310 | QString sentence1; | 320 | QString sentence1; | ||
311 | 321 | | |||
312 | if (mtimeDest < mtimeSrc) { | 322 | if (mtimeDest < mtimeSrc) { | ||
313 | sentence1 = i18n("An older item named '%1' already exists.", d->dest.toDisplayString(QUrl::PreferLocalFile)); | 323 | sentence1 = i18n("An older item named '%1' already exists.", d->dest.toDisplayString(QUrl::PreferLocalFile)); | ||
▲ Show 20 Lines • Show All 361 Lines • Show Last 20 Lines |
You don't need a member variable for this.