[Rqda-commits] r22 - pkg pkg/R pkg/man www

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Nov 29 09:45:57 CET 2008


Author: wincent
Date: 2008-11-29 09:45:56 +0100 (Sat, 29 Nov 2008)
New Revision: 22

Added:
   pkg/KnownBugs
   pkg/License
   pkg/R/FileCatButton.R
   www/ChangeLog.txt
Modified:
   pkg/ChangeLog
   pkg/DESCRIPTION
   pkg/R/CodesFun.R
   pkg/R/Coding_Buttons.R
   pkg/R/FileButton.R
   pkg/R/FilesFun.R
   pkg/R/GUIHandler.R
   pkg/R/ProjectButton.R
   pkg/R/Rename.R
   pkg/R/deletion.R
   pkg/R/root_gui.R
   pkg/TODO
   pkg/man/RQDA-package.Rd
   pkg/man/list.deleted.rd
   www/RQDA.css
   www/index.html
Log:
version 0.1.5-22, see ChangeLog for more.

Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog	2008-11-26 15:15:36 UTC (rev 21)
+++ pkg/ChangeLog	2008-11-29 08:45:56 UTC (rev 22)
@@ -1,3 +1,10 @@
+2008-11-29
+	* enhancement of function list.deleted() and pdelete()
+	* better handle the encoding issue in ViewFileButton and handler for openning a file.
+	* Add F-Cat (file-category) to help organized the files.
+	* Add doubleclick handlers to CodeOfCat and FileOfCat to retrieve coding and open file.
+	* fix typo (Thanks Adrian Dusa)
+	
 2008-11-25
 	*Take care of the warning from R CMD check
 	

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2008-11-26 15:15:36 UTC (rev 21)
+++ pkg/DESCRIPTION	2008-11-29 08:45:56 UTC (rev 22)
@@ -1,7 +1,7 @@
 Package: RQDA
 Type: Package
 Title: Qualitative data analysis
-Version: 0.1.5
+Version: 0.1.5-22
 Date: 2008-11-01
 Author: Huang Ronggui
 Maintainer: Huang <ronggui.huang at gmail.com>

Added: pkg/KnownBugs
===================================================================
--- pkg/KnownBugs	                        (rev 0)
+++ pkg/KnownBugs	2008-11-29 08:45:56 UTC (rev 22)
@@ -0,0 +1 @@
+retreival2() has a bug: can not always (sometimes it does) scroll to the right position when click the button of back.
\ No newline at end of file

Added: pkg/License
===================================================================
--- pkg/License	                        (rev 0)
+++ pkg/License	2008-11-29 08:45:56 UTC (rev 22)
@@ -0,0 +1,12 @@
+http://www.opensource.org/licenses/bsd-license.php
+
+Copyright (c) 2008-2009, Ronggui HUANG,All rights reserved.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the name of the owner nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file

Modified: pkg/R/CodesFun.R
===================================================================
--- pkg/R/CodesFun.R	2008-11-26 15:15:36 UTC (rev 21)
+++ pkg/R/CodesFun.R	2008-11-29 08:45:56 UTC (rev 22)
@@ -42,10 +42,10 @@
   endN <- index$endN
   if (startN != endN){
     buffer <- slot(widget,"widget")@widget$GetBuffer()
-    # buffer$createTag("blue.foreground",foreground = "blue")
-    # buffer$ApplyTagByName("blue.foreground",startI,endI)
-     buffer$createTag("red.background",list(foreground = "red")) ## better, it can mark space
-     buffer$ApplyTagByName("red.background",startI,endI); ## change colors   
+    buffer$createTag("red.foreground",foreground = "red")
+    buffer$ApplyTagByName("red.foreground",startI,endI)
+    ## buffer$createTag("red.background",list(foreground = "red")) ## better, it can mark space
+    ## buffer$ApplyTagByName("red.background",startI,endI); ## change colors   
   }
   ## only when selected text chunk is not "", apply the color scheme.
   return(list(start=startN,end=endN,text=selected))
@@ -128,8 +128,10 @@
   }
 }
 
