Changed default from FTP to MetaWeblog.

Changed post action to publish.
This commit is contained in:
Erik C. Thauvin 2004-07-25 06:59:26 +00:00
parent 45cf46a227
commit 1a8a73a643
4 changed files with 144 additions and 109 deletions

View file

@ -71,7 +71,7 @@
<option name="PUT_FOCUS_INTO_COMMENT" value="true" /> <option name="PUT_FOCUS_INTO_COMMENT" value="true" />
<option name="SHOW_CHECKIN_OPTIONS" value="true" /> <option name="SHOW_CHECKIN_OPTIONS" value="true" />
<option name="FORCE_NON_EMPTY_COMMENT" value="false" /> <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
<option name="LAST_COMMIT_MESSAGE" value="Worked around Radio's lame XML encoding support." /> <option name="LAST_COMMIT_MESSAGE" value="Left a System.out.println(), oops." />
<option name="SAVE_LAST_COMMIT_MESSAGE" value="true" /> <option name="SAVE_LAST_COMMIT_MESSAGE" value="true" />
<option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8" /> <option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" /> <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
@ -112,10 +112,10 @@
<option name="HIDE_WARNINGS" value="false" /> <option name="HIDE_WARNINGS" value="false" />
</component> </component>
<component name="FileEditorManager" split-orientation="vertical" split-proportion="0.5"> <component name="FileEditorManager" split-orientation="vertical" split-proportion="0.5">
<first-group selected-file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifePost.java"> <first-group selected-file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlogger.java">
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/post.xml" pinned="false"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/post.xml" pinned="false">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="7" column="75" selection-start="534" selection-end="534" vertical-scroll-proportion="0.21834862"> <state line="13" column="78" selection-start="927" selection-end="927" vertical-scroll-proportion="0.40550458">
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -131,7 +131,7 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeAction.java" pinned="false"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeAction.java" pinned="false">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="50" column="11" selection-start="840" selection-end="840" vertical-scroll-proportion="1.0623853"> <state line="50" column="11" selection-start="840" selection-end="840" vertical-scroll-proportion="1.0220183">
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
@ -149,14 +149,14 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifePost.java" pinned="false"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifePost.java" pinned="false">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="119" column="14" selection-start="4738" selection-end="4738" vertical-scroll-proportion="0.5614679"> <state line="117" column="21" selection-start="4735" selection-end="4735" vertical-scroll-proportion="0.08256881">
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeRPCResponse.java" pinned="false"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeRPCResponse.java" pinned="false">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="50" column="13" selection-start="1963" selection-end="1963" vertical-scroll-proportion="-2.3651376"> <state line="50" column="13" selection-start="1963" selection-end="1963" vertical-scroll-proportion="0.03119266">
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
@ -165,21 +165,21 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeFTP.java" pinned="false"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeFTP.java" pinned="false">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="132" column="71" selection-start="3917" selection-end="3917" vertical-scroll-proportion="1.0201834"> <state line="132" column="71" selection-start="3917" selection-end="3917" vertical-scroll-proportion="0.9798165">
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/main.xml" pinned="false"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/main.xml" pinned="false">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="8" column="60" selection-start="410" selection-end="410" vertical-scroll-proportion="0.24954128"> <state line="18" column="36" selection-start="882" selection-end="882" vertical-scroll-proportion="0.5614679">
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlogger.java" pinned="false"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlogger.java" pinned="false">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="544" column="28" selection-start="13717" selection-end="13717" vertical-scroll-proportion="-6.187156"> <state line="669" column="11" selection-start="16595" selection-end="16595" vertical-scroll-proportion="0.055045873">
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
@ -188,7 +188,7 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/ReleaseInfo.java" pinned="false"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/ReleaseInfo.java" pinned="false">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="15" column="23" selection-start="413" selection-end="413" vertical-scroll-proportion="0.29174313"> <state line="15" column="23" selection-start="413" selection-end="413" vertical-scroll-proportion="0.30535713">
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -209,14 +209,14 @@
<component name="J2EEProjectPane" /> <component name="J2EEProjectPane" />
<component name="NamedScopeManager" /> <component name="NamedScopeManager" />
<component name="PackagesPane"> <component name="PackagesPane">
<expanded_node url="net.thauvin.lifeblogger" module="LifeBlogger" type="package" />
<expanded_node url="net" module="LifeBlogger" type="package" /> <expanded_node url="net" module="LifeBlogger" type="package" />
<expanded_node url="net.thauvin" module="LifeBlogger" type="package" /> <expanded_node url="net.thauvin" module="LifeBlogger" type="package" />
<expanded_node url="" module="LifeBlogger" type="module" /> <expanded_node url="" module="LifeBlogger" type="module" />
<expanded_node url="net.thauvin.lifeblogger" module="LifeBlogger" type="package" />
</component> </component>
<component name="ProjectPane"> <component name="ProjectPane">
<expanded_node url="file://$PROJECT_DIR$" module="LifeBlogger" type="directory" />
<expanded_node url="" module="LifeBlogger" type="module" /> <expanded_node url="" module="LifeBlogger" type="module" />
<expanded_node url="file://$PROJECT_DIR$" module="LifeBlogger" type="directory" />
</component> </component>
<component name="ProjectView"> <component name="ProjectView">
<navigator currentView="ProjectPane" splitterProportion="0.5"> <navigator currentView="ProjectPane" splitterProportion="0.5">
@ -243,20 +243,6 @@
</component> </component>
<component name="RunManager"> <component name="RunManager">
<activeType name="Application" /> <activeType name="Application" />
<configuration selected="false" default="true" type="JUnit" factoryName="JUnit">
<module name="" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ADDITIONAL_CLASS_PATH" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="wholeProject" />
</option>
</configuration>
<configuration selected="false" default="true" type="WebLogic Instance" factoryName="Local"> <configuration selected="false" default="true" type="WebLogic Instance" factoryName="Local">
<option name="WORKING_DIRECTORY" /> <option name="WORKING_DIRECTORY" />
<option name="HOST" value="localhost" /> <option name="HOST" value="localhost" />
@ -271,12 +257,19 @@
<option name="SERVER_NAME" value="myserver" /> <option name="SERVER_NAME" value="myserver" />
<option name="DOMAIN_NAME" value="mydomain" /> <option name="DOMAIN_NAME" value="mydomain" />
</configuration> </configuration>
<configuration selected="false" default="true" type="Application" factoryName="Application"> <configuration selected="false" default="true" type="JUnit" factoryName="JUnit">
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<module name="" /> <module name="" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ADDITIONAL_CLASS_PATH" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="wholeProject" />
</option>
</configuration> </configuration>
<configuration selected="false" default="true" type="Remote" factoryName="Remote"> <configuration selected="false" default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" /> <option name="USE_SOCKET_TRANSPORT" value="true" />
@ -285,6 +278,13 @@
<option name="HOST" value="localhost" /> <option name="HOST" value="localhost" />
<option name="PORT" value="5005" /> <option name="PORT" value="5005" />
</configuration> </configuration>
<configuration selected="false" default="true" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<module name="" />
</configuration>
<configuration selected="false" default="true" type="Applet" factoryName="Applet"> <configuration selected="false" default="true" type="Applet" factoryName="Applet">
<module name="" /> <module name="" />
<option name="MAIN_CLASS_NAME" /> <option name="MAIN_CLASS_NAME" />
@ -301,14 +301,14 @@
<option name="PROGRAM_PARAMETERS" value="" /> <option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<module name="LifeBlogger" /> <module name="LifeBlogger" />
<RunnerSettings RunnerId="Run" />
<RunnerSettings RunnerId="Debug"> <RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="1127" /> <option name="DEBUG_PORT" value="1127" />
<option name="TRANSPORT" value="0" /> <option name="TRANSPORT" value="0" />
<option name="LOCAL" value="false" /> <option name="LOCAL" value="false" />
</RunnerSettings> </RunnerSettings>
<ConfigurationWrapper RunnerId="Run" /> <RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Debug" /> <ConfigurationWrapper RunnerId="Debug" />
<ConfigurationWrapper RunnerId="Run" />
</configuration> </configuration>
</component> </component>
<component name="SelectInManager" /> <component name="SelectInManager" />
@ -364,7 +364,7 @@
<window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="8" /> <window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="8" />
<window_info id="Regex" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="9" /> <window_info id="Regex" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="9" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="7" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="7" />
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.23265307" order="0" /> <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.19489796" order="0" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="1" /> <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="1" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="10" /> <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="10" />
@ -514,13 +514,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/post.xml">
<provider selected="true" editor-type-id="text-editor">
<state line="7" column="75" selection-start="534" selection-end="534" vertical-scroll-proportion="0.21834862">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlog.java"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlog.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="52" column="22" selection-start="2083" selection-end="2083" vertical-scroll-proportion="0.5302752"> <state line="52" column="22" selection-start="2083" selection-end="2083" vertical-scroll-proportion="0.5302752">
@ -532,7 +525,7 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeAction.java"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeAction.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="50" column="11" selection-start="840" selection-end="840" vertical-scroll-proportion="1.0623853"> <state line="50" column="11" selection-start="840" selection-end="840" vertical-scroll-proportion="1.0220183">
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
@ -548,30 +541,46 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeFTP.java"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeRPCResponse.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="132" column="71" selection-start="3917" selection-end="3917" vertical-scroll-proportion="1.0201834"> <state line="50" column="13" selection-start="1963" selection-end="1963" vertical-scroll-proportion="0.03119266">
<folding /> <folding>
<element signature="imports" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/main.xml"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeFTP.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="8" column="60" selection-start="410" selection-end="410" vertical-scroll-proportion="0.24954128"> <state line="132" column="71" selection-start="3917" selection-end="3917" vertical-scroll-proportion="0.9798165">
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/ReleaseInfo.java"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/ReleaseInfo.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="15" column="23" selection-start="413" selection-end="413" vertical-scroll-proportion="0.29174313"> <state line="15" column="23" selection-start="413" selection-end="413" vertical-scroll-proportion="0.30535713">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/post.xml">
<provider selected="true" editor-type-id="text-editor">
<state line="13" column="78" selection-start="927" selection-end="927" vertical-scroll-proportion="0.40550458">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/main.xml">
<provider selected="true" editor-type-id="text-editor">
<state line="18" column="36" selection-start="882" selection-end="882" vertical-scroll-proportion="0.5614679">
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlogger.java"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlogger.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="544" column="28" selection-start="13717" selection-end="13717" vertical-scroll-proportion="-6.187156"> <state line="669" column="11" selection-start="16595" selection-end="16595" vertical-scroll-proportion="0.055045873">
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
@ -580,20 +589,11 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifePost.java"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifePost.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="119" column="14" selection-start="4738" selection-end="4738" vertical-scroll-proportion="0.5614679"> <state line="117" column="21" selection-start="4735" selection-end="4735" vertical-scroll-proportion="0.08256881">
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeRPCResponse.java">
<provider selected="true" editor-type-id="text-editor">
<state line="50" column="13" selection-start="1963" selection-end="1963" vertical-scroll-proportion="-2.3651376">
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component> </component>
</project> </project>

