~osomon/oxide/typeinfo-qt55

« back to all changes in this revision

Viewing changes to qt/quick/api/oxideqquickwebview.cc

  • Committer: Olivier Tilloy
  • Date: 2016-01-12 11:46:34 UTC
  • mfrom: (1272.2.38 touch-selection-api)
  • Revision ID: olivier.tilloy@canonical.com-20160112114634-u1t78baa0u4hfoha
Add a touch selection API, to allow embedders to display handles for resizing the current selection, and contextual actions for it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// vim:expandtab:shiftwidth=2:tabstop=2:
2
 
// Copyright (C) 2013-2015 Canonical Ltd.
 
2
// Copyright (C) 2013-2016 Canonical Ltd.
3
3
 
4
4
// This library is free software; you can redistribute it and/or
5
5
// modify it under the terms of the GNU Lesser General Public
57
57
#include "qt/quick/oxide_qquick_init.h"
58
58
#include "qt/quick/oxide_qquick_prompt_dialog.h"
59
59
#include "qt/quick/oxide_qquick_software_frame_node.h"
 
60
#include "qt/quick/oxide_qquick_touch_handle_drawable.h"
60
61
#include "qt/quick/oxide_qquick_web_context_menu.h"
61
62
#include "qt/quick/oxide_qquick_web_popup_menu.h"
62
63
 
63
64
#include "oxideqquicklocationbarcontroller_p.h"
64
65
#include "oxideqquickscriptmessagehandler_p.h"
65
66
#include "oxideqquickscriptmessagehandler_p_p.h"
 
67
#include "oxideqquicktouchselectioncontroller_p.h"
66
68
#include "oxideqquickwebcontext_p.h"
67
69
#include "oxideqquickwebcontext_p_p.h"
68
70
#include "oxideqquickwebframe_p.h"
214
216
  return new oxide::qquick::FilePicker(q, client);
215
217
}
216
218
 
 
219
oxide::qt::TouchHandleDrawableProxy*
 
220
OxideQQuickWebViewPrivate::CreateTouchHandleDrawable() {
 
221
  Q_Q(OxideQQuickWebView);
 
222
 
 
223
  return new oxide::qquick::TouchHandleDrawable(q);
 
224
}
 
225
 
217
226
void OxideQQuickWebViewPrivate::WebProcessStatusChanged() {
218
227
  Q_Q(OxideQQuickWebView);
219
228
 
284
293
  navigation_history_.onNavigationEntryChanged(index);
285
294
}
286
295
 
 
296
void OxideQQuickWebViewPrivate::TouchSelectionChanged(bool active,
 
297
                                                      QRectF bounds) {
 
298
  Q_Q(OxideQQuickWebView);
 
299
 
 
300
  q->touchSelectionController()->onTouchSelectionChanged(active, bounds);
 
301
}
 
302
 
287
303
void OxideQQuickWebViewPrivate::CreateWebFrame(
288
304
    oxide::qt::WebFrameProxy* proxy) {
289
305
  Q_Q(OxideQQuickWebView);
642
658
  emit q->hoveredUrlChanged();
643
659
}
644
660
 
 
661
void OxideQQuickWebViewPrivate::OnEditingCapabilitiesChanged() {
 
662
  Q_Q(OxideQQuickWebView);
 
663
 
 
664
  emit q->editingCapabilitiesChanged();
 
665
}
 
666
 
645
667
void OxideQQuickWebViewPrivate::completeConstruction() {
646
668
  Q_Q(OxideQQuickWebView);
647
669
 
2084
2106
  return d->proxy()->targetUrl();
2085
2107
}
2086
2108
 
 
2109
OxideQQuickWebView::EditCapabilities OxideQQuickWebView::editingCapabilities() const {
 
2110
  Q_D(const OxideQQuickWebView);
 
2111
 
 
2112
  if (!d->proxy()) {
 
2113
    return NoCapability;
 
2114
  }
 
2115
 
 
2116
  oxide::qt::EditCapabilityFlags flags = d->proxy()->editFlags();
 
2117
  return static_cast<EditCapabilities>(flags);
 
2118
}
 
2119
 
2087
2120
// static
2088
2121
OxideQQuickWebViewAttached* OxideQQuickWebView::qmlAttachedProperties(
2089
2122
    QObject* object) {
2214
2247
  return d->find_controller_.data();
2215
2248
}
2216
2249
 
 
2250
OxideQQuickTouchSelectionController* OxideQQuickWebView::touchSelectionController() {
 
2251
  Q_D(OxideQQuickWebView);
 
2252
 
 
2253
  if (!d->touch_selection_controller_) {
 
2254
    d->touch_selection_controller_.reset(
 
2255
        new OxideQQuickTouchSelectionController(this));
 
2256
  }
 
2257
 
 
2258
  return d->touch_selection_controller_.data();
 
2259
}
 
2260
 
2217
2261
#include "moc_oxideqquickwebview_p.cpp"