View Issue Details

IDProjectCategoryView StatusLast Update
0007760ScribusPDFpublic2009-02-01 15:04
Reporterdclemente Assigned Tofschmid  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version1.3.3.13svn 
Fixed in Version1.3.3.13svn 
Summary0007760: [patch] Be able to select action of submit button: send form as HTML, XFDF, PDF, FDF
Description  This patch against 1.3.3.x adds a new option to form buttons in order to specify how the form should be sent when the submit button is clicked.
  At the moment only FDF (default) and HTML were possible. The patch adds HTML and XFDF and sets the corresponding flags in the output file.

  It uses the attribute ANHTML with values 0, 1, 2, 3. The checkbox was changed to a combobox to hold the extra values.

  This needs to be ported to 1.3.5. But I suggest improving bug 7609 first.
TagsNo tags attached.
Patch

Activities

2009-01-27 16:43

 

submit-type.patch (7,505 bytes)   
=== modified file 'scribus/annot.cpp'
--- scribus/annot.cpp	2008-11-18 17:30:33 +0000
+++ scribus/annot.cpp	2008-11-21 12:38:04 +0000
@@ -576,10 +576,19 @@
 	Frame3bLayout->addWidget( SubURL );
 	if (item->annotation().ActionType() == 3)
 		SubURL->setText(item->annotation().Action());
-	SubAsHtml = new QCheckBox( Frame3b, "UseCurr" );
-	SubAsHtml->setChecked(item->annotation().HTML());
-	SubAsHtml->setText( tr( "Submit Data as HTML" ) );
-	Frame3bLayout->addWidget( SubAsHtml );
+	SubText2 = new QLabel( Frame3b, "SubText2" );
+	SubText2->setText( tr( "Submit format:" ) );
+	Frame3bLayout->addWidget( SubText2 );
+	SelAsHtml = new QComboBox( true, Frame3b, "SelAsHtml" );
+	QString tmp_selhtml[]={tr("FDF"), tr("HTML"), tr("XFDF"), tr("PDF")};
+	//QString tmp_selhtml[]={"FDF", "HTML", "XFDF", "PDF"};
+	size_t array_selhtml = sizeof(tmp_selhtml) / sizeof(*tmp_selhtml);
+	/* PFJ - 28/02/04 - Altered from uint to int and var name */
+	for (uint propogate2 = 0; propogate2 < array_selhtml; ++propogate2)
+		SelAsHtml->insertItem(tmp_selhtml[propogate2]);
+	SelAsHtml->setEditable(false);
+	SelAsHtml->setCurrentItem(item->annotation().HTML());
+	Frame3bLayout->addWidget( SelAsHtml );
 	QSpacerItem* spacerSu = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
 	Frame3bLayout->addItem( spacerSu);
 	Fram2->addWidget( Frame3b , 4);
@@ -1906,7 +1915,7 @@
 		case 3:
 			item->annotation().setActionType(3);
 			item->annotation().setAction(SubURL->text().stripWhiteSpace());
-			item->annotation().setHTML(SubAsHtml->isChecked());
+			item->annotation().setHTML(SelAsHtml->currentItem());
 			break;
 		case 4:
 			item->annotation().setActionType(4);
@@ -2087,7 +2096,7 @@
 	case 3:
 		Fram2->raiseWidget(4);
 		SubURL->setText(item->annotation().Action());
-		SubAsHtml->setChecked(item->annotation().HTML());
+		SelAsHtml->setCurrentItem(item->annotation().HTML());
 		break;
 	case 2:
 		Fram2->raiseWidget(3);

=== modified file 'scribus/annot.h'
--- scribus/annot.h	2008-11-13 15:46:29 +0000
+++ scribus/annot.h	2008-11-21 11:49:58 +0000
@@ -185,7 +185,8 @@
     QFrame* Frame3b;
     QLabel* SubText1;
     QLineEdit* SubURL;