View file

@ -72,7 +72,7 @@ public class LifeBlogger extends Thinlet
System.getProperty("user.home") + File.separator + ReleaseInfo.getProject() + ".properties"; System.getProperty("user.home") + File.separator + ReleaseInfo.getProject() + ".properties";
private static final String JDBC_PREFIX = "jdbc:sqlite:/"; private static final String JDBC_PREFIX = "jdbc:sqlite:/";
private static final String DATABASE = "\\DataBase\\NokiaLifeblogDataBase.db"; private static final String DATABASE = "\\DataBase\\NokiaLifeblogDataBase.db";
private static final String DEFAULT_ACTION = "ftp"; private static final String DEFAULT_ACTION = "mw";
private final Properties _prefs = new Properties(); private final Properties _prefs = new Properties();
private File _homeDir = new File(System.getProperty("user.home") + "\\My Documents\\NokiaLifeblogData"); private File _homeDir = new File(System.getProperty("user.home") + "\\My Documents\\NokiaLifeblogData");
private String _action; private String _action;
@ -482,47 +482,7 @@ public class LifeBlogger extends Thinlet
public final void post(Object dialog, Object blogPanel) public final void post(Object dialog, Object blogPanel)
throws IOException throws IOException
{ {
final String host = getString(find(blogPanel, "host"), "text"); post(dialog, blogPanel, false);
final String blogID = getString(find(blogPanel, "blogid"), "text");
final String login = getString(find(blogPanel, "login"), "text");
final String password = getString(find(blogPanel, "password"), "text");
final String entry = getString(find(blogPanel, "entry"), "text");
if (host.length() <= 0)
{
alert("Please specify a XML-RPC URL.");
}
else if (login.length() <= 0)
{
alert("Please specify a login name.");
}
else if (password.length() <= 0)
{
alert("Please specify a password.");
}
else if (entry.length() <= 0)
{
alert("Please specify a post entry.");
}
else if (blogID.length() <= 0)
{
alert("Please specify a blog ID.");
}
else
{
_prefs.put("blog-host", host);
_prefs.put("blog-login", login);
_prefs.put("blog-password", Base64.encodeBytes(password.getBytes(), Base64.DONT_BREAK_LINES));
_prefs.put("blog-id", blogID);
savePrefs();
closeDialog(dialog);
final LifePost post =
new LifePost(this, host, blogID, login, password, getString(find(blogPanel, "entry"), "text"));
post.start();
}
} }
/** /**
@ -621,6 +581,20 @@ public class LifeBlogger extends Thinlet
} }
} }
/**
* Preforms the publish to blog action.
*
* @param dialog The post dialog,
* @param blogPanel The panel contaning the post data.
*
* @throws IOException If an error occurs while performing the action.
*/
public final void publish(Object dialog, Object blogPanel)
throws IOException
{
post(dialog, blogPanel, true);
}
/** /**
* Toggles the given button based on the specified table selection. * Toggles the given button based on the specified table selection.
* *
@ -684,6 +658,61 @@ public class LifeBlogger extends Thinlet
} }
} }
/**
* Preforms the post/publish to blog action.
*
* @param dialog The post dialog,
* @param blogPanel The panel contaning the post data.
* @param publish Set to <code>true</code> to publish the post, <code>false</code> otherwise.
*
* @throws IOException If an error occurs while performing the action.
*/
private void post(Object dialog, Object blogPanel, boolean publish)
throws IOException
{
final String host = getString(find(blogPanel, "host"), "text");
final String blogID = getString(find(blogPanel, "blogid"), "text");
final String login = getString(find(blogPanel, "login"), "text");
final String password = getString(find(blogPanel, "password"), "text");
final String entry = getString(find(blogPanel, "entry"), "text");
if (host.length() <= 0)
{
alert("Please specify a XML-RPC URL.");
}
else if (login.length() <= 0)
{
alert("Please specify a login name.");
}
else if (password.length() <= 0)
{
alert("Please specify a password.");
}
else if (entry.length() <= 0)
{
alert("Please specify a post entry.");
}
else if (blogID.length() <= 0)
{
alert("Please specify a blog ID.");
}
else
{
_prefs.put("blog-host", host);
_prefs.put("blog-login", login);
_prefs.put("blog-password", Base64.encodeBytes(password.getBytes(), Base64.DONT_BREAK_LINES));
_prefs.put("blog-id", blogID);
savePrefs();
closeDialog(dialog);
final LifePost post =
new LifePost(this, host, blogID, login, password, getString(find(blogPanel, "entry"), "text"), publish);
post.start();
}
}
// Displays an alert. // Displays an alert.
private void alert(String message) private void alert(String message)
{ {
@ -778,7 +807,7 @@ public class LifeBlogger extends Thinlet
putProperty(find(mw, "file"), "mtype", mimeType); putProperty(find(mw, "file"), "mtype", mimeType);
setString(find(mw, "filename"), "text", file.substring(file.lastIndexOf('\\') + 1)); setString(find(mw, "filename"), "text", file.substring(file.lastIndexOf('\\') + 1));
setString(find(mw, "host"), "text", _prefs.getProperty("mw-host", "")); setString(find(mw, "host"), "text", _prefs.getProperty("mw-host", ""));
setString(find(mw, "login"), "text", _prefs.getProperty("mw-login", "anonymous")); setString(find(mw, "login"), "text", _prefs.getProperty("mw-login", ""));
setString(find(mw, "password"), "text", new String(Base64.decode(_prefs.getProperty("mw-password", "")))); setString(find(mw, "password"), "text", new String(Base64.decode(_prefs.getProperty("mw-password", ""))));
setString(find(mw, "blogid"), "text", _prefs.getProperty("mw-id", "")); setString(find(mw, "blogid"), "text", _prefs.getProperty("mw-id", ""));
add(mw); add(mw);

View file

@ -56,6 +56,7 @@ public class LifePost extends LifeAction
{ {
private final String _blogEntry; private final String _blogEntry;
private final String _blogID; private final String _blogID;
private final boolean _publish;
/** /**
* Creates a new LifePost object. * Creates a new LifePost object.
@ -66,16 +67,19 @@ public class LifePost extends LifeAction
* @param login The MetaWeblog login username. * @param login The MetaWeblog login username.
* @param password The MetaWeblog login password. * @param password The MetaWeblog login password.
* @param blogEntry The blog entry. * @param blogEntry The blog entry.
* @param publish DOCUMENT ME!
* *
* @throws IOException If an error occurs while creating the object. * @throws IOException If an error occurs while creating the object.
*/ */
public LifePost(LifeBlogger thinlet, String url, String blogID, String login, String password, String blogEntry) public LifePost(LifeBlogger thinlet, String url, String blogID, String login, String password, String blogEntry,
boolean publish)
throws IOException throws IOException
{ {
super(thinlet, url, login, password); super(thinlet, url, login, password);
_blogEntry = blogEntry; _blogEntry = blogEntry;
_blogID = blogID; _blogID = blogID;
_publish = publish;
} }
/** /**
@ -104,7 +108,9 @@ public class LifePost extends LifeAction
.append(getPassword()) .append(getPassword())
.append("</string></value></param><param><value><string>") .append("</string></value></param><param><value><string>")
.append(textToXML(_blogEntry)) .append(textToXML(_blogEntry))
.append("</string></value></param><param><value><boolean>false</boolean></value></param></params></methodCall>"); .append("</string></value></param><param><value><boolean>")
.append(String.valueOf(_publish))
.append("</boolean></value></param></params></methodCall>");
final URLConnection urlConn = url.openConnection(); final URLConnection urlConn = url.openConnection();
urlConn.setDoInput(true); urlConn.setDoInput(true);
urlConn.setDoOutput(true); urlConn.setDoOutput(true);
@ -118,7 +124,6 @@ public class LifePost extends LifeAction
dos.close(); dos.close();
//System.out.println(request); //System.out.println(request);
final LifeRPCResponse xmlrpc = new LifeRPCResponse(urlConn.getInputStream()); final LifeRPCResponse xmlrpc = new LifeRPCResponse(urlConn.getInputStream());
if (xmlrpc.isValidResponse()) if (xmlrpc.isValidResponse())
@ -166,7 +171,7 @@ public class LifePost extends LifeAction
} }
// High/Low-ASCII character // High/Low-ASCII character
else if (ch >= 128 || ch < 32) else if ((ch >= 128) || (ch < 32))
{ {
c = (int) ch; c = (int) ch;
@ -195,11 +200,11 @@ public class LifePost extends LifeAction
// Loop thru each characters of the text // Loop thru each characters of the text
for (int i = 0; i < text.length(); i++) for (int i = 0; i < text.length(); i++)
{ {
// Convert character to HTML/XML // Convert character to XML
html.append(charToXML(text.charAt(i))); html.append(charToXML(text.charAt(i)));
} }
// Return HTML/XML string // Return XML string
return html.toString(); return html.toString();
} }
} }

View file

@ -10,6 +10,7 @@
</panel> </panel>
<panel columns="2" halign="right" gap="4"> <panel columns="2" halign="right" gap="4">
<button name="cancelbtn" text="Cancel" icon="/icon/exit.gif" action="closeDialog(dialog)"/> <button name="cancelbtn" text="Cancel" icon="/icon/exit.gif" action="closeDialog(dialog)"/>
<button name="sendbtn" text="Post" icon="/icon/go.gif" action="post(dialog, blog)"/> <!-- <button name="sendbtn" text="Post" icon="/icon/go.gif" action="post(dialog, blog)"/> -->
<button name="sendbtn" text="Post" icon="/icon/go.gif" action="publish(dialog, blog)"/>
</panel> </panel>
</dialog> </dialog>