~ubuntu-branches/ubuntu/jaunty/gnome-do-plugins/jaunty-proposed

« back to all changes in this revision

Viewing changes to BundledLibraries/libgoogle-data-mono-1.4.0.2/src/gdocuments/documentservice.cs

  • Committer: Bazaar Package Importer
  • Author(s): Iain Lane, Daniel T Chen, Iain Lane
  • Date: 2009-03-18 00:40:51 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20090318004051-ujn1ja3kiu3ky7ru
Tags: 0.8.1.3+dfsg-0ubuntu1
[ Daniel T Chen ]
* New upstream release (LP: #344578)
  + Banshee plugin goes crazy if banshee isn't loaded first
    (LP: #289802)
  + gnome-do gCalculate plugin fails to display "times" symbol
    (LP: #274252)
  + Banshee-1 fails to build in Mono 2.0 (LP: #309188)
  + Pidgin 2.5.4 has incompatible dbus interface. s/uint/int/
    (LP: #314927)
  + Pidgin plugin hangs opening a chat if pidgin is unresponsive
    (LP: #315565)
  + twitter plugin still reports friend updates even when
    deactivated (LP: #317674)
  + Misspelling in microblogging plugin confirmation message
    (LP: #319433)
  + make install uses mdtool, but configure doesn't check for it
    (LP: #322951)
  + Virtualbox Icon in 2.10 are broken because of a new
    specification (LP: #323902)
  + Google Maps Plugin shouldn't always use route (LP: #324271)
  + Fix for Google Maps when using newlines and other special
    characters (LP: #324667)
  + VirtualBox failed to load icon (LP: #325712)
  + 'Read Man Pages' plugin makes Gnome-Do unresponsive
    (LP: #325935)
  + Search returns broken URLs (LP: #327855)
  + Default action for SSH hosts is "open" (LP: #328236)
  + Files and Folders Configuration doesn't use standard buttons
    (LP: #328236)
  + Window manager maximize action should focus if window is not
    currently focused (LP: #258893)
  + Locate plugin has no error message (LP: #262360)
  + Wishlist: Let user specify files and folders to ignore
    (LP: #263177)
  + ts-client plugin doesn't index subdirectories (LP: #322352)
  + Max 3000 items in Files and Folders plugin (LP: #324105)
  + putty cannot find host when running from gnome do
    (LP: #324282)
  + locate plugin with globbing (LP: #334798)
  + Twitter plugin encountered an error in UpdateFriends
    (LP: #317575)
  + gnome-terminal profiles no longer work (LP: #321977)
  + Creating a task using Remember the Milk plugin can fail if
    no task list is specified (LP: #324066)
  + bundled libraries makefile needs destdir (LP: #324704)
  + Typographical error in del.icio.us plugin (LP: #330525)
  + ImageShack fails to upload (LP: #337324)
* debian/copyright
  + Refresh for new upstream version; new plugins added.
* debian/patches/00_dfsg_autofoo.dpatch
  + Update for new upstream version
  + Don't build the YouTube plugin due to removal of shipped
    exes and dlls causing FTBFS
* debian/patches/02_ssh_respect_exec_arg.dpatch
  debian/patches/03_buildsystem_respect_mcs.dpatch
  debian/patches/04_fix_pidgin_dbus_ints.dpatch
  + Drop; fixed upstream

[ Iain Lane ]
* debian/rules: Update repackaging to not delete *.dll; upstream now ships
  source copies of google-gdata meaning we can now enable the Google and
  Youtube plugins.
* debian/patches/00_dfsg_autofoo: Drop, fixed by including and building
  these libs now. 
* debian/copyright: Update with information for google-gdata. 
* debian/patches/04_fix_pidgin_dbus_ints.dpatch: Add left out piece of patch
* debian/control: Bump gnome-do build-dep to require current version. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 2006 Google Inc.
 
2
 *
 
3
 * Licensed under the Apache License, Version 2.0 (the "License");
 
4
 * you may not use this file except in compliance with the License.
 
5
 * You may obtain a copy of the License at
 
6
 *
 
7
 *     http://www.apache.org/licenses/LICENSE-2.0
 
8
 *
 
9
 * Unless required by applicable law or agreed to in writing, software
 
10
 * distributed under the License is distributed on an "AS IS" BASIS,
 
11
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
12
 * See the License for the specific language governing permissions and
 
13
 * limitations under the License.
 
14
*/
 
15
 
 
16
 
 
17
using System;
 
18
using System.IO;
 
19
using System.Collections;
 
20
using System.Text;
 
21
using System.Net; 
 
22
using Google.GData.Client;
 
23
using Google.GData.Extensions;
 
24
 
 
25
 
 
26
namespace Google.GData.Documents {
 
27
 
 
28
    //////////////////////////////////////////////////////////////////////
 
29
    /// <summary>
 
30
    /// The Google Documents List data API allows client applications to upload 
 
31
    /// documents to Google Documents and list them in the form of Google data 
 
32
    /// API ("GData") feeds. Your client application can request a list of a user's 
 
33
    /// documents, and query the content in an existing document.
 
34
    /// Here are some of the things you can do with the Documents List data API:
 
35
    ///     Upload the word processing documents and spreadsheets on
 
36
    ///         your computer to allow you to back them up or 
 
37
    ///         collaborate online when editing.
 
38
    ///     Find all of your documents that contain specific keywords.
 
39
    ///     Get a list of spreadsheets which can be accessed through the Google Spreadsheets data API. 
 
40
    /// </summary>
 
41
    //////////////////////////////////////////////////////////////////////
 
42
    public class DocumentsService : Service
 
43
    {
 
44
       
 
45
        /// <summary>The Calendar service's name</summary> 
 
46
        public const string GDocumentsService = "writely";
 
47
 
 
48
        /// <summary>
 
49
        /// A Hashtable that expresses the allowed content types.
 
50
        /// </summary>
 
51
        public static Hashtable GDocumentsAllowedTypes;
 
52
 
 
53
        /// <summary>
 
54
        /// Static constructor used to initialize GDocumentsAllowedTypes.
 
55
        /// </summary>
 
56
        static DocumentsService()
 
57
        {
 
58
            GDocumentsAllowedTypes = new Hashtable();
 
59
            GDocumentsAllowedTypes.Add("CSV", "text/csv");
 
60
            GDocumentsAllowedTypes.Add("TAB", "text/tab-separated-values");
 
61
            GDocumentsAllowedTypes.Add("TSV", "text/tab-separated-values");
 
62
            GDocumentsAllowedTypes.Add("TXT", "text/plain");
 
63
            GDocumentsAllowedTypes.Add("HTML", "text/html");
 
64
            GDocumentsAllowedTypes.Add("HTM", "text/html");
 
65
            GDocumentsAllowedTypes.Add("DOC", "application/msword");
 
66
            GDocumentsAllowedTypes.Add("ODS", "application/x-vnd.oasis.opendocument.spreadsheet");
 
67
            GDocumentsAllowedTypes.Add("ODT", "application/vnd.oasis.opendocument.text");
 
68
            GDocumentsAllowedTypes.Add("RTF", "application/rtf");
 
69
            GDocumentsAllowedTypes.Add("SXW", "application/vnd.sun.xml.writer");
 
70
            GDocumentsAllowedTypes.Add("XLS", "application/vnd.ms-excel");
 
71
            GDocumentsAllowedTypes.Add("PPT", "application/vnd.ms-powerpoint");
 
72
            GDocumentsAllowedTypes.Add("PPS", "application/vnd.ms-powerpoint");
 
73
            GDocumentsAllowedTypes.Add("PDF", "application/pdf");
 
74
        }
 
75
 
 
76
        /// <summary>
 
77
        ///  default constructor
 
78
        /// </summary>
 
79
        /// <param name="applicationName">the applicationname</param>
 
80
        public DocumentsService(string applicationName) : base(GDocumentsService, applicationName)
 
81
        {
 
82
            this.NewFeed += new ServiceEventHandler(this.OnNewFeed); 
 
83
        }
 
84
   
 
85
        /// <summary>
 
86
        /// overloaded to create typed version of Query
 
87
        /// </summary>
 
88
        /// <param name="feedQuery"></param>
 
89
        /// <returns>EventFeed</returns>
 
90
        public DocumentsFeed Query(DocumentsListQuery feedQuery) 
 
91
        {
 
92
            return base.Query(feedQuery) as DocumentsFeed;
 
93
        }
 
94
 
 
95
 
 
96
        /// <summary>
 
97
        /// Simple method to upload a document, presentation, or spreadsheet
 
98
        /// based upon the file extension.
 
99
        /// </summary>
 
100
        /// <param name="fileName">The full path to the file.</param>
 
101
        /// <param name="documentName">The desired name of the document on the server.</param>
 
102
        /// <returns>A DocumentEntry describing the created document.</returns>
 
103
        public DocumentEntry UploadDocument(string fileName, string documentName)
 
104
        {
 
105
 
 
106
            FileInfo fileInfo = new FileInfo(fileName);
 
107
            FileStream stream = fileInfo.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
 
108
            Uri postUri = new Uri(DocumentsListQuery.documentsBaseUri);
 
109
 
 
110
            if (documentName == null)
 
111
            {
 
112
                documentName = fileInfo.Name;
 
113
            }
 
114
 
 
115
            //convert the extension to caps and strip the "." off the front
 
116
            string ext = fileInfo.Extension.ToUpper().Substring(1);
 
117
 
 
118
            String contentType = (String) GDocumentsAllowedTypes[ext];
 
119
 
 
120
            if (contentType == null)
 
121
            {
 
122
                throw new ArgumentException("File extension '"+ext+"' is not recognized as valid.");
 
123
            }
 
124
 
 
125
            DocumentEntry entry = this.Insert(postUri, stream, contentType, documentName) as DocumentEntry;
 
126
 
 
127
            stream.Close();
 
128
 
 
129
            return entry;
 
130
        }
 
131
 
 
132
 
 
133
        /// <summary>
 
134
        /// by default all services now use version 1 for the protocol.
 
135
        /// this needs to be overridden by a service to specify otherwise. 
 
136
        /// YouTube uses version 2
 
137
        /// </summary>
 
138
        /// <returns></returns>
 
139
        protected override void InitVersionInformation()
 
140
        {
 
141
             this.ProtocolMajor = VersionDefaults.VersionTwo;
 
142
        }
 
143
 
 
144
 
 
145
 
 
146
 
 
147
        //////////////////////////////////////////////////////////////////////
 
148
        /// <summary>eventchaining. We catch this by from the base service, which 
 
149
        /// would not by default create an atomFeed</summary> 
 
150
        /// <param name="sender"> the object which send the event</param>
 
151
        /// <param name="e">FeedParserEventArguments, holds the feedentry</param> 
 
152
        /// <returns> </returns>
 
153
        //////////////////////////////////////////////////////////////////////
 
154
        protected void OnNewFeed(object sender, ServiceEventArgs e)
 
155
        {
 
156
            Tracing.TraceMsg("Created new Documents Feed");
 
157
            if (e == null)
 
158
            {
 
159
                throw new ArgumentNullException("e"); 
 
160
            }
 
161
            e.Feed = new DocumentsFeed(e.Uri, e.Service);
 
162
        }
 
163
        /////////////////////////////////////////////////////////////////////////////
 
164
    }
 
165
}