-    QCheckBox* SubAsHtml;
+    QLabel* SubText2;
+    QComboBox* SelAsHtml;
     QFrame* Frame3c;
     QLabel* SubText1a;
     QLineEdit* SubURLa;

=== modified file 'scribus/annotation.h'
--- scribus/annotation.h	2008-11-13 15:46:29 +0000
+++ scribus/annotation.h	2008-11-21 12:50:08 +0000
@@ -39,7 +39,7 @@
 						An_Fo_act(""), An_Bl_act(""), An_K_act(""), An_F_act(""), An_V_act(""), An_C_act(""),
 						AnToolTip(""), AnRollOver(""), AnDown(""), AnBColor(""), An_Extern(""), AnBsty(0),
 						AnBwid(1), AnFeed(1), AnZiel(0), AnFlag(0), AnMaxChar(-1), AnVis(0), AnChkStil(0),
-						AnFont(4), AnIsChk(false), AnAAact(false), AnHTML(false), AnUseIcons(false),
+						AnFont(4), AnIsChk(false), AnAAact(false), AnHTML(0), AnUseIcons(false),
 						AnIPlace(1), AnScaleW(0), AnFormat(0)
 		{
 		}
@@ -74,7 +74,7 @@
 		void setFormat(int newFormat) { AnFormat=newFormat; }
 		void setIsChk(bool newIsChk) { AnIsChk=newIsChk; }
 		void setAAact(bool newAAct) { AnAAact=newAAct; }
-		void setHTML(bool newHTML) { AnHTML=newHTML; }
+		void setHTML(int newHTML) { AnHTML=newHTML; }
 		void setUseIcons(bool newUseIcons) { AnUseIcons=newUseIcons; }
 		void setIPlace(int newIPlace) { AnIPlace=newIPlace; }
 		void setScaleW(int newScaleW) { AnScaleW=newScaleW; }
@@ -108,7 +108,7 @@
 		int Format() const { return AnFormat; }
 		bool IsChk() const { return AnIsChk; }
 		bool AAact() const { return AnAAact; }
-		bool HTML() const { return AnHTML; }
+		int HTML() const { return AnHTML; }
 		bool UseIcons() const { return AnUseIcons; }
 		int IPlace() const { return AnIPlace; }
 		int ScaleW() const { return AnScaleW; }
@@ -142,7 +142,7 @@
 		int AnFont;
 		bool AnIsChk;
 		bool AnAAact;
-		bool AnHTML;
+		int AnHTML;
 		bool AnUseIcons;
 		int AnIPlace;
 		int AnScaleW;

=== modified file 'scribus/fileloader.cpp'
--- scribus/fileloader.cpp	2008-11-13 15:46:29 +0000
+++ scribus/fileloader.cpp	2008-11-21 12:51:11 +0000
@@ -2317,7 +2317,7 @@
 	currItem->annotation().setVis(obj->attribute("ANVIS", "0").toInt());
 	currItem->annotation().setIsChk(static_cast<bool>(obj->attribute("ANCHK", "0").toInt()));
 	currItem->annotation().setAAact(static_cast<bool>(obj->attribute("ANAA", "0").toInt()));
-	currItem->annotation().setHTML(static_cast<bool>(obj->attribute("ANHTML", "0").toInt()));
+	currItem->annotation().setHTML(obj->attribute("ANHTML", "0").toInt());
 	currItem->annotation().setUseIcons(static_cast<bool>(obj->attribute("ANICON", "0").toInt()));
 	currItem->annotation().setChkStil(obj->attribute("ANCHKS", "0").toInt());
 	currItem->annotation().setMaxChar(obj->attribute("ANMC", "-1").toInt());

