200
200
d->imgList->setControlButtonsPlacement(KPImagesList::ControlButtonsBelow);
201
201
d->imgList->setAllowRAW(true);
202
202
d->imgList->loadImagesFromCurrentSelection();
203
d->imgList->listView()->setWhatsThis(i18n("This is the list of images to upload to your Wikimedia account."));
203
d->imgList->listView()->setWhatsThis(i18n("This is the list of images to upload to the wiki."));
205
205
// --------------------- Upload tab ----------------------------------
230
230
QVBoxLayout* uploadBoxLayout = new QVBoxLayout(uploadPanel);
232
232
d->fileBox = new QWidget(uploadBox);
233
d->fileBox->setWhatsThis(i18n("This is the login form to your Wikimedia account."));
233
d->fileBox->setWhatsThis(i18n("This is the login form to your account on the chosen wiki."));
234
234
QGridLayout* fileBoxLayout = new QGridLayout(d->fileBox);
236
236
loadImageInfoFirstLoad();
241
241
d->descEdit = new KTextEdit(d->fileBox);
242
242
d->descEdit->setPlainText(d->defaultMessage);
243
243
d->descEdit->setTabChangesFocus(1);
244
d->descEdit->setAcceptRichText(false);
244
245
d->categoryEdit = new KTextEdit(d->fileBox);
245
246
d->categoryEdit->setPlainText(d->defaultMessage);
246
247
d->categoryEdit->setTabChangesFocus(1);
248
d->categoryEdit->setAcceptRichText(false);
248
250
d->latitudeEdit = new KLineEdit(d->defaultMessage, d->fileBox);
249
251
d->longitudeEdit = new KLineEdit(d->defaultMessage, d->fileBox);
296
298
QGridLayout* loginBoxLayout = new QGridLayout(d->loginBox);
298
300
d->wikiSelect = new QComboBox(d->loginBox);
299
KPushButton* newWikiBtn = new KPushButton(KGuiItem(i18n("New"), "list-add", i18n("Create new wiki")), d->loginBox);
301
KPushButton* newWikiBtn = new KPushButton(KGuiItem(i18n("New"), "list-add", i18n("Add a wiki to this list")), d->loginBox);
300
302
d->nameEdit = new KLineEdit(d->loginBox);
301
303
d->passwdEdit = new KLineEdit(d->loginBox);
302
304
d->passwdEdit->setEchoMode(KLineEdit::Password);
304
d->wikiSelect->addItem(i18n("kamelopedia"), QString("http://kamelopedia.mormo.org/api.php"));
305
d->wikiSelect->addItem(i18n("MediaWiki"), QString("http://www.mediawiki.org/w/api.php"));
306
d->wikiSelect->addItem(i18n("Wikia:foto"), QString("http://foto.wikia.com/api.php"));
307
d->wikiSelect->addItem(i18n("Wikia:uncyclopedia"), QString("http://uncyclopedia.wikia.com/api.php"));
308
d->wikiSelect->addItem(i18n("Wikimedia:commons"), QString("http://commons.wikimedia.org/w/api.php"));
309
d->wikiSelect->addItem(i18n("Wikimedia:meta"), QString("http://meta.wikimedia.org/w/api.php"));
306
d->wikiSelect->addItem(i18n("Wikimedia Commons"), QString("http://commons.wikimedia.org/w/api.php"));
307
d->wikiSelect->addItem(i18n("Wikimedia Meta"), QString("http://meta.wikimedia.org/w/api.php"));
308
d->wikiSelect->addItem(i18n("Wikipedia"), QString("http://en.wikipedia.org/w/api.php"));
310
309
d->wikiSelect->addItem(i18n("Wikibooks"), QString("http://en.wikibooks.org/w/api.php"));
311
310
d->wikiSelect->addItem(i18n("Wikinews"), QString("http://en.wikinews.org/w/api.php"));
312
d->wikiSelect->addItem(i18n("Wikipedia"), QString("http://en.wikipedia.org/w/api.php"));
313
311
d->wikiSelect->addItem(i18n("Wikiquote"), QString("http://en.wikiquote.org/w/api.php"));
314
312
d->wikiSelect->addItem(i18n("Wikisource"), QString("http://en.wikinews.org/w/api.php"));
315
313
d->wikiSelect->addItem(i18n("Wiktionary"), QString("http://en.wiktionary.org/w/api.php"));
314
d->wikiSelect->addItem(i18n("MediaWiki"), QString("http://www.mediawiki.org/w/api.php"));
315
d->wikiSelect->addItem(i18n("Wikia Foto"), QString("http://foto.wikia.com/api.php"));
316
d->wikiSelect->addItem(i18n("Wikia Uncyclopedia"), QString("http://uncyclopedia.wikia.com/api.php"));
317
318
d->wikiSelect->setEditable(false);
376
377
loginBoxLayout->setObjectName("d->loginBoxLayout");
378
379
d->accountBox = new KHBox(d->userBox);
379
d->accountBox->setWhatsThis(i18n("This is the Wikimedia account that is currently logged in."));
380
d->accountBox->setWhatsThis(i18n("This is the account that is currently logged in."));
381
382
QLabel* userNameLbl = new QLabel(d->accountBox);
382
userNameLbl->setText(i18nc("Wikimedia account settings", "Logged as: "));
383
userNameLbl->setText(i18nc("Username which is used to connect to the wiki", "Logged as: "));
383
384
d->userNameDisplayLbl = new QLabel(d->accountBox);
384
385
QLabel* space = new QLabel(d->accountBox);
385
386
d->changeUserBtn = new KPushButton(KGuiItem(i18n("Change Account"), "system-switch-user",
386
i18n("Logout and change Wikimedia Account used for transfer")),
387
i18n("Logout and change the account used for transfer")),
388
389
d->accountBox->setStretchFactor(space, 10);
389
390
d->accountBox->hide();
394
395
// --------------------- Login area ----------------------------------
396
397
d->textBox = new QWidget(panel2);
397
d->textBox->setWhatsThis(i18n("This is the login form to your Wikimedia account."));
398
d->textBox->setWhatsThis(i18n("This is the login form to your account on the chosen wiki."));
398
399
QGridLayout* textBoxLayout = new QGridLayout(d->textBox);
400
401
QLabel* authorLbl = new QLabel(i18n("Author:"), d->textBox);
432
433
QLabel* genCatLbl = new QLabel(i18n("Generic categories:"), d->textBox);
433
434
d->genCatEdit = new KTextEdit(d->textBox);
434
435
d->genCatEdit->setTabChangesFocus(1);
436
d->genCatEdit->setWhatsThis(i18n("This is a place to enter categories that will be added to all the files."));
437
d->genCatEdit->setAcceptRichText(false);
436
439
QLabel* genTxtLbl = new QLabel(i18n("Generic text:"), d->textBox);
437
440
d->genTxtEdit = new KTextEdit(d->textBox);
438
441
d->genTxtEdit->setTabChangesFocus(1);
442
d->genTxtEdit->setWhatsThis(i18n("This is a place to enter text that will be added to all the files, below the Information template."));
443
d->genTxtEdit->setAcceptRichText(false);
440
445
textBoxLayout->addWidget(authorLbl, 1, 0, 1, 1);
441
446
textBoxLayout->addWidget(sourceLbl, 2, 0, 1, 1);
539
544
this, SLOT(slotAddWikiClicked()));
541
546
connect(d->titleEdit, SIGNAL(editingFinished()),
547
this, SLOT(slotRestoreExtension()));
549
connect(d->titleEdit, SIGNAL(textEdited(const QString&)),
542
550
this, SLOT(slotApplyTitle()));
544
connect(d->dateEdit, SIGNAL(editingFinished()),
552
connect(d->dateEdit, SIGNAL(textEdited(const QString&)),
545
553
this, SLOT(slotApplyDate()));
547
555
// Problem: textChanged() is also called when the text is changed by setText()
548
// editingFinished() would be better, but KTextEdit does not have this.
556
// textEdited() would be better, but KTextEdit does not have this.
549
557
// Solution for the moment: we do not setText() when the selection changes
550
558
connect(d->categoryEdit, SIGNAL(textChanged()),
551
559
this, SLOT(slotApplyCategories()));
553
561
// Problem: textChanged() is also called when the text is changed by setText()
554
// editingFinished() would be better, but KTextEdit does not have this.
562
// textEdited() would be better, but KTextEdit does not have this.
555
563
// Solution for the moment: we do not setText() when the selection changes
556
564
connect(d->descEdit, SIGNAL(textChanged()),
557
565
this, SLOT(slotApplyDescription()));
559
connect(d->latitudeEdit, SIGNAL(editingFinished()),
567
connect(d->latitudeEdit, SIGNAL(textEdited(const QString&)),
560
568
this, SLOT(slotApplyLatitude()));
562
connect(d->longitudeEdit, SIGNAL(editingFinished()),
570
connect(d->longitudeEdit, SIGNAL(textEdited(const QString&)),
563
571
this, SLOT(slotApplyLongitude()));
565
573
connect(d->imgList, SIGNAL(signalItemClicked(QTreeWidgetItem*)),
818
void WmWidget::slotRestoreExtension()
820
kDebug() << "RestoreExtension";
823
QString originalExtension;
824
QString currentExtension;
826
QMap<QString, QString> imageMetaData;
827
QList<QTreeWidgetItem*> selectedItems = d->imgList->listView()->selectedItems();
829
// Build the list of items to rename
830
for (int i = 0; i < selectedItems.size(); ++i)
832
KPImagesListViewItem* l_item = dynamic_cast<KPImagesListViewItem*>(selectedItems.at(i));
833
urls.append(l_item->url());
836
for (int i = 0; i < urls.size(); ++i)
838
imageMetaData = d->imagesDescInfo[urls.at(i).path()];
839
imageTitle = imageMetaData["title"];
841
// Add original extension if removed
842
currentExtension = imageTitle.split('.').last();
843
originalExtension = urls.at(i).path().split('.').last();
844
if(QString::compare(currentExtension, originalExtension, Qt::CaseInsensitive) != 0)
846
imageTitle.append(".").append(originalExtension);
847
d->titleEdit->setText(imageTitle);
850
kDebug() << urls.at(i).path() << "renamed to" << imageTitle;
851
imageMetaData["title"] = imageTitle;
852
d->imagesDescInfo[urls.at(i).path()] = imageMetaData;
810
856
void WmWidget::slotApplyTitle()
812
858
kDebug() << "ApplyTitle";
814
860
QString givenTitle = title();
815
861
QString imageTitle;
817
QString originalExtension;
818
QString currentExtension;
820
864
QMap<QString, QString> imageMetaData;
821
865
QList<QTreeWidgetItem*> selectedItems = d->imgList->listView()->selectedItems();
848
892
imageTitle.replace(imageTitle.indexOf("#"), 1, number);
851
// Add original extension if removed
852
currentExtension = imageTitle.split('.').last();
853
originalExtension = urls.at(i).path().split('.').last();
854
if(QString::compare(currentExtension, originalExtension, Qt::CaseInsensitive) != 0)
856
imageTitle.append(".").append(originalExtension);
857
d->titleEdit->setText(imageTitle);
860
895
kDebug() << urls.at(i).path() << "renamed to" << imageTitle;
861
896
imageMetaData["title"] = imageTitle;
862
897
d->imagesDescInfo[urls.at(i).path()] = imageMetaData;