/*
* $Id: STUpdaterDialogs.m 207 2010-01-31 00:08:34Z stuart $
*
* SafariTabs
* http://stuconnolly.com/projects/safaritabs/
*
* Copyright (c) 2010 Stuart Connolly. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#import "STUpdaterDialogs.h"
#import "STUtilities.h"
@implementation STUpdaterDialogs
/*!
* Displays a standard message dialog indicating that there is no new SafariTabs version to update to.
*/
void STDisplayNoNewVersionAvailableDialog(void)
{
[[NSAlert alertWithMessageText
:STLocalizedString
(@"Update no update -> message") defaultButton
:nil alternateButton
:nil otherButton
:nil informativeTextWithFormat
:[NSString stringWithFormat
:STLocalizedString
(@"Update no update -> informative message"), STPluginVersion
()]] runModal
];
}
/*!
* Displays a standard message dialog indicating that an error occurred whilst trying to check for new versions
* of SafariTabs.
*/
void STDisplayCheckForUpdateErrorDialog(void)
{
[[NSAlert alertWithMessageText
:STLocalizedString
(@"Update fail -> message") defaultButton
:nil alternateButton
:nil otherButton
:nil informativeTextWithFormat
:STLocalizedString
(@"Update fail -> informative message")] runModal
];
}
/*!
* Displays a standard message dialog indicating that an error occurred whilst trying to download a new version
* of SafariTabs.
*/
void STDisplayDownloadUpdateErrorDialog(void)
{
[[NSAlert alertWithMessageText
:STLocalizedString
(@"Download fail -> message") defaultButton
:nil alternateButton
:nil otherButton
:nil informativeTextWithFormat
:STLocalizedString
(@"Download fail -> informative message")] runModal
];
}
/*!
* Displays a standard message dialog indicating that the download was successfully completed.
*/
void STDisplayDownloadCompleteDialog(void)
{
[[NSAlert alertWithMessageText
:STLocalizedString
(@"Download complete -> message") defaultButton
:nil alternateButton
:nil otherButton
:nil informativeTextWithFormat
:STLocalizedString
(@"Download complete -> informative message")] runModal
];
}
/*!
* Displays a standard message dialog indicating that a new version of SafariTabs is available to download.
*
* @param version The new version string
*
* @return The user's decision of whether or not to update. One of NSAlertDefaultReturn (1) or NSAlertAlternateReturn (0).
*/
NSAlert *STGetNewVersionAvailableDialog
(NSString *version,
BOOL displaySuppressionOption
)
{
NSAlert *alert
= [NSAlert alertWithMessageText
:STLocalizedString
(@"Update new version -> message")
defaultButton:STLocalizedString(@"Update new version -> download")
alternateButton:STLocalizedString(@"Update new version -> not now")
otherButton:nil
informativeTextWithFormat
:[NSString stringWithFormat
:STLocalizedString
(@"Update new version -> informative message"), version, STPluginVersion
()]];
[alert setShowsSuppressionButton:displaySuppressionOption];
[[alert suppressionButton] setTitle:STLocalizedString(@"Update new version -> suppresion message")];
return alert;
}
@end