=== modified file 'scribus/pdflib.cpp'
--- scribus/pdflib.cpp	2008-11-19 10:11:20 +0000
+++ scribus/pdflib.cpp	2008-11-21 10:29:32 +0000
@@ -4878,8 +4878,27 @@
 				if (ite->annotation().ActionType() == 3)
 				{
 					PutDoc("/A << /Type /Action /S /SubmitForm\n/F << /FS /URL /F "+ EncString("("+ite->annotation().Action()+")",ObjCounter-1)+" >>\n");
-					if (ite->annotation().HTML())
-						PutDoc("/Flags 4");
+
+					switch (ite->annotation().HTML()) {
+
+					case 1:
+					  // HTML
+					  PutDoc("/Flags 4"); // bit 3 on
+					  break;
+					case 2:
+					  // XFDF
+					  PutDoc("/Flags 64"); // bit 6 on
+					  break;
+					case 3:
+					  // PDF
+					  PutDoc("/Flags 512"); // bit 9 on
+					  break;
+					case 0:
+					default:
+					  // FDF
+					  // bit 3 off
+					  break;
+					}
 					PutDoc(">>\n");
 				}
 				if (ite->annotation().ActionType() == 1)

=== modified file 'scribus/util.cpp'
--- scribus/util.cpp	2008-11-13 15:46:29 +0000
+++ scribus/util.cpp	2008-11-21 12:51:36 +0000
@@ -962,7 +962,7 @@
 	OB->m_annotation.setVis(obj->attribute("ANVIS", "0").toInt());
 	OB->m_annotation.setIsChk(static_cast<bool>(obj->attribute("ANCHK", "0").toInt()));
 	OB->m_annotation.setAAact(static_cast<bool>(obj->attribute("ANAA", "0").toInt()));
-	OB->m_annotation.setHTML(static_cast<bool>(obj->attribute("ANHTML", "0").toInt()));
+	OB->m_annotation.setHTML(obj->attribute("ANHTML", "0").toInt());
 	OB->m_annotation.setUseIcons(static_cast<bool>(obj->attribute("ANICON", "0").toInt()));
 	OB->m_annotation.setChkStil(obj->attribute("ANCHKS", "0").toInt());
 	OB->m_annotation.setMaxChar(obj->attribute("ANMC", "-1").toInt());

=== modified file 'scribus/po/scribus.ca.ts'
--- scribus/po/scribus.ca.ts	2008-11-17 15:02:34 +0000
+++ scribus/po/scribus.ca.ts	2009-01-07 11:28:57 +0000
@@ -5142,8 +5142,8 @@
         <translation>Enviar a URL:</translation>
     </message>
     <message>
-        <source>Submit Data as HTML</source>
-        <translation>Enviar Dades com HTML</translation>
+        <source>Submit format</source>
+        <translation>Format d'enviament</translation>
     </message>
     <message>
         <source>Import Data from:</source>

=== modified file 'scribus/po/scribus.es_ES.ts'
--- scribus/po/scribus.es_ES.ts	2008-11-17 15:02:34 +0000
+++ scribus/po/scribus.es_ES.ts	2009-01-07 11:28:36 +0000
@@ -4272,8 +4272,8 @@
         <translation>Enviar a URL:</translation>
     </message>
     <message>
-        <source>Submit Data as HTML</source>
-        <translation>Enviar datos como HTML</translation>
+        <source>Submit format</source>
+        <translation>Formato de envĂ­o</translation>
     </message>
     <message>
         <source>Import Data from:</source>


submit-type.patch (7,505 bytes)   

fschmid

2009-01-29 21:26

developer   ~0021044

Have ported your Patch to 1.3.5svn now.

Issue History

Date Modified Username Field Change
2009-01-27 16:43 dclemente New Issue
2009-01-27 16:43 dclemente File Added: submit-type.patch
2009-01-29 21:26 fschmid Note Added: 0021044
2009-01-31 12:07 fschmid Status new => resolved
2009-01-31 12:07 fschmid Fixed in Version => 1.3.3.13svn
2009-01-31 12:07 fschmid Resolution open => fixed
2009-01-31 12:07 fschmid Assigned To => fschmid
2009-02-01 15:04 cbradney Status resolved => closed