Exemple #1
0
 private void SetEmailFormat(EmailFormat selectedEmailFormat)
 {
     // Setup the email settings
     EmailFormat[] availableValues;
     if (EmailConfigHelper.HasMAPI())
     {
         checkbox_email.Enabled       = true;
         combobox_emailformat.Visible = true;
         if (EmailConfigHelper.HasOutlook())
         {
             availableValues = new EmailFormat[] { EmailFormat.MAPI, EmailFormat.OUTLOOK_TXT, EmailFormat.OUTLOOK_HTML };
         }
         else
         {
             // Force MAPI in configuration if no Outlook
             coreConfiguration.OutputEMailFormat = EmailFormat.MAPI;
             availableValues = new EmailFormat[] { EmailFormat.MAPI };
         }
         PopulateComboBox <EmailFormat>(combobox_emailformat, availableValues, selectedEmailFormat);
     }
     else
     {
         checkbox_email.Enabled       = false;
         checkbox_email.Checked       = false;
         combobox_emailformat.Visible = false;
     }
 }
Exemple #2
0
 static OutlookDestination()
 {
     if (EmailConfigHelper.HasOutlook())
     {
         isActiveFlag = true;
     }
     exePath = PluginUtils.GetExePath("OUTLOOK.EXE");
     if (exePath != null && File.Exists(exePath))
     {
         applicationIcon = PluginUtils.GetExeIcon(exePath, 0);
         WindowDetails.AddProcessToExcludeFromFreeze("outlook");
         if (conf.OutlookAllowExportInMeetings)
         {
             meetingIcon = PluginUtils.GetExeIcon(exePath, 2);
         }
     }
     else
     {
         exePath = null;
     }
     if (exePath == null)
     {
         isActiveFlag = false;
     }
 }
        static EmailDestination()
        {
            // Logic to decide what email implementation we use
            if (EmailConfigHelper.HasMAPI())
            {
                isActiveFlag = true;
                mapiClient   = EmailConfigHelper.GetMapiClient();
                if (!string.IsNullOrEmpty(mapiClient))
                {
                    if (mapiClient.ToLower().Contains("microsoft outlook"))
                    {
                        isOutlookUsed = true;
                    }
                }
            }
            else if (EmailConfigHelper.HasOutlook())
            {
                mapiClient    = "Microsoft Outlook";
                isActiveFlag  = true;
                isOutlookUsed = true;
            }
            // Use default email icon
            mailIcon = GreenshotPlugin.Core.GreenshotResources.getImage("Email.Image");

            if (isOutlookUsed)
            {
                exePath = GetExePath("OUTLOOK.EXE");
                if (exePath != null && File.Exists(exePath))
                {
                    applicationIcon = GetExeIcon(exePath, 0);
                    if (conf.OutlookAllowExportInMeetings)
                    {
                        meetingIcon = GetExeIcon(exePath, 2);
                    }
                }
                else
                {
                    exePath = null;
                }
                if (exePath == null)
                {
                    isOutlookUsed = false;
                    if (!EmailConfigHelper.HasMAPI())
                    {
                        isActiveFlag = false;
                    }
                }
            }
            if (isActiveFlag && !isOutlookUsed)
            {
                // Use default email icon
                applicationIcon = mailIcon;
            }
        }
Exemple #4
0
 static EmailDestination()
 {
     // Logic to decide what email implementation we use
     if (EmailConfigHelper.HasMapi())
     {
         _isActiveFlag = true;
         _mapiClient   = EmailConfigHelper.GetMapiClient();
         if (!string.IsNullOrEmpty(_mapiClient))
         {
             // Active as we have a mapi client, can be disabled later
             _isActiveFlag = true;
         }
     }
 }
 public OutlookDestination()
 {
     if (EmailConfigHelper.HasOutlook())
     {
         _isActiveFlag = true;
     }
     _exePath = PluginUtils.GetExePath("OUTLOOK.EXE");
     if (_exePath != null && !File.Exists(_exePath))
     {
         _exePath = null;
     }
     if (_exePath == null)
     {
         _isActiveFlag = false;
     }
 }
Exemple #6
0
        /// <summary>
        /// Helper Method for creating an Email with Image Attachment
        /// </summary>
        /// <param name="image">The image to send</param>
        /// <param name="captureDetails">ICaptureDetails</param>
        public static void SendImage(Image image, ICaptureDetails captureDetails)
        {
            string pattern = conf.OutputFileFilenamePattern;

            if (pattern == null || string.IsNullOrEmpty(pattern.Trim()))
            {
                pattern = "greenshot ${capturetime}";
            }
            string filename = FilenameHelper.GetFilenameFromPattern(pattern, conf.OutputFileFormat, captureDetails);

            // Prevent problems with "other characters", which causes a problem in e.g. Outlook 2007 or break our HTML
            filename = Regex.Replace(filename, @"[^\d\w\.]", "_");
            // Remove multiple "_"
            filename = Regex.Replace(filename, @"_+", "_");
            string tmpFile = Path.Combine(Path.GetTempPath(), filename);

            LOG.Debug("Creating TMP File for Email: " + tmpFile);

            // Catching any exception to prevent that the user can't write in the directory.
            // This is done for e.g. bugs #2974608, #2963943, #2816163, #2795317, #2789218
            try {
                ImageOutput.Save(image, tmpFile, true, conf.OutputFileJpegQuality, false);
            } catch (Exception e) {
                // Show the problem
                MessageBox.Show(e.Message, "Error");
                // when save failed we present a SaveWithDialog
                tmpFile = ImageOutput.SaveWithDialog(image, captureDetails);
            }

            if (tmpFile != null)
            {
                // Store the list of currently active windows, so we can make sure we show the email window later!
                List <WindowDetails> windowsBefore = WindowDetails.GetVisibleWindows();
                bool isEmailSend = false;
                if (EmailConfigHelper.HasOutlook() && (conf.OutputEMailFormat == EmailFormat.OUTLOOK_HTML || conf.OutputEMailFormat == EmailFormat.OUTLOOK_TXT))
                {
                    isEmailSend = OutlookExporter.ExportToOutlook(tmpFile, captureDetails);
                }
                if (!isEmailSend && EmailConfigHelper.HasMAPI())
                {
                    // Fallback to MAPI
                    // Send the email and Cleanup the tmp files on exit
                    SendImage(tmpFile, captureDetails.Title, true);
                }
                WindowDetails.ActiveNewerWindows(windowsBefore);
            }
        }
