Using common dialogs with S60 and Maemo Platform
Archived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.
The article is believed to be still valid for the original topic scope.
The article is believed to be still valid for the original topic scope.
Comparison
Both S60 Platform and Maemo Platform have a number of common dialogs to ease the application development.
Comparing S60 and Maemo Platforms
S60 Platform
enum TCommonDialogType
{
ECFDDialogTypeNormal,
ECFDDialogTypeSelect,
ECFDDialogTypeSave,
ECFDDialogTypeMove,
ECFDDialogTypeBrowse,
ECFDDialogTypeDefaultSetting,
ECFDDialogTypeCopy
};
...
TFileName fileName;
TBuf<KMaxFileName> defaultPath;
TCommonDialogType dialogType = ECFDDialogTypeSave;
...
CAknFileSelectionDialog* dialog = CAknFileSelectionDialog::NewL(dialogType);
...
TBool result = dialog->RunDlgLD(fileName, defaultPath);
...
Maemo Platform
typedef struct _AppData AppData;
struct _AppData
{
HildonProgram *program; /* handle to application */
HildonWindow *window; /* handle to app's window */
osso_context_t *osso; /* handle to osso */
};
/* Struct to include view's information */
typedef struct _MainView MainView;
struct _MainView
{
/* Handle to app's data */
AppData *data;
...
};
/* File chooser */
gchar* interface_file_chooser(MainView * mainview, GtkFileChooserAction action)
{
GtkWidget *dialog;
gchar* filename = NULL;
dialog = hildon_file_chooser_dialog_new( GTK_WINDOW(mainview->data->program), action);
gtk_widget_show_all (GTK_WIDGET(dialog));
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
{
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
}
gtk_widget_destroy (dialog);
return filename;
}



