Ejemplo n.º 1
0
 private void OnIconViewDragDataReceived(object o, DragDataReceivedArgs args)
 {
     bool bFolderCreated = false;
        switch (args.Info)
        {
     case (uint) DragTargetType.iFolderID:
      string ifolderID =
       System.Text.Encoding.UTF8.GetString(args.SelectionData.Data);
      iFolderHolder holder = ifdata.GetAvailableiFolder(ifolderID);
      if (holder != null)
       DownloadiFolder(holder, true);
      break;
     case (uint) DragTargetType.UriList:
      UriList uriList = new UriList(args.SelectionData);
      if (uriList.Count == 1)
      {
       string path = null;
       try
       {
        path = uriList.ToLocalPaths()[0];
       }
       catch
       {
        return;
       }
       DomainInformation[] domains = domainController.GetDomains();
       if (domains.Length <= 0) return;
       string domainID = domains[0].ID;
       DomainInformation defaultDomain = domainController.GetDefaultDomain();
       if (defaultDomain != null)
        domainID = defaultDomain.ID;
       DragCreateDialog cd = new DragCreateDialog(this, domains, domainID, path, ifws);
       cd.TransientFor = this;
       int rc = 0;
       do
       {
        rc = cd.Run();
        cd.Hide();
        if (rc == (int)ResponseType.Ok)
        {
     try
     {
      string selectedFolder = cd.iFolderPath.Trim();
      string selectedDomain = cd.DomainID;
      bool SSL = cd.ssl;
      string algorithm = cd.EncryptionAlgorithm;
      string parentDir = System.IO.Path.GetDirectoryName( selectedFolder );
      if ( ( parentDir == null ) || ( parentDir == String.Empty ) )
      {
       iFolderMsgDialog dg = new iFolderMsgDialog(
        this,
        iFolderMsgDialog.DialogType.Warning,
        iFolderMsgDialog.ButtonSet.Ok,
        "",
        Util.GS("Invalid folder specified"),
        Util.GS("An invalid folder was specified"));
       dg.Run();
       dg.Hide();
       dg.Destroy();
       continue;
      }
      iFolderHolder ifHolder = null;
      try
      {
       if( algorithm != null)
       {
        DomainInformation domainInfo = domainController.GetDomain(selectedDomain);
        if( !domainInfo.Authenticated)
        {
     DisplayLoginMesg();
     continue;
        }
        bool passPhraseStatus = false;
        bool passphraseStatus = false;
        try
        {
                                               passphraseStatus = simws.IsPassPhraseSet(selectedDomain);
        }
        catch(Exception)
        {
     DisplayLoginMesg();
     continue;
        }
        if(passphraseStatus == true)
        {
     string passphrasecheck = simws.GetPassPhrase(selectedDomain);
     if( passphrasecheck == null || passphrasecheck =="")
     {
      Debug.PrintLine(" passphrase not entered at login");
      passPhraseStatus = ShowVerifyDialog(selectedDomain, simws);
     }
     else
     {
      passPhraseStatus = true;
     }
        }
        else
        {
     passPhraseStatus = ShowEnterPassPhraseDialog(selectedDomain, simws);
        }
        if( passPhraseStatus == false)
        {
     continue;
        }
       }
       ifHolder = ifdata.CreateiFolder(selectedFolder, selectedDomain, SSL, algorithm);
      }
      catch(Exception e)
      {
       if (DisplayCreateOrSetupException(e))
       {
        continue;
       }
      }
      if(ifHolder == null)
       throw new Exception("Simias returned null");
      rc = 0;
      Util.LastCreatedPath = ifHolder.iFolder.UnManagedPath;
      if ((bool)ClientConfig.Get(ClientConfig.KEY_SHOW_CREATION))
      {
       iFolderCreationDialog dlg =
        new iFolderCreationDialog(ifHolder.iFolder);
       dlg.TransientFor = this;
       int createRC;
       do
       {
        createRC = dlg.Run();
        if(createRC == (int)Gtk.ResponseType.Help)
        {
     Util.ShowHelp("myifolders.html", this);
        }
       }while(createRC != (int)Gtk.ResponseType.Ok);
       dlg.Hide();
       if(dlg.HideDialog)
       {
        ClientConfig.Set(
     ClientConfig.KEY_SHOW_CREATION, false);
       }
       cd.Destroy();
       cd = null;
      }
     }
     catch (Exception e)
     {
      Debug.PrintLine(e.Message);
      continue;
     }
        }
       }
       while(rc == (int)ResponseType.Ok);
      }
      break;
     default:
      break;
        }
        Gtk.Drag.Finish (args.Context, bFolderCreated, false, args.Time);
 }
