From 55e74e06ffae30b9d01fa24fd1668d8816ee2500 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 19 Jun 2013 00:02:44 +0300 Subject: [PATCH] Avoid deprecated API Change-Id: I703e94b999382f52331a61050eaf3d31073f5a9c --- fpicker/source/aqua/SalAquaPicker.mm | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/fpicker/source/aqua/SalAquaPicker.mm b/fpicker/source/aqua/SalAquaPicker.mm index b4a39d46a174..5b155fac34e8 100644 --- a/fpicker/source/aqua/SalAquaPicker.mm +++ b/fpicker/source/aqua/SalAquaPicker.mm @@ -165,30 +165,27 @@ int SalAquaPicker::run() int retVal = 0; - NSString *startDirectory; + NSURL *startDirectory; if (m_sDisplayDirectory.getLength() > 0) { NSString *temp = [NSString stringWithOUString:m_sDisplayDirectory]; - NSURL *url = [NSURL URLWithString:temp]; - startDirectory = [url path]; + startDirectory = [NSURL URLWithString:temp]; - OSL_TRACE("start dir: %s", [startDirectory UTF8String]); - // NSLog(@"%@", startDirectory); + OSL_TRACE("start dir: %s", [startDirectory path]); } else { - startDirectory = NSHomeDirectory(); + startDirectory = [NSURL fileURLWithPath:NSHomeDirectory() isDirectory:YES]; } -#if HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY && HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE -#pragma GCC diagnostic push -#pragma GCC diagnostic warning "-Wdeprecated-declarations" -#endif switch(m_nDialogType) { case NAVIGATIONSERVICES_DIRECTORY: case NAVIGATIONSERVICES_OPEN: - retVal = [(NSOpenPanel*)m_pDialog runModalForDirectory:startDirectory file:nil types:nil]; + [m_pDialog setDirectoryURL:startDirectory]; + retVal = [(NSOpenPanel*)m_pDialog runModal]; break; case NAVIGATIONSERVICES_SAVE: - retVal = [m_pDialog runModalForDirectory:startDirectory file:[NSString stringWithOUString:((SalAquaFilePicker*)this)->getSaveFileName()]/*[m_pDialog saveFilename]*/]; + [m_pDialog setDirectoryURL:startDirectory]; + [m_pDialog setNameFieldStringValue:[NSString stringWithOUString:((SalAquaFilePicker*)this)->getSaveFileName()]]; + retVal = [m_pDialog runModal]; break; // [m_pDialog beginSheetForDirectory:startDirectory file:[m_pDialog saveFilename] modalForWindow:[NSApp keyWindow] modalDelegate:((SalAquaFilePicker*)this)->getDelegate() didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:nil]; default: @@ -196,14 +193,11 @@ int SalAquaPicker::run() } if (retVal == NSFileHandlingPanelOKButton) { - NSString* pDir = [m_pDialog directory]; + NSURL* pDir = [m_pDialog directoryURL]; if (pDir) { - implsetDisplayDirectory([[NSURL fileURLWithPath:pDir] OUStringForInfo:FULLPATH]); + implsetDisplayDirectory([pDir OUStringForInfo:FULLPATH]); } } -#if HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY && HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE -#pragma GCC diagnostic pop -#endif DBG_PRINT_EXIT(CLASS_NAME, __func__, retVal); [pool release];