-retrieval2 <- function(){
-  currentCode <- svalue(.rqda$.codes_rqda)
+retrieval2 <- function(CodeNameWidget){
+## CodeNameWidget=.rqda$.codes_rqda for Codes Tab
+## CodeNameWidget=.rqda$.CodeofCat for C-Cat Tab
+  currentCode <- svalue(CodeNameWidget)
   if (length(currentCode)!=0){
     Encoding(currentCode) <- "UTF-8"
     currentCid <- dbGetQuery(.rqda$qdacon,sprintf("select id from freecode where name== '%s' ",currentCode))[1,1]
@@ -154,7 +156,7 @@
         ComputeCallbackFun <- function(BeginPosition,EndPosition,FileName){
           CallBackFUN <- function(button){  
             tryCatch(dispose(.rqda$.rootBackToFile),error=function(e) {})
-            root <- gwindow(title=FileName, parent=c(370,10),width=600,height=600)
+            root <- gwindow(title=FileName, parent=c(370,40),width=580,height=300)
             assign(".rootBackToFile",root,env=.rqda)
             displayFile <- gtext(container=root,font.attr=c(sizes="large"))
             assign(".displayFile",displayFile,env=.rqda)
@@ -163,9 +165,13 @@
             add(.rqda$.displayFile,content,font.attr=c(sizes="large"))
             HL(.rqda$.displayFile,data.frame(begin=BeginPosition,end=EndPosition))
             .rqda$.displayFile at widget@widget$SetEditable(FALSE)
-            gtkTextViewScrollToIter(.rqda$.displayFile at widget@widget,
-                                      .rqda$.displayFile at widget@widget$GetBuffer()$GetIterAtOffset(BeginPosition)$iter,
-                                      0.001,xal=0,yal=0,use.align=TRUE)## doesn't seem to work.
+            MarkHere <- .rqda$.displayFile at widget@widget$GetBuffer()$CreateMark(mark.name = "MarkHere", where=.rqda$.displayFile at widget@widget$GetBuffer()$GetIterAtOffset(BeginPosition)$iter)
+            # create a mark -> more reliable to use ScrollToMark than ScrollToIter
+            #gtkTextViewScrollToIter(.rqda$.displayFile at widget@widget,
+            #                          .rqda$.displayFile at widget@widget$GetBuffer()$GetIterAtOffset(BeginPosition)$iter,
+            #                          0.001,xal=0,yal=0,use.align=TRUE)## doesn't seem to work.
+            gtkTextViewScrollToMark(.rqda$.displayFile at widget@widget,
+                                      MarkHere,0,xal=0,yal=0.2,use.align=TRUE)
             }    
          CallBackFUN
         }
@@ -174,7 +180,7 @@
       iter <- buffer$getIterAtOffset(0)$iter
 create.tags <- function(buffer)
 {
-buffer$createTag("big",size = 20 * PANGO_SCALE)
+buffer$createTag("big",size = 14 * PANGO_SCALE)
 buffer$createTag("x-large",scale = PANGO_SCALE_X_LARGE)
 buffer$createTag("large",scale = PANGO_SCALE_LARGE)
 buffer$createTag("red.foreground",foreground = "red")

Modified: pkg/R/Coding_Buttons.R
===================================================================
--- pkg/R/Coding_Buttons.R	2008-11-26 15:15:36 UTC (rev 21)
+++ pkg/R/Coding_Buttons.R	2008-11-29 08:45:56 UTC (rev 22)
@@ -46,7 +46,7 @@
   gbutton(label,
           handler=function(h,...) {
             if (is_projOpen(env=.rqda,conName="qdacon")) {
-              retrieval2()
+              retrieval2(CodeNameWidget=.rqda$.codes_rqda)
             }
           }
           )

Modified: pkg/R/FileButton.R
===================================================================
--- pkg/R/FileButton.R	2008-11-26 15:15:36 UTC (rev 21)
+++ pkg/R/FileButton.R	2008-11-29 08:45:56 UTC (rev 22)
@@ -40,11 +40,13 @@
       if (length(svalue(.rqda$.fnames_rqda))==0){gmessage("Select a file first.",icon="error",con=TRUE)}
       else {
         tryCatch(dispose(.rqda$.root_edit),error=function(e) {})
-        ## notice the error handler
-        assign(".root_edit",gwindow(title=svalue(.rqda$.fnames_rqda), parent=c(370,10),width=600,height=600),env=.rqda)
+        ## notice the error handler
+        SelectedFileName <- svalue(.rqda$.fnames_rqda)
+        assign(".root_edit",gwindow(title=SelectedFileName, parent=c(370,10),width=600,height=600),env=.rqda)
         .root_edit <- get(".root_edit",.rqda)
-        assign(".openfile_gui",gtext(container=.root_edit,font.attr=c(sizes="large")),env=.rqda)
-        content <- dbGetQuery(.rqda$qdacon, sprintf("select file from source where name='%s'",svalue(.rqda$.fnames_rqda)))[1,1] 
+        assign(".openfile_gui",gtext(container=.root_edit,font.attr=c(sizes="large")),env=.rqda)
+        Encoding(SelectedFileName) <- "unknown"
+        content <- dbGetQuery(.rqda$qdacon, sprintf("select file from source where name='%s'",SelectedFileName))[1,1] 
         Encoding(content) <- "UTF-8" ## so it display correct in the gtext widget
         ## turn data.frame to 1-length character.
         W <- get(".openfile_gui",.rqda)

Added: pkg/R/FileCatButton.R
===================================================================
--- pkg/R/FileCatButton.R	                        (rev 0)
+++ pkg/R/FileCatButton.R	2008-11-29 08:45:56 UTC (rev 22)
@@ -0,0 +1,127 @@
+#################
+AddFileCatButton <- function(label="ADD"){
+  gbutton(label,handler=function(h,...) {
+    if (is_projOpen(env=.rqda,conName="qdacon")) {
+      item <- ginput("Enter new File Category. ", icon="info")
+      Encoding(item) <- "UTF-8"
+      AddTodbTable(item,"filecat",Id="catid") ## FILE CATegory
+      UpdateTableWidget(Widget=.rqda$.FileCatWidget,FromdbTable="filecat")
+    }
+          }
+          )
+}
+
+
+DeleteFileCatButton <- function(label="Delete"){
+  gbutton(label,
+          handler=function(h,...)
+          {
+            if (is_projOpen(env=.rqda,conName="qdacon") &
+                length(svalue(.rqda$.FileCatWidget))!=0) {
+              del <- gconfirm("Really delete the File Category?",icon="question")
+              if (isTRUE(del)){
+                Selected <- svalue(.rqda$.FileCatWidget)
+                Encoding(Selected) <- "UTF-8"
+                catid <- dbGetQuery(.rqda$qdacon,sprintf("select catid from filecat where status==1 and name=='%s'",Selected))[,1]
+                if (length(catid) ==1){
+                  dbGetQuery(.rqda$qdacon,sprintf("update filecat set status=0 where name=='%s'",Selected))
+                  ## set status in table freecode to 0
+                  UpdateTableWidget(Widget=.rqda$.FileCatWidget,FromdbTable="filecat")
+                  tryCatch(dbGetQuery(.rqda$qdacon,sprintf("update treefile set status=0 where catid=='%s'",catid)),error=function(e){}) 
+                  ## should delete all the related codelists
+                  UpdateFileofCatWidget() ## update the filecode of cat widget
+                } else gmessage("The Category Name is not unique.",con=TRUE)
+                
+              }
+            }
+          }
+          )
+}
+
+
+FileCat_RenameButton <- function(label="Rename",Widget=.rqda$.FileCatWidget,...)
+{
+  ## rename of selected file cat.
+  gbutton(label,handler=function(h,...) {
+    if (is_projOpen(env=.rqda,"qdacon")) {
+      ## if project is open, then continue
+      OldName <- svalue(Widget)
+      if (length(OldName)==0){
+        gmessage("Select a File Category first.",icon="error",con=TRUE)
+      }
+      else {
+        ## get the new file names
+        NewName <- ginput("Enter new Cateory name. ", icon="info")
+        Encoding(NewName) <- "UTF-8"
+        rename(OldName,NewName,"filecat")
+        UpdateTableWidget(Widget=.rqda$.FileCatWidget,FromdbTable="filecat")
+      }
+    }
+  }
+          )
+}
+
+UpdateFileofCatWidget <- function(con=.rqda$qdacon,Widget=.rqda$.FileofCat){
+  SelectedFileCat <- svalue(.rqda$.FileCatWidget)
+  if (length(SelectedFileCat)!=0){
+    Encoding(SelectedFileCat) <- "UTF-8"
+    catid <- dbGetQuery(.rqda$qdacon,sprintf("select catid from filecat where status=1 and name='%s'",SelectedFileCat))[,1]
+    Total_fid <- dbGetQuery(con,sprintf("select fid from treefile where status==1 and catid==%i",catid))
+    if (nrow(Total_fid)!=0){
+      items <- dbGetQuery(con,"select name,id from source where status==1")
+      if (nrow(items)!=0) {
+        items <- items[items$id %in% Total_fid$fid,"name"]
+        Encoding(items) <- "UTF-8"
+      } else items <- NULL
+    } else items <- NULL
+  } else items <- NULL
+    tryCatch(Widget[] <- items,error=function(e){})
+}
+
+FileCatAddToButton <- function(label="AddTo",Widget=.rqda$.FileCatWidget,...)
+{
+  gbutton(label,handler=function(h,...) {
+    SelectedFileCat <- svalue(.rqda$.FileCatWidget)
+    catid <- dbGetQuery(.rqda$qdacon,sprintf("select catid from filecat where status=1 and name='%s'",SelectedFileCat))[,1]
+    freefile <-  dbGetQuery(.rqda$qdacon,"select name, id from source where status=1")
+    Encoding(SelectedFileCat) <- Encoding(freefile[['name']]) <- "UTF-8"
+    fileofcat <- dbGetQuery(.rqda$qdacon,sprintf("select fid from treefile where status=1 and catid=%i",catid))
+    if (nrow(fileofcat)!=0){
+    fileoutofcat <- subset(freefile,!(id %in% fileofcat$fid))
+  } else  fileoutofcat <- freefile
+    Selected <- select.list(fileoutofcat[['name']],multiple=TRUE)
+    if (length(Selected)!=0){
+      Selected <- iconv(Selected,to="UTF-8")
+      fid <- fileoutofcat[fileoutofcat$name %in% Selected,"id"]
+      Dat <- data.frame(fid=fid,catid=catid,date=date(),dateM=date(),memo="",status=1)
+      dbWriteTable(.rqda$qdacon,"treefile",Dat,row.names=FALSE,append=TRUE)
+      UpdateFileofCatWidget()
+  }
+}
+          )
+}
+
+FileCatDropFromButton <- function(label="DropFrom",Widget=.rqda$.FileofCat,...)
+{
+  gbutton(label,handler=function(h,...) {
+    FileOfCat <- svalue(Widget)
+    if ((NumofSelected <- length(FileOfCat)) ==0) {
+      gmessage("Please select the Files you want to delete.",con=TRUE)} else
+    {
+      ## Give a confirm msg
+      del <- gconfirm(sprintf("Delete %i file(s) from this category. Are you sure?",NumofSelected),con=TRUE,icon="question")
+      if (isTRUE(del)){
+        SelectedFileCat <- svalue(.rqda$.FileCatWidget)
+        Encoding(SelectedFileCat) <- Encoding(FileOfCat)<- "UTF-8"
+        catid <- dbGetQuery(.rqda$qdacon,sprintf("select catid from filecat where status=1 and name='%s'",SelectedFileCat))[,1]
+    for (i in FileOfCat){
+      fid <- dbGetQuery(.rqda$qdacon,sprintf("select id from source where status=1 and name='%s'",i))[,1]
+      dbGetQuery(.rqda$qdacon,sprintf("update treefile set status==0 where catid==%i and fid==%i",catid,fid))
+    }
+        ## update .CodeofCat Widget
+        UpdateFileofCatWidget()
+      }
+    }
+  }
+          )
+}

Modified: pkg/R/FilesFun.R
===================================================================
--- pkg/R/FilesFun.R	2008-11-26 15:15:36 UTC (rev 21)
+++ pkg/R/FilesFun.R	2008-11-29 08:45:56 UTC (rev 22)
@@ -56,3 +56,32 @@
 
 enc <- function(x) gsub("'", "''", x)
 ## replace " with two '. to make insert smoothly.
+
+ViewFileFun <- function(FileNameWidget){
+## FileNameWidget=.rqda$.fnames_rqda in Files Tab
+## FileNameWidget=.rqda$.FileofCat in F-CAT Tab
+        if (is_projOpen(env = .rqda, conName = "qdacon")) {
+            if (length(svalue(FileNameWidget)) == 0) {
+                gmessage("Select a file first.", icon = "error", 
+                  con = TRUE)
+            }
+            else {
+                tryCatch(dispose(.rqda$.root_edit), error = function(e) {
+                })
+                SelectedFileName <- svalue(FileNameWidget)
+                assign(".root_edit", gwindow(title = SelectedFileName, 
+                  parent = c(370, 10), width = 600, height = 600), 
+                  env = .rqda)
+                .root_edit <- get(".root_edit", .rqda)
+                assign(".openfile_gui", gtext(container = .root_edit, 
+                  font.attr = c(sizes = "large")), env = .rqda)
+                Encoding(SelectedFileName) <- "unknown"
+                content <- dbGetQuery(.rqda$qdacon, sprintf("select file from source where name='%s'", 
+                  SelectedFileName))[1, 1]
+                Encoding(content) <- "UTF-8"
+                W <- get(".openfile_gui", .rqda)
+                add(W, content, font.attr = c(sizes = "large"))
+                slot(W, "widget")@widget$SetEditable(FALSE)
+            }
+        }
+    }

Modified: pkg/R/GUIHandler.R
===================================================================
--- pkg/R/GUIHandler.R	2008-11-26 15:15:36 UTC (rev 21)
+++ pkg/R/GUIHandler.R	2008-11-29 08:45:56 UTC (rev 22)
@@ -4,7 +4,7 @@
   ## handler for Root
   addHandlerUnrealize(.rqda$.root_rqdagui, handler = function(h,...) {
     ## make sure is the project should be closed by issuing a confirm window.
-    val <- gconfirm("Really EXIST?\n\nYou can use RQDA() to start this program again.", parent=h$obj)
+    val <- gconfirm("Really EXIT?\n\nYou can use RQDA() to start this program again.", parent=h$obj)
     if(as.logical(val))
       return(FALSE)             # destroy
     else
@@ -38,10 +38,15 @@
       else {
         tryCatch(dispose(.rqda$.root_edit),error=function(e) {})
         ## notice the error handler
-        assign(".root_edit",gwindow(title=svalue(.rqda$.fnames_rqda), parent=c(370,10),width=600,height=600),env=.rqda)
+        SelectedFile <- svalue(.rqda$.fnames_rqda)
+        assign(".root_edit",gwindow(title=SelectedFile, parent=c(370,10),width=600,height=600),env=.rqda)
         .root_edit <- get(".root_edit",.rqda)
         assign(".openfile_gui",gtext(container=.root_edit,font.attr=c(sizes="large")),env=.rqda)
-        content <- dbGetQuery(.rqda$qdacon, sprintf("select file from source where name='%s'",svalue(.rqda$.fnames_rqda)))[1,1] 
+        Encoding(SelectedFile) <- "unknown"
+        ## By default, SelectedFile is in UTF-8, if not set to unknown, under FreeBSD,
+        ## it will convert to the current encoding before the query
+        ## so it should be set to unknow in order to get the correct qunery result.
+        content <- dbGetQuery(.rqda$qdacon, sprintf("select file from source where name='%s'",SelectedFile))[1,1]
         Encoding(content) <- "UTF-8" ## so it display correct in the gtext widget
         ## turn data.frame to 1-length character.
         W <- get(".openfile_gui",.rqda)
@@ -140,6 +145,17 @@
     UpdateCodeofCatWidget(con=.rqda$qdacon,Widget=.rqda$.CodeofCat)
 })
 
+  addhandlerdoubleclick(.rqda$.CodeofCat,handler=function(h,...) {
+            if (is_projOpen(env=.rqda,conName="qdacon"))  retrieval2(CodeNameWidget=.rqda$.CodeofCat)
+          }
+                        )
+
+  addHandlerClicked(.rqda$.FileCatWidget,handler <- function(h,...){
+    UpdateFileofCatWidget(con=.rqda$qdacon,Widget=.rqda$.FileofCat)
+})
+
+addhandlerdoubleclick(.rqda$.FileofCat, handler <- function(h,...) ViewFileFun(FileNameWidget=.rqda$.FileofCat))
+
 add3rdmousepopupmenu(.rqda$.CasesNamesWidget, CaseNamesWidgetMenu)
 ## popup menu by right-click on CaseNamesWidget
 }

Modified: pkg/R/ProjectButton.R
===================================================================
--- pkg/R/ProjectButton.R	2008-11-26 15:15:36 UTC (rev 21)
+++ pkg/R/ProjectButton.R	2008-11-29 08:45:56 UTC (rev 22)
@@ -21,6 +21,8 @@
       tryCatch(CaseNamesUpdate(),error=function(e){})
       tryCatch(UpdateTableWidget(Widget=.rqda$.CodeCatWidget,FromdbTable="codecat"),error=function(e){})
       tryCatch(UpdateCodeofCatWidget(),error=function(e){})
+      tryCatch(UpdateTableWidget(Widget=.rqda$.FileCatWidget,FromdbTable="filecat"),error=function(e){})
+      tryCatch(UpdateFileofCatWidget(),error=function(e){})
 
     }
   }
@@ -36,6 +38,8 @@
       tryCatch(.rqda$.CasesNamesWidget[]<-NULL,error=function(e){})
       tryCatch(UpdateTableWidget(Widget=.rqda$.CodeCatWidget,FromdbTable="codecat"),error=function(e){})
       tryCatch(UpdateCodeofCatWidget(),error=function(e){})
+      tryCatch(UpdateTableWidget(Widget=.rqda$.FileCatWidget,FromdbTable="filecat"),error=function(e){})
+      tryCatch(UpdateFileofCatWidget(),error=function(e){})
       }
                                )
 

Modified: pkg/R/Rename.R
===================================================================
--- pkg/R/Rename.R	2008-11-26 15:15:36 UTC (rev 21)
+++ pkg/R/Rename.R	2008-11-29 08:45:56 UTC (rev 22)
@@ -1,4 +1,4 @@
-rename <- function(from,to,table=c("source","freecode","cases","codecat")){
+rename <- function(from,to,table=c("source","freecode","cases","codecat","filecat")){
   ## rename name field in table source and freecode (other tables can be added futher)
   ## source is the file name, freecode is the free code name
   ## should check it there is any dupliation in the table????????????????????????????????

Modified: pkg/R/deletion.R
===================================================================
--- pkg/R/deletion.R	2008-11-26 15:15:36 UTC (rev 21)
+++ pkg/R/deletion.R	2008-11-29 08:45:56 UTC (rev 22)
@@ -1,4 +1,4 @@
-list.deleted <- function(type=c("file","code","coding")){
+list.deleted <- function(type=c("file","code","case","codecategory","coding")){
   ## list the tmp deleted file/code/coding
   if (!isIdCurrent(.rqda$qdacon)) print("No project is open!")
   else {
@@ -11,15 +11,23 @@
     }
     else if (type=="coding") {
       ans <- dbGetQuery(.rqda$qdacon, "select seltext from coding where status=0")
+    } else if (type=="case"){
+      ans <- dbGetQuery(.rqda$qdacon, "select name from cases where status=0")
+    } else if (type=="codecategory"){
+      ans <- dbGetQuery(.rqda$qdacon, "select name from codecat where status=0")
     }
+    if (nrow(ans)==0) {
+      sprintf("No %s is deleted.",type)
+    }  else {
+      Encoding(ans[,1]) <- "UTF-8"
+      ans
+    }
   }
-  if (nrow(ans)==0) sprintf("No %s is deleted.",type)
-  else ans
 }
 
 
 
-pdelete <- function(type=c("file","code","coding"),ask=FALSE){
+pdelete <- function(type=c("file","code","case","codecategory","coding"),ask=FALSE){
   ## permanantly delete all the "deleted" files/codes/codings (those with status==0)
   if (!isIdCurrent(.rqda$qdacon)) {
     print("No project is open!")
@@ -33,14 +41,30 @@
         del <- select.list(del[,1],multiple=TRUE)
       } else del <- del[,1]
       if (type=="file"){
+        fid <- dbGetQuery(.rqda$qdacon, sprintf("select id from source where status=0 AND name in (%s)",
+                                                paste(paste("'",del,"'",sep=""),collapse=",")))[,1]
+        if (length(fid)!=0){
+       dbGetQuery(.rqda$qdacon, sprintf("delete from coding where fid in (%s)",
+                                                paste(paste(fid,sep=""),collapse=",")))
+       ## delete associated coding even regardless of their status
+
         ans <- dbGetQuery(.rqda$qdacon, sprintf("delete from source where status=0 AND name in (%s)",
                                                 paste(paste("'",del,"'",sep=""),collapse=",")))
+   }
       } else if (type=="code"){
         ans <- dbGetQuery(.rqda$qdacon, sprintf("delete from freecode where status=0 AND name in (%s)",
                                                 paste(paste("'",del,"'",sep=""),collapse=",")))
       } else if (type=="coding") {
         ans <- dbGetQuery(.rqda$qdacon, sprintf("delete from coding where status=0 AND seltext in (%s)",
                                                 paste(paste("'",del,"'",sep=""),collapse=",")))
+      } else if (type=="case"){
+        ans <- dbGetQuery(.rqda$qdacon, sprintf("delete from cases where status=0 AND name in (%s)",
+                                                paste("'",del,"'",collapse=",",sep="")))
+        ## and its related caselinkage?
+      } else if (type=="codecategory"){
+        ans <- dbGetQuery(.rqda$qdacon, sprintf("delete from codecat where status=0 AND name in ('%s')",
+                                                paste("'",del,"'",collapse=",",sep="")))
+        ## and its related treecode?
       }
     }
   }
@@ -65,16 +89,12 @@
         if (type=="file"){
           ans <- dbGetQuery(.rqda$qdacon, sprintf("update source set status=1 where status=0 AND name in (%s)",
                                                   paste(paste("'",del,"'",sep=""),collapse=",")))
-          assign("currentFid",integer(0),envir=.rqda)
-          assign("currentFile",character(0),envir=.rqda)
-          FileNamesUpdate(FileNamesWidget=.rqda$.fnames_rqda)
+             FileNamesUpdate(FileNamesWidget=.rqda$.fnames_rqda)
         } else if (type=="code"){
           ans <- dbGetQuery(.rqda$qdacon, sprintf("update freecode set status=1 where status=0 AND name in (%s)",
                                                   paste(paste("'",del,"'",sep=""),collapse=",")))
-          assign("currentCid",integer(0),envir=.rqda)
-          assign("currentCode",character(0),envir=.rqda)
           CodeNamesUpdate(CodeNamesWidget=.rqda$.codes_rqda)
-          ## update "codes_index" "currentCid"  "currentCode"
+          ## update Widget
         }
         ## else if (type=="coding") {
         ## ans <- dbGetQuery(.rqda$qdacon, sprintf("update coding set status=1 where status=0 AND seltext in (%s)",

Modified: pkg/R/root_gui.R
===================================================================
--- pkg/R/root_gui.R	2008-11-26 15:15:36 UTC (rev 21)
+++ pkg/R/root_gui.R	2008-11-29 08:45:56 UTC (rev 22)
@@ -26,7 +26,7 @@
   ".proj_gui" <- ggroup(container=.nb_rqdagui,horizontal=FALSE,label="Project")
   ".newproj_gui" <- NewProjectButton(container=.proj_gui)
   ".open.proj_gui" <- OpenProjectButton(container=.proj_gui)
-  ".project_memo" <- Proj_MemoButton(label = "Porject Memo", container = .proj_gui)
+  ".project_memo" <- Proj_MemoButton(label = "Project Memo", container = .proj_gui)
   ## project memo button
   ".close.proj_gui" <- CloseProjectButton(container=.proj_gui)
   ".projinfo_gui" <- ProjectInforButton(container=.proj_gui)
@@ -81,7 +81,7 @@
   ".case_pan" <- gpanedgroup(container=.nb_rqdagui,horizontal=FALSE,label="Case")
   ".case_buttons" <- glayout(container=.case_pan)
   ".CasesNamesWidget" <- gtable("Please click Update",container=.case_pan)
-  .CasesNamesWidget[] <- NULL 
+  .CasesNamesWidget[] <- NULL ; names(.CasesNamesWidget) <- "Cases"
   .case_buttons[1,1] <- AddCaseButton()
   .case_buttons[1,2] <- DeleteCaseButton()
   .case_buttons[1,3] <- Case_RenameButton()
@@ -107,7 +107,18 @@
 
 ######################### GUI  for F-cat
 #########################
-##   ".fcat_gui" <- ggroup(container=.nb_rqdagui,horizontal=FALSE,label="F-Cat")
+  ".filecat_pan" <- gpanedgroup(container=.nb_rqdagui,horizontal=FALSE,label="F-Cat")
+  ".filecat_buttons" <- glayout(container=.filecat_pan)
+  ".Fcat_PW" <- ggroup(cont=.filecat_pan,horizontal = FALSE)## parent Widget of F-cat
+  ".FileCatWidget" <- gtable("Please click Update",container=.Fcat_PW,expand=TRUE)
+   .FileCatWidget[] <- NULL; names(.FileCatWidget)<-"File Category"
+   ".FileofCat" <- gtable("Please click Update",container=.Fcat_PW,expand=TRUE,multiple=TRUE)
+   .FileofCat[] <- NULL;names(.FileofCat)<-"Files of This Category"
+   .filecat_buttons[1,1] <- AddFileCatButton("Add")
+   .filecat_buttons[1,2] <- FileCat_RenameButton("Rename")
+   .filecat_buttons[1,3] <- DeleteFileCatButton("Delete") ## should take care of treecode table
+   .filecat_buttons[1,4] <- FileCatAddToButton("AddTo")
+   .filecat_buttons[1,5] <- FileCatDropFromButton("DropFrom")
 
 ######################### GUI  for settings
 #########################
@@ -128,12 +139,15 @@
 assign(".CasesNamesWidget",.CasesNamesWidget,env=.rqda)
 assign(".CodeCatWidget",.CodeCatWidget,env=.rqda)
 assign(".CodeofCat",.CodeofCat,env=.rqda)
+assign(".FileCatWidget",.FileCatWidget,env=.rqda)
+assign(".FileofCat",.FileofCat,env=.rqda)
 
 ##########################
 ### set the positions
-svalue(.codes_pan) <- 0.1
-svalue(.codecat_pan)<-0.035
-svalue(.case_pan)<-0.035
+svalue(.codes_pan) <- 0.13
+svalue(.codecat_pan)<-0.07
+svalue(.filecat_pan)<-0.07
+svalue(.case_pan)<-0.07
 
 ##########################
 Handler()

Modified: pkg/TODO
===================================================================
--- pkg/TODO	2008-11-26 15:15:36 UTC (rev 21)
+++ pkg/TODO	2008-11-29 08:45:56 UTC (rev 22)
@@ -4,5 +4,6 @@
 
 functions cleaning treecode/codecat table. and the previous deletion functions should be modified.
 
+add warning when duplicated file/code etc. are added.
 ### less important
 should add document on the table structure.

Modified: pkg/man/RQDA-package.Rd
===================================================================
--- pkg/man/RQDA-package.Rd	2008-11-26 15:15:36 UTC (rev 21)
+++ pkg/man/RQDA-package.Rd	2008-11-29 08:45:56 UTC (rev 22)
@@ -3,7 +3,7 @@
 \alias{RQDA}
 \docType{package}
 \title{
-Qualitative data analysis
+  R-based Qualitative Data Analysis package
 }
 \description{
   Qualitative Data Analysis based on R language. Current version only supports plain text.

Modified: pkg/man/list.deleted.rd
===================================================================
--- pkg/man/list.deleted.rd	2008-11-26 15:15:36 UTC (rev 21)
+++ pkg/man/list.deleted.rd	2008-11-29 08:45:56 UTC (rev 22)
@@ -10,13 +10,18 @@
   \code{undelete} let you reuse the temporary tagged as deleted file and code.
 }
 \usage{
-list.deleted(type = c("file", "code", "coding"))
-pdelete(type = c("file", "code", "coding"),ask = FALSE)
+list.deleted(type = c("file","code","case","codecategory","coding"))
+pdelete(type = c("file","code","case","codecategory","coding"),ask = FALSE)
 undelete(type=c("file","code"))
 }
 
 \arguments{
-  \item{type}{ What kind of info would you like to show or clear.}
+  \item{type}{ What kind of info would you like to show or clear.$_file_$
+  is the name of file (in the Files tab). $_code_$ is the name of codes
+  (in the Codes tab). $_case_$ is the
+  name of case (in the Case tab). $_codecategory_$ is name of code
+  category (in the C-Cat tab). $_coding_$ is the text segment associated
+  with specific code.}
   \item{ask} {You can choose which ones to be deleted when is
   TRUE. Otherwise, it will delete all with temporary tagged with
   deletion mark, that is status=0.}

Added: www/ChangeLog.txt
===================================================================
--- www/ChangeLog.txt	                        (rev 0)
+++ www/ChangeLog.txt	2008-11-29 08:45:56 UTC (rev 22)
@@ -0,0 +1,56 @@
+2008-11-29
+	* enhancement of function list.deleted() and pdelete()
+	* better handle the encoding issue in ViewFileButton and handler for openning a file.
+	* Add F-Cat (file-category) to help organized the files.
+	* Add doubleclick handlers to CodeOfCat and FileOfCat to retrieve coding and open file.
+	* fix typo (Thanks Adrian Dusa)
+	
+2008-11-25
+	*Take care of the warning from R CMD check
+	
+2008-11-24
+	* Can back to the original file from Retrieved text chunck (by retrieval2 function).
+	
+2008-11-23 (as version 0.1.5)
+	* Add AddTo/DropFrom Buttons for Code-Category.
+	* Improve the display of retrieved coding.
+	
+2008-11-22
+	* change "Add Code Category" Button to popup menu
+	* Open selected file by double click.
+	* Retrieve coding chuck by double click.
+	* Add/rename/delete Buttons for Code-Category.
+	
+2008-11-21
+	* Add WebSearch Case button (for convienence)
+	* Add "Add Code Category" Button
+	
+2008-11-19 (as verion 0.1.4)
+	* Add project memo
+	* rename of file/free code names
+	* reorganize the code for memo(s)
+	* Handle Encoding better (use UTF-8 for storage in date base)
+	* Add cases category
+	
+2008-11-01(as version 0.1.3)
+	* Add functionality of file/code/coding memo.
+	
+2008-10-31
+	* Add functionality of delete selected code.
+	* Add helper functions to show the temp deleted file/code/coding.
+	* Add helper functions to delete file/code/coding permanently.
+	* Add helper functions to undo the temporary deletion.
+	* Minor changes to the database structure, adding memo, owner and date.
+	* some minor bugs are fixed.
+	* Now, RQDA() will launch when the package is attached.
+
+2008-10-29
+	* Add functionality of delete selected file.
+
+2008-5-17
+	* Open coding text chunk is added.
+	* "Unmark" button works now.
+	
+2008-5-14
+	* Use /R/sysdata.rda to store meta data such as .rqda environment, so no need to generate it in .GlobalEnv.
+	* Add RQDA-package.rd in /man.

Modified: www/RQDA.css
===================================================================
--- www/RQDA.css	2008-11-26 15:15:36 UTC (rev 21)
+++ www/RQDA.css	2008-11-29 08:45:56 UTC (rev 22)
@@ -16,7 +16,7 @@
   width: 9em }
 h1 {
   font-family: Helvetica, Arial,SunSans-Regular, sans-serif;
-  font-size:14px
+  font-size:13px
   }
 
 ul.navbar li {

Modified: www/index.html
===================================================================
--- www/index.html	2008-11-26 15:15:36 UTC (rev 21)
+++ www/index.html	2008-11-29 08:45:56 UTC (rev 22)
@@ -24,6 +24,7 @@
 <li>Retrieval of coding, and easily back to the original file (ease the problem of segmentation)
 <li>Single-file (*.rqda) format, which is basically SQLite database. Data are stored in UTF-8, so it should be portable
 <li>Facilitator helps to categorize codes,which is key to theory building. I deliberately avoid using tree-like categorization
+<li>Facilitator helps to categorize files
 <li>There is a case category, which is crucial feature to bridge qualitative and quantitative research
 <li>Search information about selected case from the Internet vis popup menu
 <li>Temporary delete files and codes
@@ -34,11 +35,13 @@
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/rqda -r 22


More information about the Rqda-commits mailing list