Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, April 2008
Saving on Mac OS X


Message 1 in thread

Hi All,

I'm a newbie to Qt. I've a problem while saving on Mac OS X.
I'm using the getSaveFileName() static function of QFileDialog for  
displaying the save dialog. When I enter an existing file name in the  
Save As text field without the extension, the file is getting  
overwritten without confirmation. But if I mention the extension, the  
confirmation dialog is displayed. Is there anyway to solve this issue  
so that  if the user gives an existing name without extension, the  
confirmation dialog should appear without over writing. Working fine  
in Windows.

code snippet using getSaveFileName():

	QString filename = QFileDialog::getSaveFileName(
	this,
         tr( "Save as..." ),
         defaultPath + QString::fromLatin1( "/Untitled.xyz" ),
         tr( "Files (*.xyz)" ) );



I've  tried without using the static method but even in this case it's  
of no use.
	
	QString filename;		
	QFileDialog dialog(this);
	dialog.setFileMode(QFileDialog::AnyFile);
	dialog.setFilter( tr( "Files (*.xyz)" ));
	dialog.setAcceptMode(QFileDialog::AcceptSave);
	dialog.setConfirmOverwrite(true);
	QStringList fileNames;
	if (dialog.exec())
		fileNames = dialog.selectedFiles();
	
	if ( fileNames.count() )
	{
		filename = fileNames.at(0);
	}

Please help me out in solving this issue.

Thanks
Sudheer


DISCLAIMER

âThe information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you"

Message 2 in thread

Hi All,

I found one solution by setting the default suffix and this time I'm  
able to see the confirmation dialog. But how do I use this  
defaultSuffix property with getSaveFileName() function as it will use  
the native file dialog and not QFileDialog for Windows & Mac ?

Thanks
Sudheer


On 22-Apr-08, at 1:57 PM, Sudheer Dantuluri wrote:

> Hi All,
>
> I'm a newbie to Qt. I've a problem while saving on Mac OS X.
> I'm using the getSaveFileName() static function of QFileDialog for  
> displaying the save dialog. When I enter an existing file name in  
> the Save As text field without the extension, the file is getting  
> overwritten without confirmation. But if I mention the extension,  
> the confirmation dialog is displayed. Is there anyway to solve this  
> issue so that  if the user gives an existing name without extension,  
> the confirmation dialog should appear without over writing. Working  
> fine in Windows.
>
> code snippet using getSaveFileName():
>
> 	QString filename = QFileDialog::getSaveFileName(
> 	this,
>         tr( "Save as..." ),
>         defaultPath + QString::fromLatin1( "/Untitled.xyz" ),
>         tr( "Files (*.xyz)" ) );
>
>
>
> I've  tried without using the static method but even in this case  
> it's of no use.
> 	
> 	QString filename;		
> 	QFileDialog dialog(this);
> 	dialog.setFileMode(QFileDialog::AnyFile);
> 	dialog.setFilter( tr( "Files (*.xyz)" ));
> 	dialog.setAcceptMode(QFileDialog::AcceptSave);
> 	dialog.setConfirmOverwrite(true);
> 	QStringList fileNames;
> 	if (dialog.exec())
> 		fileNames = dialog.selectedFiles();
> 	
> 	if ( fileNames.count() )
> 	{
> 		filename = fileNames.at(0);
> 	}
>
> Please help me out in solving this issue.
>
> Thanks
> Sudheer
>
>
>
> DISCLAIMER âThe information contained in this e-mail message and/or  
> attachments to it may contain confidential or privileged  
> information. If you are not the intended recipient, any  
> dissemination, use, review, distribution, printing or copying of the  
> information contained in this e-mail message and/or attachments to  
> it are strictly prohibited. If you have received this communication  
> in error, please notify us by reply e-mail or telephone and  
> immediately and permanently delete the message and any attachments.  
> Thank you"

DISCLAIMER

âThe information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you"