bool reset(const Value &value) { bool result = false; QString text; typeFlag = determineTypeFlag(value, typeFlag, typeFlags); updateGUI(typeFlag); if (!value.isEmpty()) { if (typeFlag == KBibTeX::tfSource) { /// simple case: field's value is to be shown as BibTeX code, including surrounding curly braces FileExporterBibTeX exporter; text = exporter.valueToBibTeX(value); result = true; } else { /// except for the source view type flag, type flag views do not support composed values, /// therefore only the first value will be shown const QSharedPointer<ValueItem> first = value.first(); const QSharedPointer<PlainText> plainText = first.dynamicCast<PlainText>(); if (typeFlag == KBibTeX::tfPlainText && !plainText.isNull()) { text = plainText->text(); result = true; } else { const QSharedPointer<Person> person = first.dynamicCast<Person>(); if (typeFlag == KBibTeX::tfPerson && !person.isNull()) { text = Person::transcribePersonName(person.data(), personNameFormatting); result = true; } else { const QSharedPointer<MacroKey> macroKey = first.dynamicCast<MacroKey>(); if (typeFlag == KBibTeX::tfReference && !macroKey.isNull()) { text = macroKey->text(); result = true; } else { const QSharedPointer<Keyword> keyword = first.dynamicCast<Keyword>(); if (typeFlag == KBibTeX::tfKeyword && !keyword.isNull()) { text = keyword->text(); result = true; } else { const QSharedPointer<VerbatimText> verbatimText = first.dynamicCast<VerbatimText>(); if (typeFlag == KBibTeX::tfVerbatim && !verbatimText.isNull()) { text = verbatimText->text(); result = true; } else qCWarning(LOG_KBIBTEX_GUI) << "Could not reset: " << typeFlag << "(" << (typeFlag == KBibTeX::tfSource ? "Source" : (typeFlag == KBibTeX::tfReference ? "Reference" : (typeFlag == KBibTeX::tfPerson ? "Person" : (typeFlag == KBibTeX::tfPlainText ? "PlainText" : (typeFlag == KBibTeX::tfKeyword ? "Keyword" : (typeFlag == KBibTeX::tfVerbatim ? "Verbatim" : "???")))))) << ") " << (typeFlags.testFlag(KBibTeX::tfPerson) ? "Person" : "") << (typeFlags.testFlag(KBibTeX::tfPlainText) ? "PlainText" : "") << (typeFlags.testFlag(KBibTeX::tfReference) ? "Reference" : "") << (typeFlags.testFlag(KBibTeX::tfVerbatim) ? "Verbatim" : "") << " " << typeid((void)*first).name() << " : " << PlainTextValue::text(value); } } } } } } updateURL(text); parent->setText(text); return result; }
void DolphinView::triggerIconsViewItem(QIconViewItem* item) { const ButtonState keyboardState = KApplication::keyboardMouseState(); const bool isSelectionActive = ((keyboardState & ShiftButton) > 0) || ((keyboardState & ControlButton) > 0); if ((item != 0) && !isSelectionActive) { // Updating the URL must be done outside the scope of this slot, // as iconview items will get deleted. QTimer::singleShot(0, this, SLOT(updateURL())); Dolphin::mainWin().setActiveView(this); } }
void DolphinView::triggerDetailsViewItem(QListViewItem* item, const QPoint& pos, int /* column */) { if (item == 0) { return; } if (m_detailsView->isOnFilename(item, pos)) { // Updating the URL must be done outside the scope of this slot, // as listview items will get deleted. QTimer::singleShot(0, this, SLOT(updateURL())); Dolphin::mainWin().setActiveView(this); } else { m_detailsView->clearSelection(); } }
void WebView::showWebView(const std::string &url, float x, float y, float width, float height) { cocos2d::JniMethodInfo methodInfo; if(cocos2d::JniHelper::getStaticMethodInfo(methodInfo,CLASS_NAME,"displayWebView", "(IIII)V")) { jint jX = (int)x; jint jY = (int)y; jint jWidth = (int)width; jint jHeight = (int)height; methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, jX, jY, jWidth, jHeight); methodInfo.env->DeleteLocalRef(methodInfo.classID); } else { LOGD("jni:displayWebView not found"); } updateURL(url); }
void textChanged(const QString &text) { updateURL(text); }