Ejemplo n.º 2
0
 private void OnIconViewDragDataReceived(object o, DragDataReceivedArgs args)
 {
     Console.WriteLine("OnIconViewDragDataReceived: {0}", (DragTargetType)args.Info);
        bool bFolderCreated = false;
        switch (args.Info)
        {
     case (uint) DragTargetType.iFolderID:
      string ifolderID =
       System.Text.Encoding.UTF8.GetString(args.SelectionData.Data);
      iFolderHolder holder = ifdata.GetAvailableiFolder(ifolderID);
      if (holder != null)
       DownloadiFolder(holder);
      break;
     case (uint) DragTargetType.UriList:
      UriList uriList = new UriList(args.SelectionData);
      if (uriList.Count == 1)
      {
       string path = uriList.ToLocalPaths()[0];
        DomainInformation[] domains = domainController.GetDomains();
        if (domains.Length <= 0) return;
        string domainID = domains[0].ID;
        DomainInformation defaultDomain = domainController.GetDefaultDomain();
        if (defaultDomain != null)
     domainID = defaultDomain.ID;
        DragCreateDialog cd = new DragCreateDialog(this, domains, domainID, path);
        cd.TransientFor = this;
        int rc = 0;
        do
        {
     rc = cd.Run();
     cd.Hide();
     if (rc == (int)ResponseType.Ok)
     {
      try
      {
       string selectedFolder = cd.iFolderPath.Trim();
       string selectedDomain = cd.DomainID;
       string parentDir = System.IO.Path.GetDirectoryName( selectedFolder );
       if ( ( parentDir == null ) || ( parentDir == String.Empty ) )
       {
        iFolderMsgDialog dg = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Warning,
     iFolderMsgDialog.ButtonSet.Ok,
     "",
     Util.GS("Invalid folder specified"),
     Util.GS("An invalid folder was specified"));
        dg.Run();
        dg.Hide();
        dg.Destroy();
        continue;
       }
       iFolderHolder ifHolder = null;
       try
       {
        ifHolder =
     ifdata.CreateiFolder(selectedFolder,
       selectedDomain);
       }
       catch(Exception e)
       {
        if (DisplayCreateOrSetupException(e))
        {
     continue;
        }
       }
       if(ifHolder == null)
        throw new Exception("Simias returned null");
       rc = 0;
       Util.LastCreatedPath = ifHolder.iFolder.UnManagedPath;
       if(ClientConfig.Get(ClientConfig.KEY_SHOW_CREATION,
       "true") == "true")
       {
        iFolderCreationDialog dlg =
     new iFolderCreationDialog(ifHolder.iFolder);
        dlg.TransientFor = this;
        int createRC;
        do
        {
     createRC = dlg.Run();
     if(createRC == (int)Gtk.ResponseType.Help)
     {
      Util.ShowHelp("myifolders.html", this);
     }
        }while(createRC != (int)Gtk.ResponseType.Ok);
        dlg.Hide();
        if(dlg.HideDialog)
        {
     ClientConfig.Set(
      ClientConfig.KEY_SHOW_CREATION, "false");
        }
        cd.Destroy();
        cd = null;
       }
      }
      catch (Exception e)
      {
       Console.WriteLine(e.Message);
       continue;
      }
     }
        }
        while(rc == (int)ResponseType.Ok);
      }
      break;
     default:
      break;
        }
        Gtk.Drag.Finish (args.Context, bFolderCreated, false, args.Time);
 }
Ejemplo n.º 3
0
 private void OnIconViewDragDataReceived(object o, DragDataReceivedArgs args)
 {
     Console.WriteLine("OnIconViewDragDataReceived: {0}", (TargetType)args.Info);
        bool bFolderCreated = false;
        switch (args.Info)
        {
     case (uint) TargetType.UriList:
      DomainInformation defaultDomain = domainController.GetDefaultDomain();
      if (defaultDomain == null) return;
      UriList uriList = new UriList(args.SelectionData);
      foreach (string path in uriList.ToLocalPaths())
      {
       if (ifws.CanBeiFolder(path))
       {
        try
        {
     ifdata.CreateiFolder(path, defaultDomain.ID);
     bFolderCreated = true;
        }
        catch
        {
     Console.WriteLine("Error creating folder on drag-and-drop");
        }
       }
      }
      break;
     default:
      break;
        }
        Gtk.Drag.Finish (args.Context, bFolderCreated, false, args.Time);
 }