[Bbs2ch-cvs 238] [220] 履歴を消去できるようにした。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2007年 9月 17日 (月) 00:19:45 JST


Revision: 220
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=bbs2ch&view=rev&rev=220
Author:   flyson
Date:     2007-09-17 00:19:45 +0900 (Mon, 17 Sep 2007)

Log Message:
-----------
履歴を消去できるようにした。
履歴保存日数を指定できるようにした。

Modified Paths:
--------------
    trunk/bbs2chreader/chrome/content/bbs2chreader/bbsmenu/page.js
    trunk/bbs2chreader/components/idl/nsIBbs2chService.idl
    trunk/bbs2chreader/components/nsBbs2chService.js
    trunk/bbs2chreader/components/nsIBbs2chService.xpt
    trunk/bbs2chreader/defaults/preferences/bbs2chreader-pref.js


-------------- next part --------------
Modified: trunk/bbs2chreader/chrome/content/bbs2chreader/bbsmenu/page.js
===================================================================
--- trunk/bbs2chreader/chrome/content/bbs2chreader/bbsmenu/page.js	2007-09-15 09:39:01 UTC (rev 219)
+++ trunk/bbs2chreader/chrome/content/bbs2chreader/bbsmenu/page.js	2007-09-16 15:19:45 UTC (rev 220)
@@ -190,6 +190,15 @@
 	}finally{
 		gBbs2chService.historyDB.commitTransaction();
 	}
+
+	if(popHistory.hasChildNodes()){
+		popHistory.appendChild(document.createElement("menuseparator"));
+		var menuNode = document.createElement("menuitem");
+		menuNode.setAttribute("label", "Clear History");
+		menuNode.setAttribute("oncommand", "clearHistory()");
+		popHistory.appendChild(menuNode);
+	}
+
 }
 
 
@@ -208,6 +217,9 @@
 	}
 }
 
+function clearHistory(){
+	gBbs2chService.clearHistory();
+}
 
 /**
  * bbsmenu.html をダウンロードして板一覧を更新する

Modified: trunk/bbs2chreader/components/idl/nsIBbs2chService.idl
===================================================================
--- trunk/bbs2chreader/components/idl/nsIBbs2chService.idl	2007-09-15 09:39:01 UTC (rev 219)
+++ trunk/bbs2chreader/components/idl/nsIBbs2chService.idl	2007-09-16 15:19:45 UTC (rev 220)
@@ -223,4 +223,5 @@
 	void maruAuth();
 
 	boolean visitPage(in nsIURL aBoardURL, in AString aTitle, in unsigned long aType);
+	void clearHistory();
 };

Modified: trunk/bbs2chreader/components/nsBbs2chService.js
===================================================================
--- trunk/bbs2chreader/components/nsBbs2chService.js	2007-09-15 09:39:01 UTC (rev 219)
+++ trunk/bbs2chreader/components/nsBbs2chService.js	2007-09-16 15:19:45 UTC (rev 220)
@@ -74,9 +74,9 @@
 				this._historyDB.executeSimpleSQL(sql);
 			}
 
-				// 最終訪問日が30以前のデータを削除
-				// XXX 設定で日付を指定できるようにする
-			var sql = "DELETE FROM history WHERE last_visited < strftime('%s', 'now', '-30 day')";
+			var historyExpireDays = aBbs2chService.pref.getIntPref("extensions.bbs2chreader.history_expire_days");
+			if(historyExpireDays > 365) historyExpireDays = 365;
+			var sql = "DELETE FROM history WHERE last_visited < strftime('%s', 'now', '-" + historyExpireDays +  " day')";
 			this._historyDB.executeSimpleSQL(sql);
 
 		}finally{
@@ -117,6 +117,19 @@
 			this.historyDB.commitTransaction();
 		}
 		return true;
+	},
+
+	clearHistory: function(){
+		this._historyDB.beginTransaction();
+		try{
+			this._historyDB.executeSimpleSQL("DELETE FROM history;");
+		}finally{
+			this.historyDB.commitTransaction();
+		}
+
+		try{
+			this._historyDB.executeSimpleSQL("VACUUM");
+		}catch(ex){}
 	}
 };
 
@@ -729,6 +742,11 @@
 	},
 
 
+	clearHistory :function(){
+		this._globalHistory.clearHistory();
+	},
+
+
   	// ********** ********* implements nsIObserver ********** **********
 
 	observe: function(aSubject, aTopic, aData){

Modified: trunk/bbs2chreader/components/nsIBbs2chService.xpt
===================================================================
(Binary files differ)

Modified: trunk/bbs2chreader/defaults/preferences/bbs2chreader-pref.js
===================================================================
--- trunk/bbs2chreader/defaults/preferences/bbs2chreader-pref.js	2007-09-15 09:39:01 UTC (rev 219)
+++ trunk/bbs2chreader/defaults/preferences/bbs2chreader-pref.js	2007-09-16 15:19:45 UTC (rev 220)
@@ -10,6 +10,8 @@
 pref("extensions.bbs2chreader.server_port.seamonkey", 8824);
 pref("extensions.bbs2chreader.server_port.other", 8825);
 
+pref("extensions.bbs2chreader.history_expire_days", 60);
+
 pref("extensions.bbs2chreader.maru_auth_url", "https://2chv.tora3.net/futen.cgi");
 pref("extensions.bbs2chreader.maru_auto_auth", true);
 pref("extensions.bbs2chreader.maru_last_auth_time", 0);


bbs2ch-cvs メーリングリストの案内
Back to archive index