summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorportix <none@none>2012-07-24 00:00:41 +0200
committerportix <none@none>2012-07-24 00:00:41 +0200
commit93fb3652107ad443d5edb79f591d9b29f8980ed5 (patch)
treebeff6a8c37276efc90d83c75a95a319a23bb1564
parent0983e0ae429cdef8f2e756df9211dcd0f1c0d0c7 (diff)
downloaddwb-93fb3652107ad443d5edb79f591d9b29f8980ed5.zip
Check if a site has forms before prompting for a password
-rw-r--r--extensions/formfiller14
-rw-r--r--src/callback.c6
-rw-r--r--src/dwb.c28
-rw-r--r--src/dwb.h2
4 files changed, 49 insertions, 1 deletions
diff --git a/extensions/formfiller b/extensions/formfiller
index 3913bf8c..b6b8fb0e 100644
--- a/extensions/formfiller
+++ b/extensions/formfiller
@@ -330,6 +330,14 @@ function getForm() {//{{{
if (!formFound)
io.error("No storable form found");
}//}}}
+function getHasForms(frames) {//{{{
+ var i;
+ for (i=0; i<frames.length; i++) {
+ if (frames[i].inject("return document.forms.length > 0;") == "true")
+ return true;
+ }
+ return false;
+}//}}}
function fillForm() {//{{{
var data, frames, host, i, ret = false;
@@ -337,11 +345,15 @@ function fillForm() {//{{{
io.error("No formdata found");
return;
}
+ frames = tabs.current.allFrames;
+ if (!getHasForms(frames)) {
+ io.error("No form found");
+ return;
+ }
data = getFormData();
if (data === null)
return;
- frames = tabs.current.allFrames;
for (i=0; i<frames.length; i++) {
host = frames[i].host;
if (data[host]) {
diff --git a/src/callback.c b/src/callback.c
index dfa5c54c..5388375f 100644
--- a/src/callback.c
+++ b/src/callback.c
@@ -167,6 +167,12 @@ callback_key_press(GtkWidget *w, GdkEventKey *e) {
dwb_change_mode(NORMAL_MODE, true);
ret = false;
}
+#if 0
+ else if(e->state == GDK_SHIFT_MASK && e->keyval == GDK_KEY_Insert) {
+ dwb_paste_primary();
+ return true;
+ }
+#endif
else if (dwb_eval_override_key(e, CP_OVERRIDE_ALL))
ret = true;
else if (mode & INSERT_MODE) {
diff --git a/src/dwb.c b/src/dwb.c
index 9075140e..6f91b7ac 100644
--- a/src/dwb.c
+++ b/src/dwb.c
@@ -698,6 +698,34 @@ dwb_set_clipboard(const char *text, GdkAtom atom) {
return ret;
}/*}}}*/
+#if 0
+void
+dwb_paste_primary() {
+ char *c_text = NULL;
+ GtkClipboard *p_clip = gtk_widget_get_clipboard(CURRENT_WEBVIEW_WIDGET(), GDK_SELECTION_PRIMARY);
+ if (p_clip == NULL)
+ return;
+ char *p_text = gtk_clipboard_wait_for_text(p_clip);
+ if (p_text == NULL)
+ return;
+ GtkClipboard *c_clip = gtk_widget_get_clipboard(CURRENT_WEBVIEW_WIDGET(), GDK_NONE);
+ if (c_clip == NULL)
+ return;
+ c_text = gtk_clipboard_wait_for_text(c_clip);
+ gtk_clipboard_set_text(c_clip, p_text, -1);
+ webkit_web_view_paste_clipboard(CURRENT_WEBVIEW());
+ if (c_clip != NULL) {
+ if (c_text != NULL)
+ gtk_clipboard_set_text(c_clip, c_text, -1);
+ else {
+ // clear clipboard
+ }
+ }
+ g_free(p_text);
+ g_free(c_text);
+}
+#endif
+
/* dwb_scroll (Glist *gl, double step, ScrollDirection dir) {{{*/
void
dwb_scroll(GList *gl, double step, ScrollDirection dir) {
diff --git a/src/dwb.h b/src/dwb.h
index da439ba1..c424a4df 100644
--- a/src/dwb.h
+++ b/src/dwb.h
@@ -904,6 +904,8 @@ void dwb_set_open_mode(Open);
DwbStatus dwb_set_clipboard(const char *text, GdkAtom atom);
char * dwb_clipboard_get_text(GdkAtom atom);
+void dwb_paste_primary(void);
+
DwbStatus dwb_open_in_editor(void);
gboolean dwb_confirm(GList *gl, char *prompt, ...);