Exemple #7
0
        /// <summary>
        ///     Helper Method for creating an Email with Image Attachment
        /// </summary>
        /// <param name="surface">The image to send</param>
        /// <param name="captureDetails">ICaptureDetails</param>
        public static void SendImage(ISurface surface, ICaptureDetails captureDetails)
        {
            var tmpFile = ImageOutput.SaveNamedTmpFile(surface, captureDetails, new SurfaceOutputSettings());

            if (tmpFile != null)
            {
                // Store the list of currently active windows, so we can make sure we show the email window later!
                //bool isEmailSend = false;
                //if (EmailConfigHelper.HasOutlook() && (CoreConfig.OutputEMailFormat == EmailFormats.Html || CoreConfig.OutputEMailFormat == EmailFormats.Text)) {
                //	isEmailSend = OutlookExporter.ExportToOutlook(tmpFile, captureDetails);
                //}
                if (/*!isEmailSend &&*/ EmailConfigHelper.HasMapi())
                {
                    // Fallback to MAPI
                    // Send the email
                    SendImage(tmpFile, captureDetails.Title);
                }
            }
        }
Exemple #8
0
 static OutlookDestination()
 {
     if (EmailConfigHelper.HasOutlook())
     {
         isActiveFlag = true;
     }
     exePath = PluginUtils.GetExePath("OUTLOOK.EXE");
     if (exePath != null && File.Exists(exePath))
     {
         WindowDetails.AddProcessToExcludeFromFreeze("outlook");
     }
     else
     {
         exePath = null;
     }
     if (exePath == null)
     {
         isActiveFlag = false;
     }
 }
Exemple #9
0
        /// <summary>
        /// Helper Method for creating an Email with Image Attachment
        /// </summary>
        /// <param name="surface">The image to send</param>
        /// <param name="captureDetails">ICaptureDetails</param>
        public static void SendImage(ISurface surface, ICaptureDetails captureDetails)
        {
            string tmpFile = ImageOutput.SaveNamedTmpFile(surface, captureDetails, new SurfaceOutputSettings());

            if (tmpFile != null)
            {
                // Store the list of currently active windows, so we can make sure we show the email window later!
                var windowsBefore = WindowDetails.GetVisibleWindows();
                //bool isEmailSend = false;
                //if (EmailConfigHelper.HasOutlook() && (CoreConfig.OutputEMailFormat == EmailFormat.OUTLOOK_HTML || CoreConfig.OutputEMailFormat == EmailFormat.OUTLOOK_TXT)) {
                //	isEmailSend = OutlookExporter.ExportToOutlook(tmpFile, captureDetails);
                //}
                if (/*!isEmailSend &&*/ EmailConfigHelper.HasMapi())
                {
                    // Fallback to MAPI
                    // Send the email
                    SendImage(tmpFile, captureDetails.Title);
                }
                WindowDetails.ActiveNewerWindows(windowsBefore);
            }
        }
 public OutlookDestination(
     IOfficeConfiguration officeConfiguration,
     ICoreConfiguration coreConfiguration,
     IGreenshotLanguage greenshotLanguage
     ) : base(coreConfiguration, greenshotLanguage)
 {
     _officeConfiguration = officeConfiguration;
     if (EmailConfigHelper.HasOutlook())
     {
         _isActiveFlag = true;
     }
     _exePath = PluginUtils.GetExePath("OUTLOOK.EXE");
     if (_exePath != null && !File.Exists(_exePath))
     {
         _exePath = null;
     }
     if (_exePath == null)
     {
         _isActiveFlag = false;
     }
 }
Exemple #11
0
        /// <summary>
        /// Helper Method for creating an Email with Image Attachment
        /// </summary>
        /// <param name="image">The image to send</param>
        /// <param name="captureDetails">ICaptureDetails</param>
        public static void SendImage(Image image, ICaptureDetails captureDetails)
        {
            string tmpFile = ImageOutput.SaveNamedTmpFile(image, captureDetails, conf.OutputFileFormat, conf.OutputFileJpegQuality, conf.OutputFileReduceColors);

            if (tmpFile != null)
            {
                // Store the list of currently active windows, so we can make sure we show the email window later!
                List <WindowDetails> windowsBefore = WindowDetails.GetVisibleWindows();
                bool isEmailSend = false;
                //if (EmailConfigHelper.HasOutlook() && (conf.OutputEMailFormat == EmailFormat.OUTLOOK_HTML || conf.OutputEMailFormat == EmailFormat.OUTLOOK_TXT)) {
                //	isEmailSend = OutlookExporter.ExportToOutlook(tmpFile, captureDetails);
                //}
                if (!isEmailSend && EmailConfigHelper.HasMAPI())
                {
                    // Fallback to MAPI
                    // Send the email
                    SendImage(tmpFile, captureDetails.Title);
                }
                WindowDetails.ActiveNewerWindows(windowsBefore);
            }
        }